Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Last active June 20, 2021 22:07
Show Gist options
  • Save JoshCheek/e54ed502856a31251afbf6e03ede225a to your computer and use it in GitHub Desktop.
Save JoshCheek/e54ed502856a31251afbf6e03ede225a to your computer and use it in GitHub Desktop.
YAML boolean values
# Context: https://twitter.com/josh_cheek/status/1406730934880198664
# NOTE: If you want to run this in bash, you have tod ouble-escape the newlines being passed to `tr`
curl -sL http://yaml.org/type/bool.html | # grab the docs on booleans
nokogiri -e 'puts $_.css("pre.screen").text' | # extract the values they mention
tr -d \n | # remove their whitespace formatting
tr \| \n | # each BNF "or" option gets its own line
ruby -r yaml -lne 'p [$_, YAML.load($_)]' | # print each input value and what it parses to
bat -l ruby # syntax highlight it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment