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 Log | |
| LOGS = Hash.new {|h,k| h[k] = Logger.new("log/#{k}.log")} | |
| extend self | |
| def method_missing name | |
| LOGS[name] | |
| 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 Sequel::Model | |
| def sql_literal(dataset=nil) | |
| self.pk | |
| 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
| >> m = Match.first | |
| => #<Match _id: 4d9bce2458f68fbb67000001, user_ids: [1, 2], _id: BSON::ObjectId('4d9bce2458f68fbb67000001'), _type: nil> | |
| >> m.players.create(:user_id => 1) | |
| NoMethodError: undefined method `name' for nil:NilClass |
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
| <a href="#" class="button h64" id="buy_package_1234"> | |
| <div class="left bg"></div> | |
| <div class="right bg"></div> | |
| <span class="text">Buy</span> | |
| </a> |
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
| function gg { freyr $@ --config-file="/web/Freyrfile" --ignore-local --namespace=gg; } |
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 'benchmark' | |
| arr = [*0..99999] | |
| num = 100 | |
| Benchmark.bmbm do |x| | |
| x.report("sym#to_proc") do | |
| num.times do | |
| arr.each(&:to_i) | |
| 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 Stack | |
| def initialize | |
| @main = [] | |
| @min = [] | |
| end | |
| def push val | |
| @main << val | |
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
| server: | |
| :start: "merb -p 80{{instance%2}}" | |
| :instances: 40 | |
| :environment: | |
| merb_env: production | |
| workers: | |
| :start: rake resque:work | |
| :instances: 1 | |
| :arg0: '*' |
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 QikLog | |
| def self.method_missing meth | |
| unless logger = instance_variable_get(:"@#{meth}") | |
| logger = Logger.new(File.join('log',"#{meth}.log")) | |
| instance_variable_set(:"@#{meth}", logger) | |
| end | |
| logger | |
| end | |
| end |