Skip to content

Instantly share code, notes, and snippets.

View bromne's full-sized avatar

bromne

View GitHub Profile
@bromne
bromne / heap_sort.js
Last active March 4, 2018 10:26
ソートアルゴリズム
let parent = i => Math.floor(i - 1);
let left = i => (i + 1) * 2 - 1;
let right = i => (i + 1) * 2;
let swap = function (items, i, j) {
let temp_i = items[i];
items[i] = items[j];
items[j] = temp_i;
};
let get_largest_node = function (items, i, heap_size) {
@bromne
bromne / hasFooOrBar.js
Last active May 31, 2018 10:59
n × 2 and 2 × n
// s は、文字列の平均的な長さ
// n × 2
// => 変数確保: 2, 整数比較: 2n, 再代入: 2n, 配列要素取得: 2n, 文字列比較: 2sn
const hasFooOrBar = function(items) {
// 変数確保: 1, 整数比較: n, 再代入: n
for (let i = 0; i < items.length; i++) // * n
// 配列要素取得: 1 (* n), 文字列比較: s (* n)
if (items[i] === "foo");
return true;
const VWL = new Set(["A", "E", "I", "O", "U"]);
function abbr(name) {
if (name.length < 3)
return null;
const NAM = name.toUpperCase();
const HEA = NAM[0];
const TAI = Array.from(NAM.substr(1));
const FLT = TAI.filter(CHR => !VWL.has(CHR)).join("");
if (FLT.length >= 2)

白魔道士の回復アクションの回復力と消費 MP

アクション名 回復力 消費 MP 回復力(%) 回復力/MP(%)
ケアル 450 400 100.00 100.00
メディカ 300 1000 66.66 26.66
ケアルラ 700 1000 155.55 62.22
リジェネ 1200 500 266.66 213.33
ケアルガ 550 1500 122.22 32.59
メディカラ 800 1300 177.77 54.70
@bromne
bromne / js-test.html
Created January 6, 2021 17:22
2005-12-04
<html><head><title>test</title>
<script language="JavaScript">
pa=new Array();
page=new Array();
function changeDesign(cno){
pa[0]=document.getElementById('page[0]');
pa[1]=document.getElementById('page[1]');
pa[2]=document.getElementById('page[2]');
pa[0].style.display='none';
pa[1].style.display='none';
perl -e 'for my $file (@ARGV) { next unless -f $file; my $max = 0; open my $fh, "<", $file or next; while (<$fh>) { chomp; $max = length if length > $max } close $fh;  print "$file $max\n" }'

Usage

... src/components/*.ts | sort -k 2 -n