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
$ irb | |
>> omar = ["a", "b", "c"] | |
=> ["a", "b", "c"] | |
>> omar.to_s | |
=> "abc" | |
>> class Array | |
>> def to_s | |
>> output = "I am an Array. I contain: " | |
>> self.each {|x| output += " element: #{x} " } | |
>> return output |
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
# Some default enhancements/settings for IRB, based on | |
# http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks | |
unless defined? ETC_IRBRC_LOADED | |
# Require RubyGems by default. | |
require 'rubygems' | |
# Activate auto-completion. | |
require 'irb/completion' |
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 User < ActiveRecord::Base | |
# Paperclip | |
has_attached_file :photo, | |
:styles => { | |
:thumb=> "100x100#", | |
:small => "150x150>", | |
:medium => "300x300>", | |
:large => "400x400>" } | |
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
polyglot:newstorefront-sparkfly cbq$ git push | |
Counting objects: 27, done. | |
Compressing objects: 100% (16/16), done. | |
Writing objects: 100% (16/16), 23.31 KiB, done. | |
Total 16 (delta 12), reused 0 (delta 0) | |
error: unable to create temporary sha1 filename ./objects/tmp_obj_CHVPmT: Permission denied | |
fatal: failed to write object | |
error: unpack failed: unpacker exited with error code | |
To [email protected]:sthiel/storefront-sparkfly.git |
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
<lwp> | |
<xml> | |
<userLocs>http://community.sparkfly.local:3000/lwp/locations</userLocs> | |
<mechants>http://community.sparkfly.local:3000/lwp/merchants</mechants> | |
<mechantInfo>http://community.sparkfly.local:3000/lwp/merchant_info</mechantInfo> | |
<geocode>http://community.sparkfly.local:3000/lwp/geocode</geocode> | |
<nearcount>http://community.sparkfly.local:3000/lwp/nearcount</nearcount> | |
<nearbymerchants>http://community.sparkfly.local:3000/lwp/nearby_merchants</nearbymerchants> | |
<editLink>http://community.sparkfly.local:3000/my/preferences/lwp</editLink> |
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 File.dirname(__FILE__) + '/../test_helper' | |
class HebrewReversalTest < Test::Unit::TestCase | |
def setup | |
@single_line_string = "I should be reversed." | |
@multi_line_string = "I should be reversed. \nAnd I should too. \nAlong with me!" | |
end | |
# helper to reverse strings if the language is rtl |
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' | |
class FishTest < ActiveSupport::TestCase | |
# Replace this with your real tests. | |
def test_fish_belongs_to_pond | |
pond = Pond.create! | |
fish = pond.fishes.create!() | |
assert pond.fishes.member?(fish) # works | |
fish = Fish.create(:pond => pond) | |
assert pond.fishes.reload.member?(fish) # Does not work |
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' | |
class FishTest < ActiveSupport::TestCase | |
# Replace this with your real tests. | |
def test_fish_belongs_to_pond | |
pond = Pond.create! | |
fish = pond.fishes.create!() | |
assert pond.fishes.member?(fish) # works | |
fish = Fish.create(:pond => pond) | |
assert pond.fishes.reload.member?(fish) # Does not work |
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
def cool_action | |
if request.get? | |
render :text => "You called a get, didn't you?" | |
elsif request.post? | |
render :text => "You're a poster, you big poster you." | |
elsif request.xhr? | |
render :text => "Oh, AJAX XMLHTTPrequesting. Aren't you special." | |
else | |
render :text => "Man, what is this a PUT? a DELETE? How utterly 2001!" |
NewerOlder