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
module.exports = (n) => { | |
return '1'.repeat(n) !== '1'.repeat(n).match(/1?$|(11+?)\1+$/)[0]; | |
}; |
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
'use strict'; | |
const express = require('express'); | |
const Promise = require('bluebird'); | |
const app = express(); | |
const delayAndSometimesThrowError = (second) => { | |
const deferred = Promise.pending(); | |
setTimeout(function() { |
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
'use strict'; | |
const request = require('request-promise'); | |
const express = require('express'); | |
const nock = require('nock'); | |
const app = express(); | |
app.get('/', function(req, res) { | |
request('http://requestb.in/16ge7w71').then((args) => { |
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
'use strict'; | |
const request = require('request-promise'); | |
const express = require('express'); | |
const nock = require('nock'); | |
const app = express(); | |
app.get('/', function(req, res) { | |
request('http://requestb.in/16ge7w71').then((args) => { |
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
'use strict'; | |
const kue = require('kue'); | |
kue.createQueue({ | |
prefix: 's9', | |
redis: { | |
host: 'localhost', | |
db: 1 | |
} |
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
'use strict'; | |
const Promise = require('bluebird'); | |
const _ = require('lodash'); | |
const t = Date.now(); | |
function delay(second, idx, lng) { | |
var deferred = Promise.pending(); | |
setTimeout(function() { | |
console.log('execute:', _.floor((Date.now() - t) / 1000) + 's'); | |
console.log('index is:', idx); |
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
_.mixin({ | |
'duplicate': (array) => _.filter(array, function (value, index, iteratee) { | |
return _.includes(iteratee, value, index + 1) | |
} | |
}); |
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
# Clean, simple, compatible and meaningful. | |
# Tested on Linux, Unix and Windows under ANSI colors. | |
# It is recommended to use with a dark background and the font Inconsolata. | |
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | |
# | |
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/ | |
# Mar 2013 ys | |
# this custom theme add node version | |
# Sep 2016 dontaire |
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
set "previousMatchPattern ((?!last)(prev(ious)?|newer|back|«|less|<|‹|上一页| )+)" | |
set "nextMatchPattern ((?!first)(next|older|more|>|›|»|forward|下一页| )+)" |
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
table { | |
table-layout: fixed; | |
} | |
td { | |
overflow:hidden; text-overflow: ellipsis; | |
} |