Skip to content

Instantly share code, notes, and snippets.

View RascalTwo's full-sized avatar

Rascal Two RascalTwo

View GitHub Profile
@RascalTwo
RascalTwo / README.md
Last active January 12, 2024 23:20
Helper script to make ordering of pre-commit hooks a breeze!

Reorder pre-commit hooks

A simple script that allows you to reorder your pre-commit hooks by ID.

Simply run the script - with custom --input and --output if needed - and it will write the IDs of hooks to order.txt - or --temp-file.

Then after modifying the order of the IDs in order.txt, hit enter in the script and it will reorder the hooks in the file you specified.

@RascalTwo
RascalTwo / skills.csv
Last active February 2, 2023 12:55
LinkedIn skills
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Skill Title
.NET CLR
.NET Compact Framework
.NET Core
.NET Framework
.NET Remoting
.com
.htaccess
1-4 Units
@RascalTwo
RascalTwo / README.md
Last active February 2, 2023 00:07
Webpack-ify Node.js Server

Quick instructions for Webpack-ifying backend Node.js code:

  • npm install --save-dev webpack-node-externals webpack webpack-cli nodemon
  • Ensure main is within package.json
  • Add *.dist.js to .gitignore
  • Create included webpack.config.js
  • Run npx webpack --watch in combination with npx nodemon MAIN.dist.js

To make things easier, additionally:

// must have textbox open & editing for this to work
textboxInterval = ((end) => {
function tick(){
const now = Date.now();
const diff = Math.floor((end.getTime() - now) / 1000);
const mins = diff < 0 ? 0 : Math.floor(diff / 60);
const seconds = diff < 0 ? 0 : diff % 60;
const textbox = $('.textbox-editor')[0];
if (!textbox) return;
textbox.value = `${mins.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')} minutes`;
const bench = require('benchmark');
module.exports = (test, ...functions) => {
const suite = new bench.Suite();
for (const func of functions) {
suite.add(func.name, test.bind(null, func));
}
return suite
.on('start', () => console.log('Starting benchmark...'))
.on('cycle', (event) => {
const util = require('util');
const debug = require('debug')('express-middleware-logger');
function deepIsEqual(one, two) {
if (one === two) return true;
if (typeof one !== typeof two) return false;
if (one === null || two === null) return false;
if (typeof one === 'object' && typeof two === 'object') return [...new Set([...Object.keys(one), ...Object.keys(two)])].every(key => deepIsEqual(one[key], two[key]));
return false;
@RascalTwo
RascalTwo / App.jsx
Created October 1, 2022 21:09
React Standalone HTML template
import Button from './Button'
// As React is globally imported, the usual named importing needs to be destructured from it instead.
const { useState } = React;
/**
* A simple counter app.
*/
export default function App(){
const [count, setCount] = useState(0);
@RascalTwo
RascalTwo / base.css
Created August 20, 2022 19:37
Streamlabs Custom Notification Overlay
.widget-AlertBox {
position: relative;
}
body,
html {
height: 100%;
width: 100%;
overflow: hidden;
}
#wrap {
// ==UserScript==
// @name Audio Anki
// @description Interact with Anki cards with your voice and ears, having the card automatically read aloud to you, then giving you the chance to speak your answer, and highlighting words you spoke that were in the card answer.
// @match https://ankiuser.net/study/
// @grant none
// @version 1.0
// @author Rascal_Two
// ==/UserScript==
function delay(ms) {