Skip to content

Instantly share code, notes, and snippets.

View jem-computer's full-sized avatar
🌈

Jem jem-computer

🌈
View GitHub Profile

Flatten / Unflatten

So I'm trying to calculate the cartesian product of object's properties

const style = {
  fontFamily: ['helvetica', 'comic sans'],
  fontWeight: [300, 700],
}

const expected = [
import expect from 'expect';
import { flatten, unflatten } from 'src/flatten';
describe('Flatten', () => {
it('flattens an object, prefixed by original keys', () => {
const input = {
foo: {
bar: 'baz',
qux: 'zip',
},

Backpack criteria.todo

  • All black, no tacky logos
  • Laptop sleeve
  • Not too officey for hiking or cycling; not too outdoorsy for commuting
  • Waterproofish
  • External water bottle pocket (negates GoRucks etc)
  • ~20-25L
    • small enough to be a personal item on a plane
    • big enough for day-to-day use
  • Doesn't make you look like an accountant
/* @flow */
import { compose, contains, filter, forEach, flip, map, prop } from 'ramda';
type TypekitFont = {
descriptors: {
featureSettings: string,
subset: string,
unicodeRange: string,
weight: number,
},
/* @flow */
import type { Action, AppState, StyleProp } from '../../Types';
import { append, compose, equals, init, last, lensPath, over, reject, set,
update, view } from 'ramda';
const UNDO = 'UNDO';
export function undo(): Action {
return {
type: UNDO,
data: true,
import { compose, countBy, divide, filter, groupBy, head, last, toLower, map, prop, sum, values } from 'ramda';
const sumValues = compose(sum, values);
export function countByFrom(input) {
return compose(
map(countBy(last)),
groupBy(head),
filter((x) => {
return x.length > 1;
import expect from 'expect';
import { countByFrom, probablize } from 'src/MarkovMatrix';
describe('MarkovMatrix', () => {
it('counts by from-state', () => {
const input = [
['foo', 'bar'],
['foo', 'bar'],
['foo', 'bar'],
['foo', 'baz'],
@jem-computer
jem-computer / ShareButton.jsx
Created May 17, 2016 16:54 — forked from jamesslock/ShareButton.jsx
ReactJS Share Buttons
import React, { PropTypes } from 'react';
import Button from '../components/Button.jsx';
import Icon from '../components/Icon.jsx';
module.exports = React.createClass({
render: function () {
const {
className,
classNameIcon,
children,
viewBookList bookList =
bookList
|> List.map viewBook
|> div [ class "container" ]
viewBookList bookList =
div
[ class "container" ]
(List.map viewBook bookList)