Skip to content

Instantly share code, notes, and snippets.

📝
Documenting things

Brandon Weaver baweaver

📝
Documenting things
Block or report user

Report or block baweaver

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@baweaver
baweaver / favorite_things_ruby_edition
Last active Sep 21, 2019
A Few of my Favorite Things translated to Ruby (WIP)
View favorite_things_ruby_edition
Ruby programming
And Gems pushed to GitHub
Cloud based deployments and CI / CD
Tests that will pass on the first try
These are a few of my favorite things
Just Rails new app name
and omakase thinking
convention o'er configuration
and sane default settings
View hash_set_extension.rb
class Hash
alias_method :+, :merge
def -(other)
other_keys = Set.new(other.keys)
# Irrelevant value method
# reject { |k, _v| other_keys.include?(k) }
# Relevant value method
View proposed_pipeline.rb
def double(n) n * 2 end
increment = -> n { n + 1 }
5
|> double # Method
|> increment # Proc
|> to_s(2) # self.to_s
View tales_of_the_ruby_grimoire.md

Tales of the Ruby Grimoire

Introduction

The council of 3.0 had been called, and Scarlet was readying to join them to discuss the future of the land of Ruby. With her was her student, Red, carrying out his latest lesson.

"Now be sure to finish the remaining problems by the time I return, Red. I expect I'll have many fun things to tell you of when I return." said Scarlet.

Red nodded, still writing away on his scrolls, but as Scarlet exited the castle a sly sort of grin grew on his face.

View contramap.rb
class Proc
def contramap(&fn) self << fn end
end
adds = -> a, b { a + b }.curry
[1, 2, 3].map(&adds[2])
# => [3, 4, 5]
# What if the type on the left doesn't work with `adds`?
@baweaver
baweaver / async_helpers.js
Created Apr 12, 2019
Helpers for working with ActionCable async on the client side
View async_helpers.js
// Helpers
const MAX_WAIT = 10000;
const POLLING_RATE = 500;
export function timedOut (maxWait) {
const startTime = Date.now();
return () => Date.now() - startTime > maxWait;
}
@baweaver
baweaver / open_source.md
Created Dec 2, 2016
So you want to start on Open Source?
View open_source.md

So you want to start on Open Source?

A short guide for getting you started into the magical world of OSS.

What is your passion?

Are you a musician? Look for musical tools. Are you an artist? Look for some graphics libraries. Find something that works with your other passions to get you going.

If your passion is programming, look for ways to improve the environment.

View rails_booklist.md

Rails Book List

A list of Rails books and their applications. Free books are tagged with (F)

Have a suggestion? Leave a comment. There are still books I need to read on the subject so some may not show up in this list yet.

Learning Rails

Your first steps into Rails

@baweaver
baweaver / ruby_tricks.rb
Created Feb 14, 2018
Having fun with M and Q
View ruby_tricks.rb
# A few fun tricks right quick. Note that more tricks like this are over at:
# https://medium.com/rubyinside/triple-equals-black-magic-d934936a6379
#
# I'll probably condense this into a blog post later, but for now we'll have our fun.
# 1 - "Pattern Matching" with case
# We make a new lambda named M for brevity. Because it can be called with `[]` it
# looks quite natural in flow with a case statement.
#
@baweaver
baweaver / ruby_quotes.txt
Created Oct 20, 2018
Best of Ruby IRC channel quotes
View ruby_quotes.txt
phaul - I don't know :) I don't understand you code :)
baweaver - Ah good
baweaver - that makes two of us
You can’t perform that action at this time.