Skip to content

Instantly share code, notes, and snippets.

View dmachat's full-sized avatar

Drew Machat dmachat

View GitHub Profile
@dmachat
dmachat / timeframe-pages.js
Created February 12, 2018 18:46
segment data by timeframe
const timeframes = [
{
name: '1900-1920',
range: [timestamp, timestamp] // you could also parse this from the name
slug: 'timeframes/1900-1920',
},
...
];
function filterDataByTimeframe(range, data) {
@dmachat
dmachat / react-native-maps-enable-google-maps-manual-instructions.md
Last active November 22, 2018 17:04 — forked from heron2014/react-native-maps-enable-google-maps-instructions.md
Instructions for manually installing Google Maps for react-native-maps

Install Google Maps for iOS manually for react-native-maps

This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps

After installing react-native-maps from npm:

  1. Drag this folder node_modules/react-native-maps/lib/ios/AirGoogleMaps/ into your project, and choose Create groups in the popup window.

  2. In xcode, right click on Libraries -> Add files to [your project], and navigate to and add node_modules/react-native-maps/lib/ios/AirMaps.xcodeproj. Select Copy files is necessary and Create groups.

@dmachat
dmachat / withRoutes.js
Last active October 20, 2017 00:39
a simple store
class ParentComponent extends Component {
constructor(props) {
super(props);
this.state = {
data; // data lives here
};
this.setStore = this.setStore.bind(this);
}
// this gets called when the promise resolves in DataComponentOne
@dmachat
dmachat / gulpvwebpack.md
Last active August 18, 2016 21:30
gulp vs webpack initial

Compare gulp vs webpack production output after initial changeover to webpack

gulp webpack
build time 34-41s 16-24s
incremental build time 1-2s ~1s
bundle size 1.8M 924K
vendor bundle size N/A 776K
app.css size 97K 74K
export const ADD_DATA = ‘ADD_DATA’;
export const REMOVE_DATA = ‘REMOVE_DATA’;
export default function(data) {
return {
type: 'ADD_DATA',
data,
};
}
import addData from 'addData';
export default function inputController($scope, $ngRedux) {
// 'connect' returns an unsubscribe function, that we use when the directive is destroyed.
// values from the Redux store are bound to 'this' (or, the directive's scope),
// and updates on store updates
const disconnect = $ngRedux.connect((state) => {
return {
state: state.data,
};
// initial app state can be supplied (or bootstrapped) here
const defaultState = {
items: [],
};
/**
* @params
* state {object} - this is the current state of this branch of the store (store.data)
* action {object} - the instructions from the component, commonly { type, data }
*/
const template = `
<ul>
<li ng-repeat=”item in controller.state”>
{{ item.label }} - {{ item.value }}
</li>
</ul>`;
export default function renderController($scope, $ngRedux) {
const disconnect = $ngRedux.connect((state) => {
return {
@dmachat
dmachat / README.md
Last active April 21, 2016 17:32
Map click + updateChoropleth bug