Skip to content

Instantly share code, notes, and snippets.

View JohnIrle's full-sized avatar
💻

John Irle JohnIrle

💻
View GitHub Profile
@JohnIrle
JohnIrle / fullPathFinderTitle.sh
Created September 8, 2024 16:10
Display the full path in the Finder Title. E.g. /User/Documents
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
killall Finder
@JohnIrle
JohnIrle / Cargo.toml
Created April 4, 2024 16:12
Extreme Clippy - Enable all lints and disable lints as necessary while developing.
[package]
name = "extreme-clippy"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[lints.clippy]
@JohnIrle
JohnIrle / GolandTRunTemplate.md
Created March 16, 2024 21:24
Go land live template for t.Run
  • Create a new live template under the Go template group

  • Give it an abbreviation. I use trun

  • Use the Go -> expression context

  • Paste this into the "Template text" box

t.Run("$NAME$", func(t *testing.T) {
    $END$
})
@JohnIrle
JohnIrle / useMedia.jsx
Created March 25, 2021 20:27 — forked from cassidoo/useMedia.jsx
An example of checking on a media query with React Hooks
function useMedia(query) {
const [matches, setMatches] = useState(window.matchMedia(query).matches)
useEffect(() => {
const media = window.matchMedia(query)
if (media.matches !== matches) {
setMatches(media.matches)
}
const listener = () => {
setMatches(media.matches)
@JohnIrle
JohnIrle / console-log-nest-object.js
Created March 1, 2021 14:41
Pretty print a js object that is nested with JSON.stringify and console.log
console.log(JSON.stringify(object, null, ' '));
@JohnIrle
JohnIrle / semantic-commit-messages.md
Created February 4, 2021 03:11 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@JohnIrle
JohnIrle / install-latest-nvim.sh
Last active July 16, 2021 15:39
Install latest neovim on osx with homebrew
brew unlink neovim
brew install neovim --HEAD
nvim --version
@JohnIrle
JohnIrle / init.vim
Created November 19, 2020 03:12
Display terminal background image in nvim
hi normal guibg=NONE ctermbg=NONE

Bootstrap a TypeScript + React project

Learn how to setup a TypeScript + React project from scratch. Understand the reason behind every line involved in the configuration allowing you to customize it at will in the future.

We start of with a bare bones package.json file cat package.json

{
  "name": "bootstrap",
  "version": "0.0.0",
 "license": "MIT",
function hashStringToInt(s, tableSize) {
let hash = 17;
for (let i = 0; i < s.length; i++) {
hash = (13 * hash * s.charCodeAt(i)) % tableSize
}
return hash;
}