Skip to content

Instantly share code, notes, and snippets.

View wm's full-sized avatar

Will Mernagh wm

View GitHub Profile
@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 / gist:1664077
Created January 23, 2012 16:22
iterm2 tmux
These release notes are for the development builds of iTerm2. The last stable release was 1.0.0.
iTerm2 1.0.0.20120108
You'd better sit down for this one.
Marquee Features
- Deep tmux integration!
Have you ever had an ssh session lost because you had to reboot, had a network failure, or the power went out? Are you tired of giving up a keystroke to tmux or screen? Suffer no longer! iTerm2 and tmux are now deeply integrated. By installing a special version of tmux, it gains the ability to speak directly to iTerm2. When you run tmux with -C, iTerm2 will open real, native windows or tabs for each tmux window. The whole state of your tmux session is reflected in native iTerm2 windows. As you interact with a window, your typing is sent back to tmux. Any time you resize a window, add a split pane, close a split pane, close a window, or open a window (with Shell->tmux->new window), that action happens in tmux as well as in iTerm2. Even your window positions and tabs are saved from session to session. For more
@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)
/*
* File: BinarySearchTree.cpp
* Prj: Dictonary
*
* Created by Will Mernagh on April 21.
* Copyright 2007. All rights reserved.
*
*/
#include <iostream>

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

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.

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)
@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",