Skip to content

Instantly share code, notes, and snippets.

View chranderson's full-sized avatar
👋

Chris Anderson chranderson

👋
  • Denver, Colorado
View GitHub Profile
// src/container/form1.js
// when i add a file to this input, it triggers the FORM2 reducer's case: redux-form/CHANGE' and calls function in FORM2.
<input type="file" {...fileField}/>
// src/redux/modules/form1.js
export default function reducer(state = initialState, action = {}) {
switch (action.type) {
case FILE_SELECTED:
return {....}
}
import React, { Component, PropTypes } from 'react';
import {reduxForm} from 'redux-form';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as dataMapActions from 'redux/modules/dataMap';
import {updateFieldMap} from 'redux/modules/dataMap';
@connect(
state => ({
fieldMap: state.dataMap.fieldMap,
@chranderson
chranderson / gist:72194f8bf58b78660cbe
Created October 29, 2015 15:08
Push new objects to array upon DATA_SUCCESS action from api get request
const initialState = {
fieldMap = []
}
// take result, push objects to fielMap array
const createFieldMap = (result, fieldMap, fieldMapMade) => {
if (!fieldMapMade) {
result.headers.map((key, index) => {
const cardIndex = index;
const samplesArr = [];
@chranderson
chranderson / gist:f9c391f8dbfc5c924694
Created September 29, 2015 16:30 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*