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
#!/usr/bin/env ruby | |
branch_name = `git rev-parse --abbrev-ref HEAD` | |
branch_number_regex = /^(\d+)/ | |
matcher = branch_name.match(branch_number_regex) | |
branch_number = matcher[1] | |
if branch_number | |
path = ARGV[0] |
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
require 'test_helper' | |
require 'minitest/autorun' | |
describe VenuesController do | |
describe "#index" do | |
it "must succeed" do | |
get :index | |
response.status.must =~ /200/ | |
end | |
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
<div>Hello there!</div> |
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 SuperClass | |
def foo | |
puts "I'm in super!" | |
end | |
alias :bar foo | |
end | |
class SubClass < SuperClass | |
def foo | |
puts "I'm in sub!" |
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
$(div).fadeIn().show('slide', {direction: 'up'}); // BZZZT... they both get queued | |
// BZZZZT... they both get added to the object's fx queue... same deal! | |
$(div).fadeIn(); | |
$(div).show('slide', {direction: 'up'}); | |
$(div).fadeIn().show('slide', {direction: 'up'}).dequeue(); // DINGDINGDING! This works but is incredibly stupid! |
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
setStatus : function ( status ) { | |
var triggerChange = this.get("status") == status; | |
this.set({status: status}); | |
if (triggerChange) | |
this.trigger("change:status", this, status); | |
} |
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
HotCocoa::URLConnection.get('http://google.com') do |c| | |
c.success { success_callback } | |
c.failure { failure_callback } | |
c.error { |e| error_handler.call_something e } | |
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
require 'active_support' | |
class Geckobyte | |
include HTTParty | |
base_uri 'http://webservices.geckobyte.com' | |
remote_methods = %w[bodies brands makes models options tire tires tires_by_brand_name tires_by_size | |
tires_test tires_with_wheel vehicle wheel wheels_by_brand_name wheels_with_tire years] | |
remote_methods.each do |m| |
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
NSURLConnection.connectionWithRequest(url_request, delegate: ConnectionDelegate.new do |d| | |
d.success { |data| some_object.do_something_with_data(data) } | |
d.failure do |data, error| | |
# we can do something more complex here... and we don't have to look in the delegate class! | |
some_other_object.do_something_with_error(error) | |
end | |
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
ree-1.8.7-2009.10 > fuckery = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(nil, "fuckery!") | |
=> nil | |
ree-1.8.7-2009.10 > fuckery | |
=> nil | |
ree-1.8.7-2009.10 > fuckery.object_id | |
=> 4 | |
ree-1.8.7-2009.10 > !!fuckery | |
=> true | |
ree-1.8.7-2009.10 > |