Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Christensen benjchristensen

View GitHub Profile
@benjchristensen
benjchristensen / DebounceBuffer.java
Last active May 14, 2018
DebounceBuffer: Use publish(), debounce() and buffer() together to capture bursts of events.
View DebounceBuffer.java
import java.util.List;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Subscriber;
import rx.schedulers.Schedulers;
public class DebounceBuffer {
public static void main(String args[]) {
@mtnygard
mtnygard / query.clj
Created Feb 8, 2013
Use Datomic queries as a source for RxJava pipes.
View query.clj
(ns rxjava-datomic.query
(:require [datomic.api :as d])
(:use [clojure.repl :only [pst]])
(:import [rx Observable]
datomic.Peer))
(defn query [qry & inputs]
(Observable/toObservable
(Peer/q qry (object-array inputs))))
@benjchristensen
benjchristensen / index.html
Last active Nov 28, 2019
Interactive Line Graph (D3)
View index.html
<!--
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View JSONUtility.java
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@barrym
barrym / example.coffee
Created Aug 10, 2011
d3 scrolling line graph example
View example.coffee
w = 500
h = 300
x = null
y = null
intervalTime = 500
data = d3.range(100).map((n) -> Math.round(Math.random() * 100))
setInterval(
() ->