This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(sprite, spriteContainer) { | |
| var spriteMouseDowns = Observable.fromEvent(sprite, "mousedown"), | |
| spriteContainerMouseMoves = Observable.fromEvent(spriteContainer, "mousemove"), | |
| spriteContainerMouseUps = Observable.fromEvent(spriteContainer, "mouseup"), | |
| spriteMouseDrags = | |
| // For every mouse down event on the sprite... | |
| spriteMouseDowns. | |
| flatMap(function() { | |
| return spriteContainerMouseMoves; | |
| }).takeUntil(spriteContainerMouseUps); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(sprite, spriteContainer) { | |
| // All of the mouse event sequences look like this: | |
| // seq([ {pageX: 22, pageY: 3423, offsetX: 14, offsetY: 22} ,,, ]) | |
| var spriteMouseDowns = Observable.fromEvent(sprite, "mousedown"), | |
| spriteContainerMouseMoves = Observable.fromEvent(spriteContainer, "mousemove"), | |
| spriteContainerMouseUps = Observable.fromEvent(spriteContainer, "mouseup"), | |
| // Create a sequence that looks like this: | |
| // seq([ {pageX: 22, pageY:4080 },,,{pageX: 24, pageY: 4082},,, ]) | |
| spriteMouseDrags = | |
| // For every mouse down event on the sprite... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Unsafe.Coerce | |
| y :: (a -> a) -> a | |
| y = \f -> (\x -> f (unsafeCoerce x x))(\x -> f (unsafeCoerce x x)) | |
| -- Ref: [Y Combinator in Haskell](http://stackoverflow.com/questions/4273413/y-combinator-in-haskell) | |
| -- a fibonacci example | |
| main = putStrLn $ show $ y (\fact -> \n -> if n < 2 then 1 else n * fact (n - 1)) 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Wire.h> | |
| #include <Bridge.h> | |
| #include <YunServer.h> | |
| #include <YunClient.h> | |
| // Yun server | |
| YunServer server; | |
| void setup() { | |
| // Join i2c bus (address optional for master) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Wire.h> | |
| // Motor pins | |
| int speed_motor1 = 6; | |
| int speed_motor2 = 5; | |
| int direction_motor1 = 7; | |
| int direction_motor2 = 8; | |
| // Sensor pins | |
| int distance_sensor = A0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM resin/rpi-raspbian | |
| MAINTAINER Justin Lin <[email protected]> | |
| # Basic tools | |
| RUN apt-get -qq update && \ | |
| apt-get -qqy install wget && \ | |
| apt-get -qqy install vim && \ | |
| apt-get -qqy install unzip && \ | |
| apt-get -qqy install git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Oracle Java 8 Dockerfile | |
| # | |
| # https://github.com/dockerfile/java | |
| # https://github.com/dockerfile/java/tree/master/oracle-java8 | |
| # | |
| # origin: https://github.com/dockerfile/java/blob/master/oracle-java8/Dockerfile | |
| # modified by: Wei Lin | |
| # date: 2015/9/2 | |
| # Pull base image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sshd | |
| # VERSION: 0.0.2 | |
| # origin: | |
| # MAINTAINER Sven Dowideit <[email protected]> | |
| # https://docs.docker.com/examples/running_ssh_service/ | |
| # | |
| # modified by: Wei Lin | |
| # date: 2015/9/2 | |
| # Pull base image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM armv7/armhf-ubuntu:14.04 | |
| MAINTAINER Justin Lin <[email protected]> | |
| ENV TERM linux | |
| # Basic tools | |
| RUN apt-get -qq update && \ | |
| apt-get -qqy install wget && \ | |
| apt-get -qqy install vim && \ | |
| apt-get -qqy install unzip && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prolog … 快速排序法 … 白話版… XD | |
| /* | |
| * [] 附加 Result 的 結果為 Result | |
| */ | |
| append([], Result, Result). | |
| /* | |
| * Tail 附加 Other 的結果為 Subappend => [Head | Tail] 附加 Other 的結果為 [Head | Subappend] | |
| * |