Skip to content

Instantly share code, notes, and snippets.

View hiroppy's full-sized avatar
:electron:
focusing on my works

Yuta Hiroto hiroppy

:electron:
focusing on my works
View GitHub Profile
@hiroppy
hiroppy / translateHumanToCat
Last active August 29, 2015 14:07
ひらがな、英語を猫語に変換する
{'あ':'にょににゃぁにゅ'},
{'い':'にょににゃぁにゃぁ'},
{'う':'にょににゃぁにゃー'},
{'え':'にょににゃぁにゃわん'},
{'お':'にょににゃぁにゃーん'},
{'か':'にょににゃぁにゃーご'},
{'き':'にょににゃぁにゃーー'},
{'く':'にょににゃぁしゃ'},
{'け':'にょににゃあにゃ'},
@hiroppy
hiroppy / URLSearchParams.js
Last active March 24, 2017 10:31
WHATWG URL
const { URLSearchParams } = require('url');
const params = new URLSearchParams('foo=bar&hoge=fuga&foo=baz');
// URLSearchParams { 'foo' => 'bar', 'foo' => 'baz', 'hoge' => 'fuga' }
console.log(params.toString()); // foo=bar&foo=baz&hoge=fuga
params.sort();
// URLSearchParams { 'foo' => 'bar', 'foo' => 'baz', 'hoge' => 'fuga' }
console.log(params.toString()); // foo=bar&foo=baz&hoge=fuga
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
import { Request, Response } from 'express';
import * as React from 'react';
import { Provider } from 'react-redux';
import { renderToNodeStream, renderToStaticMarkup } from 'react-dom/server';
import { StaticRouter } from 'react-router-dom';
import { ServerStyleSheet } from 'styled-components';
import { HTML } from '../HTML';
import { Router } from '../../client/Router';
import { configureStore } from '../../client/store/configureStore';
import { rootSaga } from '../../client/sagas';
@hiroppy
hiroppy / index.ts
Last active July 6, 2021 08:12
polling using redux-saga
import { delay } from 'redux-saga';
import { put, take, race, call, cancel, takeEvery } from 'redux-saga/effects';
import { Upload, addJob, removeJob } from '../actions/job';
function* upload(action: Upload) {
try {
const { file, jobId: id } = action.payload;
yield put(addJob({ id }));
@hiroppy
hiroppy / saga.md
Last active July 13, 2020 04:44
redux-saga設計

構成要素

1. 一つの責務しか持たない saga

非同期イベントの場合は、success と failure を持ちます。

2. 1 を集めて処理のフローを定義する saga

基本的にこの saga が container からコールされます。(e.g. page のロード等)
ここでは複数の saga が処理順にかかれており、開始から終了までの処理が全て書かれることを想定します。

@hiroppy
hiroppy / resume.md
Last active November 11, 2021 14:15
履歴

サイト: https://hiroppy.me/

高校生の頃から少しプログラミング(JavaScript, C++)と主に PSP のためにハンダ付けを始める

2011

大学

  • 大学に入学する
  • 画像処理研究室に所属開始する
@hiroppy
hiroppy / permission.md
Last active May 9, 2019 17:51
list the permissions of my managed repository
@hiroppy
hiroppy / calc.js
Created May 19, 2019 01:17
Benchmarks: Compare es5 and es2015
const { readFile } = require('fs').promises;
(async () => {
const n = 3;
/**
1 middleware
5 middleware
10 middleware
15 middleware
@hiroppy
hiroppy / chat.mjs
Last active March 4, 2023 12:07
communicating with chatGPT
import * as readline from 'node:readline/promises';
import { stdin as input, stdout as output } from 'node:process';
const token = "your-token";
const messages = [];
const rl = readline.createInterface({ input, output });
rl.prompt();
rl.on('line', async (line) => {