Skip to content

Instantly share code, notes, and snippets.

View pierrenel's full-sized avatar
:shipit:

Pierre Nel pierrenel

:shipit:
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active May 24, 2024 13:55
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@talkingmoose
talkingmoose / Sonoma-compatible Macs (regex)
Last active December 10, 2023 17:14
Regex looks for all Mac models compatible with macOS Sonoma. May not be up-to-date with newly released models.
https://support.apple.com/en-us/HT213772
Published Date: November 15, 2023
Verification: https://regex101.com/r/GCfKMt/9
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[345]|BookPro1[5-8]|BookAir([89]|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@joshcawthorne
joshcawthorne / useWindowSize.js
Last active October 5, 2023 13:21
SSR-Compatible (NextJS, Gatsby etc) React hook for getting Window Size.
import { useState, useEffect } from "react";
function useWindowSize() {
const [windowSize, setWindowSize] = useState<{ width: number | undefined; height: number | undefined }>({
width: undefined,
height: undefined,
});
useEffect(() => {
function handleResize() {
@IanColdwater
IanColdwater / twittermute.txt
Last active May 23, 2024 18:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@thomaswangarchive
thomaswangarchive / Stack.js
Last active March 5, 2021 12:45
Stack layout component in React
import React from "react";
import styled from "styled-components";
const Stack = styled.div`
--space: ${props => props.space || "1.5rem"};
display: flex;
flex-direction: column;
justify-content: flex-start;
* {
@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 15, 2024 20:11
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@antoniocapelo
antoniocapelo / use-scroll-listener.js
Last active July 8, 2019 09:57
Custom React Hook for setting a passive scroll listener and get updated scrollY and scroll direction information
/**
* useScrollListener hook
* Usage: const { scrollY, scrollDirection } = useScrollListener();
*/
import { useState, useRef, useEffect } from 'react';
export function useScroll() {
const [scrollY, setScrollY] = useState(0);
const [progress, setProgress] = useState(0);
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active May 24, 2024 11:21
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@jonkwheeler
jonkwheeler / RevealText.js
Last active May 2, 2024 05:46
React: Animation component using GSAP's SplitText plugin to reveal text on a page
// @flow
import { PureComponent, type Node, Fragment } from 'react';
import { TimelineLite } from 'gsap';
import SplitText from 'Lib/gsap-bonus/umd/SplitText';
import Waypoint from 'react-waypoint';
type RevealTextProps = {
children: Node,
waypointTopOffset: string,
waypointBottomOffset: string,