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
/** | |
* Recursively flatten an array. | |
* @example | |
* input: [[1,2,[3]],4] | |
* output: [1,2,3,4] | |
**/ | |
function flatten(current) { | |
let accumulator = [] | |
if (Array.isArray(current)) { | |
// Process the nested array. |
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/python3 | |
''' | |
[Ubuntu] Cycle the mouse between displays. | |
Suggestion: setup keyboard shortcuts such as: | |
- "super + tab" to "cycle_mouse_on_display.py" | |
- "super + shift + tab" to "cycle_mouse_on_display.py --reverse" | |
- Tested on Ubuntu 17.04. |
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
[ignore] | |
; We fork some components by platform | |
.*/*[.]android.js | |
; Ignore "BUCK" generated dirs | |
<PROJECT_ROOT>/\.buckd/ | |
; Ignore unexpected extra "@providesModule" | |
.*/node_modules/.*/node_modules/fbjs/.* |
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
// Input: | |
// [[1,2,[3]],4] | |
// Output: | |
// [1,2,3,4] | |
Array.prototype.flatten = function() { | |
return this.reduce(function(previousValue, currentValue) { | |
let value = Array.isArray(currentValue) ? currentValue.flatten() : currentValue; | |
return previousValue.concat(value); | |
}, new Array()); | |
} |