Skip to content

Instantly share code, notes, and snippets.

bestie /
Created Jul 5, 2021
A Rack app for rick rollin'
body = <<~HTML
<div class="tenor-gif-embed" data-postid="12136175" data-share-method="host" data-width="100%" data-aspect-ratio="1.4777448071216617"><a href="">Rick Ashley Dance GIF</a> from <a href="">Rickashley GIFs</a></div><script type="text/javascript" async src=""></script>
app = ->(env) {
bestie / 1_udp_listener.rb
Last active Sep 25, 2019
Help me fix this Rust UDP problem :)
View 1_udp_listener.rb
require "socket"
rx_port = 2222
tx_port = 2223
host = "localhost"
socket =
socket.bind(host, rx_port)
socket.connect(host, tx_port)
View prison_break.rb
# Run this script with the ENV var payload.
# Payload will be executed as part of your request to visit a prisoner.
# The goal is to free a prison in as few characters as possible.
module PrisonBreak
class Visit
attr_accessor :free_prisoner
attr_reader :prison, :payload

Keybase proof

I hereby claim:

  • I am bestie on github.
  • I am bestie ( on keybase.
  • I have a public key ASAU_62OgyyQ6IpGAlmQkLNK-JwXmslWMiOAueQy95ieOgo

To claim this, I am signing this object:

bestie / password_gen.rb
Last active Jan 19, 2018
Memorable, secure password generator in one file. XKCD style, includes 1765 common words.
View password_gen.rb
#!/usr/bin/env ruby
require "optparse"
options = {
:n_passwords => 1,
:password_length => 4,
:separator => " ",
bestie / wat_gems.rb
Created Nov 28, 2017
Parse the Gemfile.lock file and print the list of Gems that Bundler would install
View wat_gems.rb
require "bundler"
bundle =
gem_name_version_map = { |spec|
bestie / count_colors.rb
Created Jun 15, 2016
Imperative `` vs functional
View count_colors.rb
# Task: Count how many users have each favorite color
User =, :favorite_color)
colors = [:red, :green, :blue, :hot_pink]
users = { |n|, colors.sample) }
# The follow two example print the same result
bestie / tsort_spec.rb
Last active Mar 29, 2016
A topological sort head scratcher
View tsort_spec.rb
# Ah it's OK I got this one myself. It's pretty late at night but I get it now!
# I'll leave this here in case anyone is interested. I've added the
# explaination below
# This is some code I wrote as excercise after watching
# The first example mimics the result from the video and is there just to
# verify my use of the TSort module is correct.
View date_range_filter.rb
class DateRangeFilter
def self.to_proc
->(constraint, events) { new(constraint, events).call }.to_proc
def initialize(constraint, events)
@constraint = constraint
@events = events
View refactor_towards_hexagonal_rails.rb
class ApplicationController
def core_application
def adapter