Skip to content

Instantly share code, notes, and snippets.

View yosssi's full-sized avatar

Keiji Yoshida yosssi

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.

@yosssi
yosssi / 1.png
Last active August 29, 2015 14:03
1.png
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABCsAAAJJCAYAAACDJ706AAAgAElEQVR4Xuy9B5hl1XXlv18Olaurc6IDNDRNUAMCIQQChFAOlmQF27I99jiNZcvW2OM08803M05/jZOcg7ItK9mSLBEkASKJ3E1uaDrSOVV1xVf18n/99rm3usDdTUOXjay5t3lU1Xv3nXvOPueee/Y6a6+dauuw75Gj1WrZ0aNHbXh42CYmJqxer3+P1CypRmKBxAKJBRILJBZILJBYILFAYoHEAv+RLJDP561cLltfX5/19vZaOp2e1erf/+SD1mrhSjWtLT+m2WpYq61Xq2mtZtOsXdX7+kzuFue1UylLpVSHlL7Cj1TB8vmCZTM5/Z6xNl/R/9oqjyPbSllXZ691Fjv1eV5fy1hKl2s069ZsNtSeghULBW9XU9dryHeq1mrW0nczmYzlMma5rL6TyXod2uGi+qlXm/q2dW1d1+vX0kecE+qa0nlZ1Uk18rrwd3ipdP3k7RRlttJql5pDu/xsfa7PKIfz67pOo9FQnRs6N7yXU79kczkr6JyG6t3CHc2mVUbW29FucM221epVq1UnrT41JXu2LKN2prM5y+TyluOl7zSbbSsWi6pM2uqyf1qVmZyatEplXOZv+Hu5nGxMkTX9nlZ79b2UysqqLemM6j/d/vA+tqGeprYViyWbrFb8vCb20WcZlZFSucV0ym3d1DUbsl9af2PiquqcycjG2YZlUiWrT3IdfVefV70dsquunWvSn2HcNDVOsqWSNdX2DHZXHxvf0fsNtTGtPmTsNHU+BqfO6ZxZMVtUUfzdVP1kS/1L6fOs/rXV6OpExRo1lcX4U119PGSz3t8t+kJ1qWvMDA0P2cDihd5OFWN5jbWKyuxUP9Vlz7aqNKVx2eDyExrj4zUrlXqsldc46ypZvrOk/ktZQddpjk3a1PCInX3Vpad9v2mMfW+AFUNDQ7Z7924fzMmRWCCxQGKBxAKJBRILJBZILJBYIL
@yosssi
yosssi / .vimrc
Created July 1, 2014 00:36
.vimrc
set rtp+=/usr/local/go/misc/vim
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
exe "set rtp+=".globpath($GOPATH, "src/github.com/nsf/gocode/vim")
let g:gofmt_command = 'goimports'
set completeopt=menu
set number
set expandtab
set tabstop=2
set shiftwidth=2
"set paste
@yosssi
yosssi / features-of-go.md
Created June 25, 2014 22:46
Features of Go
  • Concurrency
    • Goroutine
    • sync package
  • Cross compile
  • New features from Go 1.3
@yosssi
yosssi / Better Errors with Rails 4
Created June 24, 2014 11:36
Better Errors with Rails 4
https://github.com/charliesome/better_errors/issues/210
@yosssi
yosssi / go-nginx.md
Last active August 7, 2024 20:10
Go networking performance vs Nginx

1. Nginx

$ wrk -t12 -c400 -d2s http://127.0.0.1:8080
Running 2s test @ http://127.0.0.1:8080
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.71ms    3.16ms  23.05ms   69.17%
    Req/Sec     3.44k     1.98k    7.80k    58.22%
  63697 requests in 2.00s, 17.86MB read
@yosssi
yosssi / 01_normal.go
Created June 19, 2014 12:24
BoltStore benchmark
func (s *Store) save(session *sessions.Session) error {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
err := enc.Encode(session.Values)
if err != nil {
return err
}
data, err := proto.Marshal(shared.NewSession(buf.Bytes(), session.Options.MaxAge))
if err != nil {
return err
package store
import (
"fmt"
"github.com/boltdb/bolt"
)
// reap removes sessions older than a given duration.
// This function assumes that all session data is stored in a "sessions" bucket