(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.
(function () { | |
var makeCallback = function(eventType, observer) { | |
if (eventType === 'value') { | |
return function(snap) { | |
observer.onNext(snap); | |
}; | |
} else { | |
return function(snap, prevName) { | |
// Wrap into an object, since we can only pass one argument through. | |
observer.onNext({snapshot: snap, prevName: prevName}); |
(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.
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicReadGetObject", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": [ | |
"s3:GetObject" | |
], |
/** | |
* If have any hooks that use Remix hooks, this helper will save you headaches | |
*/ | |
import { createRemixStub } from "@remix-run/testing"; | |
import { renderHook } from "@testing-library/react"; | |
const renderRemixHook = <T,>(callback: () => T) => { | |
const RemixStub = ({ children }: PropsWithChildren) => { | |
const Remix = createRemixStub([ |
When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.
I like to follow working example code so this is how the boilerplate will look like:
import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))
import Http
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
// F#'s "pipe-forward" |> operator | |
// | |
// Also "Optional-chaining" operators |>! and |>& | |
// | |
// And adapters for standard library map/filter/sorted | |
infix operator |> { precedence 50 associativity left } | |
infix operator |>! { precedence 50 associativity left } | |
infix operator |>& { precedence 50 associativity left } | |
infix operator |>* { precedence 50 associativity left } |
export type PerformanceServerTimings = Record< | |
string, | |
Array<PerformanceServerTiming> | |
> | |
/** | |
* Run this on the server to get a `time` function that can be used to time | |
* server-side operations and add them to the `Server-Timing` header. | |
*/ | |
export function getServerTiming() { |