View createSlide.JS
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
const createSlide = (imgId) => { | |
const divE = document.createElement('div') | |
divE.innerHTML = '<div></div>' | |
divE.id = 'slide' | |
screenE.appendChild(divE) | |
const slideE = document.querySelector('#slide > div') | |
const slideUL = document.createElement('ul') | |
for(let i = 0; i < 4; i++) { | |
const liE = document.createElement('li') |
View displaySomePropertyOnRightTopCorner.JS
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
const displaySomePropertyOnRightTopCorner = (SomeProperty) => { | |
if (!SomeProperty) { return false } | |
const divE = document.createElement('div') | |
divE.textContent = SomeProperty | |
divE.style.width = '5vw' | |
divE.style.height = '5vh' | |
divE.style.backgroundColor = 'rgb(255 255 255/.5)' | |
divE.style.zIndex = [...document.querySelectorAll`*`].reduce((a,e,i,t,z=+window.getComputedStyle(e).zIndex||0) => z>a ? z:a ,0) + 1 | |
divE.style.position = 'fixed' | |
divE.style.right = '0' |
View duckduckgoBookmarklet.js
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
javascript:(()=%3E%7Bd=document,w=window,Qr=(w.getSelection?w.getSelection():d.getSelection?d.getSelection():d.selection.createRange().text);if(!Qr%7C%7CQr==%27%27)%7Bvoid(Qr=prompt(%27DuckDuckGo%20search%20word:%27,%27%27));%7Dif(Qr)w.open(%27https://duckduckgo.com/?q=%27+encodeURI(Qr))%7D)() |
View functions.php
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
// use [user_description] in a block, get $user_ID echo '<script>console.log("'.$user_ID.'")</script>'; in function.php before. | |
function get_user_description() { | |
$user_ID = get_current_user_id(); | |
return get_user_meta({$user_ID}, 'description', true); | |
} | |
add_shortcode('user_description', 'get_user_description'); |
View OpenChrome.scpt
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
try | |
tell application "BBEdit" to set theFile to file of document 1 | |
tell application "Finder" to open theFile using (path to application "Google Chrome") | |
on error | |
try | |
return theFile | |
on error errorMessage | |
return errorMessage | |
end try | |
end try |
View detectScrollEnd.js
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
scrolledElement.addEventListener('scroll', (e) => { | |
if (e.tareget.offsetHeight + e.tareget.scrollTop >= e.tareget.scrollHeight) { | |
// Do something. | |
} | |
}, { passive: true }) |
View install-pam_tid-and-pam_reattach.sh
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
#!/bin/bash | |
set -e | |
set -o pipefail | |
# pam_tidの存在チェック(間違えてLinux環境などで実行されたら中断する) | |
test -f /usr/lib/pam/pam_tid.so.2 || exit 1 | |
# sudoでTouchIDが使えるようにする | |
if ! grep -Eq '^auth\s.*\spam_tid\.so$' /etc/pam.d/sudo; then | |
( set -e; set -o pipefail |
View ContentView.swift
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
// | |
// ContentView.swift | |
// WKWebViewTemplate | |
// | |
// Created by Hiroyuki KITAGO on 2022/01/26. | |
// | |
import SwiftUI | |
import WebKit | |
struct ContentView: View { |
View dark.js
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
javascript:(()=>%7BcssText='@media(prefers-color-scheme:dark){body{filter:invert(1) hue-rotate(180deg);background-color:#000}img{filter:invert(1) hue-rotate(180deg)}}';textNode=document.createTextNode(cssText);styleNode=document.createElement('style');styleNode.appendChild(textNode);document.getElementsByTagName('head')[0].appendChild(styleNode)%7D)() |
View quickdarkmode.css
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
@media (prefers-color-scheme: dark) { | |
body { | |
filter: invert(1) hue-rotate(180deg); | |
background-color:#000; | |
} | |
img { | |
filter: invert(1) hue-rotate(180deg); | |
} | |
} |
NewerOlder