Skip to content

Instantly share code, notes, and snippets.

Giles gilesbowkett

Block or report user

Report or block gilesbowkett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View d-gen.clj
(asdf)
(defn- state-line [[state results]]
(let [d (->> results
(sort-by :year)
(reduce (fn [line {:keys [year from-center]}]
(conj line (str (x-for-margin from-center)
","
(+ 10 (year-base year)))))
View customer.rb
class Customer
attr_reader :name
def initialize(name)
@name = name
@rentals = []
end
def add_rental(arg)
@rentals << arg
@gilesbowkett
gilesbowkett / wtf.coffee
Created Aug 25, 2011 — forked from jashkenas/wtf.coffee
why does this CoffeeScript not accurately translate this Ruby?
View wtf.coffee
insert: (ball, column) ->
for row in @rows when row[column] is null
row[column] = ball
return
View in some functional test.rb
# How does that session value get set!?
class << @response.session
def []=(k,v)
puts "Setting session[#{k.inspect}] = #{v.inspect} (#{caller[0]})"
super
end
end
View ruby_conf_vids.rb
require "rubygems"
require "hpricot"
require "open-uri"
url = "http://feeds.feedburner.com/Rubyconf2008-Confreaks"
(Hpricot(open url)/:enclosure).map {|x| x.attributes["url"]}.uniq.each do |vid|
# File.exist?(vid.split("/").last) ? next : `curl #{vid}`
filename = vid.gsub(/http:.+\//, '')
filename.gsub!(/-/, "_")
View ruby_conf_vids.rb
require "rubygems"
require "hpricot"
require "open-uri"
url = "http://feeds.feedburner.com/Rubyconf2008-Confreaks"
(Hpricot(open url)/:enclosure).map {|x| x.attributes["url"]}.uniq.each do |vid|
filename = vid.gsub(/http:.+\//, '')
filename.gsub!(/-/, "_")
next if File.exist?(filename)
You can’t perform that action at this time.