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(keys, values, rereduce) { | |
if (rereduce) { | |
var result = []; | |
values.forEach(function(valueGroup){ | |
valueGroup.forEach(function(value){ | |
result.push(value); | |
}); | |
}); | |
return result; | |
} else { |
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
#RVM settings | |
if [[ -s ~/.rvm/scripts/rvm ]] ; then | |
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" | |
fi | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
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
(defun ruby-send-region (start end) | |
"Send the current region to the inferior Ruby process." | |
(interactive "r") | |
(let (term (file (buffer-file-name)) line) | |
(save-excursion | |
(save-restriction | |
(widen) | |
(goto-char start) | |
(setq line (+ start (forward-line (- start)) 1)) | |
(goto-char start) |
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
GC.disable | |
objects = ObjectSpace.count_objects | |
start = objects[:TOTAL] | |
puts "objects: #{start}" # => 9811 | |
1_000_000.times do | |
"I am a lonly" + " concatenated" + " string" + "." | |
end | |
end_objects = ObjectSpace.count_objects(objects)[:TOTAL] | |
puts "objects: #{end_objects}" # => ? | |
puts "difference: #{end_objects - start}" # => ? |
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
GC.disable | |
objects = ObjectSpace.count_objects | |
start = objects[:TOTAL] | |
puts "objects: #{start}" # => 9811 | |
1_000_000.times do | |
"I am a lonly" + " concatenated" + " string" + "." | |
end | |
end_objects = ObjectSpace.count_objects(objects)[:TOTAL] | |
puts "objects: #{end_objects}" | |
puts "difference: #{end_objects - start}" |
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
alias g='git' | |
alias gm='git merge' | |
alias gmf='git merge --ff-only' | |
alias gs='git status' | |
alias gl='git pull' | |
alias glr='git pull --rebase' | |
alias gf='git fetch' | |
alias gp='git push' | |
alias gd='git diff' | |
alias gc='git commit -v' |
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
# Hook to save the html page of every failed scenario into the temp | |
# file directory taht it can be checked after cucumber has finished running. | |
require 'fileutils' | |
require 'capybara/util/save_and_open_page' | |
FAILED_SCENARIO_PAGES_PATH = File.join Rails.root, 'tmp', 'failed_scenarios' | |
FileUtils.rm_rf FAILED_SCENARIO_PAGES_PATH | |
After do |scenario| | |
if scenario.failed? |
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
# Routes | |
# To prevent too deep nesting, we make the show, edit, update and destroy actions not nested under the category. We have a lot of models nested inside the product. | |
resources :category do | |
resources :products, :only => [:new, :create, :index] | |
end | |
resources :products, :only => [:show, :edit, :update, :destroy] | |
# ProductController | |
# We need to expose :category, :products and :product |
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
# .gitconfig | |
[format] | |
pretty = %C(yellow)%h%Creset%C(green)%d%Creset %s %C(red)[%an]%Creset %C(cyan)[%cr]%Creset | |
# .bashrc / .zshrc | |
alias gg='git log --graph' |
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 Screencast | |
attr_accessor :versions | |
def initialize(params) | |
params.each {|key, value| self.send "#{key}=", value } | |
end | |
end | |
class ScreencastCategories | |
def self.by_tool(screencasts) |
OlderNewer