Skip to content

Instantly share code, notes, and snippets.

// This pattern gives you full control of how JavaScript steps through an array loop, and is an alternative of using array.forEach or a "for" loop.
// The best use case for this is if you need to wait for operations like ajax requests to complete before continuing the loop.
var array = [1,2,3,4,5,6,7];
var looper = function(item){
if(item){
// do an ajax request, or some operation that takes time
fireAjaxRequest(item, function(results){
// do something with the results, then continue the loop
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@nuxlli
nuxlli / sublime_text_2_useful_shortcuts.md
Created September 9, 2011 18:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods