Skip to content

Instantly share code, notes, and snippets.

View olets's full-sized avatar
:shipit:

Henry Bley-Vroman olets

:shipit:
View GitHub Profile
@olets
olets / .zshrc
Created July 28, 2024 03:45
zsh completion setup
# If a completion is performed with the cursor within a word, and a full completion is inserted, the cursor is moved to the end of the word. That is, the cursor is moved to the end of the word if either a single match is inserted or menu completion is performed.
setopt always_to_end
# Automatically use menu completion after the second consecutive request for completion, for example by pressing the tab key repeatedly. This option is overridden by MENU_COMPLETE.
setopt auto_menu
# If unset, the cursor is set to the end of the word if completion is started. Otherwise it stays there and completion is done from both ends.
setopt complete_in_word
# On an ambiguous completion, instead of listing possibilities or beeping, insert the first match immediately. Then when completion is requested again, remove the first match and insert the second match, etc. When there are no more matches, go back to the first one again. reverse-menu-complete may be used to loop through the list in the other direction. This option over
function numsFromNumsAndRanges(numsAndRanges) {
const nums = new Set();
const numsAtStartOfRanges = new Set();
const numsAtEndOfRanges = new Set();
if (!numsAndRanges.length > 0) {
return { nums, numsAtStartOfRanges, numsAtEndOfRanges };
}
for (const numOrRange of numsAndRanges.split(',')) {
@olets
olets / A Tailwind CSS aspect-ratio Replacement Supporting Safari 14.md
Last active October 11, 2023 19:25
A Tailwind CSS aspect-ratio Replacement Supporting Safari 14
@olets
olets / input.scss
Created April 11, 2022 21:51
Generated by SassMeister.com.
@mixin focus() {
&:focus,
&:hover {
@content;
}
}
$btn-saturate-default: 25%;
$btn-lighten-default: 4%;
$btn-darken-default: 5%; // see also ecomm/molecules/button.scss
@olets
olets / links-elements-of-interest.js
Created October 21, 2021 23:18
find on a page all links with a pathname you care about
@olets
olets / README.md
Created September 24, 2021 07:06
Twig text transform (case) macros

Twig text transform (case) macros

Macros for

  • camelCase ( camel(string))
  • PascaleCase (pascale(string))
  • snake_case (snake(string))
  • SCREAMING_SNAKE_CASE (screamingsnake(string))
// ==UserScript==
// @name GitHub Ignore Whitespace
// @namespace https://olets.dev/
// @version 1.1
// @description Add URL parameter to ignore whitespace in GitHub pull request reviews
// @author Nimai C. Malle, forked by Henry Bley-Vroman
// @match https://github.com/*/*/pull/*
// @grant none
// @downloadURL https://gist.githubusercontent.com/olets/5083dad8870a4bdb4bf1cee8f38bc14b/raw/github_ignore_whitespace.js?v=1.1
// ==/UserScript==
@olets
olets / install-netbeans-on-macos-with-homebrew.md
Created July 7, 2021 23:10
Install Netbeans on macOS with Homebrew

Netbeans requires Java but the Netbeans Homebrew formula does not include Java as a dependency so it must be installed manually first:

brew install java

Per the Netbeans formula caveats,

For the system Java wrappers to find this JDK, symlink it with

@olets
olets / form-redirect-without-hash.md
Created June 25, 2021 23:54
Redirect form submission without hash

When redirecting a form with a redirect input, for example

<input type="hidden" name="redirect" value="<url>">

the browser may preserve the window hash after the redirect. For example, submitting

@olets
olets / appendFormDataToUrl.js
Created May 26, 2021 13:15
Append form data to a URL
/**
* Append form data to URL
* Henry Bley-Vroman, 2021
*
* Takes a URL and a form, returns a URL
* Use case: handling form submission with JS
*
* `url = (form.action, form)` and then use `url`
* `url = (url, form)` and then use `url`
*