Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
## widget | |
import httplib2 | |
from urllib import urlencode | |
import colander | |
from colander import null | |
from colander import Invalid | |
from deform.widget import CheckedInputWidget |
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
if has("autocmd") | |
" remove trailing white spaces | |
autocmd BufWritePre * :%s/\s\+$//e | |
endif |
Assumed that you have set leiningen up and can use it.
Copy project.clj
, repl-test.cljs
and brepl-test.html
from this gist
or git clone this gist and move or copy repl-test.cljs under src
directory.
$ git clone https://gist.github.com/6183122.git
$ cd 6183122/
Prepare an environment according to A minimum setting to use browser REPL of ClojureScript.
Input lines of dom-example.cljs
to the REPL.
Here's a SCREEN CAST.
Enjoy!
from pprint import pprint | |
import jinja2 | |
import markdown | |
HTML_TEMPLATE = """{% macro get_html() %} | |
{{ content | markdown }} | |
{% endmacro %} | |
{% set html_content = get_html() %} | |
Title from Markdown meta-data: {{ get_title() }} |
#!/bin/bash | |
# Huikee CSV-to-XLSX konvertteri by Samuli | |
# Versio 2.0, using unoconv | |
# Unicode now works | |
root_dir=$(pwd) | |
FOLDERS=$(find $root_dir -type d) | |
for fol in $FOLDERS |
# Based on http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/ | |
import six | |
from sqlalchemy.dialects import postgresql | |
from sqlalchemy.types import SchemaType, TypeDecorator, Enum | |
from sqlalchemy import __version__, text, cast | |
import re | |
if __version__ < '0.6.5': | |
raise NotImplementedError("Version 0.6.5 or higher of SQLAlchemy is required.") |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent