Skip to content

Instantly share code, notes, and snippets.

View megalithic's full-sized avatar

Seth Messer megalithic

View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 12, 2025 13:07
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@demosten
demosten / brewv.sh
Created February 20, 2019 15:33
Install specific version of a Homebrew formula
#!/bin/bash
#
# Install specific version of a Homebrew formula
#
# Usage: brewv.sh formula_name desired_version
#
# Notes:
# - this will unshallow your brew repo copy. It might take some time the first time
# you call this script
# - it will uninstall (instead of unlink) all your other versions of the formula.

Visual Studio Code shortcuts I use often

Navigation

Sidebar:

  • Cmd-Shift-F: search
  • Cmd-Shift-E: files

Navigating in current editor:

@james2doyle
james2doyle / httpstatus.lua
Created April 20, 2018 21:21
Hammerspoon HTTP Status Codes. Easily find the code or name for HTTP statuses. Press the keybinding (ctrl+shift+H) and filter the results. Hitting enter on a choice will send you to the httpstatuses.com website
--[[
Name: HTTP Status Codes
Author: James Doyle <[email protected]>
Description: Easily find the code or name for HTTP statuses
Demo: https://cl.ly/0Y302M0z3G1x/Screen%20Recording%202018-04-20%20at%2002.14%20PM.gif
Installation: Just require this file in your Hammerspoon init.lua file
Usage:
Press the keybinding (ctrl+shift+H) and filter the results
Hitting enter on a choice will send you to the httpstatuses.com website
]]--
@alexshagov
alexshagov / install-universal-ctags-with-gtags-osx.md
Last active May 21, 2022 13:41
How to install GNU Global with universall ctags support on mac OS

Unfortunately, homebrew does not support --with-universal-ctags option for global (on the state of April 2018) The reason is that universal-ctags is not officially released yet.

Install universal ctags

Run brew install --HEAD universal-ctags/universal-ctags/universal-ctags (See https://github.com/universal-ctags/homebrew-universal-ctags repo)

If you're on macOS, you might have an old ctags installed with command line tools for XCode. To fix this, simply run alias ctags="brew --prefix/bin/ctags"

@parmort
parmort / tmux_tc.md
Created March 26, 2018 21:47
Tmux TrueColor Setup

Tmux TrueColor (a.k.a. 24-bit color) Support

Prerequisites

To enable TrueColor for Tmux, you must make sure that you have two things:

  1. Tmux version 2.2 or higher. You can find out your version by running tmux -V
  2. You have a terminal that supports TrueColor (it may also be referenced by 24 bit color. To check if you do, run
@atomkirk
atomkirk / ecto-url-validation.md
Last active August 4, 2024 03:51
validate url in elixir

Here's an ecto changeset validation for urls:

  @doc """
  validates field is a valid url

  ## Examples
    iex> Ecto.Changeset.cast(%ZB.Account{}, %{"website" => "https://www.zipbooks.com"}, [:website])
    ...> |> Utils.Changeset.validate_url(:website)
    ...> |> Map.get(:valid?)
@BretFisher
BretFisher / pcat-install.sh
Last active April 15, 2025 04:14
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@zzamboni
zzamboni / catch_fn.lua
Last active August 24, 2023 10:21
How to catch the fn key using Hammerspoon
-- Catch fn-h and convert it to a left arrow key.
function catcher(event)
if event:getFlags()['fn'] and event:getCharacters() == "h" then
print("fn-h!")
return true, {hs.eventtap.event.newKeyEvent({}, "left", true)}
end
return false
end
local tapper=hs.eventtap.new({hs.eventtap.event.types.keyDown}, catcher):start()
@niksmac
niksmac / zmv-examples.md
Created March 7, 2017 05:58
ZMV-Examples (require autoload zmv)

rename a section of a filename, i. e. example.1.{txt,conf,db} or 12345.1.{wav,ogg,mp3} and

change the 1 to a 2 in the filename while preserving the rest of it.

$ zmv -n '(.)(<->)(.[^.]#)' '$1$(($2+1))$3' # would rename x.0001.y to x.2.y. $ zmv -n '(.0#)(<->)(.[^.]#)' '$1$(($2+1))$3'

Rename files to lower case

$ zmv '*' '${(L)f}'

serially all files (foo.foo > 1.foo, fnord.foo > 2.foo, ..)

$ autoload zmv