Skip to content

Instantly share code, notes, and snippets.

@kuy
kuy / routes.js
Last active January 4, 2017 18:03
const routes = {
'/posts': {
'/:id': function* show({ params: { id } }) {
yield call(loadPost, id); // Wait for loading data
yield PostShow; // Component change
},
'/:id/edit': [function* edit({ params: { id } }) {
yield call(loadPost, id); // Wait for loading data
yield PostEdit;
}, function* dirtyCheck() {
@kuy
kuy / takeFromChannels.js
Last active January 11, 2017 03:18
take event from multiple channels
// From https://github.com/kuy/redux-tower/commit/9619bb7f65f147640ee8e15ecc8d26dae1b537fd#diff-f38699c88139ae09699a6830074a2af5R30
function takeFromChannels(channels) {
return race(
Object.keys(channels)
.map(name => ([name, channels[name]]))
.reduce((prev, [name, ch]) => ({ ...prev, [name]: take(ch) }), {})
);
}
/* @flow */
type FN = (x: string) => number;
type FS = (x: number) => string;
type F = FN & FS; // Intersection types
declare var toS: FS;
declare var toN: FN;
declare var toF: F;
@kuy
kuy / union.js
Last active January 9, 2017 10:30
/* @flow */
type FN = (x: string) => number;
type FS = (x: number) => string;
type F = FN | FS; // Union types
declare var toS: FS;
declare var toN: FN;
declare var toF: F;
/* @flow */
type A = { a: string };
type B = { b: number };
type U = A | B;
type I = A & B;
// Union types
({ a: 'a' }: U);

もうNativeOnly開発者はいらないのかもしれない

駄文

ReactNativeさえあればもうAndroid/iOS固有のスキルはいらないんじゃね?と思い始めてしまいました。

Qiita他を見る限り、Web専門の人が結構ReactNativeでアプリを組み始めている んですよね。

間違いなく自分のReactNativeより上手に組んでいるでしょう。

@kuy
kuy / flow.md
Last active January 29, 2017 06:11
Code reading of facebook/flow #1

Goal

Enumerate related modules when I execute flow check command.

Memo

src/flow.ml

ServerCommands.CheckCommand.command が呼び出される。

@kuy
kuy / timer.ml
Created April 2, 2017 15:12
Periodic timer using OCaml + Core + Async.
open Core.Std
open Async.Std
let rec timer () =
after (sec 5.)
>>= fun _ ->
print_endline "Hello";
timer ()
let _ =
// ...
"scripts": {
// ...
"build": "npm run build:tower && ./node_modules/.bin/webpack",
"build:tower": "./node_modules/.bin/babel ./node_modules/redux-tower/src --out-dir ./node_modules/redux-tower/lib --ignore __tests__",
// ...
},
// ...
"dependencies": {
// ...
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'app-build', '-f', 'Dockerfile.build', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['run', '-v', '/workspace/src:/app/src', '-v', '/workspace/build:/app/build', 'app-build']
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/foo/bar:v1', '.']
images:
- 'gcr.io/foo/bar:v1'