Skip to content

Instantly share code, notes, and snippets.

function build_table(element, object) {
var i;
for (i in object) {
$(element).append("<tr><td>"+i+"</td><td>"+object[i]+"</td></tr>");
}
}
build_table("#sam", {
foo: "bar",
baz: "fizz"
function Graph(width, length) {
this.width = width;
this.length = length;
this.elements = 2; // I want to keep this
this.nodes = new Array(width * length);
var i;
for (i = 0; i < this.nodes.length; i += 1) {
this.nodes[i] = new Node(this, i);
}
x = .4375 * (16 + x)
x = 7 + .4375x
x / .4375 = 16 + x
x - x / .4375 = 16
0 / .4375 = 16
0 = 7
math mother fuckers
function (very, good, parameters) {
// Line up our variables
var foo,
string_var= "lol",
bar,
object = new Constructor();
// Four space indent
if (condition) {
Item -> Attributes
----------------------
item_id | attribute_id
1 5
1 8
Item Attributes
-----------------------------
attribute_id | human_readable
5 Wood Floors
function () {
// Blah blah useless comment
COAD
}
function () {
// Informative post, you can tell by the extra linebreak ^
elegant coad
function Graph(w, l, h) {
this.w = w;
this.l = l;
this.h = h || 1;
this.nodes = [];
}
Graph.prototype.toVec2 = function (i) {
return new Vec2(i % this.w, Math.floor(i / this.w), 0 /* ??? */ );
};
if ((m % i == 0) && (i == 20) && (i != 0)) {
printf("%d", m);
break;
} else {
m++;
i = 0;
}
Graph.prototype.toVector = function (i) {
return new Vector(i % this.w, Math.floor(i / this.w), /* ??? */);
};
Graph.inBounds = function (G, x) {
var vec = x.vector;
return (vec.x < G.w && vec.x >= 0 && vec.y < G.h && vec.y >= 0);
};