Skip to content

Instantly share code, notes, and snippets.

View hkitago's full-sized avatar

hkitago hkitago

  • Kawasaki
View GitHub Profile
@hkitago
hkitago / XSearch.js
Last active May 8, 2024 03:56
Bookmarklet to search on X
javascript:(()=>{w=window,d=document,t=(w.getSelection?w.getSelection():d.getSelection?d.getSelection():d.selection.createRange().text);if(!t||t==''){void(t=prompt('X search word:',''))}if(t){w.open(`https://twitter.com/search?q=${encodeURIComponent(t)}`)}})()
@hkitago
hkitago / newXPost.js
Last active May 8, 2024 03:30
Bookmarklet to create a new post for X with a text selected and the URL.
javascript:(()=>{w=window,d=document,t=(w.getSelection?w.getSelection():d.getSelection?d.getSelection():d.selection.createRange().text);if(!t||t==''){void(t=prompt('Create new XPost:',''));if(!t){t=d.title;}}else{t=`"${t}"`}if(t){w.open(`https://x.com/intent/tweet?text=${encodeURIComponent(t+' '+location.href)}`)}})()
@hkitago
hkitago / fake_spreadsheet.js
Last active March 9, 2024 05:15
fake_spreadsheet.js
(()=>{
'use strict'
// need: <section id="screen-1"></section>
// CSV
const csvData = `,CUE,HH,MM,SS,FF,NEXT,Event Description,PF,ADDR,CGHZ,PDS,ANGLE,QTY,CAL,TYPE,DUR,Effect Description,REF,MFG,MAGAZINE,PRICE1,PRICE2,PRICE3,CUSTOM1,CUSTOM2
,0,00,00,00,00,00 05 00,<Start>,00,000,00,,,0,0,,00 00,,,,,,,,,
,2,00,00,05,00,00 15 00,,00,200,00,,,15,75,ザラ,00 00,キラキラ,1s,,,,,,,
,3,00,00,20,00,00 10 00,,00,320,00,,,4,120,ザラ,00 00,キラキラ,0s,,,,,,,
,4,00,00,30,00,00 05 00,,00,100,00,,,1,91,ザラ,00 00,単発,,,,,,,,
,5,00,00,35,00,00 05 00,,00,101,00,,,1,91,ザラ,00 00,単発,,,,0 00,0 00,0 00,,
@hkitago
hkitago / placeSVGOnTapOrClick.js
Created July 28, 2023 05:32
put SVG file in Canvas
// キャンバスの取得
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
// キャンバスを全画面に設定
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// SVGオブジェクトを保持する配列
const svgObjects = [];
@hkitago
hkitago / ContentView.swift
Created July 26, 2023 21:09
Smartphone dB Measurement for SwiftUI
//
// ContentView.swift
// audioRecorder
//
// Created by Hiroyuki KITAGO and ChatGPT July 20 Version on 2023/07/26.
//
import SwiftUI
import AVFoundation
@hkitago
hkitago / swipe.js
Last active April 14, 2023 04:16
to add EventListener to swipe nodes.
const swipeNodes = document.querySelectorAll('.swipe')
let isTouched = false
const basePoint = {'x': 0, 'y': 0, }
Array.from(swipeNodes).map((x) => {
x.addEventListener('touchstart', (e) => {
e.preventDefault()
isTouched = true
basePoint['x'] = e.touches[0].clientX
basePoint['y'] = e.touches[0].clientY
})
@hkitago
hkitago / ContentView.swift
Last active March 30, 2023 17:26
WKWebViewTemplate to display HTML with JavaScript
//
// ContentView.swift
// WKWebViewTemplate
//
// Created by Hiroyuki KITAGO on 2022/01/26.
//
import SwiftUI
import WebKit
struct ContentView: View {
@hkitago
hkitago / createSlide.JS
Created March 13, 2023 01:01
Create Overlay Slideshow for 4 Photos by receiving the first photo ID number.
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')
@hkitago
hkitago / displaySomePropertyOnRightTopCorner.JS
Created January 30, 2023 08:26
Display Some Property On Right Top Corner
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'
@hkitago
hkitago / MainActivity.kt
Last active December 7, 2022 04:44
Enabling Immersive Mode from JavaScript Event on WebView
/*****************************************************************************
* Put <uses-permission android:name="android.permission.INTERNET" /> in AndroidManifest.xml
* and <WebView android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent"/> in activity_main.xml
****************************************************************************/
package com.hkitago.enablingImmersiveMode
import android.annotation.SuppressLint
import android.app.Activity
import android.os.Build
import android.os.Bundle