Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Taiju Muto tai2

Block or report user

Report or block tai2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View crawler.go
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
View tree_comparison.go
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
//type Tree struct {
// Left *Tree
// Value int
View through2_spy.d.ts
/// <reference types="node" />
declare module 'through2-spy' {
import stream = require('stream');
function through2_spy(transform?: SpyFunction): stream.Transform;
type SpyFunction = (this: stream.Transform, chunk: any) => void;
export = through2_spy;
View rot13.go
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
View rot13.go
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
View word_count.go
import "strings"
func WordCount(s string) map[string]int {
counts := make(map[string]int)
words := strings.Fields(s)
for _, word := range words {
count, ok := counts[word]
if ok {
counts[word] = count + 1
} else {
@tai2
tai2 / errorLoggerMiddleware.ts
Created Apr 4, 2019
Dump stack trace to console when FSA contains an error.
View errorLoggerMiddleware.ts
import { Dispatch } from 'redux'
type ErrorAction = { payload: Error }
function isErrorAction(action: any): action is ErrorAction {
return (<ErrorAction>action).payload instanceof Error
}
const errorLoggerMiddleware = (store: any) => (next: Dispatch) => (
action: any
View me_and_python.md

2002: 出会い

エリック・レイモンドのハッカーになろうに感化されて、Pythonを使いはじめる。シンプルな構文やスライスの多機能さなどに魅了される。

2005: 遺伝的アルゴリズムによるSameGameソルバー(趣味)

大学で受講していた遺伝的アルゴリズムの講義で要求された自由課題として、Pygameを使ってSameGameを実装した上で、そのソルバーもPythonで実装した。評価関数の設計が良くなかったのか、スコアはあまり伸びなかった(ソースコード消失)。

2006: RSA公開鍵の実装(趣味)

View getVideoDuration.ts
export default function getVideoDuration(src: string): Promise<number> {
return new Promise((resolve, reject) => {
const video = document.createElement('video')
video.src = src
video.addEventListener('loadedmetadata', () => {
resolve(video.duration)
})
video.addEventListener('error', error => {
reject(error)
})
You can’t perform that action at this time.