Skip to content

Instantly share code, notes, and snippets.

Avatar
🚋

Barnett Klane barnett

🚋
View GitHub Profile
@barnett
barnett / Instructions.md
Created Aug 12, 2020
Jekyll + Liquid dynamic navigation
View Instructions.md

Simple way to dynamically manage documentation through front matter without the need for a pesky config file.

Three variables one can set in front matter:

  • parent: Represents if this should be nested within another page for navigation
  • hidden: false for a page to be publicly listed, it'll be accessible via direct link regardless
  • nav_priority: Weights which document to show first, 1 is highest (ie top)

Logic

  • Can default to hide/show everything within _config.yml
  • A page shows up as a header if it:
@barnett
barnett / install_ruby_with_rbenv.md
Last active Jul 3, 2020 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS
View install_ruby_with_rbenv.md

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

View keybase.md

Keybase proof

I hereby claim:

  • I am barnett on github.
  • I am bklane (https://keybase.io/bklane) on keybase.
  • I have a public key whose fingerprint is 2358 150E 4439 57FD F09A DC94 6011 A341 710D 7558

To claim this, I am signing this object:

@barnett
barnett / count.rb
Last active Jul 13, 2016
Ruby Array#count magic
View count.rb
# Data
# We need to get a count for # of votes for different candidates
>> VOTES = {
?> "Napoleon" => "Pedro",
?> "Don" => "Summer",
?> "Deb" => "Pedro",
?> "Randy" => "Summer",
?> "Trisha" => "Pedro",
?> }
=> {"Napoleon"=>"Pedro", "Don"=>"Summer", "Deb"=>"Pedro", "Randy"=>"Summer", "Trisha"=>"Pedro"}