This file contains hidden or 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
class myComponent extends React.Component { | |
constructor() { | |
super() | |
// Replace existing method with hardbound version of it | |
this.someMethod = someMethod.bind(this) | |
} | |
someMethod() { | |
// Do something that relies on 'this' |
This file contains hidden or 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 find(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? acc || item : acc, undefined) | |
} |
This file contains hidden or 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 map(arr, fn) { | |
return arr.reduce((acc, item) => […acc, fn(item)], []) | |
} |
This file contains hidden or 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 filter(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? […acc, item] : acc, []) | |
} |
This file contains hidden or 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
#!/usr/bin/env bash | |
git branch | grep -v $(git rev-parse --abbrev-ref HEAD) | xargs git branch -D |
This file contains hidden or 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
#!/usr/bin/env bash | |
git branch | grep -v "^*" | xargs git branch -D |
OlderNewer