This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function killEvent(fn) { | |
return function _killEvent(event) { | |
event.preventDefault() | |
event.stopPropagation() | |
return fn(event) | |
} | |
} | |
export function onChangeEvent(cb, isEnabled = true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Func} from 'tcomb' | |
import {ReactNode, propTypes} from 'tcomb-react' | |
import React from 'react' | |
import events from 'add-event-listener' | |
const findDOMNode = React.findDOMNode | |
export default class OutsideClick extends React.Component { | |
_localNode = null | |
static propTypes = propTypes({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function todos(state = [], action) { | |
switch (action.type) { | |
case ADD_TODO: | |
return [...state, { | |
text: action.text, | |
completed: false | |
}]; | |
case COMPLETE_TODO: | |
return [ | |
...state.slice(0, action.index), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
type BaseAction = { | |
type: string | |
} | |
type ReduxReducer<TState, TAction> = (state: TState, action: TAction & BaseAction) => TState | |
class Reducer<TState, TAction> { | |
reduce: ReduxReducer<TState, TAction>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type {ReducerFn} from '../../../decorators' | |
import {generateReducer} from '../../../decorators' | |
class Action {} | |
class TodoAddMultipleAction extends Action {} | |
class TodoAddMultipleErrorAction extends Action {} | |
class TodoAddErrorAction extends Action {} | |
class TodoCompleteErrorAction extends Action {} | |
class TodoDestroyErrorAction extends Action {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type {ReducerFn} from '../../../decorators' | |
import {generateReducer} from '../../../decorators' | |
class Action {} | |
class TodoAddMultipleAction extends Action {} | |
class TodoAddMultipleErrorAction extends Action {} | |
class TodoAddErrorAction extends Action {} | |
class TodoCompleteErrorAction extends Action {} | |
class TodoDestroyErrorAction extends Action {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cubietruck automatic lirc device detection by Igor Pecovnik | |
str=$(cat /proc/bus/input/devices | grep "H: Handlers=sysrq rfkill kbd event" | awk '{print $(NF)}') | |
sed -i 's/DEVICE="\/dev\/input.*/DEVICE="\/dev\/input\/'$str'"/g' /etc/lirc/hardware.conf | |
# /etc/lirc/hardware.conf | |
# | |
#Chosen Remote Control | |
REMOTE="devinput" | |
REMOTE_MODULES="" | |
REMOTE_DRIVER="devinput" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Socket = { | |
create(url: string): Observable; | |
} | |
type PostAueryArg = { | |
id: string; | |
} | |
type Comment = { | |
id: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TodoItemModel = { | |
id: string; | |
title: string; | |
} | |
export default function TodoItem( | |
item: TodoItemModel, | |
beginEditing: () => void, | |
endEditing: () => void, | |
editingItem: TodoItemModel, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// loads Model1 and Model2 by one request | |
loader(Loader12, deps), | |
// loads Model1 | |
loader(Loader1, deps), | |
// Loads Model2 | |
loader(Loader2, deps), | |
// Keep Model1 state and pending/error/success status, attach default loader | |
value(Model1, new Model1(), Loader1), |