Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding various bits from recent work

  • Loading branch information...
commit b721acdebf7865e80f5260d65836f109006d43eb 1 parent 1b756dc
@smholloway authored
View
35 javascript/jQueryLoader.user.js
@@ -0,0 +1,35 @@
+// This script lets you like xvideos
+//
+// ==UserScript==
+// @name jQueryLoader
+// @namespace jQueryLoader
+// @description Load jQuery into any page for use with inspector
+// @include http://*
+// @include file:///*
+// @version 1
+// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
+// ==/UserScript==
+
+try{
+ // a function that loads jQuery and calls a callback function when jQuery has finished loading
+ function addJQuery(callback) {
+ var script = document.createElement("script");
+ script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
+ script.addEventListener('load', function() {
+ var script = document.createElement("script");
+ script.textContent = "(" + callback.toString() + ")();";
+ document.body.appendChild(script);
+ }, false);
+ document.body.appendChild(script);
+ }
+
+ // load jQuery and execute the main function
+ addJQuery(main);
+
+ // the guts of this userscript
+ function main() {
+ alert('Loaded jQuery');
+ }
+} catch(e) {
+ alert("jQueryLoader encountered an error: " + e);
+}
View
BIN  javascript/userscript-install-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  javascript/userscript-install-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  javascript/userscript-install-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  javascript/userscript-install-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
35 python/tree_print.py
@@ -0,0 +1,35 @@
+class Node:
+ def __init__(self, label, id, parent_id):
+ self.label=label
+ self.id=id
+ self.parent_id=parent_id
+ self.children=[]
+
+ def add_child(parent, child):
+ parent.children.append(child)
+
+def pp(nodes):
+ pp_stack = []
+ for node in nodes:
+ if node.parent_id == 0:
+ print node.label
+ print_below(nodes, node, 1)
+ print ""
+
+def print_below(nodes, parent_node, depth):
+ for node in nodes:
+ if node.parent_id == parent_node.id:
+ for i in range(0,depth):
+ print "\t" ,
+ print node.label
+ print_below(nodes, node, depth+1)
+
+pp( [ Node("A", 1, 0), Node("B", 2, 0), Node("C", 3, 0) ] )
+
+pp( [ Node("A", 1, 0), Node("B", 2, 1), Node("C", 3, 2) ] )
+
+pp( [ Node("A", 1, 0), Node("B", 2, 0), Node("C", 3, 2) ] )
+
+pp( [ Node("A", 1, 0), Node("B", 2, 3), Node("C", 3, 1) ] )
+
+pp( [ Node("A", 1, 0), Node("B", 2, 1), Node("C", 3, 2), Node("D", 4, 3), Node("E", 5, 4), Node("F", 6, 5) ] )
View
1  shell/quine.sh
@@ -0,0 +1 @@
+#!/bin/cat
Please sign in to comment.
Something went wrong with that request. Please try again.