Skip to content

Instantly share code, notes, and snippets.

View status
github status message, going oldschool. releasing mad libraries. yall cant stop me.
View gist:244390
var session = require("session");
//debug.log(session);
var fingerPrint = {
ip:"123",
user_agent:"123",
timestamp:"123"
};
debug.log(fingerPrint);
View gist:251291
http.createServer(function (req, resp) {
setTimeout(function () {
multipart.parse(req).addCallback(function(parts) {
debug.log('multipart');
});
application.totalRequests++;
application.openRequests++;
application.currentTime = new Date();
View gist:255337
var api = new DropioApiClient("[YOUR API KEY]");
api.getDrop({drop_name:"somedrop",token:"p@ssw0rd"},receive_response);
function receive_response(response,success) {
if( success )
for(i in response)
alert(i + ": " + response[i]);
else
alert("Error getting drop: " + response.message);
};
View gist:255353
drip.toolbar.HTML = '<div id = "{{id}}" class = "{{class}}"></div>';
drip.toolbar.rendered = Mustache.to_html(drip.toolbar.HTML,{
id:"drip-toolbar",
class:"drip-toolbar",
});
drip.toolbar.css = {
height:"100px",
width:"100px",
View gist:260277
/* helper method for parsing dynamic CSS, waiting for jquery.require() >.< */
function parseCSS(id,css){
for(style in css){
if(typeof css[style] == 'object'){parseCSS(style,css[style]);
else{$(id).css(style,css[style]);}
}
};
View mustache.js
/*
Mustache templating library made available for the CommonJS environment using the
modules definition available at: http://wiki.commonjs.org/wiki/Modules/1.1
Shameless port of a shameless port
@defunkt => @janl => @aq => @voodootikigod
See http://github.com/janl/mustache.js for more info about Mustache itself.
*/
@Marak
Marak / gist:264119
Created Dec 27, 2009
mustache.js usage
View gist:264119
var rsp = {};
rsp.message = "hi";
rsp.nickname = "guest";
var chatMessage = '<div class = "drip-chat-message"><span>{{nickname}}: </span><span>{{message}}</span></div>';
chatMessage = Mustache.to_html(chatMessage, {
message:rsp.message,
nickname:rsp.nickname
});
View jset
// helper function for lazy initing objects
function jset( o,d ){
if(typeof eval(o) == 'undefined'){ eval( o + ' = ' + d + ';' ); }
return true;
}
// jset() usage
jset ( 'drip' , '{}' );
jset ( 'drip.value' , 42 );
jset ( 'drip.URI' , 'google.com' );
View application.js
var posix = require('posix'), debug = require("./node_debug/debug"), sys = require('sys');
var application = {};
application.dataPath = '/var/www/node.js/internetfactsite.com/data/drip.json';
application.data = {};
/*
*/
// helper function for lazy initing objects
function jset( o,d,t ){
if(typeof eval(o) == 'undefined'){ eval( o + ' = ' + d + ';' ); }