Skip to content

Instantly share code, notes, and snippets.

View ide's full-sized avatar
📈
My life is a hackathon

James Ide ide

📈
My life is a hackathon
View GitHub Profile
@ide
ide / gist:41a6530a0b606545c55f
Last active July 17, 2020 22:43
Moving Redux state mapper into a component
// Trying out a new syntax. It is:
//
// - not magical except for the DecoratedComponent bit
// - communicates that it returns props
// - ...that are computed from Redux data
// - resembles familiar functions like getInitialProps
// - nice aesthetically
@connect(data => X.DecoratedComponent.getDataProps(data))
export default class X extends React.Component {
@ide
ide / npm-shrinkwrap.json
Created June 24, 2015 19:06
React Native npm dependencies
{
"name": "react-native",
"version": "0.6.0",
"dependencies": {
"absolute-path": {
"version": "0.0.0",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/absolute-path/-/absolute-path-0.0.0.tgz"
},
"babel": {
@ide
ide / index.ios.js
Last active September 1, 2015 00:39
Redux batching example with React Native
/**
* Batched updates test with Redux. You will need React 0.6.0 and a .babelrc:
{
"whitelist": [
"es6.parameters.default",
"es7.decorators"
]
}
*/
'use strict';
@ide
ide / JSDomEnvironment.js
Last active August 29, 2015 14:22
Using <script> tags to evaluate code in jest
/**
* Copyright (c) 2014, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var FakeTimers = require('./lib/FakeTimers');
@ide
ide / gist:1740856
Created February 4, 2012 22:53
Parse tree for ThrowStatement without semicolon
{
name: 'ThrowStatement',
source: 'function x() {\n throw 5\n}',
range: {
location: 17,
length: 8
},
children: [{
name: 'THROW',
source: 'function x() {\n throw 5\n}',