Skip to content

Instantly share code, notes, and snippets.

View fables-tales's full-sized avatar
💭
I may be slow to respond.

Fable Tales fables-tales

💭
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env ruby
require "ripper"
require "stringio"
require "pp"
LineMetadata = Struct.new(:comment_blocks)
class Line
attr_accessor(:parts)
def initialize(parts)
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
RSpec::Matchers.define :eq_without_whitespace do |expected|
match do |actual|
actual.gsub(/\s/, "") == expected
end
end

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.

@fables-tales
fables-tales / spies.md
Last active August 29, 2015 14:24 — forked from nelstrom/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.

def foo(block)
p [:foo, 1]
block.call
p [:foo, 2]
end
def bar(block)
p [:bar, 1]
foo(block)
p [:bar, 2]
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>
def bar
puts "welp"
end
def foo
bar
end
RSpec.describe "foo" do
it "calls bar" do

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)

#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