Skip to content

Instantly share code, notes, and snippets.

@Maista6969
Maista6969 / onElementReady.js
Last active April 29, 2023 20:05
onElementReady.js
/**
* @private
*
* Converts a given string to a valid attribute name
*
* @param {String} string - Any non-empty string
* @returns {String} - A string that can safely be used as an attribute name in the DOM
*/
function toAttributeName(string) {
return string
@Maista6969
Maista6969 / performerRatings.js
Last active April 29, 2023 10:37
Shows the summarized O-counter and scene ratings for performer cards in Stash
// ==UserScript==
// @name Rating stats for performers
// @author Maista
// @namespace com.maista.userscripts
// @version 1.0
// @require https://gist.githubusercontent.com/Maista6969/aaf8f04b1af7603ed27866e9e7f46a02/raw/53f00a1ccc3370e65af4735c46bcc0a71ac5ef77/onElementReady.js
// @include http://localhost:9999/*
// @grant GM_xmlhttpRequest
// @icon http://localhost:9999/favicon.ico
// ==/UserScript==
@Maista6969
Maista6969 / studioRatings.js
Last active August 8, 2023 02:50
Shows the summarized O-counter and scene ratings for studio cards in Stash
// ==UserScript==
// @name Rating stats for studios
// @author Maista
// @namespace com.maista.userscripts
// @version 1.0
// @require https://gist.githubusercontent.com/Maista6969/aaf8f04b1af7603ed27866e9e7f46a02/raw/53f00a1ccc3370e65af4735c46bcc0a71ac5ef77/onElementReady.js
// @include http://localhost:9999/*
// @grant GM_xmlhttpRequest
// @icon http://localhost:9999/favicon.ico
// ==/UserScript==
@Maista6969
Maista6969 / ordered_table.lua
Created May 18, 2023 22:45
MPV Lua scripts to interface with Stash
local ordered_table = {}
--[[
This implementation of ordered table does not hold performance above functionality.
It invokes a metamethod `__newindex` for every access, and
while this is not ideal performance wise, the resulting table behaves very closely to
a standard Lua table, with the quirk that the keys are ordered by when they are first seen
(unless deleted and then reinserted.)
--]]
-- private unique keys
local _values = {}