Skip to content

Instantly share code, notes, and snippets.

payments = crossfilter([
{ date: "2011-11-14T16:17:54Z", total: 190, tip: 100, type: "tab" },
{ date: "2011-11-14T16:20:19Z", total: 190, tip: 100, type: "tab" },
{ date: "2011-11-14T16:28:54Z", total: 300, tip: 200, type: "visa" },
{ date: "2011-11-14T16:30:43Z", total: 90, tip: 0, type: "tab" },
{ date: "2011-11-14T16:48:46Z", total: 90, tip: 0, type: "tab" },
{ date: "2011-11-14T16:53:41Z", total: 90, tip: 0, type: "tab" },
{ date: "2011-11-14T16:54:06Z", total: 100, tip: 0, type: "cash" },
{ date: "2011-11-14T16:58:03Z", total: 90, tip: 0, type: "tab" },
{ date: "2011-11-14T17:07:21Z", total: 90, tip: 10, type: "tab" },
require 'beaneater'
require 'json'
@beanstalk = Beaneater::Pool.new(['localhost:11300'])
total = 0
puts "Listening for jobs..."
@beanstalk.jobs.register('test-tube') do |job|
@joshpencheon
joshpencheon / hash_bm.rb
Created May 21, 2014 20:59
Hash performance
require 'benchmark'
require 'rubygems'
require 'active_support/all'
@config = []
10.times do |x|
options = {}
10.times { |y| options["key#{y}"] = "value#{y}" }
@config << ["name#{x}", options]
end
@joshpencheon
joshpencheon / vector.js
Created September 5, 2011 12:39
vector
var V = {
init: function(x, y, z) {
return { x: x, y: y, z: z };
},
add: function(v1, v2) {
return {
x: v1.x + v2.x,
y: v1.y + v2.y,
z: v1.z + v2.z
@joshpencheon
joshpencheon / demo.html
Created August 18, 2011 22:26
basic raphael graph demo
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://raphaeljs.com/raphael.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">