Skip to content

Instantly share code, notes, and snippets.

Without magical change:
real 0m26.563s
user 0m26.182s
sys 0m0.192s
With magical change:
real 0m2.215s
user 0m2.024s
module Parslet::Atoms
class Context
def cache(obj, source, &block)
yield
end
end
end
$ autotest
/home/djwhitt/.rbenv/versions/1.9.3-p125/bin/ruby -I.:lib:test -rubygems -e "%w[helper test/helper.rb test/test_foo.rb].each { |f| require f }"
Run options: --seed 60917
# Running tests:
.
Finished tests in 0.000344s, 2904.3004 tests/s, 2904.3004 assertions/s.
Test gist
@djwhitt
djwhitt / spec_env.js
Created April 20, 2011 19:22
Jasmine setup
//
// Make Jasmine think this is a browser
//
setTimeout = function(fn) { fn(arguments); };
clearTimeout = function() {};
setInterval = function() {};
clearInterval = function() {};
task :a do
puts "hi"
end
Rake.application.lookup(:a).clear
task :a do
puts "hello"
end
[1, 2, 3].each do |x|
x # =>
end
# C-c C-f ...
[1, 2, 3].each do |x|
x # => 1, 2, 3
end
include_recipe "apache2"
["htdocs", "src"].each do |dir|
directory "/srv/www/rdoc.spcom.org/#{dir}" do
owner "root"
group "root"
mode "0755"
recursive true
end
end
Host *
ControlPath ~/.ssh/master-%l-%r@%h:%p
ControlMaster auto
(defn palindrome? [x]
(let [s (.toString x)
l (.length s)]
(if (or (= l 0) (= l 1))
true
(if (= (.charAt s 0) (.charAt s (- l 1)))
(palindrome? (.substring s 1 (- l 1)))
false))))
(defn products []