Skip to content

Instantly share code, notes, and snippets.

View bloudermilk's full-sized avatar

Brendan Loudermilk bloudermilk

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# TODO: Generic 500 response here and in Rails
openapi: '3.0.2'
info:
title: Open Lead Specification
version: 'v1.0'
description: >
## Overview
This spec implements a two-phase auction system commonly known as "ping
tree" or "ping post". The purpose of the system is to enable sellers of
@bloudermilk
bloudermilk / weighted_list.rb
Created June 8, 2018 00:12
Simple Ruby algorithm to generate a weighted list
# README
#
# To run tests:
# $ ruby weighted_round_robin.rb
# PASS [[0, "a"]] makes []
# PASS [[1, "a"]] makes ["a"]
# PASS [[1, "a"], [2, "b"]] makes ["b", "a", "b"]
# ...
#
# To debug (prints index as ID):
require "csv"
require "net/http"
require "json"
require "pry"
class String
def super_strip
gsub(/(^\W+|\W+$)/, "")
end
end

Keybase proof

I hereby claim:

  • I am bloudermilk on github.
  • I am bloudermilk (https://keybase.io/bloudermilk) on keybase.
  • I have a public key whose fingerprint is B54D E33B 3320 0EA7 A7AA 6852 AB19 6B5D 5009 CE58

To claim this, I am signing this object:

@bloudermilk
bloudermilk / gravatar.rb
Created February 26, 2016 23:31
Test whether or not a user has Gravatar
require "net/http"
class GravatarGenerator
URL_FORMAT = "http://www.gravatar.com/avatar/%s"
LAST_MODIFIED_TEST_STRING = "Wed, 11 Jan 1984 08:00:00 GMT"
def self.test(email)
url = URI(URL_FORMAT % generate(email))
Net::HTTP.start(url.host, url.port) do |http|
@bloudermilk
bloudermilk / vancouver-to-sf-tour-pack-list.md
Last active March 21, 2018 21:09
Pack List for my Vancouver to San Francisco Pacific Coast tour

To Do

  • Buy missing items
  • Test pack

Essentials

  • Phone
  • Wallet
  • Keys
@bloudermilk
bloudermilk / yield.rb
Last active August 29, 2015 13:58
Example of yield in ruby
def my_fancy_method
# Call the block with 1
yield 1
# Call the block with "cat"
yield "cat"
# Call the block with nothing (i.e. nil)
yield
end
def input_get
input = gets.chomp
sum[i] = input.to_i
end
def sum
sum = []
i = 0
puts input_get
[
{
"repo":{
"id":11757750,
"owner":"facebook",
"name":"huxley",
"url":"https://github.com/facebook/huxley",
"homepage":null,
"language":"Python",
"description":"Watches you browse, takes screenshots, tells you when they change."