Skip to content

Instantly share code, notes, and snippets.

@documentcloud
Created December 16, 2009 03:50
Show Gist options
  • Select an option

  • Save documentcloud/257571 to your computer and use it in GitHub Desktop.

Select an option

Save documentcloud/257571 to your computer and use it in GitHub Desktop.
(function(){
var square = function(x) {
return (x * x);
};
var sum = function(x, y) {
return (x + y);
};
var odd = function(x) {
return ((x % 2) === 0);
};
var even = function(x) {
return ((x % 2) !== 0);
};
var run_loop = function() {
fire_events(function(e) {
return e.stopPropagation();
});
listen();
return wait();
};
var object_literal = {
one: 1,
two: 2,
three: 3
};
var multiline_object = {
pi: 3.14159,
list: [1, 2, 3, 4],
three: new Idea(),
inner_obj: {
freedom: function() {
return _.freedom();
}
}
};
var stooges = [{
moe: 45
}, {
curly: 43
}, {
larry: 46
}];
var exponents = [function(x) {
return x;
}, function(x) {
return (x * x);
}, function(x) {
return ((x * x) * x);
}];
if (submarine.shields_up) {
full_speed_ahead();
fire_torpedos();
} else {
run_away();
}
var eldest = (25 > 21) ? liz : marge;
if (war_hero) {
var decoration = medal_of_honor;
}
!coffee ? go_to_sleep() : null;
var race = function() {
run();
walk();
crawl();
if (tired) {
return sleep();
}
return race();
};
(good = good || evil);
(wine = wine && cheese);
((moon.turn(360))).shapes[3].move({
x: 45,
y: 30
}).position;
var a = b = c = 5;
callback(function(e) { e.stop(); });
try {
all_hell_breaks_loose();
dogs_and_cats_living_together();
throw "up";
} catch (error) {
print(error);
} finally {
clean_up();
}
try {
all_hell_breaks_loose();
} catch (error) {
print(error);
} finally {
clean_up();
}
while (demand > supply) {
sell();
restock();
}
while (supply > demand) {
buy();
}
!!true;
a = 5;
var change_a_and_set_b = function() {
a = 10;
b = 15;
};
b = 20;
var supper;
var g = ['toast', 'cheese', 'wine'];
var j = [];
for (var h=0, i=g.length; h<i; h++) {
food = g[h];
j[h] = food.capitalize();
}
supper = j;
var k = ['soda', 'wine', 'lemonade'];
for (var l=0, m=k.length; l<m; l++) {
var bottle = k[l];
i = l;
even(i) ? drink(bottle) : null;
}
if (day === "Tuesday") {
eat_breakfast();
} else {
if (day === "Sunday") {
go_to_church();
} else {
if (day === "Saturday") {
go_to_the_park();
} else {
if (day === "Wednesday") {
eat_breakfast();
go_to_work();
eat_dinner();
} else {
go_to_work();
}
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment