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 fooA(){ | |
| console.log('exec fooA'); | |
| var dfd = new $.Deferred(); | |
| dfd.done(function() { | |
| console.log('fooA Success'); | |
| }) | |
| .fail(function() { | |
| console.log('fooA fail'); | |
| }); | |
| setTimeout(dfd.reject, 0); |
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 formidable = require('formidable'), | |
| http = require('http'), | |
| util = require('util'), | |
| fs = require('fs-extra'); | |
| http.createServer(function(req, res) { | |
| /* Process the form uploads */ | |
| if (req.url == '/upload' && req.method.toLowerCase() == 'post') { | |
| var form = new formidable.IncomingForm(); | |
| form.parse(req, function(err, fields, files) { |
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 remainFreqenceEqual(data, frequence){ | |
| console.log('remainFreqenceEqual'); | |
| frequence = frequence || 1; | |
| return _.chain(data) | |
| .reduce(function (acc, freq) { | |
| console.log('acc'); | |
| console.log(acc); | |
| acc[freq] = typeof acc[freq] == 'undefined' ? 1 : acc[freq]+1; | |
| return acc; |
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 promiseWhile(condition, body) { | |
| var dfd = $.Deferred(); | |
| function loop() { | |
| if (!condition()) return dfd.resolve(); | |
| body.apply(this, arguments) | |
| .done(loop) | |
| .fail(dfd.reject); | |
| } | |
| //call loop async |
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
Show hidden characters
| { | |
| "in_process_packages": | |
| [ | |
| ], | |
| "installed_packages": | |
| [ | |
| "All Autocomplete", | |
| "AutoFileName", | |
| "Autoprefixer", | |
| "Babel", |
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
| let tree = { | |
| name: 'root', | |
| children: [ | |
| { | |
| name: 'a', | |
| children: [ | |
| { name: 'd' }, | |
| { name: 'e' } | |
| ] |
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
| // getComponent is a function that returns a promise for a component | |
| // It will not be called until the first mount | |
| function asyncComponent(getComponent) { | |
| return class AsyncComponent extends React.Component { | |
| static Component = null; | |
| state = { Component: AsyncComponent.Component }; | |
| componentWillMount() { | |
| if (!this.state.Component) { | |
| getComponent().then(Component => { |
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
| 0x277E034c59dDD2c56539459B0C566075685a681f |
OlderNewer