Skip to content

Instantly share code, notes, and snippets.

Avatar

金鹿 nomospace

View GitHub Profile
@nomospace
nomospace / pass_proxy
Created Nov 19, 2018
Nginx使用url参数做反射代理
View pass_proxy
---
title: Nginx使用url参数做反射代理
---
```
server {
server_name www.demo.com;
listen 80;
location / {
View gist:acd42d03fbd46f5577e2
(function() {
function timer(delay) {
var self = this;
this._queue = [];
setInterval(function() {
for (var i = 0; i < self._queue.length; i++) {
self._queue[i]();
}
},
@nomospace
nomospace / gist:b4f9e60875d2a5a63dac
Created Dec 16, 2014
javascript test for existence of nested object key
View gist:b4f9e60875d2a5a63dac
function checkNested(obj /*, level1, level2, ... levelN*/) {
var args = Array.prototype.slice.call(arguments),
obj = args.shift();
for (var i = 0; i < args.length; i++) {
if (!obj || !obj.hasOwnProperty(args[i])) {
return false;
}
obj = obj[args[i]];
}
View gist:d883fc970940947a7a7b
<!DOCTYPE HTML>
<html>
<head>
<title>桌面创建快捷方式</title>
</head>
<body>
<script>
function createDesktop(sUrl, sName) {
try {
View gist:3696859
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
function parseUri(str) {
var o = parseUri.options;
var m = o.parser[o.strictMode ? "strict" : "loose"].exec(str);
var uri = {};
var i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
@nomospace
nomospace / gist:3652199
Created Sep 6, 2012
匹配形如 /* ... */ 的简单注释
@nomospace
nomospace / gist:3357290
Created Aug 15, 2012
node-imap 依次执行函数队列
View gist:3357290
var box, cmds, next = 0,
cb = function(err) {
if (err) die(err);
else if (next < cmds.length) cmds[next++].apply(this, Array.prototype.slice.call(arguments).slice(1));
};
cmds = [
function() {
imap.connect(cb);
}, function() {
@nomospace
nomospace / gist:3348672
Created Aug 14, 2012
node 下的 http status code
View gist:3348672
var CRLF = '\r\n';
var STATUS_CODES = exports.STATUS_CODES = {
100 : 'Continue',
101 : 'Switching Protocols',
102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
200 : 'OK',
201 : 'Created',
202 : 'Accepted',
203 : 'Non-Authoritative Information',
204 : 'No Content',