Skip to content

Instantly share code, notes, and snippets.

View el-ethan's full-sized avatar
🎉

Ethan el-ethan

🎉
View GitHub Profile

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]:
@el-ethan
el-ethan / pre-commit-eslint.md
Created January 6, 2019 20:16
Lint js files with changes before commit.

Place the following in .git/hooks/pre-commit:

#!/bin/sh

node ./pre-commit.js

exit $?

Place the following in pre-commit.js in the root of your repo:

/**
* To use JSON Server to serve API responses you will need to do the following:
* 1. create a db.json.
* 2. In your browser, set the following local storage key-value pairs:
* a) set use-json-server to true (unquoted). This will tell Angular to route your API requests to JSON Server.
* b) (optional) set json-server-blacklist to an array of double quoted string urls starting with slashes.
* This will tell Angular which urls (if any) to serve with the web server.
* @example
* ["/my-special-endpoint", "/my/resource"]
*/
@el-ethan
el-ethan / docker-does.md
Created November 20, 2019 12:19
A list of dos and don'ts for Docker