This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder