Skip to content

Instantly share code, notes, and snippets.

@barnett
barnett / count.rb
Last active July 13, 2016 02:35
Ruby Array#count magic
# 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"}

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 / install_ruby_with_rbenv.md
Last active October 4, 2023 07:29 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS

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.

@barnett
barnett / Instructions.md
Created August 12, 2020 04:58
Jekyll + Liquid dynamic navigation

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: