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 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 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 _ = 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 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 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 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 from 'react'; | |
import PropTypes from 'prop-types'; | |
import { | |
compose, | |
withHandlers, | |
withState, | |
setStatic, | |
setPropTypes | |
} from 'recompose'; | |
import { View } from 'react-native'; |
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 { lensPath, view } from 'ramda'; | |
const complexObject = { level1: { level2: { prop1: 1, prop2: 2 } } }; | |
const prop1Lens = lensPath(['level1', 'level2', 'prop1']); | |
console.assert(view(prop1Lens, complexObject) === 1); |
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
var byMonth = R.groupBy(R.prop('Month')); | |
var byAuthor = R.groupBy(R.prop('Author')); | |
var royalty_key = 'Royalty (SUM)'; | |
var months_keys = R.uniq(R.map(R.prop('Month'), data)).sort(); | |
var monthly_revenue = | |
R.map((group) => | |
R.reduce((acc, record) => acc + parseMoney(record[royalty_key]), 0, group), | |
byMonth(data)); |
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
var R = require('ramda'); | |
var states = [ | |
{symbol: 'CT', name: 'Connecticut', pop: 3574097}, | |
{symbol: 'ME', name: 'Maine', pop: 1328361}, | |
{symbol: 'MA', name: 'Massachusetts', pop: 6547629}, | |
{symbol: 'NH', name: 'New Hampshire', pop: 1316470}, | |
{symbol: 'RI', name: 'Rhode Island', pop: 1052567}, | |
{symbol: 'VT', name: 'Vermont', pop: 623741}, | |
]; |
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 R from 'ramda' | |
const mergePlan = (x, y) => { | |
if(Array.isArray(x) && Array.isArray(y)) { | |
return R.uniq(R.concat(x, y)); | |
} | |
if(typeof x === 'object' && typeof y === 'object'){ | |
return R.mergeWith(mergePlan, x, y) | |
} |
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 {prop, compose, apply, defaultTo, juxt} from 'ramda' | |
const player = { | |
id: 1, | |
name: 'Bnaya', | |
file: { | |
img: 'http://foo.bar/bnaya-zil.png' | |
} | |
} |
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
'use strict'; | |
var R = require('ramda'); | |
var CATEGORIES = [ | |
{category_type: 'cuisine', id: 1, name: 'French', type: 'categroy'}, | |
{category_type: 'diets', id: 2, name: 'Vegetarian', type: 'category'} | |
]; | |
var children = { |