Skip to content

Instantly share code, notes, and snippets.

View insin's full-sized avatar
⚠️
Cannot read property 'status' of undefined

Jonny Buchanan insin

⚠️
Cannot read property 'status' of undefined
View GitHub Profile
@insin
insin / app.js
Last active May 30, 2023 19:52
Checking size of importing all of React Router
import React from 'react'
import {render} from 'react-dom'
import 'react-router'
let App = React.createClass({
render() {
return <div>
<h1>Hello world!</h1>
</div>
code[class*="language-"],
pre[class*="language-"] {
color: #F8F8F2;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
@insin
insin / LICENSE
Last active May 30, 2023 19:52
hn-api-cache - manages a live cache of stories and their comment threads from the Hacker News Firebase API (https://github.com/HackerNews/API)
Copyright (c) 2016, Jonny Buchanan
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@insin
insin / nwb.config.js
Last active May 30, 2023 19:52
Config file used to get the app from https://www.fullstackreact.com/articles/react-tutorial-cloning-yelp hot loading, testing and building with the in-development version of https://github.com/insin/nwb
var path = require('path')
var isDev = process.env.NODE_ENV === 'development'
var isTest = process.env.NODE_ENV === 'test'
var config = {
type: 'react-app',
babel: {
stage: 0,
loose: 'all'
@insin
insin / Consumer.js
Created May 26, 2016 12:21 — forked from iammerrick/Consumer.js
A React component that computes the ratio based on the width or height of a given container.
import { FluidRatio } from './FluidRatio';
<FluidRatio>
{(width, height) => (
<div style={{ width, height }}>This will be a ratio of 3/4 with a width of whatever container it is rendered into.</div>
)}
</FluidRatio>
@insin
insin / wiiclassic-mayflash.cfg
Created April 29, 2016 17:20
MAME controller configuration for Wii Clasic Controller/Classic Controller Pro using the Mayflash USB adapter
<mameconfig version="10">
<system name="default">
<!--
Wii Classic Controller/Classic Controller Pro with Mayflash USB adapter
BUTTON1: X
BUTTON2: A
BUTTON3: B
BUTTON4: Y
BUTTON5: ZL
@insin
insin / README.md
Created February 8, 2016 19:42 — forked from rgrove/README.md
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the
@insin
insin / README.md
Last active December 28, 2015 12:51
React component styles

Different ways to create React components, served up with react-heatpack.

git clone https://gist.github.com/insin/02103c862ed3622f8b8b react-component-styles
cd react-component-styles
npm install
npm start

Then point your browser at http://localhost:3000

@insin
insin / README.md
Last active December 22, 2015 09:21
A Babel 6 transform which finds default argument mandatory() calls and inserts argument index and name

A Babel 6 transform which finds mandatory() calls which are the default expression for named function parameters and inserts parameter index and name information.

Based on this discussion on Twitter

Try it out in AST Explorer by selecting Transform → babelv6 from the top menu.

Sample code:

function mandatory(argPosition, name) {
@insin
insin / README.md
Last active February 14, 2017 15:40
React Form Play

Messing about with a different way to implement the validation in this component and things got out of hand because forms.

git clone https://gist.github.com/insin/49040037bbb6cd99faf7 react-form-play
cd react-form-play
npm install
npm start

Then point your browser at http://localhost:3000