Skip to content

Instantly share code, notes, and snippets.

@hartleybrody
hartleybrody / click.py
Last active February 8, 2023 14:38
setting up multiple click commands within a single file
"""
Example of setting up multiple click commands within one file.
Run these commands with:
python /path/to/file.py do-foo --foo 'hello world'
Note that click converts '_' to '-' in function name
"""

kotlin cheatsheet

string interpolation

val foo = 1
var bar = "one is $foo"
var baz = "two is ${foo + 1}"

Unit is a placeholder return value for functions that don't actually return a meaninfgul value. It is the default return type for any function if one is not specified explicitly. Nothing is a placeholder return value for functions that should never actually return (ie they throw an exception or have infinite loop). Good SO discussion on differences.

@hartleybrody
hartleybrody / python-version-setup.md
Last active February 13, 2024 15:30
modern python versions + virtualenvs

I do this infrequently enought that I always forget how to do it. Note that I've finally decided to move away from virtualenvwrapper (workon, mkvirtualenv, etc) since it didn't play nicely with the python versions set by pyenv.

Install the tools (pyenv & pyenv-virtualenv)

Only necessary if this is a new laptop

brew install pyenv
brew install pyenv-virtualenv