Skip to content

Instantly share code, notes, and snippets.

View polytypic's full-sized avatar
⚠️

Vesa Karvonen polytypic

⚠️
  • Helsinki, Finland
View GitHub Profile
func lift<A1, A2, R>(_ f: @escaping (A1, A2) -> R) -> ((Observable<A1>, Observable<A2>) -> Observable<R>) {
return { (a1: Observable<A1>, a2: Observable<A2>) -> Observable<R> in
return Observable.combineLatest(a1, a2).map(f)
}
}
func lift<A, R>(_ f: @escaping (A) -> Observable<R>) -> ((Observable<A>) -> Observable<R>) {
return { (a: Observable<A>) -> Observable<R> in
a.flatMap(f)
}
(* Functors and modular implicits
* opam switch 4.02.0+modular-implicits
* eval `opam config env`
*)
module type FUNCTOR = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
let map {F : FUNCTOR} = F.map
@srdjan
srdjan / 100+ different counter apps...
Last active February 19, 2024 22:41
100+ different js counter apps...
100+ different js counter apps...

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@milankinen
milankinen / app.js
Last active November 3, 2015 12:40
Pekonimmmmehustelua
import React from "react"
import Bacon from "baconjs"
import {render} from "react-dom"
import liftVDOM from "./liftVDOM"
import combineAsComponent from "./combineAsComponent"
import Atom from "./atom"
function initApp() => {
@milankinen
milankinen / application.js
Created October 23, 2015 10:25
Bottom-up-MÖLLYKKÄ
import React from "react"
import {combineAsArray} from "baconjs"
import Counter from "./components/counter"
import BigList from "./components/bigList"
export default initialState => (
combineAsArray(Counter(initialState), BigList()).map(
([$counter, $list]) => (
<div>
<h1>Tsers!</h1>
@leque
leque / freer.ml
Last active September 30, 2021 07:44
Freer monad in OCaml
(*
Requirement: higher, ppx_deriving.show
*)
(*
Lightweight higher-kinded polymorphism
https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf
*)
open Higher
@prakhar1989
prakhar1989 / richhickey.md
Last active November 8, 2023 17:19 — forked from stijlist/gist:bb932fb93e22fe6260b2
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@gre
gre / easing.js
Last active April 23, 2024 04:20
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {