Articles tagged with 'Ruby'
Using Dry::Container for Dependency Injection
May 6, 2020
The point of this post isn't to convince you of the usefulness of Dependency Injection there's been plenty of pixels spilled about it already. Instead, I want to talk about using Dry::Container to alleviate some of the pain points that DI introduces.
Let's Encrypt + Route53 + Ruby = Yay!
Apr 21, 2016
A few months ago, Let's Encrypt rolled out a feature to verify domains over DNS. Their automatic configuration tool doesn't support all the use cases yet, including my particular scenario: multiple load-balanced EC2 instances behind a single ELB, using Route53 for DNS. I wrote a tool to simplify updating Route53 DNS Records with the challenge, as well as updating the ELB with the resulting certificate. Check out the README and code, or read on for why I wrote it.
The Conductor Pattern
May 1, 2012
A movement has been growing over the last several months to make our Rails applications more object-oriented. One of the most popular recently has been Avdi Grimm's Objects on Rails. In it, he talks about an alternative to the Presenter pattern, which he calls Exhibits (and both of which are subsets of the Decorator pattern). I've been using another form of this, which may or may not be called a Conductor.
Annoucing ProgressBar
Apr 10, 2011
I was working on a script to sync hundreds of thousands of records between two databases, and wanted a simple way to keep track of progress. I couldn't find one that was easy to use and did what I wanted, so I wrote my own. Not much more introduction needed, how about a simple example?
About this Blog
Jul 2, 2010
After nearly a year on hiatus, I'm finally ready to start blogging again. I have several neat projects I've been working on over the last several months, and I need a place to write about them.
Writing DataMapper Adapters - A Tutorial
Mar 31, 2009
The adapter API for DataMapper has been in a bit of flux recently. When I submitted my proposal for a talk at MountainWest, adapters were irritatingly complex to write. You just needed to know too much about DataMapper's internals to be able to write one. A week before the conference began, I started a significant effort to re-write the API to make it easier. I succeeded, a little too well; my 30 minute talk only took 15. Since then, I've written a couple more adapters from scratch, and refined the API further. This post will serve as notes on the changes that I've made, and a tutorial on writing adapters.
A Response to "Database Versioning"
Mar 3, 2009
I was just going to post a comment in reply to Adam Wiggins's Database Versioning post, but it ended up being pretty long, so I'll post a response here instead.
HOWTO - Get a list of a class's subclasses
Feb 5, 2009
I recently came across a situation where I had an AbstractClass, an I wanted to know all of the classes that had inherited from it. There were lots of implementations on the web, but that weren't exactly what I wanted, or they used ObjectSpace to get ALL the classes, and see if the interesting one was in its ancestors.
Ruby Dir.glob bug
Jan 20, 2009
To further elaborate on Yehuda's twit:
HOWTO: Better JSON parsing when POSTing to Merb Apps
Oct 10, 2008
Where I work, we have fairly extensive, JSON-based web services in all out applications. As a quick example, here's what you would get if you were to GET
http://config.ssbe.example.com/configurations/90
with the mime-type application/vnd.absperf.sscj1+json
:
HOWTO: Exception Handling in Merb
Oct 1, 2008
Our app is very (JSON) web-service heavy, and so having helpful error messages in our web service documents is pretty important. Luckily, Merb makes this, like everything, a metric shitton easier than it is in rails. There are a couple poorly documented things I had to stumble through, so I thought I would write some up on how to do this.
HOWTO: Getting a sidebar in Merb
Sep 16, 2008
In several of my pages, I have a side-bar menu-y thingie. I didn't want to have to rewrite a controller-specific layout each time, but luckily Merb supports something similar to Rails's content_for block that I wrote about earlier. In Merb, its done using throw_content
(API) and catch_content
(API).