Skip to content

Instantly share code, notes, and snippets.

@7cc
7cc / pipe.js
Created January 29, 2019 08:37
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Pipeline_operator
const double = (n) => n * 2;
const increment = (n) => n + 1;
// without pipeline operator
double(increment(double(double(5)))); // 42
// with pipeline operator
5 |> double |> double |> increment |> double; // 42
@7cc
7cc / flatten.js
Last active January 5, 2019 10:51
recursive, call outer vs inner function
var array = [1, 2, [3, 4, [5, 6, [7, 8, [9]]]]]
// call outer function
function flatten(array) {
return array.reduce((prev, cur)=> {
return Array.isArray(cur)
? [...prev, ...flatten(cur)]
: [...prev, cur]
}, [])
}
@7cc
7cc / class.js
Created December 30, 2018 06:30
create subclass in javascript
var Person = function(name) {
this.name = name;
};
Person.prototype.isHuman = true;
// subclass
var Boy = class Boy extends Person {
constructor(name, age) {
super(name);
this.age = age;
table {
overflow: hidden;
}
tr:hover {
background: rgba(50,50,50,.1);
}
td, th {
position: relative;
}
@7cc
7cc / 侯爵フクロウラメラ手について.txt
Last active September 18, 2018 04:27
侯爵フクロウラメラ手について
侯爵フクロウラメラ手について
- 利点:装備一つで速度増加発動
- 欠点:侯爵で専用化される
- 足にホークでいいんじゃ?(ラメラ4、フクロウ3、ホーク3)
-- ホークを使う欠点はない?
専用化されないエンチャで
足でダメが高いのは「蝶」(7~12)くらいしかない。「ホーク」(5)
手のエンチャは「侯爵」(5)、「 広闊な」(10)で最大ダメは大して変わらない
- 足装備を色々変えるなら有用。全部にホーク貼るのは手間がかかる。
// simple iterator
var wm = new WeakMap()
function prev(array) {
var counter = wm.get(array)
if (!counter) {
return undefined
}
counter -= 1
wm.set(array, counter)
return array[counter]
data:text/plain;charset=sjis,%82%a0
data:text/plain;charset=euc-jp,%a4%a2
data:text/plain;charset=utf8,%E3%81%82
data:text/plain;charset=utf8,%EF%BB%BF%E3%81%82
// URLは勝手にUTF8にエンコードされる <- ブラウザによる模様
// "\u{0030}\u{0042}" === "0B"
data:text/plain;charset=UTF-16,%ff%fe%42%30
data:text/plain;charset=UTF-16,%ff%feB0
@7cc
7cc / aニコニコ静画-マンガAPI-01.txt
Last active September 1, 2024 10:29
ニコニコ静画、マンガAPI
*良識の範囲で使う。例えば、関連する市場も同時に表示するとか
追記:市場は終了…https://blog.nicovideo.jp/seiga/2019/12/post-1285.html
# 静画API
静画, コメント, タグ, 市場
マンガ, コメント, タグ, 市場(旧テーマ?お題)
自分のNGリスト取得
マイリスト取得?不明
ランキング
@7cc
7cc / Windowsでのmpv.confの置き場所.txt
Created April 24, 2018 14:25
Windowsでのmpv.confの置き場所
Windowsでのmpv.confの置き場所
mpv.exe と同じフォルダにmpv.confを置く
mpv.exe にmpv/mpv.confを置く
%appdata%/mpv/mpv.conf
~/.config/mpv/mpv.conf は無意味
@7cc
7cc / use-vscode-as-git-editor.md
Last active April 24, 2018 14:27
use vscode as git editor on Windows

use vscode as git editor on Windows

-n = --new-window
-w = --wait

from cmd.exe

use double quotes