Skip to content

Instantly share code, notes, and snippets.

View okunishinishi's full-sized avatar

Taka Okunishi okunishinishi

View GitHub Profile
@okunishinishi
okunishinishi / file0.txt
Last active October 31, 2018 22:53
Webページの認証を1行の記述だけでやってみる ref: https://qiita.com/okunishinishi@github/items/7353cd3d7f2cdae7ff4f
(prompt('合言葉は?') !== 'たこやき') && document.write('だめだこりゃ')
@okunishinishi
okunishinishi / file0.js
Last active March 4, 2019 10:35
婚活において積極的行動が必要な理由をGSアルゴリズムで検証してみる ref: https://qiita.com/okunishinishi@github/items/b26a1293dd510a302f37
const shuffle = require('shuffle-array')
function defineMembers (memberCount = 10) {
const men = shuffle(new Array(memberCount).fill(null).map((_, i) => ({
name: `man#${i}`,
rejectedBy: [], // 自分を拒否した異性の名前
likes: [], // 好みの異性
})))
const women = shuffle(new Array(memberCount).fill(null).map((_, i) => ({
name: `woman#${i}`,
@okunishinishi
okunishinishi / gs-example01.js
Last active November 27, 2017 02:56
Gale–Shapley algorithm for Stable marriage problem
#!/usr/bin/env node
/**
* Gale–Shapley algorithm for Stable marriage problem
*
* https://en.wikipedia.org/wiki/Stable_marriage_problem
* http://toyokeizai.net/articles/-/11584
*/
'use strict'
@okunishinishi
okunishinishi / file0.js
Last active May 9, 2017 13:57
Reduxを使ってちゃんとしたアプリをちゃんと作るのがあまりに面倒なんでなんとかしてなんとかする方法を模索してみた ref: http://qiita.com/okunishinishi@github/items/5c4860d3be8cbcc59286
function createCounterWithNamedType(counterName = '') {
return function counter(state = 0, action) {
switch (action.type) {
case `INCREMENT_${counterName}`:
return state + 1;
case `DECREMENT_${counterName}`:
return state - 1;
default:
return state;
}
@okunishinishi
okunishinishi / file0.txt
Last active April 17, 2017 02:46
[SUGOS] チュートリアル07 - Hubを冗長化する ref: http://qiita.com/okunishinishi@github/items/1fbd70b315fc1baae34c
mkdir sugos-tutorial-06
cd sugos-tutorial-06
npm init -y
@okunishinishi
okunishinishi / file0.txt
Last active April 17, 2017 01:57
[SUGOS] チュートリアル06 - Observerを使ってみる ref: http://qiita.com/okunishinishi@github/items/256e997d124abf527bb2
mkdir sugos-tutorial-06
cd sugos-tutorial-06
npm init -y
@okunishinishi
okunishinishi / file0.txt
Last active February 13, 2017 09:32
[SUGOS] チュートリアル05 - ActorやCallerを認証する ref: http://qiita.com/okunishinishi@github/items/b981528e91b31d4c42dc
mkdir sugos-tutorial-05
cd sugos-tutorial-05
npm init -y
@okunishinishi
okunishinishi / file0.txt
Last active February 13, 2017 04:25
[SUGOS] チュートリアル04 - Moduleをnpmパッケージ化する ref: http://qiita.com/okunishinishi@github/items/2c5f4f5fbd57fbb7c3e2
# Install as global module
npm install -g sugo-scaffold
# Show version to check if the installation succeeded
sugo-scaffold --version
@okunishinishi
okunishinishi / file0.txt
Last active February 7, 2017 06:43
[SUGOS] チュートリアル03 - Browser間でやり取りする ref: http://qiita.com/okunishinishi@github/items/52206755d6fb0d3e844e
mkdir sugos-tutorial-03
cd sugos-tutorial-03
npm init -y
@okunishinishi
okunishinishi / file0.txt
Last active February 7, 2017 06:44
[SUGOS] チュートリアル02 - Event Emitしてみる ref: http://qiita.com/okunishinishi@github/items/a25e5b89cf7505302b13
mkdir sugos-tutorial-02
cd sugos-tutorial-02
npm init -y