This file contains 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://nelog.jp/get_plugins --> | |
<textarea cols="16" rows="10"> | |
<?php | |
$all = ''; | |
//plugin.phpを読み込む | |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
$plugins = get_plugins(); | |
if (!empty($plugins)) { | |
$all .= '有効化済みのプラグイン:' . PHP_EOL; | |
foreach ($plugins as $path => $plugin) { |
This file contains 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
[ | |
{ | |
"en": "january", | |
"ja": "1月" | |
}, | |
{ | |
"en": "february", | |
"ja": "2月" | |
}, | |
{ |
This file contains 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
<?php | |
// /wp-content/debug.log にログを出力 | |
ob_start(); | |
print_r($prev); | |
$test = ob_get_contents(); | |
ob_end_clean(); | |
error_log('ログ: ' . $test); |
This file contains 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://blog.ver001.com/javascript-aspect-ratio/ | |
const getGCD = (a, b) => (b === 0 ? a : getGCD(b, a % b)); | |
const getAspectRatio = (w, h) => { | |
const gcd = getGCD(w, h); | |
return `${w / gcd}:${h / gcd}`; | |
}; |
This file contains 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
// based on https://qiita.com/pure-adachi/items/77fdf665ff6e5ea22128 | |
const shuffled = array.reduce((pre, _, i) => { | |
const _i = array.length - i; | |
const k = Math.floor(Math.random() * _i); | |
const _arr = [...pre]; | |
[_arr[k], _arr[_i - 1]] = [_arr[_i - 1], _arr[k]]; | |
return _arr; | |
}, array); |
This file contains 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://regex101.com/r/gXDhi9/1 | |
isValidImageUrl = (url) => { | |
const imgReg = | |
/^(?:(?<scheme>[^:/?#]+):)?(?:\/\/(?<authority>[^/?#]*))?(?<path>[^?#]*\/)?(?<file>[^?#]*\.(?<extension>[Jj][Pp][Ee]?[Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Ss][Vv][Gg]|[Ww][Ee][Bb][Pp]))(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))?$/gm; | |
return imgReg.test(url); | |
}; |
This file contains 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://shanabrian.com/web/javascript/element-get-number-of-lines.php | |
* 要素内にあるテキストの行数を取得 | |
* @param {Element} element 取得するもとの要素 | |
* @return {Number} 行数を返す | |
*/ | |
var getNumberLines = function (element) { | |
var fontSize = 0, | |
count = 0, | |
calcResult = 0; // 要素からスタイルを取得 |
This file contains 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
# 例2017年01月01日 00時00分00秒より、古い記事を削除 | |
DELETE FROM wp_posts WHERE post_date < '2017-01-01 00:00:00'; | |
# 最小の記事IDを確認し、メモを取る | |
select ID,post_date from wp_posts ORDER BY ID ASC limit 5 ; | |
# wp_postmetaテーブルからのデータ削除(最小の記事IDが140679の場合) | |
DELETE FROM wp_postmeta WHERE post_id < 140679; |
This file contains 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
// ゼロ以外でも使える #noie | |
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/padStart | |
const z = (i + "").padStart(2, "0"); |
This file contains 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
nums = ('\2780' '\2781' '\2782' '\2783' '\2784' '\2785' '\2786' '\2787' '\2788' '\2789') | |
for n, i in nums | |
li:nth-of-type({i+1})::before | |
content n |
NewerOlder