Skip to content

Instantly share code, notes, and snippets.

View vilmibm's full-sized avatar
📼

Nate Smith vilmibm

📼
View GitHub Profile
var fs = require('fs'),
sys = require('sys');
function walk(path, callback) {
var recur_or_cb = function( abspath ) {
return function(err, stats) {
if ( stats.isDirectory() )
walk(abspath, callback);
else
callback(err, abspath);
node> var hw = require("./helloworld");
Error: /home/nate/test/build/default/helloworld.node: undefined symbol: _ZN10HelloWorld4s_ctE
at Module._loadObjectSync (node.js:360:13)
at Module.loadSync (node.js:336:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at cwdRequire (repl:27:10)
at [object Context]:1:10
at Interface.<anonymous> (repl:84:19)
at Interface.emit (events:26:26)
/*$("div").prepend($('<div></div>').addClass("overlay"));*/
div.overlay {
position:absolute;
background: #666666 url(../images/jquery-ui/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat;
opacity: .50;
filter:Alpha(Opacity=50);
width:300px;
height:200px;
}
@vilmibm
vilmibm / rabbitmq_child.pl
Created October 22, 2010 18:01
rabbitmq parent
use strict;
use warnings;
use feature 'say';
use JSON;
use Net::RabbitMQ;
use Data::Dumper;
my $queue = shift @ARGV || die "No queue specified";
@vilmibm
vilmibm / twitter2xml.js
Created May 9, 2011 20:27
backup your tweets as XML
var fs = require('fs');
var http = require('http');
function sprintf(str,args) {if(args.length===0)return str;return sprintf(str.replace(/%s/,args[0]),args.splice(1));}
var page = 104;
var streams = {};
var username = process.argv[2] || 'nate_smith';
while (page > 0) {
@vilmibm
vilmibm / lispy.js
Created May 10, 2011 20:36
lispy js
// var myfun = defun(function () {
// // do something with/to this.args;
// });
defun = function defun() {
var orig_func = arguments[0];
return function() {
// convert the arguments object into a plain old array
var args = Array.prototype.slice.call(arguments);
return orig_func.apply({args:args});
}
@vilmibm
vilmibm / sillystate.js
Created August 23, 2011 01:21
and then i realized this was a little silly
buffer = mmap.map(stats.size, mmap.PROT_READ, mmap.MAP_SHARED, fd, 0);
var lbl = new LineByLine(buffer);
var comment = ';'.charCodeAt(0);
var space = ' '.charCodeAt(0);
var xxx = '*'.charCodeAt(0);
var COMMENT = "comment";
var DEF = "definition";
var NULL = null;
var STATE = NULL;
var defbuff = '';
@vilmibm
vilmibm / gist:1324928
Created October 29, 2011 18:57
chiptheglasses blog engine
#!/usr/bin/perl
chdir 'posts';
($f = `cat ../template.html`) =~ s/\$POSTS/`ls -r | xargs cat`/e;
`echo "$f" > ../build.html`;
@vilmibm
vilmibm / marimobootstrap.html
Created January 22, 2012 20:58
marimo bootstrap
<!-- require jQuery, mustache, etc. -->
<script src="/marimo.js"></script>
<script>
// feed it a library object
marimo.init($);
marimo.add_widget({
'id':'unique_str',
'murl':'http://some.api.com/public',
'widget_prototype':'request_widget'
});
@vilmibm
vilmibm / marimoevent.js
Created January 22, 2012 21:02
marimo event example
medley_abuse_form.moderate = function() {
// AJAX for moderating a given object
this.emit('object_moderated');
};
medley_comments.render = function() {
// Render a template, put it on the page
this.on('object_moderated', function() {
this.refresh();
});
this.emit('comments_loaded');