Skip to content

Instantly share code, notes, and snippets.

@lancebecker
lancebecker / gist:5034055
Created February 25, 2013 22:49
ZSH: Custom chpwd()
function chpwd() {
emulate -L zsh
clear
echo $PWD
ls -H
}
@lancebecker
lancebecker / gist:5034071
Created February 25, 2013 22:51
make RBENV and zsh place nice
# RBENV {{{
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
# }}}

Using Yeoman default yo webapp

Running "mocha:all" (mocha) task
Testing index.html
Running PhantomJS...ERROR
Warning: PhantomJS not found. Use --force to continue.

$ npm cache clean

@lancebecker
lancebecker / gist:6295014
Created August 21, 2013 14:16
GAQ in one data prop
<a href="#" data-track='{"category":"categoryName", "action":"click", "label":"labelName"}'>
TrackingManager.prototype._standardGaq = function(o) {
return _gaq.push(['_trackEvent', o.category, o.action, o.label]);
};
@lancebecker
lancebecker / gist:7238915
Created October 30, 2013 19:41
delete remote branch
git push origin :remotebranchtodelete
@lancebecker
lancebecker / gist:7240579
Created October 30, 2013 21:26
Colored output for console.log
console.log("%c %s", "color:white;background:gray;font-size:12px",a);
{
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : false, // Require triple equals i.e. `===`.
"forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohibit variable use before definition.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
@lancebecker
lancebecker / gist:347d5e90d0db3a86d083
Last active August 29, 2015 14:08
Creating gifs from quicktime screencasts for use in github comments / pull requests.

Grab the dependencies first.

brew install ffmpeg

Record your screencast video with Quicktime

Example

Put this function in your .bashrc/zshrc

git_types () {
echo $(tput setaf 0)$(tput setab 6)
echo '<type>(<scope>): <subject>'
echo "$(tput sgr 0)"
echo "$(tput sgr 3)feat$(tput sgr 0) (feature)"
echo "$(tput sgr 3)fix$(tput sgr 0) (bug fix)"
echo "$(tput sgr 3)docs$(tput sgr 0) (documentation)"
echo "$(tput sgr 3)style$(tput sgr 0) (formatting, missing semi colons, ...)"
echo "$(tput sgr 3)refactor"
link rel="apple-touch-icon" href="/touch-icon-iphone.png"
link rel="apple-touch-icon" sizes="76x76" href="/touch-icon-ipad.png"
link rel="apple-touch-icon" sizes="120x120" href="/touch-icon-iphone-retina.png"
link rel="apple-touch-icon" sizes="152x152" href="/touch-icon-ipad-retina.png"
link rel="apple-touch-startup-image" href="/startup-640x1096.png" media="(max-device-width : 548px) and (-webkit-min-device-pixel-ratio : 2)"
link rel="apple-touch-startup-image" sizes="768x1004" href="/startup-768x1004.png" media="screen and (min-device-width : 481px) and (max-device-width : 1024px) and (orientation : portrait)"