Skip to content

Instantly share code, notes, and snippets.

View dmachat's full-sized avatar

Drew Machat dmachat

View GitHub Profile
Transmitting file data .......................................svn: E165001: Commit failed (details follow):
svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:
[ERROR] 3672:15:invalid property id
[ERROR] 3672:16:syntax error
[ERROR] 3673:19:syntax error
[ERROR] 3674:15:syntax error
@dmachat
dmachat / README.md
Last active August 29, 2015 14:24
Datamaps with U.S. Counties
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 {
// 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 }
*/
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,
};
export default function(data) {
return {
type: 'ADD_DATA',
data,
};
}
@dmachat
dmachat / README.md
Last active April 21, 2016 17:32
Map click + updateChoropleth bug
@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
@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 / 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) {