Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Andrei Railean AndreiRailean

🏠
Working from home
View GitHub Profile
@AndreiRailean
AndreiRailean / git_snippets.sh
Last active Jan 31, 2017
Useful Git Snippets
View git_snippets.sh
# 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 Aug 29, 2015 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
View echoHttpRequest.js
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 Jan 30, 2017
Aliases for Git Config
View .gitconfig
[user]
name = Andrei Railean
email = andrei@siter.com.au
[alias]
co = checkout
cob = checkout -b
st = status
s = status
ci = commit
c = commit
View fix_sequence.rb
# 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 Aug 29, 2015 — forked from cjolly/pg.sh
mac upgrade postgres to 9.4.0 after automatic homebrew upgrade
View pg.sh
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 Aug 29, 2015
Clear old branches from local and remote repos
View clean_local.sh
# Delete all merged local branches except for master
git branch --merged master | grep -v master | xargs git branch -d
View keybase.md

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:

View shopify-categories.liquid.html
<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 %}
View example_note_keeping_app.rb
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!
#
View breadcrumbs.liquid
<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>