Skip to content

Instantly share code, notes, and snippets.

View nberlette's full-sized avatar
👋
Available for new projects

Nicholas Berlette nberlette

👋
Available for new projects
View GitHub Profile
@nberlette
nberlette / icns.sh
Last active March 24, 2022 18:36
Apple .icns conversion helper
#!/usr/bin/env bash
function main () {
# show the usage page if no args are given, or if passed any derivation of "-h" "--help" "-?" etc
if [ $# -eq 0 ] || [[ "$1" =~ ^[-]{0,2}(h(elp)?|[?])$ ]]; then
local bold undl ital dark reset
bold=$(printf '\033[1m')
dark=$(printf '\033[2m')
ital=$(printf '\033[3m')
undl=$(printf '\033[4m')
@nberlette
nberlette / icons.md
Last active January 2, 2022 18:21
junkyard.one - icon selection
@nberlette
nberlette / storage.js
Last active October 25, 2021 16:58
localStorage with fallbacks and serialization
/**
* Setup custom localStorage instance.
* If we can't find localStorage, use a Map to use as a 'sessionStorage' clone.
* @returns {Storage}
*/
function setup () {
var storage = localStorage
? localStorage
: window.localStorage
? window.localStorage
@nberlette
nberlette / hex.sh
Last active February 26, 2024 08:01
[bash] rgb to hex
#!/bin/bash
function hex() {
printf "%02X%02X%02X" ${*//','/' '}
}
[ $(basename -- $0) == "hex" ] && [ $# -gt 0 ] && echo $(hex "${*}")
@nberlette
nberlette / keycodes.md
Last active August 30, 2021 08:09
Key Names and Codes

Keyboard Names, Numbers, and Aliases

Key Name Key Code Description / Aliases
A...Z 65~90 and 97~112 See: Letters
0...9 48~57 and 41, 96~105 See: Numbers
F1...F19 112~130 See: Functions
; 186, 59 Semicolon
= 187, 61 Equal
, 188, 44 Comma
@nberlette
nberlette / svelte.md
Last active February 18, 2022 20:08 — forked from peltho/svelte.md
Svelte Cheat Sheet
@nberlette
nberlette / SvelteKit_vs_NextJS.md
Last active March 29, 2022 05:53
Svelte vs. Next.js

SvelteKit 🆚 Next.js

Objectives: fast, easy, convention over configuration, & batteries included. Overwhelming choices < providing a clear path forward.

Contenders: [SvelteKit][sveltekit-url] (by [Svelte][svelte-url]) and [Next.js][next-url] (by [Vercel][vercel-url]).


Comparison of Major Features

@nberlette
nberlette / clean_code.md
Created July 19, 2021 21:44 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@nberlette
nberlette / autounattend.xml
Last active December 20, 2022 23:04
NTLite Presets to debloat Windows 10 for Raspberry Pi
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="arm64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>0409:00000409</InputLocale>
<SystemLocale>en</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>en</UserLocale>
</component>
@nberlette
nberlette / HTMLRewriter.ts
Last active June 29, 2021 02:16
Cheerio + HTMLRewriter Typescript Wrapper
/**
* Cheerio Wrapper HTMLRewriter.ts
*
* Usage of cheerio here only simulates stream-oriented parser! It is slow!
* This typescript port hasn't been tested, and probably doesn't work.
*/
import cheerio from 'cheerio'