Skip to content

Instantly share code, notes, and snippets.

@jakewhiteley
jakewhiteley / FocusManager.js
Last active February 4, 2021 09:58
A class for allowing mobile focus on elements during hashchange
import E from './E'
class FocusManager {
/**
* Call this method to boot up.
*/
static init() {
if (document.location.hash) {
FocusManager.focus(document.getElementById(window.location.hash.replace('#', '')), true)
}
@martinlaxenaire
martinlaxenaire / checkPerf.js
Last active February 7, 2024 10:37
A little function that performs a CPU performance check, based on a similar piece of code orriginally made by Baptise Briel
checkPerf() {
// performance test based on cpu performance
// higher score means worse performance
// based on Baptiste Briel's work: http://awams.bbriel.me/27
let perf = 0;
const start = (performance || Date).now();
let array = [];
for(let i = 0; i < 20000; i++) {
array = Math.pow(Math.sin(Math.random()), 2);
import gsap from 'gsap'
import { evt, utils } from '@/core'
const { qs, qsa, rect } = utils
export default function () {
const el = qs('.js-clip-menu')
const mask = qs('.js-clip-menu-mask', el)
const items = qsa('.js-clip-menu-link', el)

Idea: Flat file system for file-based routing

Personally I've never liked how tools like Remix or NextJS have mapped a nested file system to routes. Simple things like "I want to put this component in its own file" become annoying tasks.

I've always been a fan of "flatter" file systems, my files often look like this:

/App/