Skip to content

Instantly share code, notes, and snippets.

View StoneyEagle's full-sized avatar
🦅

Stoney_Eagle StoneyEagle

🦅
View GitHub Profile
@StoneyEagle
StoneyEagle / Controller.cs
Last active November 15, 2024 16:10
Configuration-Driven UI
[ApiController]
[Tags("Media")]
[ApiVersion(1.0)]
[Authorize]
[Route("api/v{version:apiVersion}")]
public class HomeController : BaseController
{
[HttpGet]
[Route("home")]
public async Task<IActionResult> Home()
@StoneyEagle
StoneyEagle / musicbrainz.filenaming.script.txt
Created September 16, 2024 12:02
Picard File Naming Script
$noop(
########################################################################
# #
# Picard File Naming Script 2020-11-15 #
# Bob Swift [rdswift] #
# #
# License: GPLv3.0 #
# #
########################################################################
#
@StoneyEagle
StoneyEagle / twitch-temperature.js
Last active September 6, 2024 19:22
Temperature conversion for twitch chat
const config = {
settings: {
TWITCH: {
USERNAME: '',
OAUTH_TOKEN: '',
CHANNEL_NAME: ''
},
},
}
@StoneyEagle
StoneyEagle / createEement.ts
Created August 8, 2024 11:04
Typesafe create element
/**
* Creates a new HTML element of the specified type and assigns the given ID to it.
* @param type - The type of the HTML element to create.
* @param id - The ID to assign to the new element.
* @param unique - Whether to use an existing element with the specified ID if it already exists.
* @returns An object with four methods:
* - `addClasses`: Adds the specified CSS class names to the element's class list and returns the next 3 functions.
* - `appendTo`: Appends the element to a parent element and returns the element.
* - `prependTo`: Prepends the element to a parent element and returns the element.
* - `get`:Returns the element.
@StoneyEagle
StoneyEagle / Device Login.md
Last active March 29, 2024 18:34
Twitch Device Auth Flow for Postman
curl --location 'https://id.twitch.tv/oauth2/token' \
--form 'client_id="{{twitch-client-id}}"' \
--form 'scope="{{twitch-scopes}}"' \
--form 'device_code="{{TWITCH_DEVICE_CODE}}"' \
--form 'grant_type="urn:ietf:params:oauth:grant-type:device_code"'
Test
@StoneyEagle
StoneyEagle / Token Client Credentials.md
Created March 28, 2024 16:02
Twitch Credentials Auth for postman

Set the variables twitch-client-id and witch-client-secret as secret variables in your Postman environment,

curl --location 'https://id.twitch.tv/oauth2/token' \
--header 'Content-Type: application/json' \
--data '{
	"client_id": "{{twitch-client-id}}",
	"client_secret": "{{twitch-client-secret}}",
	"grant_type": "client_credentials",
	"scope": "the scopes you need"
}'
@StoneyEagle
StoneyEagle / obs-websocket.js
Created March 6, 2024 22:59 — forked from clarkio/obs-websocket.js
Connecting to OBS Websocket Server with Authentication
const obsConfig = {
address: '127.0.0.1',
port: 4455,
password: 'your-password'
}
const socket = new WebSocket(`ws://${obsConfig.address}:${obsConfig.port}`);
const password = obsConfig.password;
socket.onopen = function(event) {
@StoneyEagle
StoneyEagle / inject.js
Created May 2, 2023 17:57
Inject script or css into the dom
/**
* @param {string[]} filePaths - Array of file paths to append to the document
* @returns {Promise<void>} - Promise that resolves when all files have been appended
* @usage appendScriptFilesToDocument(['script.js', 'style.css'])
*/
const appendScriptFilesToDocument = (filePaths) => {
return new Promise((resolve, reject) => {
let count = 0;
const total = filePaths.length;
@StoneyEagle
StoneyEagle / theme.css
Last active April 4, 2023 23:13
Rendered NoMercy theme system for TailwindCSS
:root {
--shadow-light: 150, 150, 150;
--shadow-dark: 0, 0, 0;
--shadow: var(--shadow-light);
--gray-50: 250, 250, 250;
--gray-100: 245, 245, 245;
--gray-200: 229, 229, 229;
--gray-300: 212, 212, 212;
--gray-400: 163, 163, 163;
--gray-500: 115, 115, 115;
@StoneyEagle
StoneyEagle / paletteColorPicker.ts
Last active April 5, 2023 02:09
react-palette luminocity constrained color picker
export const byte2Hex = (n: number): string => {
const nybHexString = '0123456789ABCDEF';
return String(nybHexString.substr((n >> 4) & 0x0f, 1)) + nybHexString.substr(n & 0x0f, 1);
};
export const RGBString2hex = (string: string): string => {
const newString: number[] = string
.replace('rgb(', '')
.replace(')', '')
.split(',')