View gist:59441
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 Class | |
alias old_new new | |
def new(*args) | |
old_new(*args) | |
end | |
end | |
class Shit | |
def initialize(&block) |
View gist:59443
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 Class | |
alias old_new new | |
def new(*args) | |
old_new(*args) | |
end | |
end | |
class Shit | |
def initialize(obj) |
View gist:213276
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
igor$ macruby lib/application.rb | |
core:in `dump': nil is not a symbol (TypeError) | |
from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/hotcocoa/mappings/menu.rb:12:in `submenu:' | |
from core:in `menu:' | |
from /Users/igor/dev/macruby/sample/lib/menu.rb:3:in `application_menu' | |
from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/hotcocoa/mappings/application.rb:17:in `load_application_menu' | |
from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/hotcocoa/mappings/application.rb:8:in `handle_block:' | |
from core:in `application:' | |
from lib/application.rb:in `start' | |
from lib/application.rb:1:in `<main>' |
View gist:213279
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 'hotcocoa' | |
# Replace the following code with your own hotcocoa code | |
class Application | |
include HotCocoa | |
def start | |
application :name => "Sample" do |app| |
View gist:224275
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
-(void)createStatusItem | |
{ | |
statusItem = [[[NSStatusBar systemStatusBar] | |
statusItemWithLength:NSVariableStatusItemLength] | |
retain]; | |
[statusItem setHighlightMode:YES]; | |
NSBundle *bundle = [NSBundle bundleForClass:[self class]]; | |
NSString *path = [bundle pathForResource:@"icon" ofType:@"png"]; | |
menuIcon= [[NSImage alloc] initWithContentsOfFile:path]; |
View gist:719979
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
Transaction = Backbone.Model.extend({ | |
allAttributes: function() { | |
return _(this.attributes).extend(this.virtualAttributes()); | |
}, | |
virtualAttributes: function() { | |
return { accountFrom: this.accountFrom(), accountTo: this.accountTo(), transactionSumCents: this.transactionSumCents() }; | |
} | |
}) |
View v8_ast_example.js
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
function test(x) { | |
return x === 1; | |
} | |
if (test(2)) { | |
print("no") | |
} | |
/* AST |
View gist:992874
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
# Use @ff_with_basic_auth if you need http basic authorization | |
Capybara.register_driver :ff_with_basic_auth do |app| | |
Capybara::Driver::Selenium | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile['network.http.phishy-userpass-length'] = 1024 | |
Capybara::Driver::Selenium.new(app, { :profile => profile }) | |
end | |
Before("@ff_with_basic_auth") do |
View gist:992876
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
WebMock.allow_net_connect! | |
Before("@webmock") do | |
WebMock.disable_net_connect!(:allow_localhost => true) | |
end | |
After("@webmock") do | |
WebMock.allow_net_connect! | |
end |
View gist:1101460
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
When /^(?:I|they) follow "([^"]*?)" in the email$/ do |link| | |
def parse_email_for_anchor_text_link(link_text) | |
if current_email.body =~ %r{<a[^>]*href=['"]?([^'"]*)['"]?[^>]*?>[^<]*?#{link_text}[^<]*?</a>} | |
URI.split($1)[5..-1].compact!.join("?").gsub("&", "&") | |
end | |
end | |
url_path = parse_email_for_anchor_text_link(link) | |
visit "http://test1.localhost:31337#{url_path}" |
OlderNewer