Skip to content

Instantly share code, notes, and snippets.

View bhaity's full-sized avatar

Sikandar Shukla bhaity

View GitHub Profile
@myronmarston
myronmarston / without_foreign_keys.rb
Created September 6, 2014 04:36
Example of how to disable foreign keys for a particular context
RSpec.shared_context "without foreign key constraints", :disable_foreign_keys do
def without_foreign_key_checks
DB.run('SET foreign_key_checks = 0;')
yield
ensure
DB.run('SET foreign_key_checks = 1;')
end
around(:example) { |ex| without_foreign_key_checks(&ex) }
end
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"