Skip to content

Instantly share code, notes, and snippets.

View teppeis's full-sized avatar

Teppei Sato teppeis

View GitHub Profile
@teppeis
teppeis / install-ricty.sh
Last active June 16, 2021 11:37
Install Ricty font for Ubuntu
#!/bin/sh
sudo apt-get install fontforge fonts-inconsolata
mkdir -p ~/.fonts
TMPDIR=$(mktemp -d /tmp/ricty-XXXXX)
cd $TMPDIR
wget http://iij.dl.sourceforge.jp/mix-mplus-ipa/59022/migu-1m-20130617.zip
@teppeis
teppeis / gist:cc2b7adb501ace8ca7ab
Last active August 29, 2015 14:16
#error_handling_sushi 基調講演

基調講演

いま思い出した論点

  • JSでエラー処理どうしてる?
  • カスタムError(Errorの継承)ってクロスブラウザきつくないですか?
  • Error投げてると、非同期のsetTimeoutとかで吸収されちゃってつらくないですか?
  • それブラウザの話?Nodeの話?
  • そもそもブラウザJSで例外、エラーってどんなものがある?
  • Promiseのエラー処理ベストプラクティスとは?
@teppeis
teppeis / bench.js
Last active August 29, 2015 14:16
typescript-simple benchmark vs. coffee-script
var fs = require('fs');
var TS = require('typescript-simple').TypeScriptSimple;
var cs = require('coffee-script');
var tss = new TS({noImplicitAny: true});
var sample1 = fs.readFileSync('./sample1.ts', {encoding: 'utf8'});
var sample2 = fs.readFileSync('./sample2.ts', {encoding: 'utf8'});
// warm up
var start = new Date().getTime();
/// <reference path="typings/node/node.d.ts" />
/// <reference path="typings/typescript/typescript.d.ts" />
import ts = require("typescript");
import fs = require("fs");
import path = require("path");
function transform(contents: string, libSource: string, compilerOptions: ts.CompilerOptions = {}) {
// Generated outputs
var outputs = [];
@teppeis
teppeis / gist:c50743a60832560aa1df
Last active April 29, 2023 15:04
Break the Web: Object staticメソッドがES6で仕様変更になった件について

Break the Web: Object static methods no longer throw errors for primitives!

Object.keys等のstaticメソッドがES6で挙動が変わったことで面倒なことになってる話

何が変わったか

ES5でプリミティブを受け取ると例外を投げていたObject.keys等のメソッドが、ES6では例外を吐かなくなった。

  • Object.getPrototypeOf ( O )
  • Object.getOwnPropertyDescriptor ( O, P )
@teppeis
teppeis / gist:a48558a71a98d6bee6c9
Last active April 8, 2017 11:37
最近のFlowtype事情とReact+Flowtype連携

最近のFlowtype事情とReact+Flowtype連携

2015/01/15時点の情報です。

最近のFlowtype事情

v0.1.3が計画されてるけど、initial releaseのv0.1.0からはbugfixや細かな修正がほとんどで、大きな進化はしてない。 コミットもあまり活発ではない。 もしかしたら、Facebook社内でprivateブランチを育てていてまとまったところで出してくるのかも。 (JS等に比べて)開発者人口の少ないOCaml実装というのも、プルリクが集まりにくくOSS的な加速的進化が起きにくい原因かもしれない。

@teppeis
teppeis / gist:5284739aa1c6823b2ea9
Created January 12, 2015 07:56
Object static methods that accept non object arguments in ES6
@teppeis
teppeis / gist:54cc85137e6b581a6f95
Last active May 18, 2017 02:35
Promise/非同期のテストを簡単にする新しいアサーションヘルパーのご紹介

Promise/非同期のテストを簡単にする新しいアサーションヘルパーのご紹介

この前のブログ記事見た人はごめん。

Promise/非同期のテストは難しい

どこが間違ってるか分かります?

@teppeis
teppeis / io.js.v0.12-370e821.txt
Last active August 29, 2015 14:11
ES6 compat table node v0.10 (w or w/o --harmony) vs. node v0.11 (w or w/o --harmony) vs. io.js v0.12 (370e821) https://docs.google.com/spreadsheets/d/1NM_zGzTODZt6pCW4mCB8c74KuyZLXhxUnGfQIHh5KD4/edit?pli=1#gid=0
✘ proper tail calls (tail call optimisation)
▼ arrow functions
✘ 0 parameters
✘ 1 parameter, no brackets
✘ multiple parameters
✘ lexical "this" binding
✘ "this" unchanged by call or apply
✘ can't be bound, can be curried
✘ lexical "arguments" binding
✘ no line break between params and =>
@teppeis
teppeis / gist:5c6a5ab42dd7d5a9930a
Created November 25, 2014 08:10
BrowserStack browsers
[
{
"browser_version": "11.1",
"device": null,
"browser": "opera",
"os_version": "Mavericks",
"os": "OS X"
},
{
"browser_version": "11.6",