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 cluster = require('cluster') | |
var async = require('async') | |
var donde = require('dnode') | |
var hashring = require('hashring') | |
var ring = new hashring() | |
var jobs = require('os').cpus().length | |
var masterPort = 7000 | |
var workers = {} | |
var queue = async.queue(function(o, next) { |
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
db.collection.remove({"key": {$exists: false}}) |
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
defaults write com.google.Chrome ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*" "http://*.crossrider.com/*" |
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 product() { | |
return Array.prototype.reduce.call(arguments, function(as, bs) { | |
var o = [] | |
as.forEach(function(a) { | |
bs.forEach(function(b) { | |
if (Array.isArray(b)) { | |
b = [b] | |
} | |
o.push(a.concat(b)) | |
}) |
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 assert = require('assert') | |
module.exports = function(hash, indexes) { | |
if (typeof hash === 'object') { | |
indexes = hash | |
hash = '_hash' | |
} | |
return function(schema, options) { |
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
// add a extra key to package.json | |
// { env: {'k1', 'v1'} } | |
var exec = require('child_process').exec | |
var env = require(process.cwd() + '/package.json').env | |
var async = require('async') | |
var tasks = [] | |
for (var j in env) { | |
tasks.push((function(i) { |
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
# `tobi` did a great job by simulating a browser in command line, but still have some bugs.. | |
# So, these code need a fixed version of `tobi` git://github.com/yyfrankyy/tobi | |
# Btw, I put all the login code at `before` block, so that you can do anything with `browser` instance | |
# which will keep the sessions in memory for further request. | |
assert = require 'assert' | |
tobi = require 'tobi' | |
browser = tobi.createBrowser 5000, 'localhost' | |
describe 'User', -> |
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
base62 = require 'base62' | |
crc32 = require 'crc32' | |
uuid = require 'node-uuid' | |
exports.unique = -> | |
base62.encode parseInt("0x#{crc32 uuid.v4()}", 16) |
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
Document Path: /favicon.ico | |
Document Length: 1406 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 1.468 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 10000 | |
Total transferred: 16390000 bytes |
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
#!/bin/sh | |
# copy from http://pastebin.com/meF2mB67 | |
PRIVATE_TOKEN="MySecretToken" | |
GITLAB_URL="https://gitlab.domain.tld/" | |
URL=`git config --get remote.origin.url` | |
PROJECT=`basename ${URL} .git | cut -d':' -f2` | |
for issue_id in `grep -o -e "\(closes\|fixes\) #[0-9]\+" $1 | cut -d'#' -f2`; do |