Skip to content

Instantly share code, notes, and snippets.

View JunKikuchi's full-sized avatar

Jun Kikuchi JunKikuchi

View GitHub Profile
@avieth
avieth / gist:334201aa341d9a00c7fc
Last active July 22, 2022 13:42
Interpreting Free Monads of Functor Sums
Interpreting Free Monads of Functor Sums
========================================
This text deals with a way to compose certain kinds of monads, thereby mixing
their capabilities. It is a literate Haskell file, so let's begin with a
bunch of noise.
> {-# LANGUAGE MultiParamTypeClasses #-}
> {-# LANGUAGE FlexibleInstances #-}
> {-# LANGUAGE FlexibleContexts #-}
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@tibbe
tibbe / ghc-clang-wrapper
Last active January 3, 2016 10:19 — forked from mzero/ghc-clang-wrapper
Strip -nodefaultlibs flag to avoid warning This removes this warning: clang: warning: argument unused during compilation: '-nodefaultlibs'
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@mzero
mzero / ghc-clang-wrapper
Created October 31, 2013 06:53
This wrapper script *should* enable GHC 7.* to work on systems with Xcode 5. To use it, drop this script somewhere, make it executable, and run.... Then follow the instructions it prints out. What it will do is, instruction you to put a copy in /usr/bin, then re-run it sudo. It will then find all your GHC 7 settings files, and patch them to make…
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@Gab-km
Gab-km / whyILeftHeroku.rst
Last active December 30, 2022 10:56
何故私は Heroku から離れたか、および新しい AWS セットアップのメモ

何故私は Heroku から離れたか、および新しい AWS セットアップのメモ

原著者:Adrian Holovaty
原文:Why I left Heroku, and notes on my new AWS setup

金曜日、私は Heroku から Amazon Web Services(AWS) を直接使うように Soundslice を移行しました。私はこの変更ができてとても、そうとても嬉しくて、私がどうやったかということと、もし皆さんが同じような立場だったら何故それを検討すべきかということについて広く伝えたいと思います。

@okapies
okapies / promises-are-functional.md
Last active August 14, 2023 11:44
翻訳: ”命令型のコールバック、関数型のプロミス: Node が逸した最大の機会” by James Coglan

命令型のコールバック、関数型のプロミス: Node が逸した最大の機会

Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan

Translated by Yuta Okamoto (@okapies)

Note

  • 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
  • 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
@repeatedly
repeatedly / msgpack_issue_121.md
Last active November 30, 2021 02:09
MessagePackが文字列とバイナリをわけないのは問題?

MessagePackが文字列とバイナリをわけないのは問題?

msgpack/msgpack#121

Objective Cの実装使ってるとある問題にぶちあたった.なので,文字列をちゃんとバイナリ(Raw)と分けるべき,という提案

(*) 俺は熟読したわけではないので,中身が気になる人はちゃんと本スレを読みましょう

そもそもMessagePackとは

@kyanny
kyanny / gist:5010650
Last active December 14, 2015 01:59
msgpack/msgpack#121を3行でまとめるブログ

まともなまとめがあったのでそちらをご覧ください

MessagePackが文字列とバイナリをわけないのは問題?
https://gist.github.com/repeatedly/5011298

  • おい!おれの Python/ObjC なコードで msgpack 使うとなんかデータを復元できないんですが?バイト列か文字列か不明な場合が考慮されてないのが原因なんだから UTF-8 な文字列型を仕様に盛り込んでください
  • いやそれ特定の言語でしか起こらない問題だしプロトコル仕様はミニマムであるべきだよね?でも折衷案として文字列型を新しく定義する代わりに型ヒントを表すバイトを付与できるようにしたらどうかな?
  • JSON-like を謳うなら JSON と同じようにしろとか IETF に仕様を提案したらどうかとかオレが言いたいのはそういうことじゃねーよ文化の違いだ黙れジャップどもとか大いにモメた後、主要な開発者陣が具体的な仕様を議論し始めるも引き続き外野が水掛け論で延焼中(イマココ
@posaunehm
posaunehm / gist:4087971
Last active March 26, 2021 19:24
Why OO Sucks by Joe Armstrong
@ysk1031
ysk1031 / glicko_test.rb
Created August 10, 2012 05:44
glicko algorithmのテスト
# coding: utf-8
my_rating_0 = 1500.0 # ユーザーのレーティング初期値
my_rd_0 = 350.0 # ユーザーのRD初期値
rating_question = []
rd_question = []
result = []
# 問題のRD, Rating, 結果30回分を設定