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
{ | |
"git.autofetch": true, | |
"window.zoomLevel": 1, | |
"explorer.confirmDragAndDrop": false, | |
"editor.codeLens": false, | |
"editor.find.seedSearchStringFromSelection": false, | |
"editor.lightbulb.enabled": false, | |
"editor.suggestOnTriggerCharacters": false, | |
"editor.wordBasedSuggestions": false, | |
"sublimeTextKeymap.promptV3Features": true, |
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
const Nightmare = require('nightmare'); | |
const path = require('path'); | |
const USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'; | |
const VIEWPORT_WIDTH = 375; | |
const VIEWPORT_HEIGHT = 3000; | |
function run() { | |
let nightmare = Nightmare({ | |
show: true, |
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
npm run test | |
> string2object@0.0.1 test /Users/username/Develop/string2object.js | |
> npm run build && npm run test-build && node test/build/index.js | |
> string2object@0.0.1 build /Users/username/Develop/string2object.js | |
> babel src --out-dir lib | |
src/string2object.js -> lib/string2object.js |
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 s2o from '../../lib/string2object'; | |
function test(name, truth) { | |
try { | |
if (truth) { | |
console.info(`Success test: ${name}`); | |
} else { | |
throw new Error(`Failed test: ${name}`); | |
} | |
} catch(err) { |
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
const stringsRegExp = /("[^"]*?"|'[^']*?')/gm; | |
const numbersRegExp = /\d/gm; | |
const keysRegExp = /([{,])[\w\d]*?(\:)/gm; | |
const validTestRegExp = /^[\{\}\[\]\,]*$/; | |
const removeWhiteSpaces = function(str) { | |
return (str + '').replace(/\s*/gm, ''); | |
}; | |
const trim = function(str) { |
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 $ from 'jquery'; | |
class HogeWidget { | |
constructor(el) { | |
this.$el = $(el); | |
} | |
bind() { | |
this.$el.on('click', () => { ... }); | |
} | |
init() { |
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 class HogeWidget { | |
constructor(el, resolver) { | |
this.el = el; | |
this.resolver = resolver; | |
} | |
bind() { | |
this.el.addEventListener('click', () => { ... }); | |
} | |
init() { | |
this.bind(); |
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 _ from 'underscore'; | |
import { Promise } from 'es6-promise'; | |
import HogeWidget from 'widgets/hogeWidget'; | |
const widgets = { | |
hoge: HogeWidget | |
}; | |
const widgetsInstances = []; |
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 class HogeWidget { | |
constructor(el) { | |
this.el = el; | |
} | |
bind() { | |
this.el.addEventListener('click', () => { ... }); | |
} | |
init() { | |
this.bind(); | |
} |
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 class PooledClass { | |
constructor(clazz) { | |
this.clazz = clazz; | |
this.pool = []; | |
} | |
alloc(...args) { | |
let instance = this.pool.pop(); | |
if (!instance) { | |
instance = new this.clazz(); | |
} |
NewerOlder