Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
// ==UserScript== | |
// @id org.userscripts.users.badboy.notepag-es-key-combo | |
// @name notepag.es-key-combo | |
// @description Add key combos to notepag.es | |
// @version 2012.03.24 | |
// @author badboy_ | |
// @homepage http://fnordig.de/ | |
// @include http://notepag.es/* | |
// ==/UserScript== |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
(function(d) { | |
var dl = d.createElement('a'); | |
dl.innerText = 'Download MP3'; | |
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
dl.download = d.querySelector('em').innerText+".mp3"; | |
d.querySelector('.primary').appendChild(dl); | |
dl.style.marginLeft = '10px'; | |
dl.style.color = 'red'; | |
dl.style.fontWeight = 700; | |
})(document); |
parse("( S < 16 and T = \"P\" ) or ( S > 16 and L = 50 )") => ['S<16', 'T="P"', 'and', 'S>16', 'L=50', 'and', 'or'] |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
.shape{ | |
height: 100%; | |
width: 100%; | |
} | |
.circle { | |
border-radius: 50%/50%; | |
-moz-border-radius: 50%/50%; | |
-webkit-border-radius: 50%/50%; | |
} | |
.hide { |
$ | \bigcup\limits_{i=1}^n A_i | = $ | |
$ + ( \sum\limits_{i=0}^n | A_i | ) $ | |
$ - ( \sum\limits_{i,j:1 \le i<j \le n} | A_i \cap A_j | ) $ | |
$ + ( \sum\limits_{i,j,k:1 \le i < j < k \le n} | A_i \cap A_j \cap A_k | ) $ | |
$ - ( \sum\limits_{i,j,k,l:1 \le i < j < k < l \le n} | A_i \cap A_j \cap A_k \cap A_l | ) $ |
fs = require 'fs' | |
http = require 'http' | |
https = require 'https' | |
crypto = require 'crypto' | |
mime = require 'mime' | |
xml2js = require 'xml2js' | |
delayTimeout = (ms, func) -> setTimeout func, ms | |
class @S3Put |
//lo sauer, 2011; lsauer.com | |
/** | |
* I saw this thread: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array | |
* The solutions above lacked the elegance that can be done a with map-reduce-like operations | |
* Since this implementation works with native functions, the speed is in most circumstances faster | |
* than any solution using scripted-logic | |
* Additionally, I needed to quickly filter duplicate url-entries for: http://lsauer.github.com/chrome-session-restore/ | |
*/ | |
//copy and paste: without error handling | |
Array.prototype.unique = function(){return this.sort().filter( function(v,i,o){if(i>=0 && v!==o[i-1]) return v;});} |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |