Skip to content

Instantly share code, notes, and snippets.

View alanwsmith's full-sized avatar

Alan Smith alanwsmith

View GitHub Profile
@alanwsmith
alanwsmith / example.js
Created April 7, 2021 03:47
Playing around with alternative to Newspaper Code Structure (via: https://kentcdodds.com/blog/newspaper-code-structure)
///////////////////////////////////////////////////////////////////////
// This is changing the grouping and alphabetization of the initial //
// example to gauge readability. //
///////////////////////////////////////////////////////////////////////
export const thereIsABetterWay = true
export const bar = {
100101110111011102132|01011001002020|010110010012|010110010021|10010111011101110
@alanwsmith
alanwsmith / gist:7d344c2b60e79bac39b122ccb186b508
Created December 15, 2020 17:40
Example of viewing permissions in postgres with `\du` vs `\l`
postgres-# \du
List of roles
Role name | Attributes | Member of
---------------------+------------------------------------------------------------+-----------
launchpad_dev_user | | {}
launchpad_prod_user | | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
toolkit_dev_user | | {}
toolkit_prod | | {}
toolkit_prod_user | | {}
@alanwsmith
alanwsmith / keybase.md
Created January 26, 2016 16:15
keybase.md

Keybase proof

I hereby claim:

  • I am alanwsmith on github.
  • I am alanwsmith (https://keybase.io/alanwsmith) on keybase.
  • I have a public key whose fingerprint is C0F2 EE68 14B7 0E30 6CF6 1089 00BE 4373 A2A5 1665

To claim this, I am signing this object:

@alanwsmith
alanwsmith / jump-to-marks.zsh
Created August 25, 2013 17:43
A version of Jeroen Janssens' "Quickly navigate your filesystem from the command-line" code (including autocomplete) setup for a Mac running OS X 10.8 and a ZSH shell. (Note that I've changed the name of the 'jump' command to 'jt' to make it shorter and easier to type.) Original article: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your…
# Based on: Quickly navigate your filesystem from the command-line
# http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
# by Jeroen Janssens
# Notes:
# - This version is for Mac OSX 10.8 using ZSH.
# - It includes autocomplete functionality.
# - The original 'jump' command changed to 'jt' (think Jump To).
# - Marks are stored in '~/.jumptomarks' instead of '~/.marks'.
# - The '~/.jumptomarks' dir is created automatically by using 'mark'
@alanwsmith
alanwsmith / gist:5228247
Created March 23, 2013 16:10
Default PATH environment variable from clean install of Mac OS X 10.8.3

Notes from a clean install of Mac OS X before messing around with environmental variables. The default PATH that is provided for the default user is:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

The /usr/local/bin did not get created by default. It can be created with:

sudo mkdir -p /usr/local/bin
@alanwsmith
alanwsmith / output-commas-except-for-last-item.xslt
Created July 11, 2012 16:47
Putting commas after each value in a loop except for the last one. Useful for JSON and the like
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--
Example of putting commas after everything but the last item in a list.
This will process the XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>