This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = 1280, | |
h = 800, | |
r = 720, | |
x = d3.scale.linear().range([0, r]), | |
y = d3.scale.linear().range([0, r]), | |
node, | |
root; | |
var pack = d3.layout.pack() | |
.size([r, r]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greeting = "Hello" | |
def dumb_greeter | |
puts greeting | |
end | |
def invasive_greeter(b) | |
puts b.eval("greeting") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative './database' | |
require 'sinatra/activerecord/rake' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AmortizationTable | |
Transaction = Struct.new(:payment, :interest, :principle, :balance) | |
attr_reader :amount, :rate, :n | |
def initialize(opts={}) | |
@amount = opts.fetch(:amount, 25_000) | |
@rate = opts.fetch(:rate, (0.06 / 36)) | |
@n = opts.fetch(:n, 36) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails g model Title name | |
rails g model IssuesTitle issue_id:integer title_id:integer | |
rails g model Issue name publisher_id:integer illustration | |
rails g model Publisher name | |
rails g model Role name | |
rails g model Person name | |
rails g model PersonRole name issue_id:integer role_id:integer person_id:integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
class SpikeBuilder | |
def self.build!(name, gemset) | |
obj = new(name, gemset) | |
obj.build! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chart() { | |
var width = 720, // default width | |
height = 80; // default height | |
function my() { | |
// generate chart here, using `width` and `height` | |
} | |
my.width = function(value) { | |
if (!arguments.length) return width; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'forwardable' | |
class A | |
include Enumerable | |
extend Forwardable | |
def_delegators :@source, :[], :<< | |
def initialize | |
@source = [] | |
end | |
def each(&block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
set -sg escape-time 1 | |
set -g base-index 1 | |
# setw -g pane-base-index 1 | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is borrowed from http://bit.ly/K4h5xl | |
window.Support = (window.Support || {}) | |
window.Support.Mediator = (params) -> | |
self = {} | |
self.register = (module) -> | |
module.subscribe = self.subscribe | |
module.publish = self.publish |