Skip to content

Instantly share code, notes, and snippets.

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.

Step 1: 預浸

預浸需要 60 度 20ml 的水,注水結束之後等待 20 秒

Water Tank: 60 degress C
Command: wait 30s

Github 發 Pull Request & 貢獻流程速查

前言

此文目標讀者需先自行學會

  • 開 Github 帳號
  • 會 fork 程式 repository
  • 會在自己的電腦使用命令列 git
  • 會 clone 自己的 repository
@Swind
Swind / Example2.scala
Created April 26, 2011 08:12
用Java取得Google Tasks資訊(1) - Example 1
val TAKSKS_URL = "https://mail.google.com/tasks/r/d"
def getTasksQuery(authToken:String)={
//好用又邪惡的隱式轉換
implicit def tuplesToNameValuePair(s:Tuple2[String,String]) = new BasicNameValuePair(s._1,s._2)
val actionID = 1
val post = new HttpPost(TAKSKS_URL)
post.addHeader("AT","1")
post.addHeader("Cookie","GTL="+authToken)
@Swind
Swind / gist:946259
Created April 28, 2011 12:33
[Google][Task][JSon] Google Tasks - Get All List&Task - Post
{
"action_list" :
[
{
"action_id" : "1",
"action_type" : "get_all",
"get_deleted" : false,
"list_id" : "可以針對List ID取得資料,若不指定會取全部"
}
],
@Swind
Swind / test.scala
Created May 26, 2011 06:37
[Scala][Web] 伊莉文章的Parser
package rainy.maid.server.seeker
import java.util.ArrayList
import rainy.maid.server.domain.EneyPost
import scala.xml.NodeSeq
import scala.xml.{ XML, Node }
import de.hars.scalaxml._
import java.text.SimpleDateFormat
class eneySeeker(root: String, url: String) {
var nextPage = url
@Swind
Swind / gist:1035014
Created June 20, 2011 01:59
Android主專案的Ant build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="OpenSudoku" default="help">
<property file="local.properties" />
<property file="build.properties" />
<property file="default.properties" />
@Swind
Swind / build.sbt
Created July 23, 2011 00:59
sbt 0.11.0 build.sbt example
// Set the project name to the string 'My Project'
name := "SBTProject"
// The := method used in Name and Version is one of two fundamental methods.
// The other method is <<=
// All other initialization methods are implemented in terms of these.
version := "1.0"
//Add Repository Path
resolvers += "db4o-repo" at "http://source.db4o.com/maven"
@Swind
Swind / WebKitInABrowser.scala
Created September 13, 2011 00:11
[Scala][SWT][GUI] SWT使用WebKit核心的範例
package example.swt
import org.eclipse.swt.widgets.{Shell, Display}
import org.eclipse.swt.layout.FillLayout
import org.eclipse.swt.browser.Browser
import org.eclipse.swt.SWT
/**
* Date: 2011/9/2
* Time: 上午 8:20
@Swind
Swind / HttpDownloader.scala
Created September 16, 2011 01:10
[Scala][IO] 下載檔案
package example.http
import java.io._
import java.net.{HttpURLConnection, URL}
/**
* Date: 2011/9/16
* Time: 上午 8:37
*/