This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { setObservableConfig } from 'recompose' | |
| import { from, to } from 'rxjs' | |
| setObservableConfig({ fromESOBservable: from, toESObservable: to }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Fragment } from 'react' | |
| import PropTypes from 'prop-types' | |
| import { render } from 'react-dom' | |
| import { from, to, of } from 'rxjs' | |
| import { switchMap, map, startWith, tap, catchError } from 'rxjs/operators' | |
| import { | |
| compose, | |
| mapPropsStream, | |
| createEventHandler, | |
| withState, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { PageWrapper, ListContainer, ListItem, Loader, UserContainer } from './styledComponents' | |
| const IndexPage = ({ status, userList, selectedUser, userSelect, message, match, history }) => { | |
| const userParam = get(match, 'params.user') | |
| if (selectedUser) { | |
| userParam !== selectedUser.user && history.push(`/${selectedUser.user}`) | |
| } | |
| return ( | |
| <PageWrapper> | |
| <UserContainer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { compose, withState, withHandlers } from 'recompose' | |
| import { withRouter } from 'react-router-dom' | |
| const StreamIndex = compose( | |
| withState('userList', 'updateUserList', []), | |
| withHandlers({ setUserList: ({ updateUserList }) => users => updateUserList(state => users) }), | |
| withRouter, | |
| load, | |
| selectUser | |
| )(IndexPage) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| withHandlers({ | |
| setUserList: ({ updateUserList }) => users => updateUserList(state => users), | |
| addLike: ({ updateUserList }) => (user, like) => addUserLike(user, like), | |
| addDislike: ({ updateUserList }) => (user, dislike) => addUserDislike(user, dislike), | |
| deleteLike: ({ updateUserList }) => (user, like) => | |
| deleteUserLike(user, like.id).then(() => | |
| updateUserList(state => [ | |
| ...state.map(i => { | |
| if (i.user === user) { | |
| i.likes = i.likes.filter(i => i.id !== like.id) |
OlderNewer