Skip to content

Instantly share code, notes, and snippets.

View johnloy's full-sized avatar

John Loy johnloy

View GitHub Profile
@johnloy
johnloy / debounce.js
Created June 6, 2022 14:11 — forked from rpemberton/debounce.js
Debounce with requestAnimationFrame
// Useful for debouncing callbacks to mousemove, resize, scroll event listeners
function debounce(fn) {
let raf;
return (...args) => {
if (raf) {
console.log('debounced');
return;
}
@johnloy
johnloy / github.bash
Created February 4, 2022 16:52 — forked from igrigorik/github.bash
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep [email protected] | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@johnloy
johnloy / font-stacks.css
Created October 26, 2021 23:40 — forked from don1138/font-stacks.css
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* A modern Georgia-based serif */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
@johnloy
johnloy / transformObj.js
Created October 18, 2021 16:45 — forked from juliarose/transformObj.js
Recursively transform key/values in object, including array values
/**
* Recursively transform key/values in object, including array values
*
* Also can act as a basic deep clone method
* @param {Object} obj - Object to transform
* @param {Object} [transforms={}] - Object containing transformation functions
* @param {Function} [transform.keys] - Function for transforming keys from 'obj'
* @param {Function} [transform.values] - Function for transforming values from 'obj'
* @param {Number} [level=0] - Level of recursion, passed as the 2nd argument to a transform function
* @returns {Object} Transformed object
function getRandomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
{
"basics": {
"name": "John Loy",
"label": "Web Engineer",
"image": "",
"email": "[email protected]",
"phone": "(434) 981-7529",
"url": "https://johnloy.me",
"summary": "I’ve done most things “web”, for over 20 years, beginning my career as a graphic designer, evolving into a Web Engineer. At various points in my career I’ve called myself a webmaster, web UX designer, back-end engineer, and front-end engineer. These days I might call myself a front-end-leaning full-stack engineer, but I prefer to just call myself flexible. Also, I’m a developer who “gets” design!",
"location": {
find /home/example -iname "*.txt" -exec grep -Li "mystring" {} \+
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Next: Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
/**
* This is a better alternative to using 'forwards'
* fill mode, as it allows you to update inline styles
* after the animation has completed. Contrast with:
*
* element.animate({
* { opacity: '0.2' },
* {
* duration: 500,
* easing: 'ease-in-out',