I hereby claim:
- I am werediver on github.
- I am werediver (https://keybase.io/werediver) on keybase.
- I have a public key ASDVl2sxFUxEvo7PVGoMPO5s152IjIIoS-f3PkJ284jUJAo
To claim this, I am signing this object:
| // A lunar lander autopilot for https://lunar.unnecessarymodification.com/ | |
| function clamp(x, a, b) { | |
| return Math.min(Math.max(x, a), b); | |
| } | |
| function threshold(x, th) { | |
| return Math.abs(x) >= th ? x : 0; | |
| } |
| void main() { | |
| print(f(true).map((value) => value + 1)); | |
| print(f(false).map((value) => value + 1)); | |
| print([1, 2, 3].map((value) => "x ${value + 1}")); | |
| print([].map((value) => value + 1)); | |
| } | |
| // Methods like | |
| // map, flatMap / expand, filter / where, firstWhere, reduce, fold |
| void main() async { | |
| await variant1(); | |
| variant2(); | |
| print("xxx"); | |
| } | |
| Future<void> variant1() async { | |
| final result = await y(); | |
| // async gap | |
| print("y: $result"); |
| # Based on https://github.com/lima-vm/lima/blob/943c90b13e38be32777b8f25be17c2491bb1421f/examples/podman.yaml | |
| # | |
| # Allows connections to ports 80, 443 through non-loopback interfaces. | |
| # Example to use Podman instead of containerd & nerdctl | |
| # $ limactl start ./podman.yaml | |
| # $ limactl shell podman podman run -it -v $HOME:$HOME --rm docker.io/library/alpine | |
| # To run `podman` on the host (assumes podman-remote is installed): | |
| # $ export CONTAINER_HOST=$(limactl list podman --format 'unix://{{.Dir}}/sock/podman.sock') |
| // Resample into segments of random length | |
| // Run over primitives | |
| float seed = chf("seed"); | |
| float seg_len_min = chi("seg_len_min"); | |
| float seg_len_max = chi("seg_len_max"); | |
| float seg_padding = chf("padding"); | |
| if (seg_len_min <= 0 || seg_len_max < seg_len_min || seg_padding < 0) { | |
| error("Make sure 0 < seg_len_min <= seg_len_max and 0 <= seg_padding"); |
| enum AntGrammar: Grammar { | |
| enum Failure: Error { | |
| case invalidCodon | |
| } | |
| static func generate(_ rule: GenotypeIterating) throws -> String { | |
| return try prog(rule) | |
| } |
I hereby claim:
To claim this, I am signing this object:
| // CurryLight.swift | |
| func curry<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, U>(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25) -> U) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) -> (T11) -> (T12) -> (T13) -> (T14) -> (T15) -> (T16) -> (T17) -> (T18) -> (T19) -> (T20) -> (T21) -> (T22) -> (T23) -> (T24) -> (T25) -> U { | |
| return { (x1: T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) -> (T11) -> (T12) -> (T13) -> (T14) -> (T15) -> (T16) -> (T17) -> (T18) -> (T19) -> (T20) -> (T21) -> (T22) -> (T23) -> (T24) -> (T25) -> U in { (x2: T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) -> (T11) -> (T12) -> (T13) -> (T14) -> (T15) -> (T16) -> (T17) -> (T18) -> (T19) -> (T20) -> (T21) -> (T22) -> (T23) -> (T24) -> (T25) -> U in { (x3: T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) |
| // Swift 2.2 | |
| enum AccessLevel { | |
| case Default | |
| case Private | |
| case Internal | |
| case Public | |
| var asPrefix: String { | |
| switch self { |
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| // MARK: - Skeleton | |
| protocol StyleProtocol { | |
| func apply(to some: Any) | |
| } |