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 all='git for-each-ref --count=400 --sort=-committerdate refs/heads/ --format='"'"'printf "%%-40s %%4d behind\t%%4d ahead\t%%-20s\t%%30s\n" "$(echo %(refname) | cut -d / -f 3-)" "$(echo $(git log %(objectname)..head --oneline | wc -l))" "$(git log head..%(objectname) --oneline | wc -l)" "%(authorname)" "%(authordate)"'"'"' | $SHELL | less' |
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
# Add this to the end of your development.rb and add | |
# | |
# gem 'pry' | |
# | |
# to your Gemfile and run bundle to install. | |
silence_warnings do | |
begin | |
require 'pry' | |
IRB = Pry |
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
# Example: | |
# | |
# 2.of { Factory(:user) } #=> [<User>, <User>] | |
# | |
class Fixnum | |
def of | |
(1..self).map { |n| yield n } | |
end | |
end |
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
# all_in, any_in, and none_in extension to Array. | |
# | |
module Enumerable | |
# Returns true if the argument list contain every item of the array. | |
# | |
# Basic Usage: | |
# | |
# [:black, :blue].all_in :black, :blue # => true | |
# [:black].all_in :black, :red # => 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
# all_in, any_in, and none_in extension to Array. | |
# | |
class Array | |
# Returns true if the argument list contain every item of the array. | |
# | |
# Basic Usage: | |
# | |
# [:black, :blue].all_in :black, :blue # => true | |
# [:black].all_in :black, :red # => 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
# Use .eq where you would use ==. Avoid accidental assignment. | |
# | |
# if 1.eq 1 | |
# puts "They're equal" | |
# end | |
# | |
class Object | |
def eq(operand) | |
self == operand | |
end |
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
# has_each, has_any, and has_none extension to Array. | |
# | |
class Array | |
# Returns true is array contains each item in the argument list. | |
# | |
# Basic Usage: | |
# | |
# [:black, :blue].has_each :black # => true | |
# [:black, :blue].has_each :black, :red # => false |
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
# in extension to object. | |
# | |
class Object | |
# Returns true if the object sent #in is included in the argument list. | |
# | |
# Usage in conditionals: | |
# | |
# if 1.in 1, 2, 3 | |
# puts "1 was included" | |
# end |
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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
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
# features/support/env.rb | |
require 'webrat' | |
require 'webrat/core/matchers' | |
Webrat.configure do |config| | |
config.mode = :rack | |
config.open_error_files = false # Set to true if you want error pages to pop up in the browser | |
end |