Skip to content

Instantly share code, notes, and snippets.

#import "NSString+DictionaryFromQueryString.h"
@implementation NSString (DictionaryFromQueryString)
/**
* リクエストパラメータをNSDictionaryにする
* http://qiita.com/hal_sk/items/413ec7902f48ec39821f
*/
-(NSDictionary *) dictionaryFromQueryString{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:0];
@oymgc
oymgc / latency.markdown
Created June 1, 2012 13:29 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs

Round trip within same datacenter ...... 500,000 ns = 0.5 ms

@oymgc
oymgc / gist:1518751
Created December 25, 2011 05:08
node+postgres sample
var pg = require('pg');
var dbuser ="userid:password";
var dbsrv = "localhost:5432";
var db = "postgres";
var conString = "pg://" + dbuser + "@" + dbsrv + "/" + db ;
pg.connect(conString, function(err, client) {
client.query("SELECT NOW() as when" ,function(err,result) {
console.log("Row count: %d", result.rows.length);
@oymgc
oymgc / gist:1175262
Created August 27, 2011 11:13
sample gist for my express
/**
* Module dependencies.
*/
var express = require('express');
var app = module.exports = express.createServer();
// Configuration