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 / yc-startups-review.md
Last active August 29, 2015 14:07
yc startups review

It has a new home!

レビューはレポジトリに足していくことにしました。他のレビューは、そちらを参照ください。

yc startups review

このリストを上から見ていって、興味深いものに対するメモを残す。

アイコンの意味

@atsuya
atsuya / gist:1111126
Created July 28, 2011 07:00
fs stat thing on node 0.4.10
> require('fs').statSync('/usr')
{ dev: 234881026,
ino: 19201463,
mode: 16877,
nlink: 14,
uid: 0,
gid: 0,
rdev: 0,
size: 476,
blksize: 4096,
@atsuya
atsuya / gist:1111128
Created July 28, 2011 07:00
fs stat thing on node 0.5.2
> require('fs').statSync('/usr')
{ dev: 234881026,
ino: 19201463,
mode: 16877,
nlink: 14,
uid: 0,
gid: 0,
rdev: 0,
size: 476,
blksize: 4096,
@atsuya
atsuya / vote_nko_css.css
Created August 28, 2011 15:08
vote nko css
body { color: white; }
@atsuya
atsuya / gist:1408334
Created November 30, 2011 07:26
server: parsing multipart/form-data using connect 1.8
req.body.images.forEach(function(image){
var kb = image.size / 1024 | 0;
res.write('<li>uploaded ' + image.name + ' ' + kb + 'kb</li>');
});
@atsuya
atsuya / gist:1408333
Created November 30, 2011 07:25
client: parsing multipart/form-data using connect 1.8
<form action="/" method="post" enctype="multipart/form-data">
<input type="text" name="name" placeholder="Name:" />
<input type="file" name="images" multiple="multiple" />
<input type="submit" value="Upload" />
</form>
app.use(express.bodyParser({
uploadDir: '/tmp/uploads'
}));
@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);
@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);