Skip to content

Instantly share code, notes, and snippets.

@mikemclin
mikemclin / gist:116afef8628c2f2cba91
Created February 9, 2015 15:12
Store Git branch name into variable
# Store the current Git branch
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
# Do something
git checkout master
git merge $branch_name
git checkout $branch_name
@mikemclin
mikemclin / angular-late-dependency.js
Created September 4, 2014 14:09
Add late dependency to Angular module that has already been created
// Module `myApp` is already created. We were unaware that we needed
// the `anotherModuleDependency` module when we created `myApp`. The
// below code allows us to add `anotherModuleDependency` to the
// `myApp` dependency list.
angular.module('myApp').requires.push.apply(
angular.module('myApp').requires, ['anotherModuleDependency']
);
@mikemclin
mikemclin / angular-provider.js
Last active February 5, 2017 11:01
Configurable Angular Provider
var app = angular.module('app', []);
app.provider('MyConfig', function () {
var config = {
foo: 'bar'
};
return {
settings: function (userConfig) {
angular.extend(config, userConfig);
}, $get: function () {
@mikemclin
mikemclin / .bash_profile
Last active November 26, 2019 16:30
Bash Profile
export PATH=vendor/bin:$PATH
export PATH=Users/mikemclin/bin:$PATH
export PATH=/.composer/vendor/bin:$PATH
export PATH=node_modules/.bin:$PATH
export EDITOR='subl -w'
alias artisan='php artisan'
function homestead() {
@mikemclin
mikemclin / module.cache.js
Created January 7, 2014 16:37
Module method for caching jQuery selectors
(function(window, document, $, undefined){
var self = $.Module = {};
self.init = function() {
this.cache();
};
@mikemclin
mikemclin / subl
Last active January 1, 2016 02:59
Sublime Text 3 (OSX Mavericks): Make a symlink to `subl`. Make sure `~/bin` exists.
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl