Skip to content

Instantly share code, notes, and snippets.

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@kkazuo
kkazuo / cohttp_ssl_version.ml
Created March 15, 2017 15:25
cohttp with async_ssl : If you get SSL handshake error, specify version of ssl_config
open Core.Std
open Async.Std
module Http = Cohttp_async
let ssl_config =
Conduit_async.Ssl.configure ~version:Tlsv1_2 ()
let main key () =
Http.Client.get Uri.(of_string key) ~ssl_config >>= fun (res, body) ->
@rchaser53
rchaser53 / uniontype.js
Created February 25, 2017 13:23
continueとreturnでのunion typeの挙動
// for文内のcontinueはNG
const abc = (arg: (string | number)[]) => {
for (let i=0;i<arg.length;i++) {
if (typeof arg[i] === 'string') continue;
const abc: number = arg[i];
}
}
// if文のearly returnはOK
const abc2 = (arg: (string | number)[]) => {
@ryo33
ryo33 / ja.md
Last active June 4, 2018 06:56
ReduxでMiddlewareを使ってサクッと解決する

はじめに

これはredux-middlewaresの紹介です。

Middlewareについて

Middlewareがどのようなものかついては、非常に分かりやすい記事があるのでそれを貼っておきます。
http://qiita.com/kuy/items/57c6007f3b8a9b267a8e
僕がMiddlewareを活用するようになったのは、この記事を読んでからです。

@ryo33
ryo33 / 1.md
Last active January 4, 2017 00:14
redux-thunk and redux-middlewares

gaearon/redux-thunk

These examples are not completely compatible about whether to call next(action).

incrementAsync

redux-thunk

function incrementAsync() {
@8th713
8th713 / redux-saga_v0.14.x.js
Last active February 24, 2018 00:46
redux-saga 0.14.3 flowtype definitions
declare type ReduxSaga$Predicate<T> = (arg: T) => boolean;
declare interface ReduxSaga$Task {
isRunning(): boolean;
isCancelled(): boolean;
result(): any;
result<T>(): T;
error(): any;
done: Promise<any>;
cancel(): void;
'use strict'
import pluralize from 'pluralize'
import ApiRequest from 'lib/ApiRequest'
import { SubmissionError } from 'redux-form'
const ADD_API_RESOURCE = '@api/ADD_RESOURCE'
const REMOVE_API_RESOURCE = '@api/REMOVE_RESOURCE'

NES emulator development guide

Overview of document

@ryo33
ryo33 / saga-relay.js
Last active October 18, 2016 12:35
function* relay(request, relayChannel, nextChannel) {
const result = yield call(request)
yield put(relayChannel, [result, nextChannel])
}
function* runSequencially(requestChannel, resultChannel) {
let head = channel()
let tail = head
while (true) {
const { request, relayResult } = yield race({