Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
.shape{ | |
height: 100%; | |
width: 100%; | |
} | |
.circle { | |
border-radius: 50%/50%; | |
-moz-border-radius: 50%/50%; | |
-webkit-border-radius: 50%/50%; | |
} | |
.hide { |
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 |
parse("( S < 16 and T = \"P\" ) or ( S > 16 and L = 50 )") => ['S<16', 'T="P"', 'and', 'S>16', 'L=50', 'and', 'or'] |
(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); |
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== |
require 'spec_helper' | |
describe "Brewery" do | |
it "makes good stuff" do | |
beer.should be :good | |
end | |
it "makes not too much bottles" do | |
@bottles.should == 10 |
require 'date' | |
# Actually doesn't matter WHAT you choose as the epoch, it | |
# won't change the algorithm. Just don't change it after you | |
# have cached computed scores. Choose something before your first | |
# post to avoid annoying negative numbers. Choose something close | |
# to your first post to keep the numbers smaller. This is, I think, | |
# reddit's own epoch. | |
$our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time |
# A | |
# B | |
# | |
# D | |
# | |
# C | |
# E | |
# | |
# F | |
# |
FoundWord(word='a', locations=[Location(row=2, col=0)]) | |
FoundWord(word='al', locations=[Location(row=2, col=0), Location(row=1, col=1)]) | |
FoundWord(word='alice', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=2, col=3), Location(row=3, col=2)]) | |
FoundWord(word='alien', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=3, col=2), Location(row=3, col=3)]) | |
FoundWord(word='alin', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=3, col=3)]) | |
FoundWord(word='aline', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=3, col=3), Location(row=3, col=2)]) | |
FoundWord(word='alit', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=2, col=1)]) | |
FoundWord(word='alite', locations=[Location(row=2, col=0), Location(row=1, col=1), Location(row=2, col=2), Location(row=2, col=1), Location(row=3, col=2)]) | |
F |