Skip to content

Instantly share code, notes, and snippets.

View ryo33's full-sized avatar

Ryo Hirayama ryo33

View GitHub Profile
@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 / share-api.md
Last active May 11, 2017 13:28
sha.herokuapp.com API
@ryo33
ryo33 / loop.ex
Created August 5, 2017 17:01
Spawn a new process with registering to a registry and receive messages continuously in Elixir
def register_handler(register_func, hander_func) do
spawn_link fn ->
register_func.()
for :ok <- Stream.cycle([:ok]) do
receive do
message -> handler_func.(message)
end
end
end
end
Section "InputClass"
Identifier "Ryo33 HHKB"
MatchProduct "Topre Corporation HHKB Professional"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
@ryo33
ryo33 / defobject
Last active December 16, 2017 15:07
Elixirで作る最高のゲームエンジン ref: https://qiita.com/ryo33/items/7288f5cdfde1c298e1f7
defmacro defobject(definition) do
quote do
json = unquote(definition) |> Poison.encode! |> Poison.decode!
case ExJsonSchema.Validator.validate(Zpids.Display.Object.schema, json) do
{:error, x} ->
raise inspect x
_ -> :ok
end
def definition, do: unquote(definition)
end
@ryo33
ryo33 / Router.js
Last active July 12, 2018 02:38
redux-pages
import React from 'react';
import { connect } from 'react-redux';
import { pageSelector } from './selectors.js';
import { taskPage, relaxPage } from './pages.js';
import TaskPage from './TaskPage.js';
import RelaxPage from './RelaxPage.js';
import ErrorPage from './ErrorPage.js';
const mapStateToProps = state => {
const page = pageSelector(state);
@ryo33
ryo33 / file0.txt
Last active December 2, 2018 01:22
食事する哲学者の問題 with Cizen ref: https://qiita.com/ryo33/items/3d3fc82cdcb929e0b9ec
mix new cizen_dining_philosophers
cd cizen_dining_philosophers
@ryo33
ryo33 / research.exs
Created June 7, 2020 08:34
Performance research for re-implementing Cizen.Dispatcher
defmodule Server do
use GenServer
def init(pid) do
{:ok, pid}
end
def handle_info({:DOWN, _ref, :process, _object, _reason}, state) do
{:stop, :normal, state}
end
@ryo33
ryo33 / README.md
Last active January 2, 2021 03:07
How to run erlyberly 20210102 Erlang OTP 23

1. Install JavaFX SDK

2. git clone Erlyberly

git clone https://github.com/andytill/erlyberly.git && cd erlyberly

3. Apply the patch

@ryo33
ryo33 / Elixir Basics.exs
Last active May 29, 2021 17:51
Primality Testing in Elixir using Cizen
# This is a comment.
# Allows you to use SomeModule with the long path.
alias Too.Long.Path.To.SomeModule
# This is needed for using macros in SomeModule.
require SomeModule
# Spawns a new process that prints a result of 1 + 1.
spawn(fn ->