Skip to content

Instantly share code, notes, and snippets.

View kenichi-shibata's full-sized avatar
🇯🇵
working

Kenichi Shibata kenichi-shibata

🇯🇵
working
View GitHub Profile
const counter = (state = 0, action) => {
switch(action.type){
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
@kenichi-shibata
kenichi-shibata / Redux-Counter-2.js
Created November 26, 2015 01:29
Redux Counter using store.dispatch store.subscribe (createStore) https://jsbin.com/voyehoq/edit?html,js,output
const counter = (state = 0, action) => {
switch(action.type){
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
};
@kenichi-shibata
kenichi-shibata / react-redux-counter.html
Created November 26, 2015 03:37
Simple Counter Using React Redux
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://fb.me/react-0.14.0.js"></script>
<script src></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.min.js"></script>
<script src="https://fb.me/react-dom-0.14.0.js
"></script>
<title>React-Redux First Touch :)</title>
@kenichi-shibata
kenichi-shibata / counter-test.html
Created November 26, 2015 04:42
using deep freeze to test if the states are mutating
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Avoiding mutations</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
</head>
<body>
@kenichi-shibata
kenichi-shibata / handler.js
Created January 6, 2016 01:36 — forked from jeffrafter/handler.js
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@kenichi-shibata
kenichi-shibata / merge_to_master.sh
Created March 11, 2016 05:58 — forked from tkawachi/merge_to_master.sh
Merge develop to master and push it
#!/bin/bash
set -e
COMPANY_REMOTE=plucky
git fetch $COMPANY_REMOTE
git checkout master
git reset --hard $COMPANY_REMOTE/master
git merge --no-ff $COMPANY_REMOTE/develop
@kenichi-shibata
kenichi-shibata / redux-demo.js
Created March 15, 2016 02:51 — forked from logzh/redux-demo.js
redux-demo
redux-demo
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
https://developer.atlassian.com/blog/2015/11/scripting-with-node/
@kenichi-shibata
kenichi-shibata / node-and-npm-in-30-seconds.sh
Created May 6, 2016 01:12 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh