Skip to content

Instantly share code, notes, and snippets.

View teppeis's full-sized avatar

Teppei Sato teppeis

View GitHub Profile
@teppeis
teppeis / es-class-fields.md
Last active March 13, 2022 13:57
ES Class Fieldsのプライベートフィールドがハッシュな変態記法なのは何でなんだぜ?

ES Class Fields (Stage 2 now)

プライベートフィールドがハッシュな変態記法なのは何でなんだぜ?

class Point {
    #x;
    #y;
 constructor(x = 0, y = 0) {
@teppeis
teppeis / csp-github.txt
Created February 3, 2017 11:02
CSP Header of GitHub (2017-02-03)
Content-Security-Policy:
default-src 'none';
base-uri 'self';
block-all-mixed-content;
child-src render.githubusercontent.com;
connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com;
font-src assets-cdn.github.com;
form-action 'self' github.com gist.github.com;
frame-ancestors 'none';
img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com;
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@teppeis
teppeis / es-module-http2.md
Last active August 7, 2017 23:51
ES ModulesはHTTP/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 / 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-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 / 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>

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

function asyncFunc(msg, callback) {
  setTimeout(function() {
    console.log(msg);
    callback();
  }, 0);
}
// Options: --proper-tail-calls
"use strict";
var cache = {};
function fib(n) {
return fib_(n, _ => _);
}
function fib_(n, callback) {
if (n === 0) return callback(0);