リンク元:<a href="#target">…</a> リンク先:<div id="target">…</div>
ページトップへ
<html id="top"> <a href="#top">ページトップへ</a>
リンク元:<a href="#target">…</a> リンク先:<div id="target">…</div>
ページトップへ
<html id="top"> <a href="#top">ページトップへ</a>
同じ要素で、同じプロパティで、同じ詳細度なら後勝ち。
CSSは単純に「下に書いた方が勝つ」ではなく、
① 要素自身に指定がある?
↓
② その指定同士で詳細度を比較
↓
③ 同じ強さ(詳細度)なら下が勝つ
↓
④ 指定がなければ親から継承
の順に考えます。
① Node.js をインストール
sudo dnf install nodejs
バージョン確認
node -v npm -v
② opentype.js の導入(npm)
Web サーバーの任意のディレクトリで:
npm init -y npm install opentype.js
オブジェクトで返す
function calc(a, b) { return { sum: a + b, diff: a - b }; } const result = calc(10, 3); console.log(result.sum); // 13 console.log(result.diff); // 7
function calc(a, b) { const sum = a + b; const diff = a - b; return { sum, diff }; }
これは return { sum: sum, diff: diff } の省略記法です。
オブジェクトのキー名と変数名が同じなら短く書ける。
UTF‑8 のバイト数を調べる
function byteLength(str) { return new TextEncoder().encode(str).length; } console.log(byteLength("あ")); // 3 console.log(byteLength("A")); // 1 console.log(byteLength("😊")); // 4
const text = "Hello World"; console.log(text.includes("World")); // true console.log(text.includes("world")); // false(大文字小文字は区別される)
1. firewalld で 9090 を閉じる
~]# firewall-cmd --permanent --remove-service=cockpit ~]# firewall-cmd --reload
2. Cockpit を完全に無効化する
~]# systemctl disable --now cockpit.socket
もし Cockpit を使いたくなる場面が将来出たら
9090 を閉じたまま SSH トンネル経由でのみアクセスが最も安全。
~]$ ssh -L 9090:localhost:9090 user@server
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"> <rect x="5" y="5" rx="15%" ry="15%" width="190" height="190" stroke="black" stroke-width="10" fill="green"/> <text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle" dy="15" font-size="150" fill="white"> A </text> </svg>
# dnf --enablerepo=epel -y install phpMyAdmin
初期設定では localhost のみ許可されているため、外部アクセスを許可します。
追加
# vi /etc/httpd/conf.d/phpMyAdmin.conf
・・・ ・・・ <Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 Require local Require ip xxx.xxx.xxx.xxx </Directory> ・・・ ・・・
設定変更を反映。
# systemctl restart httpd
phpMyAdmin のログイン画面にアクセス。
http://<サーバーIP>/phpmyadmin/
MySQL/MariaDB のユーザーでログイン。
<?php // ひらがな一覧(必要なら増やせる) $hiragana = [ 'あ','い','う','え','お', 'か','き','く','け','こ', 'さ','し','す','せ','そ', 'た','ち','つ','て','と', 'な','に','ぬ','ね','の', 'は','ひ','ふ','へ','ほ', 'ま','み','む','め','も', 'や','ゆ','よ', 'ら','り','る','れ','ろ', 'わ','を','ん' ]; // ひらがな3文字をランダム生成 $captcha = ''; for ($i = 0; $i < 3; $i++) { $captcha .= $hiragana[random_int(0, count($hiragana) - 1)]; } echo $captcha;
アルファベット大文字3文字のランダム生成
<?php // アルファベット大文字一覧(A〜Z) $alpha = range('A', 'Z'); // 3文字をランダム生成 $captcha = ''; for ($i = 0; $i < 3; $i++) { $captcha .= $alpha[random_int(0, 25)]; } echo $captcha;