Skip to content

Instantly share code, notes, and snippets.

View teppeis's full-sized avatar

Teppei Sato teppeis

View GitHub Profile
@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();
@teppeis
teppeis / gist:cc2b7adb501ace8ca7ab
Last active August 29, 2015 14:16
#error_handling_sushi 基調講演

基調講演

いま思い出した論点

  • JSでエラー処理どうしてる?
  • カスタムError(Errorの継承)ってクロスブラウザきつくないですか?
  • Error投げてると、非同期のsetTimeoutとかで吸収されちゃってつらくないですか?
  • それブラウザの話?Nodeの話?
  • そもそもブラウザJSで例外、エラーってどんなものがある?
  • Promiseのエラー処理ベストプラクティスとは?
@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
// Options: --proper-tail-calls
"use strict";
var cache = {};
function fib(n) {
return fib_(n, _ => _);
}
function fib_(n, callback) {
if (n === 0) return callback(0);

条件3のreturn Promise.resolve()はあっても無くても実行結果は変わらない。

function asyncFunc(msg, callback) {
  setTimeout(function() {
    console.log(msg);
    callback();
  }, 0);
}
@teppeis
teppeis / private.xml
Last active December 8, 2016 12:49
Karabiner settings for Microsoft Remote Desktop
<?xml version="1.0"?>
<root>
<appdef>
<appname>MicrosoftRDC</appname>
<equal>com.microsoft.rdc.mac</equal>
</appdef>
<symbol_map type="KeyCode" name="RDC_VK_HOME" value="0x73"/>
<symbol_map type="KeyCode" name="RDC_VK_END" value="0x77"/>
<item>
<name>Microsoft Remote Desktop App v8.0.14+</name>
@teppeis
teppeis / closure-compiler-help.txt
Created February 4, 2016 17:01
Closure Compiler Help (v20160201)
--angular_pass : Generate $inject properties for
AngularJS for functions annotated
with @ngInject
--assume_function_wrapper : Enable additional optimizations based
on the assumption that the output
will be wrapped with a function
wrapper. This flag is used to
indicate that "global" declarations
will not actually be global but
instead isolated to the compilation
@teppeis
teppeis / test.js
Last active February 16, 2016 17:51
TypeScript + power-assert + ES6 Modules issue http://qiita.com/wadahiro/items/5d8a81252f2105112339
// generated .js
var power_assert_1 = require('power-assert');
var _1 = require('../');
describe('foo', function () {
it('test #1', function () {
power_assert_1.default.ok(_1.default() === 2);
});
});
@teppeis
teppeis / closure-compiler-v20160619-set-subclass.js
Created July 10, 2016 16:14
closure compiler output: Set is subclassable
var $jscomp = {scope:{}, getGlobal:function(a) {
return "undefined" != typeof window && window === a ? a : "undefined" != typeof global ? global : a;
}};
$jscomp.global = $jscomp.getGlobal(this);
$jscomp.initSymbol = function() {
$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol);
$jscomp.initSymbol = function() {
};
};
$jscomp.symbolCounter_ = 0;
@teppeis
teppeis / es-module-http2.md
Last active August 7, 2017 23:51
ES ModulesはHTTP/2で部分更新の夢を見るか?