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
/** | |
* Creates a new Uint8Array based on two different ArrayBuffers | |
* | |
* @private | |
* @param {ArrayBuffers} buffer1 The first buffer. | |
* @param {ArrayBuffers} buffer2 The second buffer. | |
* @return {ArrayBuffers} The new ArrayBuffer created out of the two. | |
*/ | |
var _appendBuffer = function(buffer1, buffer2) { | |
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); |
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
import Promise from 'bluebird'; | |
import EventEmitter from 'eventemitter3'; | |
class InlineWorker { | |
constructor(source) { | |
if (typeof source != 'function') { | |
throw new TypeError('source must be a function'); | |
} | |
if (this._worker) { |
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
// ES2015 | |
for (const key of Object.keys(obj)) { | |
console.log(key); // key | |
console.log(obj[key]); // value | |
} | |
// ES2016 | |
for (const value of Object.vaules(obj)) { | |
console.log(value); // value | |
} |
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
import getTimeMethod from './getTimeMethod'; | |
class FPSCounter { | |
constructor() { | |
this._getTime = getTimeMethod(); | |
this._fps = 0; | |
this._prevTime = 0; | |
this._frames = 0; | |
this.startTick(); |
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
.DS_Store | |
node_modules | |
npm-debug.log | |
/bin |
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
// encode | |
'foo © bar ≠ baz 𝌆 qux'.replace(/[\u{00A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`); |
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
import {Suite} from 'benchmark'; | |
const suite = new Suite(); | |
suite | |
.add('Array Spread Operator', () => { | |
const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; | |
const b = [...a]; | |
}) | |
.add('Array.from()', () => { |
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 getYearDays(year) { | |
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | |
return isLeapYear ? 366 : 365; | |
} | |
export { | |
getYearDays as default, | |
}; |
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
export default function calcMargin(obj = {}) { | |
if (Number.isInteger(obj)) { | |
return { | |
top: obj, | |
right: obj, | |
bottom: obj, | |
left: obj, | |
}; | |
} |
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
{ | |
"alfredtheme" : { | |
"result" : { | |
"textSpacing" : 5, | |
"subtext" : { | |
"size" : 12, | |
"colorSelected" : "#F5F5F5CC", | |
"font" : "System", | |
"color" : "#F5F5F566" | |
}, |
OlderNewer