Skip to content

Instantly share code, notes, and snippets.

Avatar

Serge Shirokov kurokikaze

View GitHub Profile
@kurokikaze
kurokikaze / nodejs.ru.xsl
Created Jan 19, 2011
Система верстки на XML+XSLT
View nodejs.ru.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
xmlns:math="http://exslt.org/math"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:func="http://exslt.org/functions"
xmlns:set="http://exslt.org/sets"
xmlns:str="http://exslt.org/strings"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
View minemap.py
from struct import unpack
import Image
tag_types = { 0 : 'End',
1 : 'Byte',
2 : 'Short',
3 : 'Int',
4 : 'Long',
5 : 'Float',
6 : 'Double',
@kurokikaze
kurokikaze / read_chunk.py
Created Nov 18, 2010
Minecraft chunk file reader
View read_chunk.py
from struct import unpack
tag_types = { 0 : 'End',
1 : 'Byte',
2 : 'Short',
3 : 'Int',
4 : 'Long',
5 : 'Float',
6 : 'Double',
7 : 'Byte array',
View betainv.inc
<?php
/**
* Taken from PHPExcel
*
* Copyright (c) 2006 - 2009 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
View transactions.js
var mongo = require('../lib/mongodb'),
sys = require('sys');
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost';
var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : mongo.Connection.DEF
AULT_PORT;
sys.puts("Connecting to " + host + ":" + port);
var db = new mongo.Db('test', new mongo.Server(host, port, {}), {});
db.open(function(err, db) {
View mapreduce.js
db.open(function(err, db) {
db.collection('rounds', function(err, collection) {
var name_letter = 'v';
var map = function() {
if (this.score1 > this.score2) {
emit(this.player1, this.score1);
} else {
if (this.score2 > this.score1) emit(this.player2, this.score2)
}
};
@kurokikaze
kurokikaze / ref.js
Created May 28, 2010
Creating reference in node-mongodb-native
View ref.js
var mongo = require('../lib/mongodb'),
sys = require('sys');
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost';
var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : mongo.Connection.DEFAULT_PORT;
sys.puts("Connecting to " + host + ":" + port);
var db = new mongo.Db('test', new mongo.Server(host, port, {}), {});
db.open(function(err, db) {
db.collection('players', function(err, collection) {
@kurokikaze
kurokikaze / server.js
Created May 5, 2010
Simple work queue implementation for node.js
View server.js
var net = require('net'),
sys = require('sys');
var messages = [];
var work_in_progress = [];
var host = '192.168.175.128';
var port = 8999;
var server = net.createServer(function(client_stream) {
View crash-tyrant.js
var sys = require("sys"),
http = require("http"),
tyrant = require("./tyrant/tyrant");
http.createServer(function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"});
tyrant.connect();
tyrant.addListener('connect', function() {
var startDate = (new Date()).getTime();
tyrant.search(tyrant.is('type', 'blog'), tyrant.sort('time', 'desc')).addCallback(function(answer) {
View nerve-test.js
var nerve = require('./nerve/nerve');
var tyrant = require('./tyrant/tyrant');
var querystring = require('./querystring/querystring');
var Mu = require('./mu/mu');
var sys = require('sys');
// combo library
function Combo(callback) {
this.callback = callback;
You can’t perform that action at this time.