(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| let map = (stream, functor) => | |
| Stream.from(_ => | |
| try Some(stream->Stream.next->functor) catch { | |
| | Stream.Failure => None | |
| } | |
| ) | |
| let keep = (stream, predicate) => | |
| Stream.from(_ => { | |
| let rec getNext = () => { |
| // Reproduced in TSX from blog :P https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/ | |
| export type ExampleAction1 = { | |
| type: 'ACTION' | |
| } | |
| export type ExampleAction2 = { | |
| type: 'ACTION2' | |
| } | |
| export type Action = ExampleAction1 | ExampleAction2; |
| // @flow | |
| /** | |
| * Copyright (c) 2019-present, Thanh Ngo. | |
| * | |
| * This source code is licensed under the license found in the | |
| * LICENSE file in the root directory of this source tree. | |
| */ | |
| // Example | |
| // const counter = flyd.stream() | |
| // const incCounter = () => counter(counter() + 1) | |
| // const FComp = ({counter, incCounter}) => <span onClick={incCounter}> {counter} </span> | |
| // connectStreams ({ | |
| // counter, | |
| // incCounter | |
| // })(FComp) | |
| // |
| import java.util.function.*; | |
| public class Lambda { | |
| public static void main(String[] args) { | |
| // In the object world of Java when everything is an object, you can't really pass function as "object." | |
| // | |
| // | |
| // | |
| // Unlike Java <1.8, Javascript allows you to have first-class functions or function as value which you can |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| INSTANCES=`aws ec2 describe-instances | grep InstanceId | awk '{ print $2 }' | tr -d '",'` | |
| for INSTANCE in $INSTANCES; do | |
| aws ec2 modify-instance-attribute --no-disable-api-termination --instance-id $INSTANCE | |
| aws ec2 terminate-instances --instance-ids $INSTANCE | |
| done |
| package edu.rutgers.cs431.teamchen.trafficgen; | |
| import edu.rutgers.cs431.TrafficGeneratorProto.Car; | |
| import edu.rutgers.cs431.TrafficGeneratorProto.GateAddress; | |
| import edu.rutgers.cs431.TrafficGeneratorProto.TimeRequest; | |
| import edu.rutgers.cs431.TrafficGeneratorProto.TimeResponse; | |
| import edu.rutgers.cs431.teamchen.util.SystemConfig; | |
| import java.io.IOException; | |
| import java.net.InetAddress; |
| // Package resloader loads resources and invokes a single callback for all packages | |
| // useful for checking availability of loaded resources on the fly or all at once | |
| package resloader | |
| import ( | |
| "errors" | |
| "path/filepath" | |
| "time" | |
| "github.com/gopherjs/gopherjs/js" |