This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This will intro clustertech flavour of require -- ctRequire. | |
Originally, require works as | |
require([ | |
'm1.js', | |
'm2.js', | |
'm3.js' | |
], | |
function(m1, m2, m3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Simple regex implementation use DFA (http://swtch.com/~rsc/regexp/regexp1.html). | |
It support following simple rules | |
1. '.' match all characters | |
2. '*' match 0+ occurrences, e.g., a* | |
3. '?' match 0 or 1 occurrences, e.g., a? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <string> | |
#include <vector> | |
#include <sstream> | |
#include <iostream> | |
using namespace std; | |
void moveout(struct peg* p, int no1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct node | |
{ | |
int data; | |
struct node *next; | |
} node; | |
node * label(node *list); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'), | |
my_http = require('http'), | |
path = require('path'), | |
url = require('url'), | |
filesys = require('fs'); | |
my_http.createServer( | |
function(request,response){ | |
var my_path = url.parse(request.url).pathname; | |
var full_path = path.join(process.cwd(),my_path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var querystring = require('querystring'); | |
function processPost(request, response, callback) { | |
var queryData = ""; | |
if(typeof callback !== 'function') return null; | |
if(request.method == 'POST') { | |
request.on('data', function(data) { | |
queryData += data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
/** | |
* Calculates the hash/checksum of a string. Default algorithm is MD5. | |
* | |
* @param {String} str | |
* @param {String} algorithm | |
* @return {String} checksum | |
* @api public | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ActionQueue() { | |
this.q = []; | |
this.actionIndex = 0; | |
} | |
ActionQueue.prototype.push = function(func) { | |
this.q.push(func); | |
}; | |
ActionQueue.prototype.run = function(callbacks) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2012 Mark Cavage, Inc. All rights reserved. | |
// Adapted from Mark Cavage's json_client.js of restify | |
// by Li Yu (liyu@clustertech.com) 2013 | |
var crypto = require('crypto'); | |
var util = require('util'); | |
var querystring = require('querystring'); | |
var restify_path = '../node_modules/restify'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var EventEmitter = require('events').EventEmitter; | |
var inspect = require('util').inspect; | |
var emit_ = EventEmitter.prototype.emit; | |
EventEmitter.prototype.emit = function(name) { | |
var args = Array.prototype.slice.call(arguments); | |
if (!(this === process.stderr && name === 'drain')) { | |
console.error("Event '%s', arguments: %s", | |
name, inspect(args.slice(1), false, 1)); | |
} |
OlderNewer