public static void main(String[] args) {
ConnectableObservable<String> producer = Observable.just("Hello World 100").publish();
Observable<String> hi = producer.map(String::toUpperCase);
Observable<String> lo = producer.map(String::toLowerCase);
Observable<String> no100 = producer.filter(s -> s.contains("100")).map(s -> s.replace("100", "1000"));
Observable<String> combined = Observable.merge(lo, hi, no100);
combined.subscribe(System.out::println);
I hereby claim:
- I am tsujeeth on github.
- I am tsujeeth (https://keybase.io/tsujeeth) on keybase.
- I have a public key ASBeqXGSzt51yfJQwt50P72PLfLv-qFtEH6qdkLSbW7CXQo
To claim this, I am signing this object:
This file contains hidden or 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
class Bottle { | |
private String message; | |
Bottle() { | |
message = ""; | |
} | |
public synchronized void set(String message) { | |
this.message = message; | |
notifyAll(); |
This file contains hidden or 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
#!/usr/bin/python | |
import random | |
import dfs | |
def add_edge(adj, u, v): | |
if u in adj: | |
current = adj[u] | |
adj[u] = current + [v] | |
else: |
This file contains hidden or 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 main | |
import ( | |
"log" | |
"os" | |
"time" | |
) | |
func getLastModTime(filename string) time.Time { | |
fileInfo, err := os.Stat(filename) |
This file contains hidden or 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
# The list of URLs is provide in an input file. | |
# (assuming one URL per line) | |
from tornado import httpclient | |
from tornado import gen | |
from tornado.ioloop import IOLoop | |
class Fetcher: | |
def __init__(self): | |
self.client = httpclient.AsyncHTTPClient() |
This file contains hidden or 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
/* Using reflect.MakeFunc to fetch from map[string]interface{}. | |
* getString(key) will either return the 'string' value or empty string. | |
* getInt(key) will either return the 'int' value or a 0. | |
*/ | |
package main | |
import ( | |
"fmt" | |
"reflect" |