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
/* Include these Gradle dependencies | |
compile 'no.tornado:tornadofx:1.5.4' | |
compile 'com.github.thomasnield:rxkotlinfx:0.1.4' | |
compile 'io.reactivex:rxkotlin:0.60.0' | |
*/ | |
class MyView : View() { | |
val items = FXCollections.observableArrayList("Alpha","Beta","Gamma", | |
"Delta","Epsilon","Zeta","Eta") |
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
/* Include these Gradle dependencies | |
compile 'no.tornado:tornadofx:1.5.4' | |
compile 'com.github.thomasnield:rxkotlinfx:0.1.4' | |
compile 'io.reactivex:rxkotlin:0.60.0' | |
*/ | |
import javafx.scene.input.KeyEvent | |
import rx.javafx.kt.events | |
import rx.javafx.kt.observeOnFx | |
import rx.lang.kotlin.toObservable |
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
from rx import Observable, Observer | |
from collections import defaultdict | |
users = [ | |
{ "id" : 0, "name" : "Hero" }, | |
{ "id" : 1, "name" : "Dunn" }, | |
{ "id" : 2, "name" : "Sue" }, | |
{ "id" : 3, "name" : "Chi" }, | |
{ "id" : 4, "name" : "Thor" }, | |
{ "id" : 5, "name" : "Clive" }, |
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 org.apache.spark.SparkConf | |
import org.apache.spark.api.java.JavaSparkContext | |
import kotlin.reflect.KClass | |
//collecting useful Kotlin extension functions for Spark | |
fun SparkConf.registerKryoClasses(vararg args: KClass<*>) = registerKryoClasses(args.map { it.java }.toTypedArray()) |
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
Alabama | |
Alaska | |
Arizona | |
Arkansas | |
California | |
Colorado | |
Connecticut | |
Delaware | |
Florida | |
Georgia |
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
from tweepy.streaming import StreamListener | |
from tweepy import OAuthHandler | |
from tweepy import Stream | |
import json | |
from rx import Observable | |
#Variables that contains the user credentials to access Twitter API | |
#Create your own at https://apps.twitter.com/ | |
access_token = "CONFIDENTIAL" |
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
# Schedules a reactive process that counts the words in a text file every three seconds, | |
# but only prints it as a dict if it has changed | |
from rx import Observable | |
import re | |
import signal | |
def word_counter(file_name): | |
file = open(file_name) |
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 io.reactivex.Observable; | |
import io.reactivex.schedulers.Schedulers; | |
import java.util.concurrent.CountDownLatch; | |
public class Launcher { | |
public static void main(String[] args) { | |
Observable<Integer> source = Observable.range(1,10); | |
CountDownLatch latch = new CountDownLatch(1); |
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
from rx import Observable | |
import os | |
def recursive_files_in_directory(folder): | |
def emit_files_recursively(observer): | |
for root, directories, filenames in os.walk(folder): | |
for directory in directories: | |
observer.on_next(os.path.join(root, directory)) |
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 io.reactivex.Flowable; | |
import io.reactivex.Observable; | |
import io.reactivex.schedulers.Schedulers; | |
import java.util.concurrent.CountDownLatch; | |
public class Launcher { | |
public static void main(String[] args) { | |
final CountDownLatch latch = new CountDownLatch(1); |