Skip to content

Instantly share code, notes, and snippets.

@taoka-toshiaki
taoka-toshiaki / youtube-shorts.php
Last active May 18, 2023 07:17
ワードプレス編集エディタにYOUTUBE-short-URLを貼り付けても変換されないのを改善する方法(wpプラグイン)
<?php
/*
Plugin Name: youtube-shorts
Plugin URI:
Description: youtube-shorts
Version: 1.0
Author: taoka-toshiaki
Author URI: youtube-shortsを貼り付け出来るように
*/
add_filter(
@taoka-toshiaki
taoka-toshiaki / main.js
Last active May 18, 2023 07:19
jsとcssファイルを再読み込みするだけのコード。(パラメータを含むものには非対応)
"use strict";
document.querySelector("button").addEventListener("click",jsandcssreload);
function jsandcssreload(){
let d = (new Date()).getTime();
[...document.querySelectorAll("link")].forEach((elm)=>{
elm.href = elm.href.replace(/(\.css)\??[0-9]{0,}$/,".css?" + d);
});
[...document.querySelectorAll("script")].forEach((elm)=>{
elm.src = elm.src.replace(/(\.js)\??[0-9]{0,}$/,".js?" + d);
});
@taoka-toshiaki
taoka-toshiaki / nohup.sh
Created August 25, 2022 06:13
Terminalを閉じてもログアウトしても処理を続ける:Linux基本コマンド
nohup 任意のコマンド > /dev/null &
@taoka-toshiaki
taoka-toshiaki / image_download.py
Created August 6, 2022 08:49
bingサイトで画像ダウンロードするために作られたものです。
from functools import cache
import time
import requests
import os
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
@taoka-toshiaki
taoka-toshiaki / main.bgchage.color.js
Last active August 3, 2022 02:58
背景色を変えるver1.1
let htmlcode = ["#181B39","#262a2e","#192734","#1c483b","#bf7800","#83094f"].map(elm =>`<span class='color_code' style='color:${elm}' data-color-code='${elm}'>■</span>`).join("\n");
const basecolor = "#262a2e";
let cookiefn = function (val) {
let CodeColor = val;
let r = document.cookie.split(';');
return r?((r)=>{
for(let ii = 0 ;ii<r.length;ii++){
let content = r[ii].split('=');
for(let i = 0 ;i<content.length;i++){
if(content[i].replaceAll(" ","")==="bgcolor_code"){
@taoka-toshiaki
taoka-toshiaki / color_change.js
Created July 21, 2022 11:21
背景のカラーチェンジ
let htmlcode = `
<span class='color_code' style='color:#262a2e' data-color-code='#262a2e'>■</span>
<span class='color_code' style='color:#192734' data-color-code='#192734'>■</span>
<span class='color_code' style='color:#1c483b' data-color-code='#1c483b'>■</span>
<span class='color_code' style='color:#bf7800' data-color-code='#bf7800'>■</span>
<span class='color_code' style='color:#83094f' data-color-code='#83094f'>■</span>
`;
let old_color = "#262a2e";
document.getElementById("site_description").insertAdjacentHTML("afterend", htmlcode);
let ColorCodeObject = document.querySelectorAll(".color_code");
@taoka-toshiaki
taoka-toshiaki / style.html
Last active July 21, 2022 07:04
tailwind-cssで画面中央に表示したい場合
<div class="h-screen w-screen flex justify-center items-center">
<p>center</p>
</div>
@taoka-toshiaki
taoka-toshiaki / vba.bas
Created July 21, 2022 07:01
AccessCSV変換
Option Compare Database
Private Sub csvconvert_Click()
Dim Path As String
Path = "C:\Users\zip\Desktop\test.csv" 'ファイルが存在すること。
DoCmd.TransferText acExportDelim, , "任意のテーブル名", Path, True
End Sub
document.getElementById("test-code").insertAdjacentHTML("afterbegin",function(a){
return "<h1>" + a + "</h1>";
}("test-code"));