Skip to content
View rageofaxe's full-sized avatar
🎯
Focusing
🎯
Focusing

Block or report rageofaxe

Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse

Pinned Loading

  1. Effector's store for AsyncStorage Effector's store for AsyncStorage
    1
    import { Store, createEffect, createStore, forward } from "effector";
    2
    import AsyncStorage from "@react-native-async-storage/async-storage";
    3
    
                  
    4
    type LocalStore = <T>(key: string) => (value: T) => Store<T>;
    5
    
                  
  2. Ramda immutable queue Ramda immutable queue
    1
    const Queue = (list) => compose(
    2
      set(lensProp('get'),      always(list)),
    3
      set(lensProp('peek'),     always(head(list))),
    4
      set(lensProp('enqueue'),  (...elms) => Queue(concat(list, elms))),
    5
      set(lensProp('dequeue'),  (n = 1)   => Queue(drop(n, list)))
  3. ackermann function with ramda memoize ackermann function with ramda memoize
    1
    const ack = memoize((m, n) => cond([
    2
      [() => equals(m, 0),                () => inc(n)],
    3
      [() => and(gt(m, 0), equals(n, 0)), () => ack(dec(m), 1)],
    4
      [() => and(gt(m, 0), gt(n, 0)),     () => ack(dec(m), ack(m, dec(n)))]
    5
    ])(m, n))
  4. Functional fizzBuzz on ramda Functional fizzBuzz on ramda
    1
    const fizz = pipe(modulo(__, 3), equals(0))
    2
    const buzz = pipe(modulo(__, 5), equals(0))
    3
    
                  
    4
    const _cond = cond([[both(fizz, buzz), always("fizzbuzz")], 
    5
                        [buzz,             always("buzz")],