Skip to content

Instantly share code, notes, and snippets.

View eiel's full-sized avatar

HIMURA Tomohiko eiel

View GitHub Profile
@eiel
eiel / birthdayDuration.mjs
Last active February 7, 2024 12:07
誕生日から何年何日経過したか計算する
function isLeapYear(year) {
if (year % 400 === 0) {
return true;
}
if (year % 100 === 0) {
return false;
}
if (year % 4 === 0) {
return true;
}
{
"plugins": [["@babel/plugin-proposal-decorators", { "version": "2021-12" }]]
}
@eiel
eiel / chatwork-api-swagger.yaml
Last active January 27, 2021 10:06
ChatWork APIのSwagger
swagger: '2.0'
info:
title: ChatWork API
version: v1
# the domain of the service
host: api.chatwork.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
<?php
namespace RadioControllerCar;
/* ラジコンの抽象クラス */
interface CarInterface
{
public function send($message);
}
function sleep(n) {
return new Promise(resolve => setTimeout(resolve, n));
}
(async () => {
console.log(Date.now());
await sleep(1000);
console.log(Date.now());
})();
@eiel
eiel / Gulpfile.js
Created September 8, 2018 16:51
gulp4 done returnのちがい
const { series, src, dest } = require('gulp');
const debug = require('gulp-debug');
function hoge1 () {
return src('src')
.pipe(debug({title: 'hoge1'}))
.pipe(dest('hoge'));
}
function hoge2 () {
return src('src')
@eiel
eiel / maybe.rb
Last active August 1, 2018 00:40
Ruby でモナドしてみる。
# >> を *
# >>= を bind
# return を self.new
# mplus を +
# mzero を self.zero
#
# に見立てて Maybe モナド書いてみた
# bind に渡す block で Maybe と書きたくないので第二引数に型情報を付加してみた。
class Monad
def *(m)
@eiel
eiel / hello.ipynb
Last active June 5, 2018 12:51
統計モデリング勉強会 環境構築 julia docker run --rm -p 8888:8888 -v "$HOME":/home/jovyan/work jupyter/datascience-notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eiel
eiel / hello.ipynb
Created June 5, 2018 12:37
統計モデリング勉強会 環境構築 docker run --rm -p 8888:8888 -v "$HOME":/home/jovyan/work jupyter/datascience-notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const { parseSchema } = require('json-schema-to-flow-type')
const schema = require('./opeanapi.json')
const flow = parseSchema(schema, {'http://json-schema.org/draft-04/schema': 'scheama.json'})
console.log(`// @flow\n\n${flow}`)