Skip to content

Instantly share code, notes, and snippets.

View jamestthompson3's full-sized avatar

jamestthompson3

View GitHub Profile
import { get } from 'lodash'
import { createEventHandler } from 'recompose'
const selectUser = mapPropsStream(props$ => {
const { stream: selected$, handler: userSelect } = createEventHandler()
return props$.pipe(
switchMap(props => {
const userInURL = get(props, 'match.params.user')
return selected$
.pipe(
const load = mapPropsStream(props$ =>
props$.pipe(
switchMap(props =>
from(fetchUsers()).pipe(
tap(res => console.log('response from fetchUsers', res),
map(users => ({ ...props, users, status: 'SUCCESS' })),
startWith({ status: 'REQUEST' })
)
),
catchError(() => ({ status: 'ERROR', message: 'Looks like our service is down' }))
import { from , to } from 'rxjs'
import { setObservableConfig, mapPropsStream } from 'recompose'
import { isEmpty } from 'lodash'
import { switchMap, map, startWith, tap, catchError } from 'rxjs/operators'
const load = mapPropsStream(props$ =>
props$.pipe(
switchMap(
props =>
isEmpty(props.userList)
@jamestthompson3
jamestthompson3 / setObservableConfig.js
Last active January 12, 2019 13:35
RXJS and recompose demo
import { setObservableConfig } from 'recompose'
import { from, to } from 'rxjs'
setObservableConfig({ fromESOBservable: from, toESObservable: to })
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@jamestthompson3
jamestthompson3 / doom-init
Created April 6, 2018 21:48
Doom init file
;;; init.el -*- lexical-binding: t; -*-
;; Copy me to ~/.doom.d/init.el or ~/.config/doom/init.el, then edit me!
(doom! :feature
(popup ; tame sudden yet inevitable temporary windows
+all ; catch all popups that start with an asterix
+defaults) ; default popup rules
;debugger ; FIXME stepping through code, to help you add bugs
eval ; run code, run (also, repls)
(evil +everywhere); come to the dark side, we have cookies