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 / 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
@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 / .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 / 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 / pg.sh
Last active August 29, 2015 14:11 — forked from cjolly/pg.sh
mac upgrade postgres to 9.4.0 after automatic homebrew upgrade
newpg=9.4.0
oldpg=9.3.5_1 # set this to your current PG version
# Stop current Postgres server
# launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Backup current db
mv /usr/local/var/postgres/ /usr/local/var/postgres-$oldpg
# Homebrew
@AndreiRailean
AndreiRailean / clean_local.sh
Last active August 29, 2015 14:10
Clear old branches from local and remote repos
# Delete all merged local branches except for master
git branch --merged master | grep -v master | xargs git branch -d

Keybase proof

I hereby claim:

  • I am andreirailean on github.
  • I am andreirailean (https://keybase.io/andreirailean) on keybase.
  • I have a public key whose fingerprint is E471 C53A 5D75 ACFF F336 7B62 FC87 179E 15D8 5E90

To claim this, I am signing this object:

<div id="categories">
<div id="categories-wrapper">
<ul class="top">
{% for toplink in linklists.product-top-menu.links %}
{% capture link_section %}{{ toplink.title | handleize }}{% endcapture %}
<li class="category {% if forloop.first %}first{% endif %}"><a>{{ toplink.title }}</a>
<ul class="items">
{% for link in linklists[link_section].links %}
<li><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endfor %}
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
<div id="breadcrumbs">
<a href="{{ shop.url }}">Home</a>
{% case template %}
{% when 'product' %}
&raquo; <a href="{{ product.type | url_for_type }}">{{ product.type }}</a>
{% else %}
{% endcase %}
&raquo; <span class="page-title">{{ page_title }}</span>
</div>