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
/*################################################# | |
# imgタグをレスポンシブ | |
#################################################*/ | |
<style> | |
.parent { | |
height:50vh; // 高さの指定は必要 | |
position:relative; | |
overflow:hidden; | |
} |
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
/*################################################# | |
# lambdaのnodejsで接続元のIPを取得出来るようにするマッピングと | |
# GETパラメータを取得出来るようにするマッピングの書き方 | |
# | |
# nodejsでのサンプルコードも | |
#################################################*/ | |
// mapping定義ファイル | |
{ | |
"sourceIp" : "$context.identity.sourceIp", // 接続元のIP | |
"querystring" : "$input.params().querystring", |
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
/*################################################# | |
# cronの確認 | |
#################################################*/ | |
<?php | |
$cron_s = get_option('cron'); | |
foreach($cron_s as $cron) { | |
foreach($cron as $cron_name => $args) { | |
foreach($args as $val) { | |
echo '登録名:'.$cron_name . " スケジュール:".$val['schedule']."<br>\n"; | |
break 2; |
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
/*################################################# | |
# リライトルールの確認 | |
#################################################*/ | |
<?php | |
echo '<pre>'; | |
print_r( get_option( 'rewrite_rules' ) ); | |
echo '</pre>'; | |
?> |
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
/*################################################# | |
# IE10以下にも対応出来るように、originがない場合も対応 | |
#################################################*/ | |
var origin = location.origin ? location.origin : location.protocol + "//" + location.hostname; | |
console.log(origin); |
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
/*################################################# | |
# エクセルで開いた際に文字化けしないようにエンコードしてcsvを生成 | |
#################################################*/ | |
<?php | |
// ファイル名 | |
$file_path = "tmp_".date('Ymd').".csv"; | |
// ------------------------------ | |
// csv生成 | |
// ------------------------------ |
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
/*################################################# | |
# phpでbasic認証したい場合 | |
#################################################*/ | |
<?php | |
// GoogleAppEngineの場合、以下の処理が必要 | |
// 参考:http://d.hatena.ne.jp/chi-bd/20150815/1439620561 | |
if (!isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['HTTP_AUTHORIZATION'])) { | |
$arr = explode(" ", $_SERVER['HTTP_AUTHORIZATION']); | |
$arr = explode(":", base64_decode($arr[1])); |
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
/*################################################# | |
# バッチの雛形 | |
# php wp-content/shell/xxxxxxxxxx.php | |
#################################################*/ | |
<?php | |
// wp-load.phpファイルがある階層を指定 | |
$wp_root = __DIR__ . '/../../../../'; | |
if (file_exists($wp_root.'/wp-load.php')) { | |
require_once($wp_root.'/wp-load.php'); | |
} else { |
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://twitter.com/を開いて実行 | |
# 一括で削除する場合に便利 | |
#################################################*/ | |
$(".js-stream-item").each(function() { | |
var authenticity_token = $(".authenticity_token").val(); | |
var data_s = { | |
"_method" : "DELETE", | |
"authenticity_token" : authenticity_token, | |
"id" : $(this).attr("data-item-id") |