Skip to content

Instantly share code, notes, and snippets.

View RussellJapheth's full-sized avatar
💭
Building

Russell Japheth RussellJapheth

💭
Building
View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR/.."
cd "$PROJECT_ROOT"
echo "Building SvelteKit app..."
pnpm run build
<button
class="btn btn-primary"
data-user-id="42"
data-role="admin"
>
View
</button>
<script>
const button = document.querySelector('.btn.btn-primary');
@RussellJapheth
RussellJapheth / debounce.js
Created February 10, 2026 07:07
Debounce a function in javascript
/**
* Creates a debounced version of a function that delays execution until after
* 'delay' milliseconds have elapsed since the last time it was invoked.
*
* @param {Function} fn - The function to execute.
* @param {number} [delay=300] - The delay in milliseconds.
* @returns {Function} - The debounced function with a .cancel() method.
*/
export function debounce(fn, delay = 300) {
let timeoutId = null;
@RussellJapheth
RussellJapheth / main.go
Created March 20, 2024 10:29
A terminal utility for formatting JSON files written in Go
// 1. Get the path for our input file from
// the command line arguments
// 2. Check if the input file is readable and contains
// valid JSON
// 3. Format the contents of the file
// 4. Save formatted JSON to another file
// 5. Compile our binary
package main
const accordions = document.querySelectorAll(".accordion");
accordions.forEach((accordion) => {
accordion.addEventListener("click", function () {
// Remove "active" class from all accordions
accordions.forEach((acc) => {
if (acc !== accordion) {
// remove active class
acc.classList.remove("active");

Prybar Api Reference

v1.0.0rfc

Users

Login

Login in to the application

@RussellJapheth
RussellJapheth / README.md
Created April 24, 2021 04:20 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})