Skip to content

Instantly share code, notes, and snippets.

View kitsuyui's full-sized avatar
🐢

kitsuyui kitsuyui

🐢
View GitHub Profile
interface Point {
x: number;
y: number;
}
interface Vector {
x: number;
y: number;
}
@kitsuyui
kitsuyui / file0.txt
Last active November 17, 2018 08:36
トリビア: location.port = undefined すると port が 0 になるのなんでだろう ref: https://qiita.com/kitsuyui/items/0625a1eed6ceb36bbf63
while (IsASCIIDigit(value[port_end]) && port_end < length)
++port_end;
while (value[port_start] == '0' && port_start < port_end - 1)
++port_start;
// Required for backwards compat.
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23463
if (port_start == port_end)
return "0";
@kitsuyui
kitsuyui / dockerrun-jsen-schema.json
Last active September 21, 2018 06:21 — forked from sordina/dockerrun-jsen-schema.json
jsen schema to validate Dockerrun.aws.json files
{
"type": "object",
"properties": {
"AWSEBDockerrunVersion": {
"type": "integer",
"minimum": 1,
"maximum": 2
},
"authentication": {
"type": "object",
// I recently saw http://davidwalsh.name/detect-native-function tweeted by
// @elijahmanor and was pretty jazzed about it. One of my favorite JS tricks is
// detecting native methods. Detecting native methods is handy because third
// party code can shim methods incorrectly as seen in past versions of
// Prototype.js, es5-shim, & modernizr, which can cause your code to behave in
// unexpected ways. This isn't a knock against those projects, shimming is really
// really hard to get right. Shimmed methods may also lack the performance
// benefits of their native counterparts. Lo-Dash, Dojo, Ember, & YUI,
// to name a few, detect native methods to avoid shims and rely on their own
// fallback paths, trusting their code over third-party.
@kitsuyui
kitsuyui / requestIdleCallback.js
Created August 8, 2018 01:52 — forked from paullewis/requestIdleCallback.js
Shims rIC in case a browser doesn't support it.
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kitsuyui
kitsuyui / file1.txt
Last active July 15, 2018 08:00
Tips: 実行中のシェルスクリプトを書きかえるときには ref: https://qiita.com/kitsuyui/items/d0048eeaa50293a92a60
$ run.sh &
$ vim run.sh
(30 秒以内に foo を bar に変えて保存する)
bar
from functools import reduce
identity = lambda x: x
tranceduce_as_map = lambda mapper: lambda concat: lambda xs, x: concat(xs, mapper(x))
tranceduce_as_filter = lambda predicate: lambda concat: lambda xs, x: concat(xs, x) if predicate(x) else xs
compose = lambda f, g: lambda x: f(g(x))
compose_n = lambda *fns: reduce(compose, fns, identity)
@kitsuyui
kitsuyui / file0.txt
Last active December 29, 2017 07:53
netcat や nmap を使わずに bash だけでポートの開放をみたい場合のハック (横着) ref: https://qiita.com/kitsuyui/items/7d79fd8940d8910e3862
$ exec 7<> /dev/tcp/8.8.8.8/53
@kitsuyui
kitsuyui / file0.txt
Last active October 5, 2017 13:29
embulk の隠しコマンド embulk irb と embulk exec ref: http://qiita.com/kitsuyui/items/311d37637e47f0d75e2b
$ embulk irb
2017-10-04 23:49:33.706 +0900: Embulk v0.8.30
irb(main):001:0> p 'yay'
"yay"
=> "yay"
irb(main):004:0> 3.times {|i| print(i)}
012=> 3
@kitsuyui
kitsuyui / file0.txt
Last active October 4, 2017 15:23
Debian 系であえて古い APT パッケージをインストールする方法 ref: http://qiita.com/kitsuyui/items/d8940e093fa41b58fe71
$ apt-cache madison openssl
openssl | 1.0.2g-1ubuntu4.8 | http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
openssl | 1.0.2g-1ubuntu4.6 | http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
openssl | 1.0.2g-1ubuntu4 | http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
openssl | 1.0.2g-1ubuntu4 | http://archive.ubuntu.com/ubuntu xenial/main Sources
openssl | 1.0.2g-1ubuntu4.8 | http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
openssl | 1.0.2g-1ubuntu4.6 | http://archive.ubuntu.com/ubuntu xenial-security/main Sources