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
import java.io.IOException; | |
import java.util.List; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.Subscription; | |
import rx.android.schedulers.AndroidSchedulers; | |
import rx.functions.Func0; | |
import rx.functions.Func1; |
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 iter | |
import java.io.File | |
import kotlin.coroutines.experimental.buildSequence | |
fun main(args: Array<String>) { | |
val file = File("path-to/access-log") | |
val linesInFile = getLines(file) | |
val bytesColumn = getBytesColumn(linesInFile) | |
val bytes = getBytes(bytesColumn) |
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 |
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.* | |
/* | |
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
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
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
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
" 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
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 |
OlderNewer