Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import org.eclipse.jdt.core.dom.ASTNode; | |
| import org.eclipse.jdt.core.dom.ASTParser; | |
| import org.eclipse.jdt.core.dom.AST; | |
| public ASTUtil { | |
| public static ASTNode getASTNode(ICompilationUnit unit) { | |
| ASTParser parser = ASTParser.newParser(AST.JLS3); | |
| parser.setKind(ASTParser.K_COMPILATION_UNIT); | |
| parser.setSource(unit); |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| /* CSSpec: Theoretical BDD for CSS based on jQuery. Doesn’t exist yet. */ | |
| with(CSSpec) { | |
| describe("all layouts", function() { | |
| describe("body", function() { | |
| it("has a white background", function() { | |
| value(this.css("background-color")).should.be.color("#fff") | |
| }) | |
| it("has black text", function() { |
| # usage: redfin-images "http://www.redfin.com/WA/Seattle/123-Home-Row-12345/home/1234567" | |
| function redfin-images() { | |
| wget -O - $1 | grep "full:" | awk -F \" '{print $4}' | xargs wget - | |
| } |