Skip to content

Instantly share code, notes, and snippets.

@joannaong
joannaong / git-fetch
Last active August 29, 2015 14:22
git - fetch from upstream (forked repo)
$ git remote add upstream git://github.com/pjhyett/github-services.git
$ git fetch upstream
# then: (like "git pull" which is fetch + merge)
$ git merge upstream/master master
@joannaong
joannaong / git-revert
Last active August 29, 2015 14:16
revert to commit
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Updates working copy to reflect the new commit
git reset --hard
@joannaong
joannaong / ajax with closure
Created November 26, 2014 19:55
ajax with closure
// closure
for(var i = 0; i < 5; i++){
(function(x){
setTimeout(function(){
alert('closure: '+x); // correct value
},10);
})(i);
}
@joannaong
joannaong / mac_showhidden_files
Created October 12, 2014 01:51
MAC - show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
@joannaong
joannaong / resize_aspectratio
Last active August 29, 2015 14:06
resize by aspect ratio
// resize renderer
var winWidth = $(window).width();
var winHeight = $(window).height();
window.renderer.resize(winWidth, winHeight);
// rescale container
var ratio = stageWidth/stageHeight;
var currRatio = winWidth/winHeight;
if (currRatio > ratio) {
@joannaong
joannaong / .gitignore
Last active August 29, 2015 14:03
.gitignore
.sass-cache/
.sass-cache-imports/
/bower_components
/dist
/deploy
/node_modules
/log/*
# CMS
/vendor
@joannaong
joannaong / meta
Last active August 29, 2015 14:03
meta
//- title
title Title
//- favicon
link(rel="icon" type="image/x-icon" href="")
//- SEO
meta(charset="utf-8")
meta(name='description', content='')
@joannaong
joannaong / center-sass
Created June 14, 2014 16:32
sass center mixin
@mixin centerer {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@joannaong
joannaong / ulimit
Last active September 16, 2016 01:06
ulimit
ulimit -n 2560
@joannaong
joannaong / subl
Last active August 29, 2015 14:01
subl command line
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
## call it this way
sublime .