Skip to content

Instantly share code, notes, and snippets.

@Nosgoroth
Nosgoroth / ProgressCircle.js
Created November 3, 2024 14:46
Draw concentric ring progress bars for Scriptable widgets
// Draws concentric ring progress bars for Scriptable widgets
//
// Use by calling ProgressCircle.concentricImage()
// Parameters:
// ringsConfig (arr) An array of plain objects with these values:
// offset (int) The ring number starting from the outer edge. First is zero.
// value (int) Percentage from 0 to 100
// bgcolor (str) Color for the background ring. This ring is always a circle.
// Set to falsy to omit the background ring.
// color (str) Color for the foreground ring, whose length will obey the value.
@Nosgoroth
Nosgoroth / index.html
Created September 17, 2024 10:25
iPadOS 18 Safari keyboard bug reproduction
<!DOCTYPE html><html>
<head>
<title>iPadOS 18 Safari Bug reproduction page</title>
</head><body>
<h2>Bug reproduction controls</h2>
<button id="test1">Open new tab</button>
<p>Latest document keyboard event keycode was <span id="eventid">-</span> at <span id="eventtime">-</span></p>
@Nosgoroth
Nosgoroth / curl_quotes.php
Created April 24, 2024 14:48
Curl quotes (transform straight quotes into curly ones) (PHP5)
<?php
function curl_quotes($str) {
// Adapted from: https://github.com/kellym/smartquotes.js/blob/master/lib/replacements.js
// Single quotes
$sx = "'"; // straight (\u0027)
$s1 = "‘"; // Opening (\u2018)
$s2 = "’"; // Closing (\u2019)
@Nosgoroth
Nosgoroth / taishooo.py
Created February 9, 2019 16:23
Download all chapters of Taishou Otome Otogibanashi to cbz from Sea Otter Scans for archival
import os, sys, zipfile, re, requests, json, tempfile, time
from pprint import pprint
class Chapter:
url = None
title = None
def __init__(self, tup): self.url, self.title = tup
def getImageListForChapterWithUrl(url):
@Nosgoroth
Nosgoroth / mangadexImageFit.user.js
Last active April 11, 2018 17:30
Fits an image to window width and height whenever it changes (Part of a deprecated userscript for Mangadex)
function CenterHandler(){
this.$img = jQuery("#current_page");
this.$w = jQuery(window);
this.$w.on('resize orientationchange', this.center.bind(this));
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
this.observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {