Skip to content

Instantly share code, notes, and snippets.

@jeromepan
jeromepan / colorTempToRGB.js
Created April 17, 2019 13:01 — forked from paulkaplan/colorTempToRGB.js
Color Temperature to RGB
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;
@jeromepan
jeromepan / export-plot-as-csv.m
Created April 11, 2019 10:55 — forked from padde/export-plot-as-csv.m
Mathematica: Export Plot Values as CSV
plot = Plot[Cos[x],{x,0,2\[Pi]}];
mydata = Flatten[Cases[plot, Line[x__] -> x, Infinity], 1];
Export["/Users/padde/Desktop/plot-data.dat", mydata, "CSV"];
@jeromepan
jeromepan / java-warmup1.java
Created February 9, 2016 17:54 — forked from schifano/java-warmup1.java
My solutions for CodingBat Java Warmup-1. This is used to document my initial attempts and improved attempts.
// sleepIn
// The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation.
// We sleep in if it * is not a weekday or we're on vacation. Return true if we sleep in.
public boolean sleepIn(boolean weekday, boolean vacation) {
if (!weekday || vacation) {
return true;
}
return false;
}