Skip to content

Instantly share code, notes, and snippets.

View wm's full-sized avatar

Will Mernagh wm

View GitHub Profile
@wm
wm / 0_README.md
Last active August 29, 2015 14:07
Extract uniq emails sorted by domain from file.

Extract uniq emails sorted by domain from file.

Note that we ignore emails of the form xxx@yyy.com, i.e. if it has a '<' we ignore it.

Usage

$ extract_emails.zsh file_with_emails.txt
example@example.com
ex@ex.com

Keybase proof

I hereby claim:

  • I am wm on github.
  • I am wmernagh (https://keybase.io/wmernagh) on keybase.
  • I have a public key whose fingerprint is E2C9 3136 5CC3 DA1C 9F5C 1A67 ED8C 249C 2A6A 260D

To claim this, I am signing this object:

@wm
wm / flexigrid.js
Created May 5, 2010 01:52
JSON Format for Flexigrid
{
"stat": "ok",
"page": 1,
"total": 100,
"rows": [
{
"id":"1",
"cell":[
"content of column 1",
"content of column 2",
class Exercise < ActiveRecord::Base
acts_as_tagger
end
class Observation < ActiveRecord::Base
acts_as_taggable_on :locations
end
@current_exercise.tag(@some_observation, :with => "SaveNYC", :on => :missions)

Copy this script to ".git/hooks/post-checkout" in your repository and make it executable:

chmod +x .git/hooks/post-checkout

Tweak it at will. I'm refreshing the bundle and restarting the app server because the Gemfile is different on my "hosted" branch than on other branches.

Using Rebase instead of Merge for pulls

Instead of doing a regular pull git pull => git fetch && git merge remotes/origin/BRANCH BRANCH

To avoid the all the merge commit messages you can run the following command instead git pull --rebase => git fetch && git rebase remotes/origin/BRANCH BRANCH

I actually have the following in my ~/.gitconfig file

/*
* File: BinarySearchTree.cpp
* Prj: Dictonary
*
* Created by Will Mernagh on April 21.
* Copyright 2007. All rights reserved.
*
*/
#include <iostream>
@wm
wm / git_work_flow.sh
Created January 21, 2011 14:32
My Git Work flow
~ $ cd MyProject.git
(master) MyProject.git $ git pull # Get main branch up to date
(master) MyProject.git $ git checkout -b 100-new-style # create story branch to do development in
(100-new-style) MyProject.git $ vim public/stylesheets/main.css # make some modifications
(100-new-style) MyProject.git $ vim public/stylesheets/two.css # make some modifications
(100-new-style) MyProject.git $ vim public/stylesheets/three.css # make some modifications
(100-new-style) MyProject.git $ git add public # Add our changes
(100-new-style) MyProject.git $ git commit -m "Re #100. Added border to our pages" # commit local changes
(100-new-style) MyProject.git $ git checkout master # change back to main branch
(master) MyProject.git $ git pull # Get upstream changes (they will be fast forwarded)
@wm
wm / git-pr.sh
Created February 10, 2012 06:33
Pull request from the command line
gh_info=`gh info`
repo_user=`echo ${gh_info}|grep 'You are'|sed 's/You are //g'`
repo_name=`echo ${gh_info}|grep '== Info for'|sed 's/== Info for //g'`
branch_name=`git branch|grep '\*'|sed 's/\* //g'`
pull_url="https://github.com/${repo_user}/${repo_name}/pull/new/${branch_name}"
@wm
wm / hack.sh
Created April 8, 2012 17:24 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#