Skip to content

Instantly share code, notes, and snippets.

View ryo33's full-sized avatar

Ryo Hirayama ryo33

View GitHub Profile

Narrative

ストーリー駆動開発のためのシンプルなライブラリ

概要

Narrativeは、Rustのトレイトで表現されたストーリーに基づいてソフトウェアの全体または一部を開発するためのライブラリです。主にE2Eテスト用に設計されていますが、そのシンプルさから様々な用途に対応できます。

目標

@ryo33
ryo33 / nnnp.md
Created November 10, 2023 03:52
Neovim No-Nonsence Protocol

"Neovim No-Nonsence Protocol" (NNNP)

I'd like to propose "Neovim No-Nonsence Protocol" as the working name for this project to help our discussion. It can also be used as the official name when releasing it if no nice names are found.

Use Cases

  • image preview
  • inline preview of latex expression in a markdown file
  • minimap.
  • color picker.
for i <- 2..10000 do
spawn(fn ->
# `rem(a, b)` returns the remainder of a / b.
Dispatcher.listen(Pattern.new(fn x -> x > i and rem(x, i) == 0 end))
receive do
x -> IO.puts("#{x} is not a prime number because #{x} is divisible by #{i}")
end
end)
end
# Things to prepare
alias Cizen.Dispatcher
alias Cizen.Pattern
require Pattern
# Dispatch something
Dispatcher.dispatch(10)
Dispatcher.dispatch({:ok, %{body: "Hello World"}})
# Listens numbers less than 10.
@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 ->
@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 / 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 / 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 / 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 / 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