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
rvm --create use ruby-2.1.2 | |
export RUBY_GC_HEAP_INIT_SLOTS=1000000 | |
export RUBY_GC_HEAP_FREE_SLOTS=500000 | |
export RUBY_GC_HEAP_GROWTH_FACTOR=1.1 | |
export RUBY_GC_HEAP_GROWTH_MAX_SLOTS=10000000 | |
export RUBY_GC_MALLOC_LIMIT_MAX=500000000 | |
export RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.1 |
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
<%= _("${TM_SELECTED_TEXT/"/\\"/g}") %> #rails gettext snippet for HTML text | |
_("${TM_SELECTED_TEXT/"/\\"/g}") #rails gettext snippet for ruby strings | |
To use same shortcut for both scope them a following | |
text.html.ruby #for html | |
string.quoted.single.ruby|string.quoted.double.ruby #for ruby strings |
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
describe "store localized date strings" do | |
class User < ActiveRecord::Base | |
end | |
it "should store a german date string" do #failing | |
user = User.create! :date_of_birth => '20.12.1980' | |
user.date_of_birth.should == Date.parse('1980-12-20') | |
end | |
it "should store a international date string" do |
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
framework 'Cocoa' | |
app = NSApplication.sharedApplication | |
window = NSWindow.alloc.initWithContentRect([0,0,200,60], | |
styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask , | |
backing:NSBackingStoreBuffered, | |
defer:false) |
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 Salute | |
attr_writer :stalutation | |
def show_salutation(sender) | |
@stalutation.stringValue = "Hi MacRuby!" | |
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
require 'hotcocoa' | |
include HotCocoa | |
application do | |
window = window(title: 'Hello World', frame: [0,0,200,60]) | |
label = label(text:'Hello World', layout: {align: :center}) | |
window << label | |
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
# fixes deserialization from xml with nested associations | |
# based on http://www.xcombinator.com/2008/08/11/activerecord-from_xml-and-from_json-part-2/ | |
module ActiveRecord #:nodoc: | |
module Serialization | |
def from_hash( hash ) | |
h = hash.dup | |
h.each do |key,value| | |
case value.class.to_s |
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
gem install gem_with_executable --format-executable |
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
set -ex | |
dir="$TEMP_FILES_DIR/disk" | |
dmg="$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg" | |
dmg_options="-imagekey zlib-level=9 -format UDZO" | |
rm -rf "$dir" | |
mkdir "$dir" | |
cp -R "$BUILT_PRODUCTS_DIR/$PROJECT_NAME.app" "$dir" | |
chmod -Rf go-w "$dir" |
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
Given /^I visit subdomain "(.+)"$/ do |sub| | |
#host! "#{sub}.example.com" #for webrat | |
Capybara.default_host = "#{sub}.example.com" #for Rack::Test | |
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity | |
################################################################################ | |
# As far as I know, you have to put all the {sub}.example.com entries that you're | |
# using in your /etc/hosts file for the Culerity tests. This didn't seem to be | |
# required for Rack::Test | |
################################################################################ |
OlderNewer