Skip to content

Instantly share code, notes, and snippets.

Tsutomu Kawamura cognitom

Block or report user

Report or block cognitom

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
@cognitom
cognitom / jisx6004 romantable.txt
Created Jan 17, 2019 — forked from ytomino/jisx6004 romantable.txt
JIS-X-6004 for Google日本語入力
View jisx6004 romantable.txt
- -
~ 〜
〜~ ~
. 。
, 、
[ ち
] 」
{ 「
} 」
・. …
@cognitom
cognitom / quickstart.js
Last active Nov 12, 2019
Unspaghetti version of Google Spreadsheet API example code
View quickstart.js
import {readFile, writeFile, mkdir} from 'mz/fs'
import readline from 'mz/readline'
import promisify from 'es6-promisify'
import google from 'googleapis'
import googleAuth from 'google-auth-library'
import clientSecret from './client_secret.json'
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json
const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
@cognitom
cognitom / normalizeDate.js
Created Jan 30, 2017
openBDの日付フィールドのノーマライズ
View normalizeDate.js
function normalizeDate (raw) {
const patterns = [
// 2017-01-30
{re: /^\d{4}-\d{2}-\d{2}($|,)/, f: m => m[0]},
// 2017-01
{re: /^\d{4}-\d{2}($|,)/, f: m => m[0]},
// 2017
{re: /^\d{4}($|,)/, f: m => m[0]},
// 20170130
{re: /^(\d{4})(\d{2})(\d{2})($|,)/, f: m => `${m[1]}-${m[2]}-${m[3]}`},
@cognitom
cognitom / download.js
Last active Jan 29, 2017
openBDの全データを整形しつつ単一ファイルにダウンロード
View download.js
import {join} from 'path'
import {createWriteStream} from 'fs'
import request from 'request'
import {parse, stringify} from 'JSONStream'
import find from 'lodash.get'
import highland from 'highland'
const apiRoot = 'https://api.openbd.jp/v1'
const cwd = process.cwd()
const distFile = join(cwd, 'all.json')
@cognitom
cognitom / app.tag
Last active Jul 3, 2016
How to use postcss with Riot.js
View app.tag
<app>
<h1>Riot</h1>
<p>A React-like user interface micro-library.</p>
<style scoped type="external">
:scope {
display: block;
}
h1 {
border-bottom: 1px solid black;
@cognitom
cognitom / index.js
Created Jun 29, 2016
How to get [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] in JavaScript
View index.js
// ES6
[...Array(10).keys()]
Array(10).map((n, i) => i)
Array.from(Array(10).keys())
Array.from({ length:10 }, (v, i) => i)
// ES5
Array(10).map(function(n, i) { return i })
// Oldies
View riot+compiler.js
/* Riot WIP, @license MIT, (c) 2015 Muut Inc. + contributors */
;(function(window, undefined) {
'use strict'
var riot = { version: 'WIP', settings: {} }
// This globals 'const' helps code size reduction
// for typeof == '' comparisons
var T_STRING = 'string',
@cognitom
cognitom / .htaccess
Created Mar 31, 2015
Underscore2Hyphen
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*)_(.*) $1-$2 [N=10,DPI]
RewriteRule (.*) http://somewhere.dom/$1 [R=301]
</IfModule>
@cognitom
cognitom / file0.txt
Last active Aug 29, 2015
CommonJSフレンドリーな、Angularアノテーション ref: http://qiita.com/cognitom/items/c7b4ffcd26f87b66af8a
View file0.txt
// インジェクション方法 A
$injector.invoke(function(serviceA){});
@cognitom
cognitom / file0.html
Last active Aug 29, 2015
AngularとBrowserifyの微妙すぎる関係 ref: http://qiita.com/cognitom/items/1f5d82a4513af446cb57
View file0.html
<script src="bower_components/todomvc-common/base.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/todoCtrl.js"></script>
<script src="js/services/todoStorage.js"></script>
<script src="js/directives/todoFocus.js"></script>
<script src="js/directives/todoEscape.js"></script>
You can’t perform that action at this time.