Skip to content

Instantly share code, notes, and snippets.

View trashhalo's full-sized avatar
:shipit:

Stephen Solka trashhalo

:shipit:
View GitHub Profile
@trashhalo
trashhalo / git-clean-local.sh
Last active August 29, 2015 13:56 — forked from schacon/gist:942899
Cleans up local tracking branches that dont exist on the remote. Removes all remote branches that have been merged into master.
# clean up merged local branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
var $private = $injector.has("$private") ? $injector.get("$private") : {};
$private.myprivatfn = function (){};
this.mypublicfn = function () {
$private.myprivatefn();
};
function test_dir {
for i in `find $1 -type f|grep _test.rb`; do echo "$(tput bold)> $i$(tput sgr0)" && bundle exec ruby -Itest $i; done
}
@trashhalo
trashhalo / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function methodThatCleansUpStuff(){
// dont return anything cause you are just cleaning up
}
function doAsyncStuff() {
return methodThatGivesAPromise()
.then(otherMethodThatGivesAPromise)
.then(()=>{throw new Error(“BOOM”)})
.then(otherOtherMethodThatGivesAPromise)
.catch(methodThatCleansUpStuff)
@trashhalo
trashhalo / manual-branch.txt
Created November 5, 2010 18:02
manually add branch
git config --add svn-remote.BRANCHNAME.url https://svn/path_to_newbranch/
git config --add svn-remote.BRANCHNAME.fetch :refs/remotes/BRANCHNAME
git svn fetch BRANCHNAME
#Created a github repository called trashhalo.github.com
mkdir trashhalo.github.com
cd trashhalo.github.com
git init
git remote add octopress git://github.com/imathis/octopress.git
git symbolic-ref HEAD refs/heads/source
#Pulling all of octopress into source branch
git pull octopress
git merge octopress/master
git remote add origin git@github.com:trashhalo/trashhalo.github.com.git
brew install p7zip
7z x file.7z
@trashhalo
trashhalo / remote-package-init.pp
Last active December 23, 2015 16:39
Puppet custom resource type example
package{'curl':
ensure => 'present'
}
define remote-package($packagename=$title,$url,$creates){
exec{"download-$packagename":
command=>"/usr/bin/curl -o /tmp/$packagename.deb $url",
creates=>$creates,
require=>Package['curl']
}
@trashhalo
trashhalo / apt-update-init.pp
Last active December 23, 2015 16:49
Adds a new apt source to the sources.list.d. Runs apt-get update for only that source and installs a package from the new source.
define apt-update-single($repofile=$title,$source){
file{"/etc/apt/sources.list.d/${repofile}.list":
ensure=>'present',
content=>$source,
}
exec{"apt-get-update-$repofile":
command=>"/usr/bin/apt-get update -o Dir::Etc::sourcelist=\"sources.list.d/${repofile}.list\" -o Dir::Etc::sourceparts=\"-\" -o APT::Get::List-Cleanup=\"0\"",
require=>File["/etc/apt/sources.list.d/${repofile}.list"],
unless=>"/bin/ls /var/lib/apt/lists/|grep $repofile 2>/dev/null"