Skip to content

Instantly share code, notes, and snippets.

@atsuya
atsuya / gist:492438d53130bd8325a3
Created August 17, 2014 07:35
rendering nsimage with CGContextDrawImage using TwUI
CGContextRef ctx = TUIGraphicsGetCurrentContext();
NSImage *image = [NSImage imageNamed:@"Logo"];
CGRect imageRect = ABIntegralRectWithSizeCenteredInRect([image size], self.bounds);
CGImageRef cgImage = [image CGImageForProposedRect:&imageRect context:nil hints:nil];
CGContextDrawImage(ctx, imageRect, cgImage);
@atsuya
atsuya / README.md
Last active December 14, 2015 12:48
moving sale

Moving Sale

ムービングセールの品の一覧です。7月17日までに私のアパートまで取りに来れる方 (Playa del Reyになります)、現金でお支払い頂ける方で宜しくお願いします。ご連絡は asoftonight [at] gmail.com までお気軽にどうぞ。

Here is a list of stuff for moving sale. You need to come pick it up at my apartment in Playa del Rey with cash before July 17th. Email me at asoftonight [at] gmail.com.

@atsuya
atsuya / gist:2626592
Created May 7, 2012 08:05
socket.io wikiの訳
> Meant to be used when running socket.io behind a proxy. Should be set to true when you want the location
> handshake to match the protocol of the origin. This fixes issues with terminating the SSL in front of Node
> and forcing location to think it's wss instead of ws.
socket.ioをproxyの後ろでは知らせる場合に使われる事を想定しています。location handshakeにおいて、originのプロトコルを一致させたい場合はtrueを設定して下さい。これは、nodeの手前でSSLが終了する事に関する問題を修正し、locationがwsではなくwssだと思うように強制します。
だと思いますが、最後の一行がはっきりしません。issuesが"with terminating the SSL in front of Node and forcing location to think it's wss instead of ws"なのか、issueは"with terminating the SSL in front of Node"でそれを"forcing location to think it's wss instead of ws"する事で直すのかが、はっきりしません。文章の内容から察するには、後者の方だと思うのですが…。
@atsuya
atsuya / Roco.coffee
Created April 9, 2012 09:04
roco example
ensure 'env', 'development'
set 'branch', 'master'
set 'nodeEntry', 'server.js'
ensure('nvmPath', '/home/deployer/nvm')
ensure('nvmNodeVersion', '0.6.7')
#
# development
@atsuya
atsuya / gist:2015329
Created March 11, 2012 06:39
socket.io-spec
> もし message id の後に + が続く場合、ACK は Socket.IO に処理されません。
> しかし、ユーザが処理する場合はその限りではありません。
もし message id の後に + が続く場合、ACK は Socket.IO に処理されず、代わりにユーザによって処理されます。
> Socket.IO は標準で multiple channels をサポートします。("multiple sockets") 各々のソケットはエンドポイントで識別されます(省略可能)
Socket.IO は標準で multiple channels をサポートします ("multiple sockets")。各々のソケットは endpoint で識別されます(省略可能)
@atsuya
atsuya / gist:1581668
Created January 9, 2012 07:30
name conflict
var url = require('url');
var test = function(url) {
console.log(url);
};
test('aaa');
@atsuya
atsuya / gist:1518844
Created December 25, 2011 07:21
assert readme

original code and test is comming from node.js, and modify them to browser compatible.

コンマ以降のところはどういう意味なのでしょう?

for example Mocha can test on bi-side, but dosen't has assertion itself.

butの後にitがあった方がいいですね。

actuary, this Assert.js can running on node.js too.

@atsuya
atsuya / browser
Created December 6, 2011 07:49
websocket binary data test - websocket-node
var socket = null;
$(function() {
socket = new WebSocket('ws://localhost:3000');
socket.binaryType = 'arraybuffer';
socket.onmessage = function(message) {
receiveBinary(message);
};
setTimeout(sendBinary, 1000);
@atsuya
atsuya / browser
Created December 6, 2011 07:42
websocket binary data test - websocket.io
var socket = null;
$(function() {
socket = new WebSocket('ws://localhost:3000');
socket.binaryType = 'arraybuffer';
socket.onmessage = function(message) {
receiveBinary(message);
};
setTimeout(sendBinary, 1000);
@atsuya
atsuya / browser
Created December 6, 2011 07:30
websocket binary data test - socket.io
io.sockets.on('connection', function (socket) {
socket.on('message', function(data) {
console.log(Buffer.isBuffer(data));
console.log(data);
var buf = new Buffer(5);
buf.writeUInt8(0x3, 0);
buf.writeUInt8(0x4, 1);
buf.writeUInt8(0x23, 2);
buf.writeUInt8(0x42, 3);