Skip to content

Instantly share code, notes, and snippets.

View spiralx's full-sized avatar

James Skinner spiralx

View GitHub Profile
@spiralx
spiralx / html-source-formatter.xsl
Created September 29, 2021 12:39
XSLT stylesheet to transform HTML into its own formatted and highlighted source code
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="html.xsl"?>
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;">
<!ENTITY QUOTE "<xsl:text>&quot;</xsl:text>">
]><xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdoc="http://spiralx.org/2010/XMLDoc"
xmlns="http://www.w3.org/1999/xhtml"
@spiralx
spiralx / is-anagram.js
Last active August 20, 2021 12:55
A bunch of methods for checking if two strings are anagrams of each other
(() => {
function run(fns, a, b, exp, gn, iters = 100000) {
console.group(gn)
for (const fn of fns) {
const name = fn.name
if (fn(a, b) !== exp) {
console.warn(`ERROR: ${name}('${a}', '${b}') = %o`, fn(a, b))
@spiralx
spiralx / machine.js
Created July 14, 2020 20:36
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Properties whose values have a CSS type
// of either <integer> or <number>
const CSS_NUMERIC_PROPERTIES = new Set([
'animation-iteration-count',
'border-image-slice',
'border-image-outset',
'border-image-width',
'column-count',
'counter-increment',
@spiralx
spiralx / angular-io.user.css
Created February 7, 2019 13:04
User CSS for angular.io
/* ==UserStyle==
@name angular.io
@description Sort out the horrible styling
@author James Skinner <spiralx@gmail.com> (https://github.com/spiralx)
@namespace http://spiralx.org/
@version 1.0.0
@preprocessor stylus
@var text text-size "Text size" 13pt
@var text line-height "Line height" 1.5em
@spiralx
spiralx / rambda-bookmarklet.md
Created January 23, 2019 18:09
Ramda Bookmarklet

Ramda Bookmarklet

Use this bookmarklet to load Ramda on any website. To "install":

  1. Create a new bookmark in your bookmarks bar (what it points to doesn't matter, any page)

  2. Edit the new bookmark and replace the URL with the following:

@spiralx
spiralx / settings.json
Created October 23, 2018 10:12
Current work VS Code settings file
// Place your settings in this file to overwrite the default settings
{
"beautify.options": {
"end_with_newline": true,
"newline_between_rules": true,
"preserve_newlines": true,
"selector_separator_newline": true,
"space_around_combinator": true,
"space_around_selector_separator": true
},
@spiralx
spiralx / amazon-offer-page-links.user.js
Created July 13, 2018 01:32
Amazon - Offer page links user script
@spiralx
spiralx / reddit-load-comments-inline.user.js
Last active November 30, 2022 13:04
Reddit - Load 'Continue this thread' inline user script
// ==UserScript==
// @name Reddit - Load 'Continue this thread' inline
// @description Changes 'Continue this thread' links to insert the linked comments into the current page
// @author James Skinner <spiralx@gmail.com> (http://github.com/spiralx)
// @namespace http://spiralx.org/
// @version 1.9.5
// @downloadURL https://gist.github.com/spiralx/7ab95c47df98a5e79ce482f3285250a0/raw/6408eac4608d837eb735c2ffcc5fda4f1439513d/reddit-load-comments-inline.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiAAABYgAWToQQYAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAAF3SURBVDhP1ZI/SAJhGMZN3WpKOAgsKGiIoKWg0K2LXIJWj6DAhpAgKMiW7irBqziHbhYE12sLGtWGKHBx0kHcQrBJXNIz9e35vvsQoj841g9+fHy8z/PyHZzrXzANNbgKF2ASHsOhOYGTUIb3cBSq4hyKa3Ey2GsMeMRvvzALd+AVvIPbcAb+yAq8hBehUOgxnU5TtVol27ap3W5TpVKhVCpFsiw/IHMusstwgOHxeDZM07T7/T5Rr0vUfacBvR7uHWIzwzBayK+zDm8KktFo9FXEifaXiHbnxAXEZKKtqcHSSCTygs6nBYuWZfEhR1eI
@spiralx
spiralx / watcher.js
Created July 4, 2018 16:23
A small module I've written to let you subscribe to DOM changes that match specified criteria
var Watcher = (function () {
'use strict';
// ----------------------------------------------------
var Css;
(function (Css) {
Css.Inverse = 'color: white; background: black';
Css.Error = 'font-weight: bold; color: #f4f';
Css.Link = 'color: #05f; font-weight: normal; text-decoration: underline';
Css.Bold = 'font-weight: bold';