Skip to content

Instantly share code, notes, and snippets.

View phillipoertel's full-sized avatar

Phillip Oertel phillipoertel

View GitHub Profile
@phillipoertel
phillipoertel / raphael.js
Created September 26, 2011 13:12
RaphaelJS animation
$(window).load(function() {
// config
var cyan = "#009fee";
var white = "#ffffff";
var paperCenterX = $(window).width() / 2;
// timings
var lineFadeInTime = 2000;
var whiteGFadeInTime = 2000;
@phillipoertel
phillipoertel / simplify_me.rb
Created September 3, 2011 21:07
Change the implementation of a classes instance method by including a module.
# original ApplicationController
class ApplicationController
def home_page?
"original"
end
end
puts ApplicationController.new.home_page?
# => original
hash1 = %w(cat dog wombat).each_with_object({}) do |item, memo|
memo[item] = item.upcase
end
p hash1
# => {"cat"=>"CAT", "dog"=>"DOG", "wombat"=>"WOMBAT"}
hash2 = %w(cat dog wombat).inject({}) do |memo, item|
memo[item] = item.upcase
memo
@phillipoertel
phillipoertel / parse_css_colors.rb
Created March 6, 2011 19:06
Get the colors from a CSS file, sorted by how often they occurr.
require 'open-uri'
#uri = "http://www.zeldman.com/wp-content/themes/zeldman-v2/style.css?0111110710"
#uri = "http://asset2.betterplace.org/stylesheets/screen.css?1299172234"
uri = 'http://www.xing.com/css/v/144/general.min.css'
def parse_css_colors(uri)
file = open(uri).read
hex_colors = file.scan(/#[a-f0-9]{3,6}/i)
require 'test/unit'
def f(x); x != 0 && x * f(x - 1) || 1; end
class FactorialTest < Test::Unit::TestCase
def test_factorial_0_is_1
assert_equal 1, f(0)
end
require 'test/unit'
def factorial(max)
(1..max).inject(1) { |sum, current| sum *= current; sum }
end
class FactorialTest < Test::Unit::TestCase
def test_factorial_0_is_1
assert_equal 1, factorial(0)
#
# CONTROLLER
#
# POST /admin/voucher_set
class Admin::VoucherSetController < ...
def create
VoucherSet.create!(params)
end
end
10:20 Intro
10:30 Patterns in Architecture Joseph Yoder Stanford Architecture http://qconsf.com/sf2009/presentation/Patterns+in+Architecture
11:45 Kanban vs Scrum - a practical guide Henrik Kniberg Metro Ballroom Lean/Kanban http://qconsf.com/sf2009/presentation/Kanban+vs+Scrum+-+a+practical+guide
13:45 adventures of an agile architect Dan North Stanford Architecture http://qconsf.com/sf2009/presentation/Adventures+of+an+Agile+Architect
15:00 Roadmap to Continuous Deployment Nathan Dye Stanford Architecture http://qconsf.com/sf2009/presentation/Roadmap+to+Continuous+Deployment
16:30 Rails in the Large ... Neil Ford Cornell Facets of Ruby http://qconsf.com/sf2009/presentation/Rails+in+the+Large%3A+How+Agility+Allows+Us+to+Build+One+of+the+World%27s++Biggest+Rails+Apps
18:00 The State and future of JavaScript Douglas Crockford http://qconsf.com/sf2009/
funkyness = ->(number){ puts "FUNKY! " * number }
(1..10).each(&funkyness)
FUNKY!
FUNKY! FUNKY!
FUNKY! FUNKY! FUNKY!
FUNKY! FUNKY! FUNKY! FUNKY!
FUNKY! FUNKY! FUNKY! FUNKY! FUNKY!
FUNKY! FUNKY! FUNKY! FUNKY! FUNKY! FUNKY!
FUNKY! FUNKY! FUNKY! FUNKY! FUNKY! FUNKY! FUNKY!