Skip to content

Instantly share code, notes, and snippets.

View chris-erickson's full-sized avatar

Chris Erickson chris-erickson

View GitHub Profile
@irvingpop
irvingpop / hny-column-cleanup.py
Last active November 16, 2024 00:33
Honeycomb column deletion tools
#!/usr/bin/env python3
# usage: hny-column-cleanup.py [-h] -k API_KEY -d DATASET [-m {hidden,spammy}]
# Honeycomb Dataset Column Cleanup tool
# arguments:
# -h, --help show this help message and exit
# -k API_KEY, --api-key API_KEY
# Honeycomb API key
# -d DATASET, --dataset DATASET
# Honeycomb Dataset
import React, { useState, useEffect, useRef } from 'react'
import { urlFor } from '../lib/api'
import useWindowDimensions from '../hooks/useWindowDimensions'
/* TODO: Add fallback image */
function LazyImage({
className,
image,
desktopSizePercent = 100,
@sindresorhus
sindresorhus / esm-package.md
Last active May 14, 2025 06:52
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

⚠️ Warning: this document is out of date.

For the most recent webpack5 instructions see MIGRATION.md.

Storybook experimental Webpack 5 support

Storybook 6.2 includes experimental Webpack 5 support. Webpack 5 brings a variety of performance improvements, as well as exciting new features like module federation. Here's a quick guide to get you going.

Intro

@dabit3
dabit3 / appsync-cdk-stack.ts
Last active December 30, 2021 16:17
Todo app AppSync API with CDK
import * as cdk from '@aws-cdk/core';
import { CfnApiKey, PrimaryKey, Values, GraphQLApi, MappingTemplate, FieldLogLevel, AttributeValues } from '@aws-cdk/aws-appsync'
import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb';
import * as lambda from '@aws-cdk/aws-lambda'
import { join } from 'path';
export class AppsyncCdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
@jefftriplett
jefftriplett / modd.conf
Last active January 13, 2020 15:03
My setup for: Modd, Python, Django, TailwindCSS, Black, and pytest
# Update project requirements when requirements.txt changes.
requirements.txt {
prep +onchange: "pip install -U -r requirements.txt"
}
../.envrc {
prep +onchange: "direnv allow"
}
**/index.css **/tailwind.config.js {
import S from '@sanity/desk-tool/structure-builder'
import { MdWork, MdAccountBalance, MdCached, MdDashboard, MdSettings, MdMail, MdPerson, MdAssignment, MdDescription, MdShoppingCart, MdLightbulb, MdLocalOffer, MdChatBubble } from 'react-icons/lib/md'
// We filter document types defined in structure to prevent
// them from being listed twice
const hiddenDocTypes = listItem =>
!['redirects', 'page', 'newsroom', 'caseStudy', 'product', 'solution', 'site-config', 'contactInfo', 'resource', 'author', 'blog', 'category', 'testimonial'].includes(listItem.getId())
export default () =>
S.list()
@cb109
cb109 / vscode_python_sort_imports_isort_on_save.md
Last active April 29, 2025 08:19
VSCode: Python Sort Imports on File Save (isort)

VSCode: Python Sort Imports on File Save (isort)

  • Make sure the isort extension is installed in VSCode

Update April 2025

The latest VSCode update brought the requirement to use a python environment 3.8+ for isort:

2025-04-24 13:28:29.888 [info] No interpreter found from setting isort.interpreter
@FlipperPA
FlipperPA / virtualenvwrapper-venv-aliases.sh
Last active June 14, 2023 16:56
Shortcuts for Python 3's venv for virtualenvwrapper users.
export VENV_HOME=~/.venvs
export VENV_PYTHON=/usr/bin/python3.6
fn_workon() {
if [ -f "${VENV_HOME}/${1}/bin/activate" ]; then
export VENV_CURRENT="${VENV_HOME}/${1}"
# Run commands before activation
if [ -f "${VENV_CURRENT}/pre_activate.sh" ]; then
. "${VENV_CURRENT}/pre_activate.sh"
fi
@parties
parties / renameReactJsToJsx.sh
Last active April 3, 2025 16:32
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;