Skip to content

Instantly share code, notes, and snippets.

View gaving's full-sized avatar
🎯
Focusing

Gavin Gilmour gaving

🎯
Focusing
View GitHub Profile
@ivanbtrujillo
ivanbtrujillo / react-lazy-with-reload.ts
Created November 30, 2023 11:15
react-lazy-with-reload.ts
/**
* This is a wrap for React.Lazy based on Christoph Nakazawa solution (https://gist.github.com/cpojer/c50a742ec943d95c3c72a41ac1c06f03) for the issue that happens when using React.Lazy and we deploy a new version of a module, changing the hash (automatically managed by bundlers).
*
* THE PROBLEM:
* When our React application is compiled for production, packaging tools (Vite in this case) often add hashes to the filename to handle caching.
* These hashes change whenever the content of the file changes. This ensures that users get the most recent version of the file, since a change in the hash will force the browser to download the new file instead of serving a cached version.
*
* If a user has your application open and you make a new deployment, the file names of the dynamically loaded modules may change (due to the new hashes).
* And then, if the user navigates to a part of your application that requires loading a new module, their browser will attempt to load the module using the old file name (which i
@ianchesal
ianchesal / overrides.lua
Created May 8, 2023 18:45
copilot.lua + copilot-cmp in NvChad
-- Add the following in your custom/configs/overrides.lua file. You can configure copilot to meet your needs here.
M.copilot = {
-- Possible configurable fields can be found on:
-- https://github.com/zbirenbaum/copilot.lua#setup-and-configuration
suggestion = {
enable = false,
},
panel = {
enable = false,
@slavafomin
slavafomin / 00-typescript-esm.md
Last active April 11, 2024 07:52
Using TypeScript with native ESM

Using TypeScript Node.js with native ESM

This reference guide shows how to configure a TypeScript Node.js project to work and compile to to native ESM.

Rationale

CommonJS module system was introduced by the Node.js developers due to the lack of the notion of "modules" in the original JavaScript (ECMAScript) language specification at that time. However, nowadays, ECMAScript has a standard module system called ESM — ECMAScript Modules, which is a part of the accepted standard. This way CommonJS could be considered vendor-specific and obsolete/legacy. Hopefully, TypeScript ecosystem now supports the "new" standard.

So the key benefits are:

@IanColdwater
IanColdwater / twittermute.txt
Last active April 3, 2024 19:43
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

I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@sarmbruster
sarmbruster / run_docker_neo4j_bloom.sh
Last active February 27, 2024 17:56
Run Neo4j in a docker container together with apoc and Bloom installed.
#!/bin/sh
# start a neo4j docker container with apoc and bloom (server variant) configured
# this requires to have
# * curl, unzip and jq being installed
# * having a valid bloom license file
# released under the WTFPL (http://www.wtfpl.net/)
# (c) Stefan Armbruster
@tamphh
tamphh / git_fzf.sh
Last active March 30, 2024 20:32 — forked from junegunn/gist:f4fca918e937e6bf5bad
Browsing git commit history with fzf
# git log show with fzf
#
# https://gist.github.com/tamphh/3c9a4aa07ef21232624bacb4b3f3c580/edit
# https://asciinema.org/a/257939
#
# git log show with fzf
gli() {
# param validation
@pabloab
pabloab / CLI-not-so-known_handy_utils.md
Last active September 8, 2020 23:05
List of not-so-known handy CLI utils

List of not-so-known handy CLI utils

Inspired from this Twitter post.

  • tig # text-mode interface for Git
  • diff-so-fancy # 11.5k
  • ncdu # Disk usage analyzer
  • bat # cat alternative
  • fzf # 20.4k A command-line fuzzy finder. Probably there is a oh-my-zsh plugin
  • httpie # 40.3k CLI, cURL-like tool for humans. See https://httpie.org/
@buckelij
buckelij / graphql-paginate.sh
Created August 30, 2018 20:45
paginate github scim data in bash/curl/jq
#!/bin/bash
# requires `bash, `jq` and `curl`
# set your credentials and org name below
#
# This script paginates the GraphQL API to get all users. It does not check for rate limits
# but sleeps 10 seconds after every call to try to avoid hitting a rate limit.
CREDENTIALS=USERNAME:TOKEN
ORG=YOUR-ORG
CURSOR=null