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 / argument_ripper.rb
Created Dec 31, 2018
First round of argument ripper
View argument_ripper.rb
# Based on: https://twitter.com/josh_cheek/status/1079827841095749632
require 'method_source'
require 'parser/ruby25'
module ArgRipper
class << self
def get_args(meth)
Parser::Ruby25
.parse(meth.source)
@baweaver
baweaver / sf.rb
Created Dec 27, 2018
Experimental version of Sf, pre-release
View sf.rb
class Sf
attr_reader :operations
OPERATORS = %i(+ - * / % < > <= >= == && & || |)
INSTANCE_OP = -> name {
-> method_name, *args, **kwargs, &fn {
@operations.push(method_name: name, args: args, kwargs: kwargs, fn: fn)
self
@baweaver
baweaver / sf.rb
Created Dec 27, 2018
Redux of Stack Functions, testing a few things out
View sf.rb
class Sf
attr_reader :operations
def initialize(operations)
@operations = operations
end
def self.method_missing(method_name, *args, **kwargs, &fn)
p where: 'self.method_missing', method_name: method_name, args: args, kwargs: kwargs, fn: fn
@baweaver
baweaver / parser_error.rb
Created Dec 9, 2018
Why does Ruby break on this?
View parser_error.rb
class Foo
attr_accessor :bar
def initialize
@bar = 99
end
def baz
puts bar
@baweaver
baweaver / definitive_lemur_archive.md
Created Dec 7, 2018
Archive of all the lemur talks, put here until I redo the homepage later.
View definitive_lemur_archive.md

The Definitive Lemur Archive

A collection of links and resources pertaining to the lemurs and presentations involving them.

Why the Lemurs?

That's a good question, and one I frequently get. These articles dive into that subject

@baweaver
baweaver / paste_tmux_pry.md
Created Dec 2, 2018
Pasting in Pry with TMUX
View paste_tmux_pry.md
@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
View destructure_method.rb
def destructure(method_name)
# Intercept the original class
meta_klass = class << self; self end
# Save the original method as a proc
method_proc = method(method_name)
# We only want to do this for keyword argument type
# methods
unless method_proc.parameters.all? { |t, _| t == :key }
View transducers.rb
# Do note that I'm being purposely verbose to make this easier to read through,
# as transducers are already a bit hard to grok without shorthanding things.
def maps(&function)
proc { |accumulator, value|
accumulator << function.call(value)
}
end
def filters(&function)
@baweaver
baweaver / jquery_index.html
Created Jun 8, 2018
Preserving the structure of the jquery site at the time the header challenge was made.
View jquery_index.html
<!doctype html>
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head data-live-domain="jquery.com">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
You can’t perform that action at this time.