Skip to content

Instantly share code, notes, and snippets.

raisch raisch

Block or report user

Report or block raisch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View grammar.pegjs
{
/*
Filename: grammar.pegjs
Author: raisch@gmail.com
*/
const util = require('util')
const _ = require('lodash')
@raisch
raisch / README.md
Last active Jan 26, 2017
Example Of Using Interned Variables In Pegjs
View README.md
View Sequential Processing of an Array Using Events
/* Created by raisch on 3/21/16. */
/*jshint node:true, bitwise:true, camelcase:false, curly:true, undef:false, unused:false, eqeqeq:true, shadow:true */
'use strict';
var assert = require('assert'),
event = require('events');
/**
@raisch
raisch / gist:99ef9ed0e72f56193564
Created Jul 12, 2015
Ipaddr Range Membership
View gist:99ef9ed0e72f56193564
var atoi = function atoi(addr) {
var parts = addr.split('.').map(function(str) {
return parseInt(str);
});
return (parts[0] ? parts[0] << 24 : 0) +
(parts[1] ? parts[1] << 16 : 0) +
(parts[2] ? parts[2] << 8 : 0) +
parts[3];
};
View example_of_fs.watch_with_events
'use strict';
const
fs = require('fs'),
filename = process.argv[2];
console.log('--watching %s',filename);
var watcher=fs.watch(filename);
watcher.on('change',function(){
@raisch
raisch / Config.js
Created Oct 1, 2013
Node require.cache tomfoolery
View Config.js
module.exports={
foo:true,
bar:false
};
@raisch
raisch / taskrunner.js
Created Jul 14, 2011
TaskRunner - runs any number of functions asynchronously and in order
View taskrunner.js
var util=require('util'),
events=require('events'),
EventEmitter=events.EventEmitter;
/*
* TaskRunner - runs any number of functions asynchronously and in order
*
* var runner = new TaskRunner( func(s) || { options } );
*
* runner.init({
@raisch
raisch / regex_tokenizer.js
Created Jun 10, 2011
Regular Expression Sentence Tokenizer (English)
View regex_tokenizer.js
// tokenize(str)
// extracts semantically useful tokens from a string containing English-language sentences
// @param {String} the string to tokenize
// @returns {Array} contains extracted tokens
function tokenize(str) {
var punct='\\['+ '\\!'+ '\\"'+ '\\#'+ '\\$'+ // since javascript does not
'\\%'+ '\\&'+ '\\\''+ '\\('+ '\\)'+ // support POSIX character
'\\*'+ '\\+'+ '\\,'+ '\\\\'+ '\\-'+ // classes, we'll need our
You can’t perform that action at this time.