This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.youtube.com/watch?v=399c-ycBvo4 - Brandon Rhodes | |
https://www.youtube.com/watch?v=51RpDZKShiw - Jason Mayer | |
Slides: https://www.slideshare.net/jamdatadude/introduction-to-sqlalchemy-orm | |
Miguel Grinberg | |
One to Many Relationship example : https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database | |
Many to May Relationship example : https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-viii-followers | |
Four tips : https://blog.miguelgrinberg.com/post/video-four-sqlalchemy-tips | |
SQl-alchemy docs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install cookiecutter / brew install cookiecutter | |
Talk by Mark Smith | |
https://www.youtube.com/watch?v=QgZ7qv4Cd0Y | |
$ cookiecutter gh:ionelmc/cookiecutter-pylibrary | |
$ cookiecutter https://github.com/Nekroze/cookiecutter-pypackage.git [ Worked Fine ] | |
Talk by Dave forgac | |
https://www.youtube.com/watch?v=qOH-h-EKKac&feature=emb_err_woyt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Collection of useful python decorators | |
# Taken from https://eli.thegreenplace.net/2012/08/22/easy-tracing-of-nested-function-calls-in-python | |
# Easy tracing of nested function calls in Python | |
import sys | |
from functools import wraps | |
class TraceCalls(object): | |
""" Use as a decorator on functions that should be traced. Several | |
functions can be decorated - they will all be indented according |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim-bootstrap | |
"***************************************************************************** | |
"" Vim-PLug core | |
"***************************************************************************** | |
let vimplug_exists=expand('~/.vim/autoload/plug.vim') | |
let g:vim_bootstrap_langs = "c" | |
let g:vim_bootstrap_editor = "vim" " nvim or vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Customer(val name: String, val fidelityScore: Int) | |
data class LineItem(val productName: String, val qtyInKg: Int, val pricePerKg: Double) { | |
fun total(): Double { | |
return qtyInKg * pricePerKg | |
} | |
} | |
class Order(val customer: Customer, val cart: List<LineItem>, val promo: ((Order) -> Double)? = null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Customer(val name: String, val fidelityScore: Int) | |
data class LineItem(val productName: String, val qtyInKg: Int, val pricePerKg: Double) { | |
fun total(): Double { | |
return qtyInKg * pricePerKg | |
} | |
} | |
class Order(val customer: Customer, val cart: List<LineItem>, val promo: Promotion? = null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun generator() = generate<Int, String> { | |
var c = 1 | |
while (true) { | |
val op = yield(c) | |
when (op) { | |
"inc" -> c += 1 | |
"mult" -> c *= 2 | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package generator | |
import kotlin.coroutines.* | |
import kotlin.coroutines.intrinsics.* | |
/* | |
ES6-style generator that can send values between coroutine and outer code in both ways. | |
Note that in ES6-generators the first invocation of `next()` goes not accept a parameter, but | |
just starts a coroutine until a subsequent `yield`, so to adopt it for the type-safe interface | |
we must declare `next` to be always invoked with a parameter and make our coroutine receive the first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package generator | |
import java.io.File | |
fun canHandle(func: () -> Boolean): Boolean { | |
return func() | |
} | |
fun firstHandler(successor: Generator<String, String>? = null) = generate<String, String>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package generator | |
import kotlin.coroutines.* | |
import kotlin.coroutines.intrinsics.* | |
fun kotlincoro() = generate<String, String>{ | |
println("[ coroutine ]: started") | |
println("[ coroutine ]: suspended at first yield and sent data to main") | |
val coroData = yield("Hello") // yield() causes coroutine to produce value "Hello" for consumer | |
// and kotlincoro function gets suspended till consumer invokes |
NewerOlder