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
| [color] | |
| diff = auto | |
| status = auto | |
| branch = auto | |
| interactive = auto | |
| [core] | |
| pager = cat | |
| excludesfile = /Users/akatsuka/.gitignore | |
| editor = /usr/bin/vim | |
| [alias] |
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
| root = process.cwd() + '/' | |
| path = require('path') | |
| fs = require('fs') | |
| yaml = require('yaml') | |
| file = fs.readFileSync(path.join(root, 'config/config.yml'), 'utf8') | |
| config = yaml.eval(file) | |
| switch process.env.NODE_ENV | |
| when 'test' |
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 uuid = require('node-uuid'); | |
| var random = uuid.v4().split('-').join(''); | |
| console.log(random); // => 6c346171ec8a4a26969e8c66228531d3 |
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 net = require('net'); | |
| var proxy = net.createServer(function(socket) { | |
| socket.setEncoding('utf8'); | |
| var redisServer = new net.Socket() | |
| redisServer.connect(6379, 'localhost'); | |
| redisServer.on('connect', function() { | |
| redisServer.setEncoding('utf8'); | |
| }); |
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
| require "benchmark" | |
| require "redis" | |
| redis = Redis.new(host: '127.0.0.1', port: 6379) | |
| Benchmark.bm(10) do |x| | |
| x.report("text type:") { | |
| 50000.times do |i| | |
| redis.set "key#{i}", 0 | |
| redis.incr "key#{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
| var mongoose = require('mongoose'); | |
| var DatabaseCleaner = require('database-cleaner'); | |
| var databaseCleaner = new DatabaseCleaner('mongodb'); | |
| mongoose.connect("mongodb://localhost:27017/test"); | |
| databaseCleaner.clean(mongoose.connections[0].db, function() { | |
| console.log('Cleaned successfully'); | |
| }); |
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
| mongoose.connection.db.executeDbCommand( { dropDatabase: 1 } ); |
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
| mongoose.connection.db.executeDbCommand( { dropDatabase: 1 } ); |
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
| export NODE_ENV=test | |
| build: | |
| coffee -o lib src | |
| test: | |
| coffee -o lib src | |
| find ./test -name 'test-*.coffee' | xargs vows | |
| spec: |
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
| OPENSSL = openssl | |
| DAYS = -days 3652 | |
| CADAYS = -days 3652 | |
| REQ = $(OPENSSL) req | |
| CA = $(OPENSSL) ca | |
| VERIFY = $(OPENSSL) verify | |
| X509 = $(OPENSSL) x509 | |
| # must be absolute path | |
| CATOP = $(PWD)/ca |