Skip to content

Instantly share code, notes, and snippets.

export default function createReducer (initialState, handlers) {
return function reducer (state = initialState, action) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action)
} else {
return state
}
}
}
declare module 'react-router-dom' {
import * as React from 'react'
import { History, Action, Location, MemoryHistoryBuildOptions } from 'history'
type RenderFn = (props: RouteProps | { match?: Match, history: History }) => JSX.Element
type GetUserConfirmationFn = (message: string, callback: (result: boolean) => void) => void
interface Match {
path: string
url: string
{
"extends": ["tslint:latest", "tslint-react"],
"rulesDirectory": ["node_modules/tslint-eslint-rules/dist/rules"],
"rules": {
"adjacent-overload-signatures": true,
"array-type": [true, "array-simple"],
"interface-name": [true, "never-prefix"],
"jsx-alignment": true,
"jsx-curly-spacing": [true, "never"],
"jsx-no-lambda": true,
package main
import (
"bytes"
"fmt"
"path/filepath"
"testing"
)
// -------
@gerardmrk
gerardmrk / fp.css
Last active February 16, 2017 03:16
PostCSS Fluid Properties Mixin
/*
Original implementation: http://www.adrenalinmedia.com.au/the-agency/insights/this-changes-everything-css-fluid-properties.aspx
*/
@define-mixin fp $property, $min, $max, $start: 320, $end: 1920, $clip: true, $clipAtStart: true, $clipAtEnd: true {
$multiplier: resolve(($max - $min) / ($end - $start) * 100);
$adder: resolve(($min * $end - $max * $start) / ($end - $start));
$formula: calc($(multiplier)vw + $(adder)px);
@if $clip == true and $clipAtStart == true {
@gerardmrk
gerardmrk / random-mov.sh
Created September 28, 2015 01:25
This script will help any data-hoarders who have an external full of movies and are indecisive about what movies to pick and watch on the weekends
#!/usr/bin/env bash
GLOBALIGNORE="*srt";
a=(/Volumes/movies/*);
b=${a[$((RANDOM % ${#a[@]}))]};
if [ -d $b ]; then
c=($b/*);