Skip to content

Instantly share code, notes, and snippets.

View webbertakken's full-sized avatar
🧙
Learning new things

Webber Takken webbertakken

🧙
Learning new things
View GitHub Profile
@webbertakken
webbertakken / Microsoft.PowerShell_profile.ps1
Created February 9, 2025 19:14
My PowerShell profile
# General modules
Import-Module -Name PSReadLine # typeahead predictions and whatnot
Import-Module -Name Terminal-Icons # Icons when listing directories
Import-Module -Name PSFzf # activate using `Ctrl T`, `Ctrl R` and `Alt C`
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 # Exposes `refreshenv`
Invoke-Expression (&starship init powershell)
# Advanced completion features (arrow up and down after having started typing)
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
@webbertakken
webbertakken / starship.toml
Last active March 3, 2025 00:59
My terminal prompt configuration for Starship.rs
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
#############
# Notes #
#############
# This config assumes you have a Nerd Font installed and enabled in your terminal.
# I use 'FiraCode Nerd Font Mono', but you should be able to use any Nerd Font you like.
@webbertakken
webbertakken / package.json
Last active April 18, 2025 18:24
Definitive cross-platform lint-staged config (explained)
{
// 1. Use these exact dependencies
"devDependencies": {
"husky": "=8.0.3",
"lint-staged": "=13.2.1"
}
// 2. Make sure it installs when people install dependencies
"scripts": {
"prepare": "husky install"
@rmorse
rmorse / react-router-dom-v.6.02.prompt.blocker.js
Last active November 13, 2024 16:02
Adds back in `useBlocker` and `usePrompt` to `react-router-dom` version 6.0.2 (they removed after the 6.0.0 beta, temporarily)
/**
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'.
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381
*/
import { useContext, useEffect, useCallback } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
/**
* Blocks all navigation attempts. This is useful for preventing the page from
* changing until some condition is met, like saving form data.
@webbertakken
webbertakken / .gitattributes
Last active May 14, 2025 00:12
.gitattributes for Unity projects
#
# Git attributes for Unity projects
#
# Compiled by the GameCI community under the MIT license - https://game.ci
#
# Latest version at https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc
#
# Ensure that text files that any contributor introduces to the repository have their line endings normalized
* text=auto
@sindresorhus
sindresorhus / esm-package.md
Last active May 19, 2025 16: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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nodkz
nodkz / .babelrc.js
Last active November 28, 2024 00:45
Babel 7.0 with .babelrc.js DEPRECATED! This config was created when babel 7 was in beta
/* eslint-disable prefer-template */
const path = require('path');
const aliases = require('./aliases');
// ///////////////////////////////////////////////////////////////
// ////////////////// PLUGINS ////////////////////////////////
// ///////////////////////////////////////////////////////////////
const commonPlugins = [
@dahjelle
dahjelle / pre-commit.sh
Created July 13, 2016 16:48
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done
@leesmith
leesmith / simple-git-workflow.md
Last active December 30, 2023 23:37
Simple Git Workflow For Continuous Delivery

Simple Git Workflow For Continuous Delivery

Workflow guidelines:

  • master branch is always production-ready, deployable, 100% green test suite
  • New development is done on feature branches, with frequent rebasing onto master
  • Clean commit history by preferring to rebase instead of merge (git pull is configured to automatically rebase)

rebase workflow

Workflow