Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Yes I Am Sure I Want To Leave YouTube
// @namespace https://github.com/lionel-rowe/
// @version 0.1
// @description Disable "Are you sure that you want to leave YouTube?" redirect page
// @author https://github.com/lionel-rowe/
// @match https://www.youtube.com/*
// @icon https://www.youtube.com/favicon.ico
// @updateURL https://gist.github.com/lionel-rowe/130b59a8cd06bdf359f9d4888baefb94/raw/yes-i-am-sure-i-want-to-leave-youtube.user.js
// @downloadURL https://gist.github.com/lionel-rowe/130b59a8cd06bdf359f9d4888baefb94/raw/yes-i-am-sure-i-want-to-leave-youtube.user.js
// https://dash.deno.com/playground/clearlyloc-phrase-oauth
import { marked } from 'npm:marked@5.0.1'
import { escape } from 'https://deno.land/std@0.208.0/html/entities.ts'
const PHRASE_BASE_URL = 'https://cloud.clearlyloc.com/web/'
const CLIENT_ID = 'WOEVUqZPEgEhblG0eOUsR6'
function authEndpointFromClientId(clientId: string) {
const url = new URL('oauth/authorize', PHRASE_BASE_URL)
function getLocaleInfoModule() {
const endpoint = 'https://query.wikidata.org/sparql'
const headers = { 'Accept': 'application/sparql-results+json' }
type Kind = 'language' | 'region'
const propertyIds: Record<Kind, { iso2: number; iso3: number }> = {
language: {
iso2: 218,
iso3: 220,
},
// ==UserScript==
// @name Disable arrow key hijacking
// @description Stop websites from hijacking left and right arrow keys.
// @author Lionel Rowe
// @run-at document-start
// @match http://*/*
// @match https://*/*
// @grant none
// @version 0.3
// @namespace https://github.com/lionel-rowe
Date: Thu, 01 Jan 1970 00:00:00 +0000 (UTC)
From: ABC <abc@example.com>
To: XYZ <xyz@example.com>
Subject:
=?UTF-8?Q?=E7=BB=9F=E4=B8=80=E7=A0=81?=
=?UTF-8?Q?=E5=8F=98=E6=88=90=E4=B9=B1=E7=A0=81?=
=?us-ascii?Q?_removing_this_part_fixes_the_mojibake?=
MIME-Version: 1.0
Content-Type: text/plain;
// https://web.archive.org/web/20160920191749/http://zhaoren.idtag.cn/samename/searchName!pmbyrepeatlist.htm
const 姓名 = [...document.querySelectorAll('li p')]
.map(x => x.textContent.trim().match(/^\d+\.(.+)$/))
.filter(Boolean)
.map(x => x[1])
const 姓 = [...new Set(姓名.map(x => x[0]))].join('')
const 名 = [...new Set(姓名.flatMap(x => [...x.slice(1)]))].join('')
// ==UserScript==
// @name Highlightify
// @namespace https://github.com/lionel-rowe/
// @version 0.4
// @description Highlightify Stack Exchange
// @author @lionel-rowe
// @match https://meta.stackexchange.com/*
// @grant none
// ==/UserScript==
/* global StackExchange */
@lionel-rowe
lionel-rowe / prepare-commit-msg.sh
Last active June 17, 2019 08:57 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
# curl <link_to_raw> > .git/hooks/prepare-commit-msg && chmod u+x .git/hooks/prepare-commit-msg
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
@lionel-rowe
lionel-rowe / QueryParams.js
Last active April 30, 2019 12:34
QueryParams - super-simple query string parser with comma-delimited arrays
const QueryParams = {};
QueryParams.options = {
usePlusSigns: false, // per RFC 1866 application/x-www-form-urlencoded; otherwise use "%20" for space
keyMustReturnArray: key => key.endsWith('_arr') // for URI-decoded keys that return `true` for this function, coerce the value to an array even if it contains no commas
};
const decode = str => {
if (QueryParams.options.usePlusSigns) {
str = str.replace(/\+/g, '%20');
/*
Concepts covered:
concept | syntax
---------------------------------|--------------------------
testing for a match | test
replacing matches | replace
...with a string | replace(re, '...')
...with a function | replace(re, m => ...)