Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Stephen Solka trashhalo

:shipit:
View GitHub Profile
@trashhalo
trashhalo / git-clean-local.sh
Last active Aug 29, 2015 — 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.
View git-clean-local.sh
# clean up merged local branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
View gist:32dba18e4b2354706efe
var $private = $injector.has("$private") ? $injector.get("$private") : {};
$private.myprivatfn = function (){};
this.mypublicfn = function () {
$private.myprivatefn();
};
View gist:da0e58a1b3bea4d8e9d0
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:9824c8de338af1bdfe6d
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)
View manual-branch.txt
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
View octopress-setup.sh
#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
View gist:4657814
brew install p7zip
7z x file.7z
@trashhalo
trashhalo / remote-package-init.pp
Last active Dec 23, 2015
Puppet custom resource type example
View remote-package-init.pp
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 Dec 23, 2015
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.
View apt-update-init.pp
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"
You can’t perform that action at this time.