Skip to content

Instantly share code, notes, and snippets.

View oestrich's full-sized avatar
🔡
Making text games

Eric Oestrich oestrich

🔡
Making text games
View GitHub Profile
@oestrich
oestrich / gist:0dd9cca43c48c3050f0fe1aa43be684c
Created September 28, 2018 11:14
Media types supported by ExVenture
curl -H "Accept: application/json" https://midmud.com/
curl -H "Accept: application/hal+json" https://midmud.com/
curl -H "Accept: application/vnd.siren+json" https://midmud.com/
curl -H "Accept: application/vnd.collection+json" https://midmud.com/
curl -H "Accept: application/vnd.mason+json" https://midmud.com/
@oestrich
oestrich / signer.rb
Created October 21, 2015 02:21
Signing Google Cloud Storage URLs
private_key = "..."
client_email = "..."
bucket = "..."
path = "..."
full_path = "/#{bucket}/#{path}"
expiration = 5.minutes.from_now.to_i
signature_string = [
"GET",
@oestrich
oestrich / exventure.json
Created July 23, 2018 00:24
ExVenture Grafana Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@oestrich
oestrich / ex_venture.json
Created March 10, 2018 18:37
ExVenture Grafana Dashboard
{
"annotations": {
"list": [
{
"$$hashKey": "object:174",
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
@oestrich
oestrich / commands.exs
Last active December 14, 2017 02:38
Command parser with macros
Code.require_file("router.exs")
defmodule Commands.User do
@behaviour Router.PreParser
@impl Router.PreParser
def call(state) do
%{state | assigns: Map.put(state.assigns, :user, %{id: 10})}
end
end

Keybase proof

I hereby claim:

  • I am oestrich on github.
  • I am ericoestrich (https://keybase.io/ericoestrich) on keybase.
  • I have a public key ASDfZSNUBY96XScRjsdNmXpz6nHJ0y1XhfVA6MnxOGUG2Qo

To claim this, I am signing this object:

@oestrich
oestrich / parallel_test_adapter.rb
Created January 30, 2013 18:57
Parallel Faraday Test Adapter
class ParallelTestAdapter < Faraday::Adapter::Test
self.supports_parallel = true
def self.setup_parallel_manager
OpenStruct.new
end
end
@oestrich
oestrich / notification_printer.rb
Created November 14, 2012 14:45
Instrument every method in a class for metrics
ActiveSupport::Notifications.subscribe(/my_class$/) do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
Rails.logger.warn "%7.2fms %s" % [event.duration, event.name]
end
@oestrich
oestrich / Results
Created September 18, 2012 23:29
Failing OAuth2 feature for rspec_api_documentation pr #51
Feature: Use OAuth2 MAC client as a test client
Background: # features/oauth2_mac_client.feature:2
Given a file named "app_spec.rb" with: # aruba-0.4.11/lib/aruba/cucumber.rb:15
"""
require "rspec_api_documentation"
require "rspec_api_documentation/dsl"
require "rack/builder"
RspecApiDocumentation.configure do |config|
@oestrich
oestrich / Gemfile
Created September 5, 2012 15:37
WebMachine Test
source :rubygems
gem 'webmachine'
gem 'rspec'
gem 'rspec_api_documentation'
gem 'rack-test'
gem 'json_spec'