Instantly share code, notes, and snippets.

David Kellum dekellum

View GitHub Profile
View const-benchmark.rb
# Adapted from
require 'benchmark'
n = 5000000
$priv_const = ( ARGV[0] == 'priv_const' )
View kernel.spec
# We have to override the new %%install behavior because, well... the kernel is special.
%global __spec_install_pre %{___build_pre}
Summary: The Linux kernel
# For a stable, released kernel, released_kernel should be 1. For rawhide
# and/or a kernel built from an rc or git snapshot, released_kernel should
# be 0.
%global released_kernel 1
View gist:4171049
(ns powerset.core-test
(:use (clojure set test)))
(defn powerset [s]
(apply union
#{s} ;the complete set of all s
(map (fn [i] (powerset (disj s i))) s)))
(deftest test-powerset
(is (= #{#{}}
View gist:193769
# GoKart becomes a module
module GoKart
# becomes a factory method for strategy classes
def strategy = nil )
( strategy == :reverse ) ? :
class ForwardStrategy
def drive
View gist:193768
# Started with something like this
class GoKart
def initialize( strategy = nil )
@strategy = strategy
def drive
if @strategy == :reverse
puts "Reverse"