Skip to content

Instantly share code, notes, and snippets.

View mytrile's full-sized avatar

Dimitar Kostov mytrile

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.

package main
import (
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"runtime"
### Keybase proof
I hereby claim:
* I am mytrile on github.
* I am mytrile (https://keybase.io/mytrile) on keybase.
* I have a public key whose fingerprint is FD68 DC90 6A12 D265 690F 0DE2 E2D7 B631 2BA4 2B0E
To claim this, I am signing this object:
require 'artoo'
connection :sphero, adaptor: :sphero, port: '4560'
device :sphero, driver: :sphero
work do
every(3.seconds) do
puts "Rolling..."
sphero.roll 60, rand(360)
end
@mytrile
mytrile / pr.md
Created August 30, 2013 07:18 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mytrile
mytrile / gist:6268806
Created August 19, 2013 12:54
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
$ brew link curl-ca-bundle
$ export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
@mytrile
mytrile / items.scala
Last active December 17, 2015 23:39
val Items = Map(
"01" -> Map(
"02" -> "Two",
"03" -> "Three",
"05" -> "Five",
"07" -> "Seven"
),
"02" -> Map(
"01" -> "One",
"08" -> "Eight"
private val productForm: Form[Product] = Form(
mapping(
"ean" -> longNumber.verifying(
"validation.ean.duplicate", Product.findByEan(_).isEmpty),
"name" -> nonEmptyText,
"description" -> nonEmptyText
)(Product.apply)(Product.unapply) // <- this shit right here
package main
import (
"unicode/utf8"
)
type Item string
type Stream chan Item
type Acc string
import org.vertx.java.core.Handler;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.deploy.Verticle;
public class Server extends Verticle {
public void start() {
vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
public void handle(HttpServerRequest req) {
String file = req.path.equals("/") ? "index.html" : req.path;
req.response.sendFile("webroot/" + file);