Skip to content

Instantly share code, notes, and snippets.

View jswartwood's full-sized avatar

Jacob Swartwood jswartwood

View GitHub Profile
@jswartwood
jswartwood / Premise.md
Created March 15, 2012 14:22 — forked from samtsai/Premise.md
AE Code Golf #1

Fibonacci Sequence

Classics series

Print the Fibonacci series (the first 10 values) separated by spaces. If you've ever taken a Computer Science class, you should be all over this one.

@jswartwood
jswartwood / truthy-eq-good-times.js
Created June 21, 2011 02:17 — forked from cowboy/truthy-eq-good-times.js
JavaScript: See what == what!
// This should do a pretty good job of iterating through the following array
// and logging any values that == each other. Beware, this is scary stuff!
// http://benalman.com/news/2010/11/schrecklichwissen-terrible-kno/
var arr = [true, 123, {}, {a:1}, [], [0], [123], "hi", function foo(){},
/re/, false, 0, "", null, undefined, NaN];
function pretty(v) {
var s = JSON.stringify(v);
return v == null ? v + "" : s === undefined ? v : s == "null" ? "NaN" : s;