Skip to content

Instantly share code, notes, and snippets.

Sam Phippen samphippen

Block or report user

Report or block samphippen

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
View rubyfmt on rubyfmt.rb
#!/usr/bin/env ruby
require "ripper"
require "stringio"
require "pp"
LineMetadata = Struct.new(:comment_blocks)
class Line
attr_accessor(:parts)
def initialize(parts)
View postsmd
1. A deconstruction of an unreasonable Junior Developer interview
2. A post about technical debt, recations to rough situations and how technical debt composes
3. Some thoughts on building a DRY enough way of integrating SaaS plans with Braintree
View gist:2dea752b109d36a21641
RSpec::Matchers.define :eq_without_whitespace do |expected|
match do |actual|
actual.gsub(/\s/, "") == expected
end
end
View abstract.md

Gems are a fundamental part of the Ruby ecosystem. Through the tireless work of open source developers we're able to amplify our own capabilities and build systems of complexities that would otherwise be out of our reach. Amongst Ruby developers from veteran to beginner a common wisdom of "use a Gem for it" pervades our culture.

Though at times the use of a Gem can be a mistake. When you add a gem to your project you are adopting it's code into your system. In this talk you'll learn what it means to add a Gem to your project. You'll get a grasp on some ways to decide if you should add a Gem to your project. You'll also walk away with a firm understanding of what it means to the future of your project when you become dependent on a Gem. If you're new to Rails and want to learn more about libraries, Gems, and all the other things surrounding third party code in your project this talk will be perfect for you.

View spies.md

Write a simple library to enable testing with spies.

Here's a simple Ruby app which interacts with a RESTful API. The app has a passing test suite, but the tests are an incomplete specification of its behaviour. Add a set of isolated tests that spy on collaborations between objects to complete the test suite.

View procs.rb
def foo(block)
p [:foo, 1]
block.call
p [:foo, 2]
end
def bar(block)
p [:bar, 1]
foo(block)
p [:bar, 2]
View gist:8f58a33bc05cd847c38c
venv)vagrant-ubuntu-trusty-64 (master)# python3 validate-reachability.py comp/main comp/
Traceback (most recent call last):
File "validate-reachability.py", line 30, in <module>
ticket = str(element.with_suffix(''))
File "/usr/lib/python3.4/pathlib.py", line 760, in with_suffix
raise ValueError("Invalid suffix %r" % (suffix))
ValueError: Invalid suffix ''
(venv)vagrant-ubuntu-trusty-64 (master)# python3 validate-reachability.py comp/main.yaml comp/
Traceback (most recent call last):
File "validate-reachability.py", line 30, in <module>
View gist:9da4777150cf958ba5b9
def bar
puts "welp"
end
def foo
bar
end
RSpec.describe "foo" do
it "calls bar" do
View gist:53c03b460a730b57370e

Logistics

Logistics is an isolated service for exporting student robotics robot.zip files.

Developer Setup

  • Make sure you have the python tool virtualenv installed
  • run ./script/setup
  • run source venv/bin/activate (this puts you in an isolated python environment, run deactivate to quit it)
View gist:a7c3c4258d33e41bfd1d

#The secret weapon in your refactoring toolbelt: Types

Types. Even saying the word makes most Rubyists run, screaming for their lives. Didn't we do away with all that public static void main nonsense a long time ago? Well yes. Yet: we shouldn't underestimate the importance of thinking about types. Even when building apps in ruby.

In this talk we'll cover:

  • Basic type theory as it applies to ruby
  • How to use types to improve our applications
  • What affects types have on our objects every day
You can’t perform that action at this time.