Skip to content

Instantly share code, notes, and snippets.

@gus
gus / node-express-cart.js
Created October 27, 2010 02:39
Shopping cart express+node middleware
var Cart = function(storedItems) {
var items = storedItems || {};
this.add = function(item, sku) {
var storedItem = items[sku];
if (storedItem == undefined) {
storedItem = items[sku] = {quantity: 0, item: item}
}
storedItem.quantity += 1;
};
@gus
gus / results.md
Created May 6, 2011 20:04
VIA Results

Your Top Character Strength

Forgiveness and mercy

You forgive those who have done you wrong. You always give people a second chance. Your guiding principle is mercy and not revenge.

Your Second Character Strength

Humor and playfulness

@gus
gus / external-with-docwrite.js
Created March 20, 2012 21:02
document.write weirdness
console.log("external1 before/" + document.readyState);
document.write("hello again, world");
console.log("external1 after/" + document.readyState);
@gus
gus / life.kt
Created January 21, 2016 14:44
/**
* This is a straightforward implementation of The Game of Life
* See http://en.wikipedia.org/wiki/Conway's_Game_of_Life
*/
package life
/*
* A field where cells live. Effectively immutable
*/
class Field(

Keybase proof

I hereby claim:

  • I am gus on github.
  • I am gus (https://keybase.io/gus) on keybase.
  • I have a public key ASCO7dFjqx8AwoU757Ewi4-g7bsEKsfqhSIFNUpMcCaYgAo

To claim this, I am signing this object:

@gus
gus / index.txt
Created November 30, 2009 21:55 — forked from toothrot/index.txt
Ruby/Clojure analogs
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation: