This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const MeCab = new require('mecab-async') | |
| const mecab = new MeCab(); | |
| mecab.parse(process.argv[2], (err, result) => { | |
| if (err) throw err; | |
| const txt = result.map(item => { | |
| if (false) { | |
| } else if (['接尾'].includes(item[2])) { | |
| return item[0]; | |
| } else if (['人名', '組織', '地域'].includes(item[3])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| superscript[a_, b_] := If[b == 1, a, Superscript[a, b]] | |
| centerDot[li_] := If[Length[li] == 1, First[li], CenterDot @@ li] | |
| j[n_] := If[PrimeQ[n], ToString[PrimePi[n]] <> "番目の素数", | |
| centerDot[superscript @@@ FactorInteger[n]]] | |
| divisible[check_Integer, OptionsPattern[origin -> True]] := | |
| Divisible[#, check] && If[OptionValue[origin], True, # != check] & | |
| divisible[checkLi_List, OptionsPattern[origin -> True]] := | |
| AnyTrue[Table[divisible[check, origin -> OptionValue[origin]][#], {check, checkLi}], TrueQ] & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function dot(a, b) { | |
| const len = Math.max(a.length, a.length); | |
| let zeros = new Array(len).fill(0); | |
| let ret; | |
| ret = zeros.reduce((p, c, i) => { | |
| const itemA = a[i] || 0; | |
| const itemB = b[i] || 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const s = []; | |
| s[0] = '0'; | |
| s[1] = '01'; | |
| function fibonacci_word(n) { | |
| let ret; | |
| if (n < 2) { | |
| ret = s[n]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| markdown http リンクにしない |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const b = 4; | |
| const p = 1 << b; | |
| const r = new Uint32Array(p); | |
| let i = 0; | |
| let j = 0; | |
| while(i < p){ | |
| r[i] = j; | |
| k = - p ^ (-p / ((i ^ (i + 1)) + 1)); | |
| j ^= k; | |
| i++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const LENGTH = 25; // 25×2の50回ランダムウォークする | |
| const MAGNITUDE = 10; // 振動ピクセル幅 | |
| // 入力した正の数を正負両方含む配列(倍のサイズ)として返す | |
| function double(arr) { | |
| let ret = []; | |
| arr.forEach((num) => { | |
| ret.push(num); | |
| ret.push(-num); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .hatena-bookmark-button-frame { | |
| border-radius: 4px; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://ja.wikipedia.org/wiki/Mathematical_Markup_Language | |
| ```replace-list--math-ml | |
| replace mrow(/(.+)/) -> ($1) | |
| replace mfrac(/(.+) (.+)/) -> ($1 / $2) | |
| replace msup(/(.+) (.+)/) -> ($1 ^ $2) | |
| replace msqrt(/(.+)/) -> √($1) | |
| replace mi(/([a-z]+)/) -> $1 | |
| replace mn(([1-9][0-9]*)) -> $1 | |
| replace mo(=) -> = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // timeline functions: | |
| this.frame_19 = function() { | |
| $(canvas).trigger('end-anim'); | |
| stop(); | |
| } |