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
// Подключение модуля fs
var fs = require('fs');
try {
// Вызов синхронного метода writeFile
fs.writeFileSync('/tmp/1.txt', 'A poem');
// Все готово, можно сделать что-нибудь с файлом
// Например, удалить его
fs.unlinkSync('/tmp/1.txt');
// Подключение модуля fs
var fs = require('fs');
// Вызов асинхронного метода writeFile
fs.writeFile('/tmp/1.txt', 'A poem', function(err) {
// Все готово, можно сделать что-нибудь с файлом
// Например, удалить его
fs.unlink('/tmp/1.txt', function(err) {
// Ну вот, теперь как-будто ничего и не делали
});
name('hook');
hook('beer', function(from, amount) {
// do something with that beer
});
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
@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;
});
function thatYouWantToExport() {
};
if (typeof exports === 'undefined') {
window.myFn = thatYouWantToExport;
} else {
exports.myFn = thatYouWantToExport;
}

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 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;
@indutny
indutny / ExeLDR.asm
Created December 31, 2010 22:31
Loader for MSDOS EXE files, without MSDOS
;Made by FeDOS (FeDOS SubSystems)
;All Rights Reserved
;FeDOS (ICQ 313-997-813)
[BITS 16]
[ORG 0x0000]
__start:
; mov cx, 0xB800
; mov es, cx
; mov bx, 0h
; mov cx, cs