This file contains 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
// Async compose | |
const compose = (…functions) => input => functions.reduceRight((chain, func) => chain.then(func), Promise.resolve(input)); | |
// Functions fn1, fn2, fn3 can be standard synchronous functions or return a Promise | |
compose(fn3, fn2, fn1)(input).then(result => console.log(`Do with the ${result} as you please`)) |
This file contains 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 from 'react'; | |
import PropTypes from 'prop-types'; | |
import { | |
compose, | |
withHandlers, | |
withState, | |
setStatic, | |
setPropTypes | |
} from 'recompose'; | |
import { View } from 'react-native'; |
This file contains 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
/* | |
* Requires Node 8+ | |
* Works in chrome, simply copy and paste into console. | |
*/ | |
const R = require('ramda'); | |
const compose = | |
(...funcs) => | |
(...args) => | |
funcs.reduceRight(async (a, f) => { |
This file contains 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 from "react"; | |
import { pure, withReducer, compose, withHandlers, mapProps } from "recompose"; | |
import R from "ramda"; | |
import { createReducer } from "./utils"; | |
const ListItem = pure(({ text }) => <li>{text}</li>); | |
const renderItems = R.map(t => <ListItem key={t} text={t} />); | |
const ListComponent = ({ todos, name, updateName, addTodo }) => | |
<div> |
This file contains 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 _ = require('lodash') | |
const { Lokka } = require('lokka') | |
const { Transport } = require('lokka-transport-http') | |
const debug = require('debug')('Transport') | |
const client = new Lokka({ | |
transport: new Transport('https://api.graph.cool/simple/v1/graphcoolendpoint') | |
}) |
This file contains 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 from 'react'; | |
import { withState, pure, branch, renderComponent, compose } from 'recompose'; | |
import { gql, graphql } from 'react-apollo'; | |
// Define a very basic loading state component - you could make this | |
// a nice animation or something | |
const Loading = () => ( | |
<div>Loading</div> | |
); |
This file contains 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, { Component } from 'react'; | |
import { graphql } from 'react-apollo'; | |
import { MatchSummary, NoDataSummary } from '@mls-digital/react-components'; | |
import MatchSummaryQuery from './match-summary.graphql'; | |
const mapResultsToProps = ({ data }) => { | |
if (!data.match) | |
return { | |
loading: data.loading, | |
}; |
This file contains 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 { withRouter } from 'react-router'; | |
import { graphql } from 'react-apollo'; | |
import { compose, mapProps } from 'recompose'; | |
import jobListQuery from './jobList.graphql'; | |
function SomeBaseComponent() { | |
{/*... some component...*/} | |
} |
This file contains 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
#!/usr/bin/env bash | |
# Browse Ramda documentation in Terminal | |
# Requires jq and a tool such as fzf or peco for interactive filtering | |
LATEST="http://raine.github.io/ramda-json-docs/latest.json" | |
DOCS_URL="http://ramdajs.com/docs/" | |
json=$(curl -s $LATEST) | |
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end') |