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.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
public class SampleExample { | |
public static void main(String args[]) { | |
hotStream().sample(500, TimeUnit.MILLISECONDS).toBlocking().forEach(System.out::println); |
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.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
public class ThrottleExample { | |
public static void main(String args[]) { | |
// first item emitted in each time window |
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.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.concurrent.atomic.AtomicLong; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
/** | |
* Example of a "cold Observable" using "reactive pull" to emit only as many items as requested by Subscriber. |
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.util.ArrayList; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
/** | |
* This demonstrates a "cold" Observable that does not use "reactive pull" and how to handle it. | |
*/ | |
public class ReactivePullColdNonConformant { |
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.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.atomic.AtomicLong; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.observables.ConnectableObservable; | |
import rx.schedulers.Schedulers; |
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.util.concurrent.CountDownLatch; | |
import rx.Observable; | |
import rx.observables.ConnectableObservable; | |
import rx.schedulers.Schedulers; | |
/** | |
* This shows how a "reactive pull" compliant "cold" Observable, when multicasted, becomes "hot" and each Subscriber | |
* must then choose its strategy for overflow. | |
*/ |
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
<?php | |
header("Content-Type: text/event-stream\n\n"); | |
echo 'data: ' . json_encode( | |
array( | |
0 => array( | |
'time' => time(), | |
'message' => 'Some kind of foo' | |
), | |
1 => array( |
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
<html> | |
<head> | |
<title>DIV Popup with "Lightbox" Style</title> | |
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script> | |
<style> | |
/* popup div contents */ | |
DIV.lightbox-content { | |
position: absolute; | |
margin-right: auto; | |
margin-left: 5%; |
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
#!/usr/bin/env python | |
import subprocess | |
import argparse | |
import zipfile | |
import os | |
parser = argparse.ArgumentParser(description='Upload a file or files to a RESTful endpoint') | |
parser.add_argument('-e', '--environment', metavar='TEST/PROD', | |
help='The environment to upload to: TEST/PROD') |
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.util.ArrayList; | |
import java.util.Collection; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import junit.framework.TestCase; | |
import org.junit.Test; |