Skip to content

Instantly share code, notes, and snippets.

const build = () => {
const bundler = new Bundler(paths.appHtml, {
command: 'build',
outDir: paths.appBuild,
publicUrl: './',
cacheDir: './.parcelCache',
// Generate Source Maps for prod
sourceMaps: true,
});
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./favicon.ico">
</head>
<body>
<div id="root"></div>
<script src="../src/index.js"></script>
const mergeProps = ({assets, playerItemAssets, items, player}, dispatchToProps, props) => ({
assets,
playerItemAssets,
items,
player,
...dispatchToProps,
missingItemAssets: memoMissingAssets(assets, playerItemAssets),
playerMesh: {
verts: selectPlayerAnim(playerItemAssets, player.skeleton, assets),
count: (selectPlayerAnim(playerItemAssets, player.skeleton, assets).length / 12),
@bryzettler
bryzettler / firstArgSelector.js
Created September 18, 2017 20:35
First Arg Reselect
/* eslint-disable import/prefer-default-export */
// @flow
import { createSelectorCreator } from 'reselect';
const defaultEqualityCheck = (a, b) => (a === b);
/**
* A selector that will only change the output if the first argument has changed.
*/
export const firstArgSelector = createSelectorCreator(
// @flow
import React from 'react';
import {
Form,
Input,
Checkbox,
Radio,
Select,
Dropdown,
TextArea,
// Materialize
<NavBar
brand=node
children=node
className=string
left=bool
right=bool
fixed=bool
options=object // options for the sidenav
/>
// Materialize
<Input
s=number // ##########
m=number // Media query sizes
l=number // ##########
children=node
className=string
label=node
error=string
success=string
// Materialize
<Button
children=node
className=string
disabled=bool
flat=bool
large=bool
floating=bool
icon=string
onClick=func
const apiResponse = [
{first: 'Bob', favorite: 'The Clash'},
{first: 'Linda', favorite: 'Ramones'},
{first: 'Amy', favorite: 'The Clash'},
];
const friendConstants = ['Bob', 'Amy', 'James', 'Tiffany', 'Linda'];
friendConstants.reduce((acc, friend, idx, orgArray) => ({
// Check for friend in apiResponse
// if there pull them out otherwise we create a default objecct
const records = [
{ title: "The Clash", artist: "The Clash", type: "LP", lengthSec: 2220, released: "1977"},
{ title: "Rocket to Russia", artist: "Ramones", type: "LP", lengthSec: 1906, released: "1977"},
{ title: "London Calling", artist: "The Clash", type: "LP", lengthSec: 3903, released: "1979"},
{ title: "Ramones", artist: "Ramones", type: "LP", lengthSec: 1755, released: "1976"},
...etc
];
const removeIndexes = [1, 2];
records.reduceRight((acc, item, idx) => {