Skip to content

Instantly share code, notes, and snippets.

@wes-goulet
wes-goulet / .zshrc
Last active January 6, 2024 19:49
My up-to-date .zshrc file, leveraging Oh My Zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/wes/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@wes-goulet
wes-goulet / launch.json
Created April 18, 2020 21:47
Example VSCode Debug Config for debugging rollup and jest tests
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Rollup",
"program": "${workspaceFolder}/node_modules/.bin/rollup",
"args": ["-c"],
"internalConsoleOptions": "openOnSessionStart"
@wes-goulet
wes-goulet / type-guard-example.js
Created October 10, 2020 18:31
Type Guard in jsdoc comment
/** @typedef {{swim: () => void}} Fish */
/** @typedef {{fly: () => void}} Bird */
/**
* @param {Fish | Bird} pet
* @returns {pet is Fish}
*/
function isFish(pet) {
return "swim" in pet;
}
window.onscroll = function () {
/** @type {HTMLElement | null} */
const header = document.querySelector('header');
if (header !== null) {
if (window.scrollY < 5) {
header.classList.remove('scrolled');
} else {
header.classList.add('scrolled');
}
}
@wes-goulet
wes-goulet / insta-fetcher.mjs
Created May 11, 2022 23:09
Node script to fetch instagram posts for a given user and save the files to a folder
#!/usr/bin/env node
// @ts-check
import fetch from "node-fetch";
import fs from "fs";
import { IgApiClient } from "instagram-private-api";
/**
* @typedef InstaPost
* @prop {string} thumbnailUrl