This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Revert to a previous commit | |
git reset --hard commit_sha | |
# Create a local branch which tracks from an already created remote branch | |
git co --track -b branch_name origin/branch_name | |
# Push local branch to a remote branch with a different name | |
git push origin local-name:remote-name | |
# If you want to rename a branch while pointed to any branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# Show verbose output about tags, branches or remotes | |
tags = tag -l | |
brs = branch -a | |
br = branch | |
remotes = remote -v | |
# Pretty log output | |
hist = log --graph --pretty=format:'%Cred%h%Creset %s%C(yellow)%d%Creset %Cgreen(%cr)%Creset [%an]' --abbrev-commit --date=relative | |
st = status | |
ci = commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeStart to '+toState.to+'- fired when the transition begins. toState,toParams : \n',toState, toParams); | |
}); | |
$rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeError - fired when an error occurs during transition.'); | |
console.log(arguments); | |
}); | |
$rootScope.$on('$stateChangeSuccess',function(event, toState, toParams, fromState, fromParams){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doWhenDataReceived(value) { | |
returnNextElement.next(value) | |
} | |
function* createFlow() { | |
const data = yield fetch('http://twitter.com/...') | |
console.log(data) | |
} | |
const returnNextElement = createFlow() // Does not start executing function yet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# regular expressions | |
# system tools with regex: grep, sed, perl, vim, less | |
``` js | |
'1 two three \n'.replace(/1/, 'one') | |
``` | |
similar to: | |
``` sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Convert a string to formatted currency. | |
Example: "abc12000.33.33" => "12,000.33" | |
*/ | |
export function currencyFormatter(value) { | |
value = value.toString(); | |
// Clear left side zeros | |
while (value.charAt(0) === "0") { | |
value = value.substr(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findNodes(options = {}) { | |
let node | |
const arr = [] | |
const el = options.el || document.body | |
const filter = options.filter ? { acceptNode: options.filter } : null | |
const walk = document.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, filter, false) | |
while(node = walk.nextNode()) { | |
arr.push(node) |