Skip to content

Instantly share code, notes, and snippets.

1yx

Block or report user

Report or block 1yx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@1yx
1yx / .spacemacs
Last active Aug 23, 2018
my dot spacemacs
View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@1yx
1yx / unix.ahk
Created Aug 8, 2018
An AutoHotKey script that provides UNIX & Linux keyboard shortcuts on Windows
View unix.ahk
;;
;; 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
@1yx
1yx / ecosystem.config.js
Created Feb 21, 2017
pm2 cron restart demo
View ecosystem.config.js
module.exports = {
apps : [
{
name: 'pm2cron',
script: 'index.js',
exec_mode: 'fork',
instance: 1,
cron_restart: '* * * * *'
}]
}
@1yx
1yx / test-redis.js
Last active Jan 12, 2017
检查几种zset的插入方式 所需要的耗时
View test-redis.js
/**
* @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');
@1yx
1yx / isPrime.js
Created Jan 4, 2017
check prime number use regex back reference in Javascript.
View isPrime.js
module.exports = (n) => {
return '1'.repeat(n) !== '1'.repeat(n).match(/1?$|(11+?)\1+$/)[0];
};
@1yx
1yx / index.js
Created Jan 2, 2017
test async function after response
View index.js
'use strict';
const express = require('express');
const Promise = require('bluebird');
const app = express();
const delayAndSometimesThrowError = (second) => {
const deferred = Promise.pending();
setTimeout(function() {
@1yx
1yx / app.js
Created Nov 7, 2016
mocha a mock serve for some times express request a http service
View app.js
'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) => {
View app.js
'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) => {
@1yx
1yx / app.js
Last active Oct 24, 2016
kue demo
View app.js
'use strict';
const kue = require('kue');
kue.createQueue({
prefix: 's9',
redis: {
host: 'localhost',
db: 1
}
You can’t perform that action at this time.