React.createClass({
mixins: [Symbiosis(Store)],
render() {
...
}
});
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
var path = require('path'), | |
w = require('webpack'); | |
module.exports = { | |
entry: { | |
app: path.resolve(__dirname, 'client/js/index.js'), | |
vendors: ['react', 'socket.io', 'react-router', 'alt'] | |
}, | |
output: { | |
path: path.resolve(__dirname, 'public/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
svdata = { | |
"api_result": 1, | |
"api_result_msg": "\u6210\u529f", | |
"api_data": { | |
"api_material": [{ | |
"api_member_id": 15139027, | |
"api_id": 1, | |
"api_value": 1000 | |
}, { | |
"api_member_id": 15139027, |
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
let a = new Prom((reject, resolve) => { | |
setTimeout(() => resolve('Promise A'), 1000); | |
}).then(result => { | |
console.log(result); | |
}); | |
let b = new Prom((reject, resolve) => { | |
resolve('Promise B'); | |
}).then(result => { | |
console.log(result); |
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
let sizemap = { | |
'': 0, | |
K: 1, | |
M: 2, | |
G: 3 | |
}; | |
let data = '`du -h --maxdepth 1` output'; | |
let files = data |
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 React from 'react'; | |
import Store from './store'; | |
import { deriveState, normalizeArray, callAll, callAllObj, listenerKey } from './util'; | |
export { Store }; | |
export default class { | |
constructor(stores = {}) { | |
// Top-level Stores | |
this.stores = stores; | |
// Dispatcher |
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
let curry = fn => { | |
let total = fn.length; | |
let len = 0; | |
let argarr = []; | |
let recur = (...args) => { | |
len += args.length; | |
argarr = argarr.concat(args); | |
return len >= total ? fn(...argarr) : recur; | |
} | |
return recur; |
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
let writeMethods = (o, arr) => { | |
// skip constructor | |
for (let i = 1; i < arr.length; i++) { | |
o[arr[i]] = 0; | |
} | |
}; | |
// Get object mirroring all instance methods of Class | |
export let methods = Class => { |
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
let fork = function(sideEffect) { | |
this.then(sideEffect); | |
return this; | |
} | |
let mangaIndexUrl = 'https://www.mangaeden.com/api/list/0'; | |
let findManga = (index, id) => | |
index.find(manga => manga.id === id); |
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
let summation = (start, end, a) => { | |
let sum = 0; | |
for (let n = start; n <= end; n++) sum += a(n); | |
return sum; | |
} | |
console.log(4 * summation(0, 100000000, n => (n & 1 === 1 ? -1 : 1) / (2 * n + 1))); // 3.141592663589326 |
OlderNewer