Skip to content

Instantly share code, notes, and snippets.

Andrew Hoyle mettledrum

Block or report user

Report or block mettledrum

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
@mettledrum
mettledrum / main.go
Last active Dec 15, 2017
go aws sdk -> s3rver docker; just morphed the README.md example a lil' bit
View main.go
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"time"
@mettledrum
mettledrum / main.go
Last active Nov 27, 2017
workers that run until error
View main.go
package main
import (
"errors"
"fmt"
"sync"
"time"
)
// what the consumer does
@mettledrum
mettledrum / main.go
Created Nov 22, 2017
hard workin go routines
View main.go
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
View fiddle.response.json
{
"who": "mettledrum",
"age": 31,
"fav_beers":
[
{
"name": "hot pepper",
"abv": 5.2,
"is_good": false
},
@mettledrum
mettledrum / agreement.html
Created May 30, 2015
wkhtmltopdf usage for PDF rendering
View agreement.html
<h1>{{.Stuff}} is really neato!</h2>
@mettledrum
mettledrum / PDFify.go
Created May 25, 2015
use suffix to PDF-ify any ol' endpoint
View PDFify.go
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/context"
"github.com/gorilla/mux"
"github.com/terryh/gopdf"
@mettledrum
mettledrum / gist:a6107e0de98140b42222
Last active Apr 24, 2018
example of using pprof
View gist:a6107e0de98140b42222
package main
import (
"runtime/pprof"
"fmt"
"net/http"
"os"
"time"
)
@mettledrum
mettledrum / _comment_forest.html.erb
Last active Aug 29, 2015
_partials for recursively displaying nested comments for a posting
View _comment_forest.html.erb
<% @comments.each do |comment_hash| %>
<%= render 'comment_tree', comment_hash: comment_hash %>
<% end %>
View variadic_item.rb
# mixes in logic to make a model understand how to fetch its relationships
# based on the item_id/item_item_type field combination
module VariadicItem
extend ActiveSupport::Concern
included do
belongs_to :item_type
end
# get the item associated with the current polymorphic record into which this module has been mixed
@mettledrum
mettledrum / numbers_to_English.rb
Last active Aug 29, 2015
Just a simple class to convert integers LT | 1 quadrillion | into their American English equivalent.
View numbers_to_English.rb
# Andrew Hoyle
# converts a +/- integer to its American English equivalent
# includes basic exceptions
# PRE: less than | 1 quintillion | and +/- integer
# allows only numbers, commas, and '+' or '-' in idx[0]
# POST: American English translation of number
class Worder
# AM. ENGLISH
You can’t perform that action at this time.