Skip to content

Instantly share code, notes, and snippets.

if (!window.$) {
/*! jQuery v4.0.0 | (c) OpenJS Foundation and other contributors | jquery.com/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,!0):t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";if(!e.document)throw Error("jQuery requires a window with a document");var n=[],r=Object.getPrototypeOf,i=n.slice,o=n.flat?function(e){return n.flat.call(e)}:function(e){return n.concat.apply([],e)},a=n.push,s=n.indexOf,u={},l=u.toString,c=u.hasOwnProperty,f=c.toString,p=f.call(Object),d={};function h(e){return null==e?e+"":"object"==typeof e?u[l.call(e)]||"object":typeof e}function g(e){return null!=e&&e===e.window}function v(e){var t=!!e&&e.length,n=h(e);return!("function"==typeof e||g(e))&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var y=e.document,m={type:!0,src:!0,nonce:!0,noModule:!0};function x(e,t,n){var r,i=(n=n||y).createElement("script");for(r in i.text=e,m)t&&t[r]&&(i[r]=t[r]);n.head.appendChild(i).p
function waitFor(fn, interval = 200) {
return new Promise(resolve => {
const check = () => {
const result = fn();
(result && result.length > 0) ? resolve(result) : setTimeout(check, interval);
};
check();
});
}
@22-2
22-2 / show-issues.js
Last active May 3, 2024 01:48
#issuesタグのファイルを取得して良い感じに表示するスクリプト🥺
const thisFile = dv.current();
/* ========================================================================== */
//
// 定数
//
/* ========================================================================== */
const TAKE = 30;
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zip.js lastModtime reproduce</title>
</head>
<body>
<main>
$SAVE_FILE = "$PSScriptRoot\SAVE_FILE.txt"
function SaveDirectory {
NewItem-IfNotExists $SAVE_FILE
$location = Get-Location
Set-Content $SAVE_FILE $location
}
function LoadDirectory {
if (Test-Path $SAVE_FILE) {
javascript: (function() {
const player = document.getElementById("movie_player"),
textarea = document.createElement("textarea"),
{video_id, list: playlist_id} = player.getVideoData(),
playlist_index = player.getPlaylistIndex() + 1,
t = Math.floor(player.getCurrentTime()),
h = Math.floor((t / 60) / 60),
m = Math.floor((t / 60) % 60),
s = Math.floor(t % 60);
let copy = "";
@22-2
22-2 / hmmss.js
Last active March 30, 2021 17:06
const hmmss = num => {
let ret = "";
const padZeroLeft = num => ("" + num).padStart(2, "0");
const h = Math.floor((num / 60) / 60),
m = Math.floor((num / 60) % 60),
s = Math.floor(num % 60);
ret += h ? `${h}:` : "";
ret += `${h ? padZeroLeft(m) : m}:`;
ret += padZeroLeft(s);
return ret;
@22-2
22-2 / minimal-fetch.js
Last active March 21, 2021 03:57
graphql server minimal fetch
fetch("http://localhost:4000/graphql", {
method: "post",
headers: {
"content-type": "application/json",
},
body: `{"query":"{ items { _id }}"}`,
});
@22-2
22-2 / nhk-radio-ext.iframe.js
Last active March 2, 2021 04:20
らじおえいかいわ
// ==UserScript==
// @name NHK Radio Player Extension - iframe
// @namespace http://tampermonkey.net/
// @version 0.1
// @description hotkeys
// @author 22-2
// @match https://www.nhk.or.jp/common/aplayer/ifr.html
// @grant none
// ==/UserScript==
// ==UserScript==
// @licence CC0
// @name NicoNico BBS Pagerize
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author 22-2
// @include https://dic.nicovideo.jp/a/*
// @include https://dic.nicovideo.jp/b/a/*
// @grant none