Skip to content

Instantly share code, notes, and snippets.

View iafonov's full-sized avatar
🌴

Igor Afonov iafonov

🌴
View GitHub Profile
# 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
function test(x) {
return x === 1;
}
if (test(2)) {
print("no")
}
/* AST
Transaction = Backbone.Model.extend({
allAttributes: function() {
return _(this.attributes).extend(this.virtualAttributes());
},
virtualAttributes: function() {
return { accountFrom: this.accountFrom(), accountTo: this.accountTo(), transactionSumCents: this.transactionSumCents() };
}
})
-(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];
require 'hotcocoa'
# Replace the following code with your own hotcocoa code
class Application
include HotCocoa
def start
application :name => "Sample" do |app|
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>'
class Class
alias old_new new
def new(*args)
old_new(*args)
end
end
class Shit
def initialize(obj)
class Class
alias old_new new
def new(*args)
old_new(*args)
end
end
class Shit
def initialize(&block)