Skip to content

Instantly share code, notes, and snippets.

(set-env! :target-path "static"
:source-paths #{"src"}
:dependencies '[[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170" :scope "provided"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[weasel "0.7.0" :scope "test"]
[cljs-ajax "0.3.14"]
[datascript "0.13.3"]
[funcool/cuerdas "0.6.0"]
{:require [myproject.app]}
# To run person.py, simply do the following on the command line:
# python person.py
#
# NOTE!
# This example just demonstrates how to do functions and class objects.
# It does NOT demonstrate which way is better.
############
# Function #
############
Never share a class between 2 styles:
```
.form{
width: auto;
}
.side.form{
width: 100%;
}
```
Do instead
timezone('Australia/Perth').localize(datetime(2016, 1, 1, 10, 00)) # 10AM is kept and unchanged
@robinchew
robinchew / beautiful_idiomatic_python.md
Last active May 24, 2016 05:35 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
import SimpleHTTPServer
import SocketServer
from textwrap import dedent
from urlparse import urlparse, parse_qs
from collections import defaultdict
import csv
import os
import sys
# http://slides.com/robinchew/deck
from collections import defaultdict
from textwrap import dedent
from urllib.parse import urlparse, parse_qs
from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server
import csv
# http://slides.com/robinchew/deck
from collections import defaultdict
from textwrap import dedent
from urllib.parse import urlparse, parse_qs
from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server
import csv
(ns cloject.mithril)
(defn build [l]
(if (vector? l)
(apply js/m
(clj->js (for [i l]
(build i))))
(if (seq? l)
(clj->js (for [i l]
(build i)))