Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
github status message, going oldschool. releasing mad libraries. yall cant stop me.
var session = require("session");
//debug.log(session);
var fingerPrint = {
ip:"123",
user_agent:"123",
timestamp:"123"
};
debug.log(fingerPrint);
http.createServer(function (req, resp) {
setTimeout(function () {
multipart.parse(req).addCallback(function(parts) {
debug.log('multipart');
});
application.totalRequests++;
application.openRequests++;
application.currentTime = new Date();
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);
};
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",
/* 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]);}
}
};
/*
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 December 27, 2009 01:48
mustache.js usage
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
});
@Marak
Marak / jset
Created December 27, 2009 11:31
// 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' );
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 + ';' ); }