Skip to content

Instantly share code, notes, and snippets.

View frontsideair's full-sized avatar

Fatih Altinok frontsideair

View GitHub Profile
@frontsideair
frontsideair / index.html
Last active February 7, 2017 07:24
Some ideas to make React component state management look more like redux
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- test here: https://esnextb.in/?gist=fa2b7e6775c242a76489c0ebc329ba7f -->
</head>
<body>
<div id="app"></div>
</body>
const Case = cases => (
pred => (
(typeof cases[pred] !== 'undefined') ? cases[pred]() : cases['_']()
)
)
const count = Case({
0: () => 'zero',
1: () => 'one',
_: () => 'many'
@frontsideair
frontsideair / paginated-selection.jsx
Last active January 4, 2016 19:51
Paginated selection table with custom select handler
'use strict';
import React from 'react';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
var products = [];
function addProducts(quantity) {
var startId = products.length;
for (var i = 0; i < quantity; i++) {