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 'rspec_api_documentation' | |
require 'rspec_api_documentation/dsl' | |
require 'spec_helper' | |
resource 'No_Doc Test' do | |
get "/foo" do | |
example "should appear in docs" do | |
do_request | |
status.should == 200 | |
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
rbx-head-18mode :003 > Base64.respond_to?(:strict_encode64) | |
=> false | |
rbx-head-18mode :004 > unless Base64.respond_to?(:strict_encode64) | |
rbx-head-18mode :005?> module Base64 | |
rbx-head-18mode :006?> def strict_encode64(bin) | |
rbx-head-18mode :007?> [bin].pack("m0") | |
rbx-head-18mode :008?> end | |
rbx-head-18mode :009?> end | |
rbx-head-18mode :010?> end | |
=> #<Rubinius::CompiledCode strict_encode64 file=(irb)> |
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
{{#if MyApp.currentUser}} | |
<ul> | |
<li>Welcome, {{ MyApp.currentUser.name}} | <a href="#" {{action "logout" on="click"}}>Log Out</a></li> | |
</ul> | |
{{else}} | |
<ul> | |
<li><a href="#" {{action "showLogin" on="click"}}>Log In</a></li> | |
</ul> | |
{{/if}} |
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
# This needs to be in your server's config somewhere, probably | |
# the main httpd.conf | |
# NameVirtualHost *:80 | |
# This line also needs to be in your server's config. | |
# LoadModule wsgi_module modules/mod_wsgi.so | |
# You need to manually edit this file to fit your needs. | |
# This configuration assumes the default installation prefix | |
# of /opt/graphite/, if you installed graphite somewhere else |
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
ruby-1.8.7-p249 > x = p.to_account | |
=> nil | |
ruby-1.8.7-p249 > !x | |
=> false | |
ruby-1.8.7-p249 > !nil | |
=> true | |
ruby-1.8.7-p249 > x | |
=> nil | |
ruby-1.8.7-p249 > x === nil | |
=> true |
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 'rubygems' | |
require 'redis' | |
require 'toystore' | |
require 'adapter/redis' | |
class BrokenInitialize | |
include Toy::Store | |
store :redis, Redis.new | |
attribute :test, String |
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 Array | |
def sum | |
inject(0) {|total,n| total + n } | |
end | |
end | |
puts Array.new([1,2,3,4]).sum | |
puts [1,2,3,4].sum | |
module StickyFingaz |
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
ENV["RAILS_ENV"] = "test" | |
require 'rubygems' | |
require 'integrity' | |
require 'notifier/campfire' | |
Integrity::Notifier.register(Integrity::Notifier::Campfire) | |
Integrity.new(File.dirname(__FILE__) + "/config.yml") |
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
>> s = Statement.new | |
=> {"updated_at"=>nil, "couchrest-type"=>"Statement", "created_at"=>nil} | |
>> s.create_attachment(:name => 'test.txt', :content_type => 'text/plain', :file => File.open('test.txt')) | |
=> {"content-type"=>"text/plain", "data"=>"dGVzdAo="} | |
>> s.save | |
=> nil | |
>> s['_attachments']['test.txt'] | |
=> {"content-type"=>"text/plain", "data"=>"ZEdWemRBbz0="} | |
>> s['_attachments']['test.txt']['content-type'] | |
=> "text/plain" |
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 Blah < CouchRest::ExtendedDocument | |
>> property :myval | |
>> property :trueval | |
>> def myval=(val) | |
>> self.trueval = val | |
>> end | |
>> end | |
=> nil | |
>> b = Blah.new(:myval => 10) | |
=> {"couchrest-type"=>"Blah", "myval"=>10} |
NewerOlder