Skip to content

Instantly share code, notes, and snippets.

Drew's Pet Store

CodePen Challenge: September 2023
Navigation – Complex Navigation

View in Full Page for best experience

Illustrations by Icons 8 from Ouch!

@ArtBIT
ArtBIT / GRUB_INIT_TUNE.md
Last active April 26, 2024 03:49
A collection of GRUB init tunes
@vratiu
vratiu / .bash_aliases
Last active April 26, 2024 03:47
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@StringKe
StringKe / focusPropAtom.ts
Created April 26, 2024 03:40
[Jotai Atom] Atomic implementations that allow parent objects to be potentially null
type PickProp<T, K> = K extends keyof NonNullable<T>
? T extends undefined
? NonNullable<T>[K] | undefined
: NonNullable<T>[K]
: undefined;
export function focusPropAtom<Store, Result, Key extends keyof NonNullable<Store>>(
baseAtom: WritableAtom<Store, [SetStateAction<Store>], Result>,
path: Key,
) {
@jboner
jboner / latency.txt
Last active April 26, 2024 03:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@lccxx
lccxx / obj2str.js
Created March 17, 2016 06:04
js obj with function stringify
function obj2str(obj) {
var fString = function(objj) {
if (!objj) return objj;
var newObj = Array.isArray(objj) ? [] : {}
Object.keys(objj).map(function(k) {
if (typeof(objj[k]) == "function") newObj[k] = objj[k].toString();
else if (typeof(objj[k]) == "object") newObj[k] = fString(objj[k]);
else newObj[k] = objj[k];
})
return newObj;
@steviecs
steviecs / gradient-obj.js
Created February 24, 2023 19:48
gradient-obj.js
/*
* Stripe WebGl Gradient Animation by Stripe.com
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
* commented out for now.
*
* Taken from: https://kevinhufnagl.com/how-to-stripe-website-gradient-effect/
* See also: https://codepen.io/smitpatelx/pen/GRZayyO
*/
// Converting colors to proper format