Skip to content

Instantly share code, notes, and snippets.

View rdleon's full-sized avatar

Rafael Díaz de León rdleon

View GitHub Profile
@rdleon
rdleon / comment.js
Created February 8, 2013 16:29
Old community script, messy and impolite.
/* comments.js
* ver 3.0
* Requires jQuery
*
* Use:
* comments.init( options );
*
* Options:
* selector: <jquery_selector>
*/
@rdleon
rdleon / gist:4739992
Created February 8, 2013 16:08
Sample of a quick and dirty jquery plugin for drawing comments
/*
* Copyright (c) 2012 R. Diaz de Leon <leon@elinter.net>
*
* comments.js
* ver 5.0a
*
* Requires:
* jQuery
*
* Use:
@rdleon
rdleon / path.js
Created October 28, 2011 19:09
Gets an array of tree paths and populates a tree.
/* This function needs that the path arrays invoke the function
* in order, else it will duplicate some nodes
*/
function populate(tree, path) {
var node = {};
var label = path.shift();
var p_node = tree[tree.length - 1] || {};
if (!tree.length || p_node.label != label) {
node.label = label;