Skip to content

Instantly share code, notes, and snippets.

View na2hiro's full-sized avatar
💽
Remix!

na2hiro na2hiro

💽
Remix!
View GitHub Profile
@na2hiro
na2hiro / README.md
Last active November 7, 2023 12:52
Sharing objects between custom server and Remix code (aka. Use socket.io in Remix) https://github.com/remix-run/remix/discussions/7454#discussioncomment-7498534

Candidates for name of the lib

  • namespaced-inputs
  • input-namespace
  • namespaced-fieldset
  • nested-input (nested-input*s* is taken)
  • uncontrolled-inputs

[lib name here] (README draft)

@na2hiro
na2hiro / Remix-request-cheatsheet.md
Last active March 18, 2024 02:42
Remix request cheatsheet
const fs = require('fs');
const {JKFPlayer} = require('json-kifu-format');
const {Iconv} = require("iconv");
let dir = "muso";
const result = [];
const sjisIconv = new Iconv("cp932", "utf-8");
fs.readdir(`./${dir}`, async (err, files) => {
@na2hiro
na2hiro / _ts4029_error_case
Last active August 29, 2015 14:25
TS4029 error case
$ sh ./run.sh
ts4029.ts(5,2): error TS4029: Public property 'mod' of exported class has or is using name '' from external module "mod" but cannot be named.
ts4029-another-variable.ts(6,2): error TS4029: Public property 'mod2' of exported class has or is using name '' from external module "mod" but cannot be named.
import mod = require('./mod');
console.log(mod.version);
@na2hiro
na2hiro / gist:f62246100f7bfece8815
Created January 31, 2015 18:03
Javaにおいてダウンキャストの代替となるパターンマッチ構文の一案
Number number = getNumber();
// before
if(number instanceof Integer){
((Integer)number).someIntegerMethod();
}else if(number instanceof Float){
((Float)number).someFloatMethod();
}
// after
match(number){
case Integer:
@na2hiro
na2hiro / gist:34fa77893a0775f18fd1
Last active August 29, 2015 14:09
スーパー正男JSブックマークレットお試し版
javascript:!function(){var s = document.createElement("script");s.src = "http://81.la/tmp/masao-bookmarklet-public.js";document.body.appendChild(s);}();void 0;
  • Canvasまさおについて
    • スーパー正男のJavaScript移植版,Javaを一切使いません.
    • 動かないところもいくつか
    • 手を加えないとIE以外では動きません.
    • RYOさんという方が開発されています. http://ux.getuploader.com/canvasmasao/
  • github上でのリポジトリ公開をお願いしました
@na2hiro
na2hiro / ICPC.js
Last active August 29, 2015 14:03
ICPC国内予選順位表 (http://icpcsec.storage.googleapis.com/icpc2014-domestic-live/standings.html) で突破チームをカラーリングするブックマークレット
//順位変動時に自動でカラーリングされる(つもり)
//http://icpc.iisf.or.jp/2014-waseda/domestic/selection/
//上記選抜ルールの手順2までです.
//ブックマークレット用
javascript:function showChosen(){console.log("show");var $teams = $("div.row li.team");var teamsByUniv = {};var chosenTeams = 0;for(var i=0; i<$teams.length; i++){var row = $teams[i];var univ = $("td.team-university", row).text();$(row).css("background-color", "");if(!teamsByUniv[univ])teamsByUniv[univ]=0;if(chosenTeams<5){if(teamsByUniv[univ]>=4) continue;}else if(chosenTeams<10){if(teamsByUniv[univ]>=3) continue;}else if(chosenTeams<20){if(teamsByUniv[univ]>=2) continue;}else if(chosenTeams<29/*26*/){if(teamsByUniv[univ]>=1) continue;}else{continue;}teamsByUniv[univ]++;chosenTeams++;$(row).css("background-color", "#ccc")}}var f = console.log.bind(console);console.log = function(arg){f(arg);if(arg=="Update success."){showChosen();}};showChosen();
//可読形式
function showChosen(){
console.log("show");
IFPH 3.1.4 m*nの評価に必要な評価ステップ数はいくつか.
ただし自然数及び加算,乗算は次の通り.
data Nat = Zero | Succ Nat
(+) :: Nat->Nat->Nat
m + Zero = m
m + Succ n = Succ (m+n)
(*) :: Nat->Nat->Nat
m * Zero = Zero
m * Succ n = (m*n)+m