Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shinout's full-sized avatar
🏠
Working from home

Shin Suzuki shinout

🏠
Working from home
View GitHub Profile
@shinout
shinout / chi-square-value.js
Created July 30, 2018 14:59
Calculate chi square values from n x m table
function chiSquareValue(values, separateBy = 2) {
if (values.length % separateBy !== 0) {
throw new Error(`Illegal separation rule. values.length ${valus.length} cannot be divided by ${separateBy}.`)
}
const sum = values.reduce((acc, val) => acc + val, 0)
const rowSums = []
const colSums = []
return values.reduce((chiSq, val, i) => {
const row = Math.floor(i / separateBy)
const col = i % separateBy
/**
* @param {number} n: 正n角形
* @param {number} r: 正n角形の中心から頂点への距離
* @return Array<{x: number, y: number }>: 座標
*/
function getRectanglePoints(n, r) {
// canvasに書かれる
const thetaUnit = Math.PI * 2 / n
const points = []
@shinout
shinout / cureapp_quiz.js
Last active March 16, 2017 12:22
次のコードは警告が出ます。何行目が原因?#cureapp_quiz をつけてtweetしよう!
1 import React from 'react'
2 import { AppRegistry, StyleSheet, Text, View } from 'react-native'
3 const styles = StyleSheet.create({
4 container: {
5 flex: 1,
6 justifyContent: 'center',
7 alignItems: 'center',
8 color: '#000000',
9 backgroundColor: '#F5FCFF',
10 },
@shinout
shinout / babel-register.js
Last active July 28, 2016 06:52
babel-register.js
module.exports = require('babel-register')({
ignore: /node_modules\/(?!memo-switch)/
})
@shinout
shinout / README-ja.md
Last active July 20, 2016 06:30
npm-v3-shrinkwrap-bug Raw

状況

  • using npm v3.10.3
  • このパッケージはdependenciesを持たない
  • このパッケージはdevDependenciesとしてreapp-uiを持つ

npm shrinkwrapで期待される結果

npm-shrinkwrap.json は依存モジュール情報を持たない

実際の結果

npm shrinkwrap.jsonはいくつか依存モジュールを持ってしまっている

@shinout
shinout / README-ja.md
Last active July 20, 2016 06:31
npm-v2-shrinkwrap-bug

状況

  • using npm v2.15.5
  • このpackageはnode-fetchに依存
  • このpackageはis-streamにdevDependenciesとして依存
  • node-fetchencodingis-streamに依存

期待される結果

npm-shrinkwrap.jsonnode-fetch, encodingおよびis-streamを含む。

@shinout
shinout / xxx.md
Created July 16, 2016 01:26
xxx.md

Main1

脂肪肝と診断されて

宮崎浩さん(41)は、大手家電メーカーに勤めるサラリーマン。妻と5歳になる子供がいます。最近の悩みは、忙しい仕事、子育て、それに...自分の健康のこと。 実は浩さん、会社の健康診断で「脂肪肝」と診断されたばかりなのです。

「肝臓の数値が高く、脂肪肝になっています。食事に気をつかって、 もっと運動をし、体重を落とすことですね。」

@shinout
shinout / nca-cli.js
Created May 26, 2016 14:24
nca-cli.js
#!/usr/bin/env node
var fs = require('fs')
var NOT_INSTALLED = [
'-------------------------------------------------------------------',
' node-circleci-autorelease is not installed locally.\n',
' npm install --save-dev node-circleci-autorelease\n',
' If already isntalled, make sure you are in the project root.',
'-------------------------------------------------------------------'].join('\n')
@shinout
shinout / prescription-code-operation.js
Created May 17, 2016 18:07
更新系operationのサーバーサイドの実装
"use strict";
// @flow
//
import LifecycleManagementOperation from './lifecycle-management-operation'
/**
* 患者に処方コードを付与するOperation
*
* @extends LifecycleManagementOperation: 更新系Operation
*/

smoking_cessation_domainの使い方の手引き

ドメインFacadeをつくる

domain = require('smoking_cessation_domain').createInstance
    baseURL: 'http://localhost:3000/api'
    sessionId: 'xxxxxxxxxx'
    debug: true