Skip to content

Instantly share code, notes, and snippets.

View gist:54847
~/scowl-6/final % egrep -h '([^s]s|z|j)ure$' * | sed 's/[sz]ure$/jure/g' burke@zaphod (18:09)
Rajure
Yurujure
enjure
meajure
clojure
expojure
injure
leijure
pleajure
View gist:61063
irb(main):001:0> require 'archive/tar'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:17: warning: else without rescue is useless
SyntaxError: /opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:15: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when IO: parse(@source, full); @source.rewind
^
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:34: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when :file: File.open(path, 'w') { |fio| fio.write(body) }
^
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:35: syntax error, unexpected keyword_when, expecting keyword_end
when :directory: FileUtils.mkdir(path)
View mclj
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# Copyright Burke Libbey 2009, MIT License.
HOME_DIR = "/Users/burke" # Home directory
SVN_DIR = "#{HOME_DIR}/src/clojure/svn" # Clojure SVN checkout path
BRANCHES_DIR = "#{SVN_DIR}/branches" # Clojure SVN branches path
TRUNK_DIR = "#{SVN_DIR}/trunk" # Clojure SVN trunk path
INSTALL_DIR = "#{HOME_DIR}/lib/clj" # Path to managed jar symlinks
View gist:68372
lambda{|n| n.zero? ? 1 : n * self.call(n-1)}
View gist:68374
fac = lambda{|n| n.zero? ? 1 : n * fac.call(n-1)}
View gist:68375
# Ruby 1.8.7
lambda{|n| (fac=lambda{|n| n.zero? ? 1 : n * fac.call(n-1)}).call(n) }
# Ruby 1.9
->(n){(fac=->(n){n.zero? ? 1 : n * fac.(n-1)}).(n)}
View gist:68376
def Y
lambda { |f| f.call(f) }.call(
lambda do |g|
yield(lambda { |*n| g.call(g).call(*n) })
end)
end
Y { |this| lambda { |n| n == 0 ? 1 : n * this.call(n - 1) } }.call(12)
#=> 479001600
View gist:68379
(λ f. f 3) (λ x. x + 2)
View gist:68381
# Ruby 1.8.7
lambda{|f| f[3]}[lambda{|x| x+2}]
View gist:68382
# Ruby 1.9
->(f){f.(3)}.(->(x){x+2})
You can’t perform that action at this time.