Skip to content

Instantly share code, notes, and snippets.

View lukasz-madon's full-sized avatar

Lukasz lukasz-madon

View GitHub Profile
@lukasz-madon
lukasz-madon / flatten_list.py
Created March 7, 2017 00:05
Flatten python collection
# following code uses recursion, so it may run out of stack memeory for large collections
def flatten(container):
"""generate a flatten sequence from the input list"""
for i in container:
if isinstance(i, (list, tuple)):
for j in flatten(i):
yield j
else:
yield i
@lukasz-madon
lukasz-madon / notebook-starter.ipynb
Created November 2, 2017 13:18
Jupyter notebook starter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukasz-madon
lukasz-madon / send_empty_json.elm
Created July 20, 2018 17:32
Send an empty json to an endpoint in Elm. Ignore the response
sendJson : Cmd Msg
sendJson =
let
json =
Http.jsonBody (Json.Encode.object [])
in
Http.send SendEmptyJsonMsg
(Http.post "api/empty-json" json (Json.Decode.succeed ""))