Skip to content

Instantly share code, notes, and snippets.

View benjchristensen's full-sized avatar

Ben Christensen benjchristensen

View GitHub Profile
@benjchristensen
benjchristensen / DebounceBuffer.java
Last active March 1, 2024 15:46
DebounceBuffer: Use publish(), debounce() and buffer() together to capture bursts of events.
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 February 8, 2013 22:19
Use Datomic queries as a source for RxJava pipes.
(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 December 7, 2023 13:39
Interactive Line Graph (D3)
<!--
* 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.
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 August 10, 2011 15:26
d3 scrolling line graph example
w = 500
h = 300
x = null
y = null
intervalTime = 500
data = d3.range(100).map((n) -> Math.round(Math.random() * 100))
setInterval(
() ->