View lazy_invocation.rb
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 'set' | |
def figure_it_out(procs, **params) | |
params_provided = params.keys.to_set | |
procs = procs.each_with_object({}) {|proc, lookup| lookup[proc.parameters.transpose[1].to_set] = proc} | |
procs[params_provided][**params] | |
rescue NoMethodError | |
raise "Unknown set of params, slacker" | |
end |
View gist:1077093
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
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > /tmp/load.patch | |
rvm get head # always good to make sure you're up to date with RVM | |
rvm reload | |
rvm install ruby-1.9.2-p180 --patch /tmp/load.patch -n patched | |
rvm use ruby-1.9.2-p180-patched |
View config.js
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
'use strict'; | |
/** | |
* @typedef {Object} Configuration | |
* @property {String} coverageEnvVar - name of environment variable for coverage | |
* @property {String} coverageFolder - directory in which to write coverage to | |
* @property {Array<String>} excludes - list of glob paths to exclude | |
* @property {Array<String>} reporters - list of reporters | |
*/ |
View Findable.rb
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
module Findable | |
extend ActiveSupport::Concern | |
# When you use uuid some methods stop to work as expected. Using this concern in your models will do the job. | |
# Override methods on module FinderMethods that use id as default order when no order is defined | |
# It's a working in progress | |
# referencer: | |
# http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-take | |
# https://github.com/rails/rails/blob/f52354ad1d15120dcc5284714bee7ee3f052986c/activerecord/lib/active_record/relation/finder_methods.rb#L503 | |
module ClassMethods |
View helpers.rb
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
def render_stack(blockitem, size) | |
size = nil if size < 2 | |
html = "" | |
link = localized.include?(blockitem) ? "" : "something" | |
html << "<a href=\"#{link}\" class=\"stack-link\">" # Not done, still need to change that for things | |
html << "<div class=\"recipe-icon\" style=\"background: url(#{url('images/wiki/#{blockitem}.png')});\" title=\"{$name}\">#{size}</div>" | |
html << "</a>" | |
end |
View wikt.css
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
/* standard css for master page tables */ | |
table.master { | |
width: 100%; /* Fill <div> */ | |
} | |
table.master > tr > th, | |
table.master > tr > td, | |
table.master > * > tr > th, | |
table.master > * > tr > td { | |
vertical-align: top; /* Set valign variable */ | |
} |
View gist:6437855
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 'forwardable' | |
module Blah | |
include ::Forwardable | |
def self.extended(base) | |
base.send :def_delegators, :@list, :<<, :length # and anything else | |
end | |
end | |
class List |
View nombom.sh
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
alias nombom='echo "(╯°□°)╯︵ ┻━┻ " && npm cache clear && bower cache clean && rm -rf node_modules bower_components && npm install && bower install' |
View beinning_of_month.rb
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
1.9.2p320 :001 > t = Time.new(2013,1,1,0,0,0,0) | |
=> 2013-01-01 00:00:00 +0000 | |
1.9.2p320 :002 > t.beginning_of_month | |
=> 2013-01-01 00:00:00 -0800 | |
1.9.2p320 :003 > t.beginning_of_month.utc | |
=> 2013-01-01 08:00:00 UTC | |
1.9.2p320 :004 > t.utc.beginning_of_month | |
=> 2013-01-01 00:00:00 UTC |
NewerOlder