Skip to content

Instantly share code, notes, and snippets.

@jaehess
jaehess / test.rb
Created September 17, 2011 20:26 — forked from tenderlove/test.rb
require 'thread'
require 'json'
require 'net/http'
require 'uri'
require 'betabrite'
require 'psych'
require 'usb'
class StreamClient
def initialize user, pass
/*
example design of an expandable list view that expands selected items in place using alternate list item view
*/
tasksView: SC.ScrollView.design({
hasHorizontalScroller: NO,
layout: { top: 24, bottom: 0, left: 0, right: 0 },
backgroundColor: 'white',
contentView: Tasks.ExpandableListView.design({
contentBinding: 'Tasks.controller.arrangedObjects',
selectionBinding: 'Tasks.controller.selection',
class Batman.SetTransform extends Batman.Set
constructor: (@source, observedItemKeys..., @transform) ->
super()
@transformIndex = new Batman.SimpleHash
if @source.isObservable
@_setObserver = new Batman.SetObserver(@source)
@_setObserver.observedItemKeys = observedItemKeys
@_setObserver.observerForItemAndKey = @observerForItemAndKey
@_setObserver.on 'itemsWereAdded', @add
@_setObserver.on 'itemsWereRemoved', @remove
@jaehess
jaehess / gist:1791066
Created February 10, 2012 17:21 — forked from ktusznio/gist:1790846
batman.js checkbox example
<!DOCTYPE html>
<html>
<head>
<title>Test App</title>
<script type="text/javascript" src="../lib/es5-shim.js"></script>
<script type="text/javascript" src="../lib/batman.js"></script>
<script type="text/javascript" src="../lib/batman.solo.js"></script>
<script type="text/javascript" src="../lib/extras/batman.rails.js"></script>
<script type="text/javascript" src="../lib/coffee-script.js"></script>
</head>
@jaehess
jaehess / app.js
Created March 6, 2012 03:19 — forked from jfhbrook/app.js
THE FRAMEWORK YOUR FRAMEWORK COULD CODE LIKE
var flatiron = require('flatiron'),
app = flatiron.app;
console.log('What\'s that in your hand? Look down,');
app.use(require('./tickets'));
console.log('look up. I HAVE IT. It\'s ' + app.qty + ' TICKETS to ' + app.description + '!');
console.log('Look again.');
app.use(require('./diamonds'));
@jaehess
jaehess / index.html
Created March 16, 2012 20:38 — forked from mbostock/.block
Hierarchical Edge Bundling (D3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.22.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.22.0"></script>
<script type="text/javascript" src="readme.js"></script>
<style type="text/css">
.node {
@jaehess
jaehess / levenshtein.js
Created March 29, 2012 05:19 — forked from andrei-m/levenshtein.js
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
// Compute the edit distance between the two given strings
exports.getEditDistance = function(a, b){
if(a.length == 0) return b.length;
if(b.length == 0) return a.length;
var matrix = [];
// increment along the first column of each row
var i;
for(i = 0; i <= b.length; i++){
@jaehess
jaehess / hack.sh
Created March 31, 2012 15:17 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jaehess
jaehess / personality.rb
Created April 12, 2012 18:13 — forked from wycats/personality.rb
More technical details about the discussion at last nights meetup
# Just wanted to clarify my points at the meetup last night.
#
# There were two different issues intertwined:
# (1) Whether to use extend or "include as extend"
# (2) When using "include as extend", what is the simplest way to achieve the goal?
#
# My personal opinion is that the answer to (1) is "extend", not "include as extend", but that
# is just my personal opinion. My answer to (2) is a more empirical question.
# Using the "extend" approach. Again, I personally prefer the simplicity of this approach, but
@jaehess
jaehess / postsql.sql
Created May 17, 2012 19:52 — forked from tobyhede/postsql.sql
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- JSON Types need to be mapped into corresponding PG types
--
-- Number => INT or DOUBLE PRECISION
-- String => TEXT