Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| " folding for Markdown headers, both styles (atx- and setex-) | |
| " http://daringfireball.net/projects/markdown/syntax#header | |
| " | |
| " this code can be placed in file | |
| " $HOME/.vim/after/ftplugin/markdown.vim | |
| func! Foldexpr_markdown(lnum) | |
| let l1 = getline(a:lnum) | |
| if l1 =~ '^\s*$' |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; Copyright (c) Rich Hickey. All rights reserved. | |
| ; The use and distribution terms for this software are covered by the | |
| ; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
| ; which can be found in the file CPL.TXT at the root of this distribution. | |
| ; By using this software in any fashion, you are agreeing to be bound by | |
| ; the terms of this license. | |
| ; You must not remove this notice, or any other, from this software. | |
| ;dimensions of square world |
| /* | |
| Copyright 2011 Martin Hawksey | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
| # Title: Photos tag for Jekyll | |
| # Authors: Devin Weaver | |
| # Description: Allows photos tag to place photos as thumbnails and open in fancybox. Uses a CDN if needed. | |
| # | |
| # ** This only covers the markup. Not the integration of FancyBox ** | |
| # | |
| # To see an unabridged explination on integrating this with [FancyBox][1] | |
| # Please read my [blog post about it][2]. | |
| # | |
| # [1]: http://fancyapps.com/fancybox/ |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| license: gpl-3.0 | |
| redirect: https://observablehq.com/@mbostock/map-coloring |
| /* Converts an object into a key/value par with an optional prefix. Used for converting objects to a query string */ | |
| var qs = function(obj, prefix){ | |
| var str = []; | |
| for (var p in obj) { | |
| var k = prefix ? prefix + "[" + p + "]" : p, | |
| v = obj[k]; | |
| str.push(angular.isObject(v) ? qs(v, k) : (k) + "=" + encodeURIComponent(v)); | |
| } | |
| return str.join("&"); | |
| } |