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
| www.livefyre.com |
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
| javascript:if(document.getSelection){s=document.getSelection();}else{s='';};document.location='https://pinboard.in/add?next=same&url='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(s)+'&title='+encodeURIComponent(document.title) |
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
| grab = function(regex) { return $(".error h2 a").filter(function(i,a) { return $(a).attr("title").match(regex)}) } | |
| cb = function(regex) { return grab(regex).parent().parent().parent().find("input[type=checkbox]")} | |
| ids = function(regex) { return grab(regex).map(function(i,a) { return $(a).attr('href').split('/')[2]}).toArray().join(',') } | |
| // This will load all of your items onto the page: | |
| timer = setInterval(function() { $("#more-link-technology").trigger("more-me") }, 500) | |
| // Wait for the last page (if you have 1000 exceptions, the last page will be around 100). | |
| // Put a breakpoint at javascripts/application.js:911 at the $.post |
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
| # In app/models/user.rb | |
| acts_as_authentic do |c| | |
| c.merge_validates_length_of_email_field_options({:unless => :inactive?}) | |
| c.merge_validates_format_of_email_field_options({:unless => :inactive?}) | |
| c.merge_validates_uniqueness_of_email_field_options({:unless => :inactive?}) | |
| c.require_password_confirmation = false | |
| c.merge_validates_length_of_password_field_options({:unless => :inactive?, :minimum => 3}) | |
| c.merge_validates_length_of_login_field_options({:within => 2..40, :unless => :inactive?}) | |
| c.merge_validates_format_of_login_field_options({:unless => :inactive?}) |
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
| # in ApplicationController: | |
| unless Rails.application.config.consider_all_requests_local | |
| rescue_from Exception, NoMethodError, :with => :render_500 | |
| rescue_from ActiveRecord::RecordNotFound, | |
| ActionController::RoutingError, | |
| ActionController::UnknownController, | |
| ActionController::UnknownAction, :with => :render_404 | |
| 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 Order | |
| has_many :foods, :through => :line_items | |
| has_many :merchandise_items, :through => :line_items | |
| has_many :line_items | |
| def total | |
| line_items.map(&:price).sum | |
| 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
| SproutRobot::Application.routes.draw do | |
| resources :users do | |
| collection do | |
| post :set_zip | |
| 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
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| Dir.foreach(FileUtils.pwd) do |f| | |
| if f.match(/\.html\.erb$/) | |
| new_name = f.gsub(/\.erb$/, ".haml") | |
| `html2haml #{f} #{new_name}` | |
| `rm #{f}` | |
| 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
| # By default, Ruby invokes class methods based on the number of parameters, ignoring | |
| # the parameter type. I was curious if I could implement the method invocation pattern | |
| # used in Lisp's CLOS, where you can have multiple methods that each accepts the same | |
| # number of paraemters, but with different types. | |
| # | |
| # Needs Ruby 1.9 | |
| class Object | |
| def self.defm(sym, *classes, &block) | |
| @defm_methods ||= {} |
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
| Dreamer [Fischer], level [1], priority [19], policy [OTHER] | |
| Dreamer [Cobb], level [1], priority [19], policy [OTHER] | |
| Dreamer [Arthur], level [1], priority [19], policy [OTHER] | |
| Dreamer [Yusuf], level [1], priority [19], policy [OTHER] | |
| Dreamer [Saito], level [1], priority [19], policy [OTHER] | |
| Dreamer [Eames], level [1], priority [19], policy [OTHER] | |
| Dreamer [Ariadne], level [1], priority [19], policy [OTHER] | |
| [Fischer] HIJACKED ! Open up my defense projections in my dream to the hijackers! | |
| [Saito] sees Fischers defense projections at work in the dream at level [1] | |
| [Saito] shot in level [1]. Following Cobb to level [2] |