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 'yaml' | |
| class CreateCars | |
| class << self | |
| def normalize_makes | |
| makes.collect do |make| | |
| { name: make["Make"], id: make["Make_ID"] } | |
| 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
| def self.find(id) | |
| BW::HTTP.get("#{BASE_URI}/photos/#{id}") do |response| | |
| new(BW::JSON.parse(response.body.to_str)) | |
| end | |
| end | |
| # p = Photo.find 116 | |
| # p p.id |
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
| tail -f log/sql.log |
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
| ActiveRecord::Base.logger = Logger.new('log/sql.log') if ENV.include?("LOG_QUERIES") |
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
| INFO 14:53:43.758083 | deals | 14:53:43 deals_web.1 | 2012-11-07T14:53:10-05:00 US-MSILVI01-OSX 43546 WARN deals /Users/mikesilvis/.rvm/gems/ree-1.8.7-2011.12@deals/gems/memcached-1.4.3/lib/memcached/memcached.rb:598:in `check_return_code' | |
| INFO 14:53:43.758188 | deals | 14:53:43 deals_web.1 | 2012-11-07T14:53:10-05:00 US-MSILVI01-OSX 43546 WARN deals /Users/mikesilvis/.rvm/gems/ree-1.8.7-2011.12@deals/gems/memcached-1.4.3/lib/memcached/memcached.rb:517:in `get' | |
| INFO 14:53:43.758289 | deals | 14:53:43 deals_web.1 | 2012-11-07T14:53:10-05:00 US-MSILVI01-OSX 43546 WARN deals /Users/mikesilvis/Documents/livingsocial/code/deals/vendor/plugins/cache_bar/lib/cache_bar.rb:34:in `get' | |
| INFO 14:53:43.758375 | deals | 14:53:43 deals_web.1 | 2012-11-07T14:53:10-05:00 US-MSILVI01-OSX 43546 WARN deals /Users/mikesilvis/Documents/livingsocial/code/deals/vendor/plugins/cache_bar/lib/cache_bar.rb:203:in `with_cache' | |
| INFO 14:53:43.758460 | deals | 14:53:43 deals_web.1 | 2012-11-07T14:53:10-05:00 US-MSILV |
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
| sudo curl \ | |
| -L https://raw.github.com/gist/3204240/ed7e118ca6e50071576bb33be7bab3201dc38d04/kext.sh \ | |
| -o /Library/org.pqrs/PCKeyboardHack/scripts/kext.sh |
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
| $.cookie('supersecret', "mypw", {expires: 365}); |
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
| before_filter :require_mike, only: [:edit, :new, :destroy] | |
| def require_mike | |
| redirect_to :root unless (cookies[:supersecret] == "mypw") | |
| 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
| def pass_my_block(&block) | |
| puts "Hi Paul!" | |
| yield | |
| puts "Bye Paul!" | |
| end | |
| pass_my_block do | |
| puts "You smell" | |
| 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
| > I18n.locale | |
| => :en | |
| >> I18n.locale = :fr | |
| => :fr | |
| >> I18n.locale | |
| => :fr | |
| >> DealCategoriesFilter::DEFAULT_SET | |
| => {"nationwide"=>{:order=>6, :nationwide_filter=>true, :label=>"Deals nationaux"}, "activities"=>{:order=>1, :category_filters=>["Entertainment", "Fitness/Active"], :label=>"activités"}, "healthbeauty"=>{:order=>4, :category_filters=>["Beauty/Health", "Health/Beauty"], :label=>"santé/beauté"}, "home"=>{:order=>5, :category_filters=>["Home Goods", "Indoor Home Care/Repair/Services", "Outdoor Home Care/Repair/Maintanance"], :vertical_filters=>:at_home?, :label=>"côté maison"}, "food"=>{:order=>3, :category_filters=>["QSR/Fast Casual", "Full-Service Restaurant", "Food/Drink", "Food"], :vertical_filters=>:gourmet?, :label=>"restaurants"}, "families"=>{:order=>2, :vertical_filters=>:families?, :label=>"corner enfants"}} | |
| >> I18n.locale = :en | |
| => :en |