Skip to content

Instantly share code, notes, and snippets.

View BenConstable's full-sized avatar

Ben Constable BenConstable

  • Mediatonic
  • Fareham, UK
  • 09:54 (UTC +01:00)
View GitHub Profile
@BenConstable
BenConstable / git-merge-feature
Last active December 9, 2015 23:38
After a Pull Request of yours is merged, you will want to make sure that your master branch has the changes, and that the feature branch you were working on gets properly tidied up. This simple Git extension does just that.
#!/bin/sh
#
# This script deletes a feature branch you've been
# working on, assuming that it's been merged as part
# of a Pull Request, and pulls it into your master
# branch.
#
# You need a typical setup, and a reference to the
# forked repo, called `upstream`.
@BenConstable
BenConstable / move-commits.sh
Created November 9, 2012 10:41
Move commits onto feature branch
#
# If, for example, you've accidentally made some commits to master
# that should be on a feature branch, this set of commands will
# move those commits over to a feature branch and reset master to
# where it should be both locally and on the remote.
#
# References:
#
# - http://stackoverflow.com/questions/1628563/move-recent-commit-to-a-new-branch
# - http://stackoverflow.com/questions/1377845/git-reset-hard-and-a-remote-repository
@BenConstable
BenConstable / dotfiles.rb
Created July 22, 2012 12:39
Simple script to link dotfiles stored in Dropbox to the local home directory
# Link dotfiles
dropboxPath = File.expand_path(File.dirname(__FILE__))
targetPath = File.expand_path('~')
files = 0
Dir.foreach(dropboxPath) do |file|
if (file != '.') && (file != '..') && (file != File.basename(__FILE__))
%x[ln -sF #{dropboxPath}/#{file} #{targetPath}/#{file}]
files += 1
end
@BenConstable
BenConstable / backbone-bootstrap.js
Created June 25, 2012 13:15
Neat wrapper for Backbone.js application bootstrapping. Very basic but works nicely!
/*
* Wrap up the Backbone application in a simple interface
*/
// Using Jquery...
(function ($) {
// Create application
var MyApp = (function () {