Skip to content

Instantly share code, notes, and snippets.

View essejmclean's full-sized avatar
👨‍💻
Writing code and pixel pushing

Jesse McLean essejmclean

👨‍💻
Writing code and pixel pushing
View GitHub Profile
@essejmclean
essejmclean / scrollbar-visible-width.ts
Last active October 24, 2023 23:54
Set --scrollbar-visible-width CSS variable
/**
* This is an Immediately Invoked Function Expression (IIFE).
* It's a good way to isolate variables declarations.
* The JavaScript parser runs this function as soon as it encounters it in the script.
*/
(function () {
/**
* Type definition for a callback function.
* The function can accept any number of arguments of any type.
*/
@essejmclean
essejmclean / markerio-widget.tsx
Last active October 25, 2023 00:02
Load Marker.io Widget in React
"use client";
import markerSDK, {
type MarkerProjectWidgetParams,
type MarkerSdk,
} from "@marker.io/browser";
import { useEffect, useMemo, useState } from "react";
// Import environment variables.
const MARKERIO_PROJECT_ID: string | undefined = process.env.MARKERIO_PROJECT_ID // <- CHANGE THIS IN YOUR CODE
@essejmclean
essejmclean / filter-null-and-undefined.ts
Last active October 24, 2023 17:04
Filter Null and Undefined Values from Nested Objects and Arrays in TypeScript
/**
* Filters out null and undefined values from the given object or array, including nested objects and arrays.
* @param {T} inputObj - The input object or array to filter.
* @returns {Required<{ [K in keyof T]: NonNullable<T[K]> }>} - A new object or array with the same structure as the input, but with all null and undefined values removed.
* @template T - The type of the input object or array, extending Record<string, any> or any[].
*/
export function filterNullAndUndefined<T extends Record<string, any> | any[]>(
inputObj: T,
): Required<{ [K in keyof T]: NonNullable<T[K]> }> {
if (typeof inputObj !== "object" || inputObj === null) {
@essejmclean
essejmclean / uiColor.js
Last active August 9, 2020 01:05
iOS UIColor for the System UI theme specification
import { rgba } from "polished";
export default {
label: [
rgba(0, 0, 0, 1),
rgba(60, 60, 67, 0.6),
rgba(60, 60, 67, 0.3),
rgba(60, 60, 67, 0.18),
],
fill: [