Skip to content

Instantly share code, notes, and snippets.

View indutny's full-sized avatar
🐋
Thanks for the fish!

Fedor Indutny indutny

🐋
Thanks for the fish!
View GitHub Profile

stream_base: introduce StreamBase

StreamBase is a brand new way to write C++ streams. The class itself is for separting StreamWrap (with the methods like .writeAsciiString, .writeBuffer, .writev, etc) from the HandleWrap class, making possible writing abstract C++ streams that are not bound to any uv socket.

Important part of the abstraction is following methods (which mimics libuv's stream API):

#!/usr/sbin/dtrace -C -s
#pragma D option quiet
#pragma D option strsize=4096
#define PTR__SIZE sizeof(uint64_t)
struct SSL {
uint32_t version;
uint8_t pad[0x12c];
@indutny
indutny / gist:703211
Created November 17, 2010 09:59
Node.js runInNewContext problem
var vm = require('vm');
var pseudo_array = vm.runInNewContext('[]');
console.log(pseudo_array instanceof Array); // Voila! "false"
@indutny
indutny / .gitconfig
Created November 18, 2010 18:40 — forked from asrail/.gitconfig
[user]
name = ...
email = ...
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
function lineWrap(str) {
// Split by lines
return str.split(/\r|\n|\r\n/g).reduce(function(prev, piece) {
var parts = [];
// Wrap line
while (piece.length) {
var match = piece.match(/^.{1,80}(?:\s|$)/),
matchlen;

Game Engines

Name Latest Release Size (KB) License Type Unit Tests Docs Notes
The Render Engine 1.5.3 MIT Cross-browser; extensive API; open-source. 2
gameQuery 0.5.1 CC BY-SA 2.5 Designed to be used with jQuery
gTile 0.0.1 (2008-07-21) Tile based
Akihabara 1.3 GPL2/MIT Classic Repro Intended for making classic arcade-style games in JS+HTML5 3
The Javascript 2D Game Engine GPL Emphasis on gravity/physics/collision detection; uses HTML5 Canvas and ExplorerCanvas for IE support. Focus on limiting CPU usage. 4
The GMP Javascript Game Engine
function thatYouWantToExport() {
};
if (typeof exports === 'undefined') {
window.myFn = thatYouWantToExport;
} else {
exports.myFn = thatYouWantToExport;
}
@indutny
indutny / pipeaccept.js
Created May 22, 2011 20:19 — forked from heapwolf/pipeaccept.js
accepting input from a pipe, nodejs
var data = '';
if (process.stdin.writable) {
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
data += chunk;
});
on('leave.drinker-name', function() {
// here
});
@indutny
indutny / gist:1034033
Created June 19, 2011 10:05
Install npm
curl http://npmjs.org/install.sh | sh