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
| module Kernel | |
| def mapme(*selectors) | |
| selectors.map {|s| send(s) } | |
| end | |
| def mapkeys(*selectors) | |
| Hash[selectors.zip(mapme(*selectors))] | |
| 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
| $ bundle exec cucumber | |
| Using the default profile... | |
| ..............................................................................................................................................................................................................................................................................................................................................................................................F-...F---F-----F----.F-F---F------...F-F-----F----------------.F-F---F-------------------------------.F-F-----F----------------------------------------.F-F---F---F---F----F----F---F---F---F---F---F---F------F---F---F----F-----F---F---F---F----F-----F---F---F---F----F-----F---F---F---F----F-----F---F------F----------------------------------------.F-F---F---F---F---F---F---F---F---F---F---F---F---F---F--- | |
| (::) failed steps (::) | |
| expected "ruby: no such file to load -- bundler/setup (LoadError)\n" to include "does another thing" | |
| Diff: | |
| @@ -1,2 +1,2 @@ | |
| -does another thing |
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
| Hola Rails people. I have a column in my database that I need to treat | |
| as case-insensitive. The standard solution to this is to downcase the | |
| value before inserting it into the database, and when doing | |
| searches. My problems with this are: | |
| 1. I have to make calls to String#downcase in several places where I | |
| *really* mean "this is case-insensitive" | |
| 2. I can only provide automatic-downcasing when going through the API | |
| I provide. Anyone calling MyClass.where(:name => foo) has to know to |
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 SomethingDoer | |
| def initialize | |
| lazy_init(:foo) { Foo.new } | |
| end | |
| def do_something | |
| @foo.something # doesn't blow up because it auto-init'd | |
| 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
| class User | |
| include Mongoid::Document | |
| references_one :best_friend, :class_name => "Person" | |
| references_one :worst_enemy, :class_name => "Person" | |
| 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
| module API | |
| class Version1 < Grape::API | |
| version 'v1' | |
| resource :hotels do | |
| get '/' do | |
| if [:latlng, :query].all? {|key| params[key].blank? } | |
| error! 'Please pass in latlng|query' | |
| 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
| subscription("12345") do | |
| plan(:amount => 12.34) | |
| credit_card(:number => 1) | |
| signup(:success) | |
| renewal(:success) | |
| renewal(:failure) | |
| payment(:success) | |
| 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
| ActionController::Routing::Routes.draw do |map| | |
| map.namespace(:admin) do |admin| | |
| admin.resource :subscription, :member => { :upgrade => :post } do |subscription| | |
| subscription.resources :payments | |
| end | |
| 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
| module Codebreaker | |
| class Game | |
| def initialize(output) | |
| @output = output | |
| end | |
| def start | |
| @output.puts("Welcome to Codebreaker!") | |
| @output << "You smell bad" | |
| 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
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
| "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <title>Create and share movies of your drawings and voice! -- Show & Tell for iPad</title> | |
| <link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
| </head> | |
| <body> |