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 'garner' | |
module Mongoid | |
module Document | |
module ClassMethods | |
# Find instances by ID or crtieria in the same order as the IDs provided. | |
# TODO: this can be done with an $or until MongoDB 2.6, see https://jira.mongodb.org/browse/SERVER-14083 | |
def find_ordered(ids, criteria = nil) | |
return [] if ids.empty? | |
instances = criteria || self.find(ids) |
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
puts Nokogiri::HTML(open("http://example.com/example")).css("div.example").count |
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
platform :ios, :deployment_target => '5.0' | |
pod 'RestKit', '~> 0.10.3' | |
pod 'SDWebImage', '~> 2.7' | |
pod 'Facebook-iOS-SDK', '~> 3.1.1' | |
pod do |spec| | |
spec.name = 'KGNoise' | |
spec.version = '1.0.1' | |
spec.summary = 'Forked library to create gradient' | |
spec.author = { 'Marco Sanson' => '[email protected]' } |
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
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app 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
WORDS = [ [ "husband", "wife" ], [ "brother", "sister"], [ "uncle", "nephew" ] ] | |
class String | |
def opposite | |
WORDS[WORDS.flatten.index(self)/2][WORDS.flatten.index(self)%2 == 0 ? 1 : 0] | |
end | |
end |