Skip to content

Instantly share code, notes, and snippets.

View lencioni's full-sized avatar
😍
Shipping

Joe Lencioni lencioni

😍
Shipping
View GitHub Profile
@Pinjasaur
Pinjasaur / bookmarklet.js
Last active May 1, 2026 17:35
Minnebar Session Schedule .ics Bookmarklet https://sessions.minnestar.org/schedule
javascript:(function(){const r={},s=(document.querySelectorAll(".nav-top .timeslot[startsAt]").forEach(e=>{var t=e.getAttribute("href").replace("#","");r[t]={start:parseInt(e.getAttribute("startsAt"),10),end:parseInt(e.getAttribute("endsAt"),10)}}),[]);if(document.querySelectorAll(".timeslot[id]").forEach(e=>{var t=e.id;const o=r[t];o&&e.querySelectorAll(".session").forEach(t=>{var r=t.querySelector("button.toggle-attendance");if(r&&"true"===r.getAttribute("data-session-attending")){var r=t.querySelector("h3.title"),n=t.querySelector(".room"),t=t.querySelector(".description"),r=r?r.textContent.trim():"Untitled Session",n=n?n.textContent.trim():"";let e="";t&&((t=t.cloneNode(!0)).querySelectorAll("a[href]").forEach(e=>{var t=e.getAttribute("href"),r=e.textContent.trim();e.replaceWith(r===t?r:r+" ("+t+")")}),e=t.textContent.trim()),s.push({title:r,location:n,description:e,start:o.start,end:o.end})}})}),0===s.length)alert("No attended sessions found. Make sure you are marked as attending sessions.");else{const i
@devonzuegel
devonzuegel / close-zoom-tab-on-success.js
Last active November 13, 2021 19:49
Close Zoom tab on success — TamperMonkey
/* This has moved to:
* https://github.com/devonzuegel/digital-nesting/blob/master/zoom/zoom.js
*/
@samthor
samthor / safari-nomodule.js
Last active January 15, 2026 17:50
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@paulirish
paulirish / server-timing-demo.js
Last active August 7, 2024 16:56
Demo of server timing values. visualized in chrome devtools
// see for screenshot:
// https://twitter.com/paul_irish/status/829090506084749312
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
sql-1;desc="MySQL lookup Server";dur=100,
sql-2;dur=900;desc="MySQL shard Server #1",
@ljharb
ljharb / array_iteration_thoughts.md
Last active June 8, 2026 11:52
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@iammerrick
iammerrick / LazilyLoad.js
Last active August 7, 2019 14:15
Lazily Load Code Declaratively in React + Webpack
import React from 'react';
const toPromise = (load) => (new Promise((resolve) => (
load(resolve)
)));
class LazilyLoad extends React.Component {
constructor() {
super(...arguments);
@janpaul123
janpaul123 / .diffux_ci-new.yaml
Created July 6, 2016 18:21
Diffux on CircleCI sketch
source_files:
- http://localhost:8080/diffux.js # For convenience, for use with webpack server. Is ignored on CircleCI.
- diffux-new.js
snapshots_folder: ./diffux_snapshots
@lencioni
lencioni / find-dead-js-modules.sh
Last active June 26, 2017 18:51 — forked from trotzig/find-dead-js-modules.sh
This script will find javascript modules that aren't currently used in your application.
#!/bin/bash
# Make the script fail on the first error encountered.
set -euo pipefail
# Create a temp folder that we can use to store files in.
if [ "$(uname -s)" = "Darwin" ]; then
tmp_dir=$(mktemp -d -t find-dead-modules.XXXXXXXX)
else
tmp_dir=$(mktemp -d --tmpdir find-dead-modules.XXXXXXXX)
@trotzig
trotzig / find-dead-js-modules.sh
Last active June 4, 2017 11:00
This script will find javascript modules that aren't currently used in your application.
#!/bin/bash
# Make the script fail on the first error encountered.
set -euo pipefail
# Create a temp folder that we can use to store files in.
if [ "$(uname -s)" = "Darwin" ]; then
tmp_dir=$(mktemp -d -t find-dead-modules.XXXXXXXX)
else
tmp_dir=$(mktemp -d --tmpdir find-dead-modules.XXXXXXXX)
@paulirish
paulirish / what-forces-layout.md
Last active June 10, 2026 01:58
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent