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
# | |
# なぜか、大きな data を送信しようとすると parse できなくなることがある(逆にそこそこ大きいと成功したりとか) | |
# ので、length < BUFFER_SIZE の部分はコメントアウトしてみた(hybiの仕様とか見てない) | |
# | |
--- ti-websocket-client.org.js 2012-02-08 19:47:03.000000000 +0900 | |
+++ ti-websocket-client.own.js 2012-02-08 19:50:54.000000000 +0900 | |
@@ -872,6 +872,7 @@ | |
type: Ti.Codec.TYPE_BYTE | |
}); |
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 CountdownLatch = function (limit){ | |
this.limit = limit; | |
this.count = 0; | |
this.waitBlock = function (){}; | |
}; | |
CountdownLatch.prototype.countDown = function (){ | |
this.count = this.count + 1; | |
if(this.limit <= this.count){ | |
return this.waitBlock(); | |
} |
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
// | |
// async.js <https://github.com/caolan/async> helpers(utils) | |
// only work on nodejs | |
// | |
var async = require('async'); | |
var ControlFlow = function (){}; | |
ControlFlow.prototype.initialize = function (){ | |
var tasks = {}; | |
Object.defineProperty(tasks, 'length', { |
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
const crypto = require('crypto'); | |
const connect = require('connect'); | |
exports.token = function(request, response){ | |
if(request.session){ | |
var lastAccess = request.session.lastAccess; | |
var csrf = crypto.createHash('md5').update('' + Date.now() + lastAccess).digest('hex'); | |
return request.session['csrf'] = csrf; | |
} | |
return null; |
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
const express = require('express'); | |
const auth = require('connect-auth'); | |
const app = express.createServer(); | |
// see: https://gist.github.com/1292608 | |
(function (){ | |
// yet another google oauth2 | |
Object.defineProperty(auth, 'GoogleV2', { | |
get: function() { | |
return require('./lib/connect-oauth-google-v2/google2'); |
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
const auth = require('connect-auth'); | |
(function (){ | |
// yet another google oauth2 | |
Object.defineProperty(auth, 'GoogleV2', { | |
get: function() { | |
return require('./lib/connect-oauth-google-v2/google2'); | |
}, | |
enumerable:true | |
}); | |
})(); |
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
#foo .a + .b { | |
background-color: red; | |
} | |
#foo .a .b { | |
background-color: blue; | |
} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Titanium Compiler plugin | |
# com.github.nowelium.titanium.plugin.androidmanifest | |
# | |
import os | |
import sys |
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 foo = function(a, b, c){ | |
return a + ":" + b + ":" + c | |
}; | |
var bar = function (){ | |
return foo.apply(null, arguments); | |
}; | |
bar('hello', 'js', 'world') | |
// ==> 'hello:js:world' |
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 Hoge = function (){}; | |
Hoge.prototype.foo = function (){ | |
return 'hello'; | |
}; | |
var a = new Hoge(); | |
a.foo(); | |
# ==> 'hello' | |
var bar = function (){ |