Skip to content

Instantly share code, notes, and snippets.

View AndreiRailean's full-sized avatar
🏠
Working from home

Andrei Railean AndreiRailean

🏠
Working from home
View GitHub Profile
@AndreiRailean
AndreiRailean / fix_sequence.rb
Created January 22, 2015 02:49
Fix Rails Sequences
# Run this when your sequences get out of whack
# Can happen after a botched database restore
# Tested with postgres
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.reset_pk_sequence!(table)
end
@AndreiRailean
AndreiRailean / .gitconfig
Last active January 30, 2017 23:18
Aliases for Git Config
[user]
name = Andrei Railean
email = andrei@siter.com.au
[alias]
co = checkout
cob = checkout -b
st = status
s = status
ci = commit
c = commit
@AndreiRailean
AndreiRailean / echoHttpRequest.js
Last active August 29, 2015 14:23 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
@AndreiRailean
AndreiRailean / git_snippets.sh
Last active January 31, 2017 01:33
Useful Git Snippets
# Checkout and track remote branch
git checkout --track -b local_branch remote/remote_branch
# Delete all merged local branches except for master
git branch --merged master | grep -v master | xargs git branch -d
# Delete all branches from origin remote except master
git branch -a --merged remotes/origin/master | grep -v master | grep "remotes/origin/" | sed 's|remotes/origin/||' | xargs -n 1 git push --delete origin