Skip to content

Instantly share code, notes, and snippets.

View hkitago's full-sized avatar

hkitago hkitago

  • Kawasaki
View GitHub Profile
@hkitago
hkitago / loadBookmarklet.js
Last active April 6, 2021 03:28
bookmarklet that fires a local js file on macOS
javascript:(()=>{d=document,js=d.createElement('script');js.setAttribute('src', '//localhost/{path2File}.js');d.body.appendChild(js)})()
@hkitago
hkitago / CombineImages.js
Last active January 15, 2020 09:15
combine images and create download link from directory id to one png file.
(() => {
'use strict'
const id = 3291/*, 3362, 3460, 3589, 3822, 4018,*/
const deviation = 4
const isColumnDirection = true
/**
* Promisify loading an image
* @param {String} imagePath The web location of the image
* @returns {Promise} A Promise that will resolve to an Image
* https://stackoverflow.com/a/47579262/579429
@hkitago
hkitago / Weblio.JS
Last active April 6, 2021 03:24
Bookmarklet to search sentences on Weblio.
javascript:(()=>%7Bt=(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!t%7C%7Ct=='')%7Bvoid(t=prompt('Weblio%20search%20word:',''))%7Dif(t)window.open('https://ejje.weblio.jp/sentence/content/'+encodeURI(t))%7D)()
@hkitago
hkitago / DQWLandmarks.js
Last active October 2, 2019 08:16
ドラクエウォーク(DQウォーク/DQW)に登場するランドマークをGoogle マップ上でピンマーカー表示するためのJSONデータ。参照元: https://appmedia.jp/dqwalk/3864508
const DQWLandmarks = [
{
"href": "https://www.google.com/maps/place/%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC/@35.6585805,139.7432442,17z/data=!3m1!4b1!4m5!3m4!1s0x60188bbd9009ec09:0x481a93f0d2a409dd!8m2!3d35.6585805!4d139.7454329?shorturl=1",
"text": "東京タワー"
},
{
"href": "https://www.google.com/maps/place/SHIBUYA109/@35.6595709,139.696562,17z/data=!3m2!4b1!5s0x60188ca9cd4c44b5:0xc538795a27b68b27!4m5!3m4!1s0x60188ca9cd6c1c87:0x55a2a75ba417e072!8m2!3d35.6595709!4d139.6987507?shorturl=1",
"text": "SHIBUYA 109"
},
{
@hkitago
hkitago / addGmapRouteEvent2Cal-JP.scpt
Created June 19, 2019 02:56
embed to Automator workflow as Service Menu on macOS
property wayPointJS : "wayPointNodes = document.querySelectorAll('.section-trip-header-waypoint-name'); wayPointNodes[1].innerText;"
property theStartHoursJS : "document.querySelector('.section-trip-summary-title').children[1].children[0].textContent.split(':')[0];"
property theStartMinutesJS : "document.querySelector('.section-trip-summary-title').children[1].children[0].textContent.split(':')[1].substr(0,2);"
property theStartDayJS : "t = document.querySelector('.section-trip-summary-title').children[1].children[0].textContent.split(':'); if(t[1].substr(4,1)){ var ds = ['日','月','火','水','木','金','土'],theStartDay = t[1].substr(4,1),theStartDayIndex = ds.indexOf(theStartDay),now = new Date(),currentDayIndex = now.getDay(); (theStartDayIndex <= currentDayIndex) ? theStartDayIndex - currentDayIndex + 7 : theStartDayIndex - currentDayIndex;} else {0;}"
property theEndHoursJS : "document.querySelector('.section-trip-summary-title').children[1].children[1].textContent.split(':')[0]"
property theEndMinutesJS : "docum
@hkitago
hkitago / ViewController.swift
Last active March 2, 2020 04:07
Fullscreen WKWebView for SPA
//
// ViewController.swift
// FullscreenWKWebView4SPA
//
// Created by Hiroyuki Kitago on 2017/10/26.
// Copyright © 2017年 Hiroyuki Kitago. All rights reserved.
//
import UIKit
import WebKit
@hkitago
hkitago / createBlankHTML.JS
Created June 8, 2019 01:42
init page to rewrite.
(function(){window.addEventListener('load',function(){const d=document;while(d.body.firstChild){d.body.removeChild(d.body.firstChild)};while(d.head.firstChild){d.head.removeChild(d.head.firstChild)};}, {passive:false});})();
@hkitago
hkitago / removeHeader.js
Last active April 2, 2021 00:51
Bookmarklet to remove header tag.
javascript:(()=>{d=document;d.head.parentNode.removeChild(d.head)})()
@hkitago
hkitago / localization.js
Created August 1, 2018 05:28
module of dynamic import.
/*****************************************************************************
* Call in app.js like this:
*
* const localizeStrings = function(){
* import('./localization.js')
* .then(() => {
* const lang = settings.language === 'English' ? 'en' : localization.lang;
* if(localization.labelStrings[lang]) {
* document.getElementById('label0').textContent = localization.labelStrings[lang].label0;
* //updateBtnLabel.call(this);
@hkitago
hkitago / beep.js
Last active August 1, 2018 05:18
making beep sound.
const audioCtx = new(window.AudioContext || window.webkitAudioContext)();
const beep = function(){
if(settings.beep === 1) {
return false;
}
const volume = 0.1
, duration = 200
, type = 'square'
, frequency = 2000 /*1000*/;