This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bundlesh: | |
# Starts a bash session in which gem binaries are run from the bundle instead of system gems. | |
# Saves your fingers from typing `bundle exec` all day. | |
# I tried to patch bundler to implement this as bundlesh, but I had trouble | |
# when PS1 wasn't exported (which it isn't, out of the box). | |
alias bundlesh='bundle exec env PS1="(\e[32mbundler\e[0m) ${PS1}" $SHELL' | |
# For extra fun with RubyMine, run bundlesh and then run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Something | |
def my_method | |
puts "(A)" | |
end | |
module PreExtension | |
def my_method | |
puts "(B)" | |
super | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :fail do | |
puts "Failing..." | |
fail | |
end | |
task :succeed do | |
puts "Success!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < Struct.new(:username, :followability) | |
def follow | |
followability.follow(self) | |
end | |
end | |
class Follow | |
def self.follow(user) | |
user.follow | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "https://rubygems.org" | |
gem "activesupport" | |
gem "tzinfo" | |
gem "timecop", git: "https://github.com/jtrupiano/timecop" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |