Skip to content

Instantly share code, notes, and snippets.

View masonfmatthews's full-sized avatar

Mason F. Matthews masonfmatthews

  • Hillsborough, NC
View GitHub Profile

Keybase proof

I hereby claim:

  • I am masonfmatthews on github.
  • I am masonfmatthews (https://keybase.io/masonfmatthews) on keybase.
  • I have a public key ASBB1tXT7YpcCYc6IBv8rX_PLRyt6AmLpJO8ZwTtsy7Qvwo

To claim this, I am signing this object:

@masonfmatthews
masonfmatthews / candidate-instructions.md
Last active February 22, 2019 22:09
Spreedly Async work sample

Spreedly Async work sample

Spreedly's main line of business is transacting with stored credit cards at other gateways and endpoints - which are all themselves some sort of remote service. As such, it is important that engineers at Spreedly understand the realities of dealing with remote services and distributed systems, in general. This work sample is designed to understand your comfort dealing with such systems.

Problem

We've deployed a server that you can start jobs on. What do the jobs do? Doesn't really matter. What is important is that the jobs will always take ~0.5 seconds to complete. You can queue up a job like this:

$ curl -H "Content-Type: application/json" -d '{

Keybase proof

I hereby claim:

  • I am masonfmatthews on github.
  • I am masonfmatthews (https://keybase.io/masonfmatthews) on keybase.
  • I have a public key ASBWgMZf7JIFopFWH_VC2gm9pk9xJdbVdQmXdHpGUyrtSwo

To claim this, I am signing this object:

@masonfmatthews
masonfmatthews / do_stuff.rb
Created November 8, 2016 14:45
Questionnaire Ruby Code
def do_stuff(big_thing, important_name)
answer = 0
bottom = 0
big_thing.each do |little_thing|
answer += little_thing[important_name]
bottom += 1
end
answer.to_f / bottom
end
puts "fake code"
@masonfmatthews
masonfmatthews / guard.swift
Created January 27, 2016 18:42
Using guard
func getCount() -> Int {
guard let json = self.json else { return 0 }
return json.count
}
func getAll() -> [Clip] {
guard json != nil else { return [] }
var clips:[Clip] = []
for result in json! {
guard let id = result["id"] as? Int,
@masonfmatthews
masonfmatthews / gist:66520677a19215a02245
Created May 8, 2015 20:00
More compact hash creation
# Optimal Moves Data
hard = {8 => {},9 => {}, 10 => {}, 11 => "Double if possible, otherwise Hit",
12 => {}, 13 => {}, 14 => {}, 15 => {}, 16 => {},
}
(5..7).each {|n| hard[n] = Hash.new("Hit")}
((2..4).to_a + (7..11).to_a).each {|n| hard[8][n] = "Hit"}
(5..6).each {|n| hard[8][n] = "Double if possible, otherwise Hit"}
(2..6).each {|n| hard[9][n] = "Double if possible, otherwise Hit"}
(7..11).each {|n| hard[9][n] = "Hit"}
@masonfmatthews
masonfmatthews / gist:91e46d2eafb7a2c23062
Created March 3, 2015 15:39
Time Passed Methods (requires Rails to run)
def time_passed(updated_at)
difference = (Time.now - updated_at.to_time)
time = (difference / 1.day).round
units = "day"
if time == 0
time = (difference / 1.hour).round
units = "hour"
if time == 0
time = (difference / 1.minute).round
units = "minute"
def first_name(name)
return "" unless name
array = name.split
if array.count < 2
""
else
array[0..-2].join(" ")
end
end