Skip to content

Instantly share code, notes, and snippets.

source "https://rubygems.org"
gem "rspec"
gem "rake"
@Peeja
Peeja / dotfile_benchmark.zsh
Created November 30, 2012 23:08
Dotfile Benchmarking
#!/bin/zsh
export TIMEFMT='%E'
main() {
echo "Purging the disk cache..."
purge
# time's output is on stderr.
zsh_elapsed_time=$( (time zsh -ilc exit) 2>&1 )
@Peeja
Peeja / Email appears to be from Andy Lindeman.png
Created November 25, 2012 00:38
GitHub email notification "bug" in Gmail: Gmail conflates senders in list view
Email appears to be from Andy Lindeman.png
@Peeja
Peeja / finalizer.rb
Created November 21, 2012 20:50
Why does this output "Finalized: false"?
finalized = false
finalizer = lambda { finalized = true }
# Hide all direct references to the object in a lambda.
lambda do
object = Object.new
ObjectSpace.define_finalizer(object, finalizer)
end.call
ObjectSpace.garbage_collect
@Peeja
Peeja / gist:3488459
Created August 27, 2012 13:35 — forked from defunkt/gist:6443
# Video: http://confreaks.com/videos/499-rubyhoedown2008-keynote
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@Peeja
Peeja / Gemfile
Created July 27, 2012 15:01
Test Case for Timecop Issue #29
# A sample Gemfile
source "https://rubygems.org"
gem "activesupport"
gem "tzinfo"
gem "timecop", git: "https://github.com/jtrupiano/timecop"
@Peeja
Peeja / toot.rb
Created June 29, 2012 15:25
Conditional Whac-A-Mole: Another solution
class User < Struct.new(:username, :followability)
def follow
followability.follow(self)
end
end
class Follow
def self.follow(user)
user.follow
end
@Peeja
Peeja / checkbox_refresh_test.html
Created February 24, 2012 21:49
Check some boxes and refresh the page. Do they stay checked?
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Checkbox Refresh Test</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="pivotalcb">
<!-- Date: 2012-02-24 -->
</head>
task :fail do
puts "Failing..."
fail
end
task :succeed do
puts "Success!"
end
@Peeja
Peeja / group_of_thingies.rb
Created December 4, 2011 02:08 — forked from coffeencoke/group_of_thingies.rb
Test a block in Ruby
class GroupOfThingies
attr_accessor :thingies
# Use like this:
#
# group_of_thingies = GroupOfThingies.new
# group_of_thingies.each do |thing|
# puts "Check out this awesome thing: #{thing}!"
# end
#