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
'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 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 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
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
/** | |
* @link https://github.com/NodeRedis/node_redis/issues/659#issuecomment-56067673 | |
* @link https://github.com/NodeRedis/node_redis/issues/539#issuecomment-32203325 | |
*/ | |
'use strict'; | |
const crypto = require('crypto'); | |
const _ = require('lodash'); | |
const Promise = require('bluebird'); | |
const redis = require('redis'); |
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
(setq debug-on-error t) |
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 = { | |
apps : [ | |
{ | |
name: 'pm2cron', | |
script: 'index.js', | |
exec_mode: 'fork', | |
instance: 1, | |
cron_restart: '* * * * *' | |
}] | |
} |
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
;; | |
;; fork from https://github.com/usi3/emacs.ahk/blob/master/emacs.ahk | |
;; | |
;; An autohotkey script that provides emacs-like keybinding on Windows | |
;; | |
#InstallKeybdHook | |
#UseHook | |
; The following line is a contribution of NTEmacs wiki http://www49.atwiki.jp/ntemacs/pages/20.html | |
SetKeyDelay 0 |