Skip to content

Instantly share code, notes, and snippets.

View lukegalea's full-sized avatar

Luke Galea lukegalea

View GitHub Profile
%% Copyright (c) 2008 Luke Galea www.ideaforge.org
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% The above copyright notice and this permission notice shall be included in
@lukegalea
lukegalea / progress_bar.erl
Created July 21, 2008 16:29
A progress bar module for erlang
%% Copyright (c) 2008 Luke Galea www.ideaforge.org
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% The above copyright notice and this permission notice shall be included in
@lukegalea
lukegalea / moongoose_issue.js
Created January 30, 2011 01:38
Mongoose Issue
var path = path = require('path');
require.paths.unshift(path.join(__dirname, "../node_modules"));
require.paths.unshift(path.join(__dirname, "../vendor"));
require('noop');
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
var ObservationSchema = new Schema({
@lukegalea
lukegalea / mongoose_find_issue.js
Created January 31, 2011 00:50
Mongoose Find Issue
var path = path = require('path');
require.paths.unshift(path.join(__dirname, "../node_modules"));
require.paths.unshift(path.join(__dirname, "../vendor"));
require('noop');
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
mongoose.connect('mongodb://localhost/pumper');
var ObservationSchema = new Schema({
@lukegalea
lukegalea / mongoose_find.js
Created January 31, 2011 00:55
Mongoose Find Issue
var path = path = require('path');
require.paths.unshift(path.join(__dirname, "../node_modules"));
require.paths.unshift(path.join(__dirname, "../vendor"));
require('noop');
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
mongoose.connect('mongodb://localhost/pumper');
var ObservationSchema = new Schema({
@lukegalea
lukegalea / jqm_data_native_broken.html
Created February 5, 2011 01:34
JQM Data Native Broken
<html>
<head>
<title>Pumper</title>
<link rel="stylesheet" href=
"http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css"
type="text/css">
<script src="http://code.jquery.com/jquery-1.5.min.js" type=
"text/javascript">
</script>
<script src=
@lukegalea
lukegalea / c10ktest.js
Created March 8, 2011 19:41
Stress Tester For Chat
// your_prompt_$ sudo sysctl -w kern.maxfiles=65536
// your_prompt_$ sudo sysctl -w kern.maxfilesperproc=32768
var exec = require('child_process').exec,
http = require('http'),
_ = require('underscore'),
crypto = require('crypto');
var md5 = function(str) {
var hash = crypto.createHash('md5');
@lukegalea
lukegalea / panopticon.js
Created March 16, 2011 13:46
Panopticon JS
// The Panopticon is a type of prison building designed by English philosopher and social theorist Jeremy Bentham in 1785.
// The concept of the design is to allow an observer to observe (-opticon) all (pan-) prisoners without the incarcerated being able to tell whether they are being watched,
// thereby conveying what one architect has called the "sentiment of an invisible omniscience."
// Bentham himself described the Panopticon as "a new mode of obtaining power of mind over mind, in a quantity hitherto without example."
var lastAction = new Date(),
timeoutMins = 2,
keepAliveMins = 1,
timeoutEvent,
keepAliveEvent,
> [email protected] preinstall /var/www/apps/dsharp/releases/20110513005251/node_modules/canvas
> node-waf configure build
> [email protected] install /var/www/apps/dsharp/releases/20110513005251/node_modules/mongodb
> ./install.sh
./install.sh: line 2: [: too many arguments
@lukegalea
lukegalea / node-csv-parser_error.txt
Created May 19, 2011 13:20
node-csv-parser error
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object function (){
var state = {
count: 0,
countWriten: 0,
field: '',
line: [],
lastC: '',