Skip to content

Instantly share code, notes, and snippets.

View kitsune7's full-sized avatar
🦊
Having fun programming ^_^

Christopher Bradshaw kitsune7

🦊
Having fun programming ^_^
View GitHub Profile
@kitsune7
kitsune7 / npm-version-reference.md
Last active February 27, 2024 17:43
npm version reference
{
  "dependencies": {
    // Use a Github repository
    "@formio/vue": "github:kitsune7/vue",
    
    // Use a PR on Github
    "@formio/vue": "github:formio/vue#pull/77/head",
    
    // MINOR and PATCH updates allowed (default when using `npm install` to add to package.json)
@kitsune7
kitsune7 / block-ads.js
Created December 24, 2022 21:25
Block Youtube ads
// ==UserScript==
// @name Block Youtube Ads
// @namespace https://stay.app/
// @version 0.1
// @description Skip Youtube ads automatically
// @author Christopher Bradshaw
// @match https://*youtube.com/*
// @require https://gist.githubusercontent.com/kitsune7/cd317ed0bda4e96b81febaf11b188d6d/raw/685a67ba681e9914a7e1a3ca52b7d4fc42077c39/monkey-utils.js
// @grant none
// ==/UserScript==
@kitsune7
kitsune7 / jsonwebtoken.ts
Created January 4, 2022 17:04
A first attempt at a JavaScript/Typescript implementation for signing JWT in the browser based on a blog article
/* I put this gist together as a way to remember the work that I did to sign json web tokens
* in the browser without libraries like `jsonwebtoken` that require Node.js.
*
* This is unfortunately asynchronous, but there's a repository I just found that may do it
* synchronously in the browser: https://github.com/kjur/jsrsasign. I might refactor this
* after taking a look at that.
*
* This is based off of code from a blog post showing how to sign json web tokens in the
* browser: https://coolaj86.com/articles/sign-jwt-webcrypto-vanilla-js/
*/
@kitsune7
kitsune7 / monkey-utils.js
Last active June 17, 2022 17:55
Tampermonkey/Greasemonkey utility functions
/*
* ---------- Utility functions ----------
* addHotkeysToElement: (element: HTMLElement, keypressToAction: Record<string, (eventTarget?: HTMLElement) => void>)
*
* - Adds a `style` tag with the given CSS to the DOM. It will put it in `head` by default.
* addStyles: (cssString: string, parentSelector: string) => void
*
* appendChild: (
* selector: string,
* child: HTMLElement | string,
@kitsune7
kitsune7 / .browserslistrc
Created July 29, 2020 04:01
My take on browsers list if given the choice
last 2 Chrome versions
last 2 Safari versions
last 2 Firefox versions
last 2 Edge versions
last 2 Opera versions
last 1 iOS version
last 1 ChromeAndroid version
last 1 Samsung version
last 1 UCAndroid version
@kitsune7
kitsune7 / .gitignore
Last active July 12, 2021 16:56
A standard .gitignore for JavaScript projects
# Logs
logs
Logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Keys
keys
// Playing around with some different ways of doing for loops
// `forEachIterableProtocol` was the main toy I got to play with
function forEachIterableProtocol (array, action) {
for (let i = array[Symbol.iterator](), obj = i.next(); !obj.done; obj = i.next()) {
action(obj.value)
}
}
function forEachNormal (array, action) {
@kitsune7
kitsune7 / New server setup.md
Last active July 25, 2020 02:07
How to setup a new remote server on Digital Ocean

Setting up a DigitalOcean Web Server

This isn't an extensive guide, but rather a reference of commands, reminders, and references that can hopefully save a lot of time.

Important Note: In each piece of code that has uppercase text, swap out that text with what it describes.

Helpful links:

@kitsune7
kitsune7 / pre-commit.sh
Last active January 24, 2020 22:52
A pre-commit hook to stop you from doing silly things
#!/bin/bash
# Requires the `dialog` package to be installed on linux machines
# Only supported on Mac OSX and Linux
warningString="You're on master. Are you sure you want to commit your changes here?"
yesResponse="Alright. Here we go, I guess."
noResponse="Cool. Let's keep it safe. Switch to a different branch before you rush to commit next time, okay?"
macDialogScript="button returned of (display dialog \"$warningString\" with icon caution buttons {'No', 'Yes'})"
@kitsune7
kitsune7 / mobile-nav.mjs
Last active November 5, 2019 06:26
A custom web component for mobile navigation
// Requires `ion-icon` web component
const css = `
<style>
:host([hidden]) { display: none; }
:host {
--background-color: #fff;
--border-color: #eee;
--link-color: dodgerblue;
--link-padding: 8px;