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 pick(collection, properties){ | |
| [].map.call(collection, function(val, key){ | |
| var result = {}; | |
| properties.forEach(copyProperty); | |
| return result; | |
| function copyProperty(propName){ result[propName] = val[propName]; } | |
| }) | |
| } |
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 gup(name, url, defaultValue) { | |
| if (!url) url = location.href; | |
| name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
| var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
| var regex = new RegExp(regexS); | |
| var results = regex.exec(url); | |
| return (results == null ? null : results[1]) || defaultValue; | |
| } | |
| var id = gup('id', document.location.toString(), '50'); |
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
| var winningBoards = [ | |
| genWinningColBoard(0), | |
| genWinningColBoard(1), | |
| genWinningColBoard(2), | |
| genWinningRowBoard(0), | |
| genWinningRowBoard(1), | |
| genWinningRowBoard(2), | |
| getDiagonalBoard(3), | |
| getDiagonalBoard(3, true) | |
| ]; |
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
| Set-Alias subl 'C:\Program Files\Sublime Text 3\sublime_text.exe' | |
| Set-Location E:\Projects | |
| $Shell = $Host.UI.RawUI | |
| $size = $Shell.WindowSize | |
| $size.width=85 | |
| $size.height=150 | |
| $Shell.WindowSize = $size | |
| $size = $Shell.BufferSize | |
| $size.width=70 |
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
| // Clock Component | |
| var timer; | |
| var Clock = React.createClass({ | |
| componentDidMount: function() { | |
| var self = this; | |
| timer = new Tock({ | |
| countdown: false, | |
| interval: 10, | |
| callback: function() { | |
| self.setState({ |
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
| { | |
| "parser": "babel-eslint", | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "jasmine": true, | |
| "phantomjs": true | |
| }, | |
| "settings": { | |
| "ecmascript": 6, |
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
| { | |
| "growl": true, | |
| "launch_in_dev": ["PhantomJS"], | |
| "launch_in_ci": ["PhantomJS"], | |
| "src_files": [ | |
| "**/*.js" | |
| ] | |
| } |
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
| sloc --format cli-table --keys "total,source,comment" --exclude .html .\js\app |
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 stringStartsWith(search, coll, prop, transform){ | |
| return coll.filter(function(item){ | |
| var key = transform ? transform(item[prop]) : item[prop]; | |
| return key.indexOf(search) === 0 | |
| }); | |
| } | |
| function reverse(str){ | |
| return str.split('').reverse().join('') | |
| } |
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
| const compose = (...fns) => (x) => fns.reduce( (v, f) => v.then ? v.then(f) : f(v), x) |