Skip to content

Instantly share code, notes, and snippets.

View rebcabin's full-sized avatar

Brian Beckman rebcabin

View GitHub Profile

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@rebcabin
rebcabin / _reader-macros.md
Created January 31, 2016 21:52 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@rebcabin
rebcabin / kalman.f90
Created May 19, 2016 01:24 — forked from mrocklin/kalman.f90
Kalman filter in BLAS/LAPACK Fortran
subroutine f(mu, Sigma, H, INFO, R, Sigmavar_2, data, muvar_2, k, n)
implicit none
integer, intent(in) :: k
integer, intent(in) :: n
real*8, intent(in) :: Sigma(n, n) ! Sigma
real*8, intent(in) :: H(k, n) ! H
real*8, intent(in) :: mu(n) ! mu
real*8, intent(in) :: R(k, k) ! R, H*Sigma*H' + R
real*8, intent(in) :: data(k) ! (H*Sigma*H' + R)^-1*((-1)*data + H*mu), data, (-1)* data + H*mu
@rebcabin
rebcabin / Ukf.fs
Created May 27, 2016 03:27 — forked from praeclarum/Ukf.fs
Unscented Kalman Filter (nonlinear version of the classic Kalman filter) in F#
module Drone.Control.Ukf
open System
open Drone.Control.Matrix
type IDiscreteModel =
abstract Process : Matrix -> Matrix
abstract Observe : Matrix -> Matrix
abstract InitialState : Matrix
@rebcabin
rebcabin / list.cpp
Created September 18, 2016 14:47 — forked from splinterofchaos/list.cpp
Several of Haskell's Data.List functions implemented in C++ Data.List: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html
#include <algorithm>
#include <vector>
#include <iterator>
#include <iostream>
template< class F, class X, class S >
constexpr X foldl( F&& f, X x, const S& s ) {
return std::accumulate (
std::begin(s), std::end(s),
@rebcabin
rebcabin / clj_spec_playground.clj
Last active February 2, 2017 16:23 — forked from ghoseb/clj_spec_playground.clj
Examples of Clojure's new clojure.spec library
(ns clj-spec-playground
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.test.check.generators :as gen]))
;;; examples of clojure.spec being used like a gradual/dependently typed system.
(defn make-user
"Create a map of inputs after splitting name."
([name email]
@rebcabin
rebcabin / virtual-time.clj
Created April 11, 2017 13:49 — forked from didibus/virtual-time.clj
My take on the google group question found here: https://groups.google.com/forum/#!topic/clojure/oe1Ch1oSlLk
(ns spec-test.virtual-time
(:require [clojure.spec :as s]
[clojure.spec.test :as st]))
(s/def ::virtual-time
(s/or
:positive-infinity #{:positive-infinity}
:negative-infinity #{:negative-infinity}
:number number?))
(s/fdef vt-lt
@rebcabin
rebcabin / virtual-time.clj
Created April 11, 2017 15:48 — forked from didibus/virtual-time.clj
My deftype based take on the google group question found here: https://groups.google.com/forum/#!topic/clojure/oe1Ch1oSlLk
(ns spec-test.virtual-time
(:require [clojure.spec :as s]
[clojure.spec.test :as st]
[clojure.spec.gen :as sgen]))
(deftype VirtualTime [time]
Object
(hashCode [_]
(hash time))
(equals [this that]
@rebcabin
rebcabin / screenshotty.py
Created October 27, 2017 18:35 — forked from Jerdak/screenshotty.py
OpenGL screenshots using python
#! /usr/bin/env python
'''
Simple example demonstrating how to take a screenshot
'''
import time
import sys
import os
import argparse
#OpenGL