Skip to content

Instantly share code, notes, and snippets.

@Brayden
Brayden / drive.sh
Created January 27, 2026 15:15
Mounted R2 Drive
#!/usr/bin/env bash
set -euo pipefail
bold() { printf "\033[1m%s\033[0m\n" "$*"; }
info() { printf "• %s\n" "$*"; }
warn() { printf "\033[33m! %s\033[0m\n" "$*"; }
err() { printf "\033[31m✗ %s\033[0m\n" "$*" >&2; }
ok() { printf "\033[32m✓ %s\033[0m\n" "$*"; }
require_macos() {
@bjarneo
bjarneo / theme-change-workspace.sh
Created December 1, 2025 16:27
Change your theme on hyprland workspace switch
#!/bin/bash
# Map workspaces to omarchy themes
declare -A workspace_themes=(
[1]="catppuccin"
[2]="catppuccin-latte"
[3]="ethereal"
[4]="everforest"
[5]="flexoki-light"
[6]="gruvbox"
@salmin89
salmin89 / background.ts
Last active June 12, 2025 09:37
Chrome Messaging using Native Observables
declare const Observable: any;
// Utility to create an Observable from Chrome's messaging system
function createMessageObservable() {
return new Observable((subscriber: any) => {
// Set up the message listener
const listener = (message: any, sender: chrome.runtime.MessageSender, sendResponse: (response?: any) => void) => {
// Forward the message to the Observable
subscriber.next({ message, sender, sendResponse });
return true;
@stevebauman
stevebauman / example.diff
Last active April 2, 2025 07:43
Sort JS Imports by length using ESLint Rule (asc)
-import axios from 'axios';
-import fs from 'fs';
-import path from 'path';
-import a from 'a';
-import somethingElse from '../somethingElse';
+import a from 'a';
+import fs from 'fs';
+import path from 'path';
+import axios from 'axios';
+import somethingElse from '../somethingElse';
@stenuto
stenuto / timelapse.sh
Created June 18, 2024 20:56
Timelapse script
#!/bin/bash
# Check if interval argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 -int <interval_in_seconds>"
exit 1
fi
# Extract the interval value
interval=$2
@jdevalk
jdevalk / copyrightholder.php
Last active January 6, 2022 04:00
This is how to add the copyrightHolder schema to the Website Schema piece Yoast SEO outputs.
<?php
add_filter( 'wpseo_schema_website', 'example_change_website_schema', 10, 2 );
/**
* Changes the Yoast SEO Website schema.
*
* @param array $data The Schema Website data.
* @param Meta_Tags_Context $context Context value object.
*
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active January 15, 2026 09:58
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@fzldn
fzldn / beautifier.js
Last active March 17, 2025 02:29
VS Code Laravel Blade formatter using extension Beautify 1.5.0 by HookyQR with js-beautify hacks
...
Beautifier.prototype.beautify = function() {
...
var source_text = this._source_text;
// BEGIN
source_text = source_text.replace(/\{\{(--)?((?:(?!(--)?\}\}).)+)(--)?\}\}/g, function(m, ds, c, dh, de) {
@Akryum
Akryum / vue.config.js
Last active April 26, 2020 14:18
Auto-import styles with vue-cli 3
const path = require('path')
module.exports = {
chainWebpack: config => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)))
},
}
function addStyleResource (rule) {
@bbarrows
bbarrows / download-embedded-vimeo-video.js
Created September 24, 2017 19:38 — forked from PezzerDev/download-embedded-vimeo-video.js
Downloads an embedded Vimeo video
downloadEmbededVideos();
/**
* Finds and downloads all embeded Vimeo videos.
*/
function downloadEmbededVideos() {
// Find Vimeo embed frame
var embedFrames = document.querySelectorAll('iframe[src*="player.vimeo.com"]');