railstips.org Archives - 26 September 2017, Tuesday

Flipper is already pretty optimized for production usage (flipper does billions of feature checks a day at GitHub), but the latest release (0.10.2) just received a couple new ones — all thanks to community contributions. In jnunemaker/flipper#190 , @mscoutermarsh said: Hi, Would love ...

Originally, I did not like the idea of an ActiveRecord adapter for Flipper . I work on GitHub.com day to day, so everything I do has to be extremely performant. Using ActiveRecord for something like this felt like way too much overhead. In fact, at GitHub, we use a custom adapter for ...

February 24, 2014 Posted by John Of Late In which I link to a new place where I’ll be writing. April 18, 2013 Posted by John Let Nunes Do It In which I release Nunes to a soon-to-be-more-instrumented world. January 23, 2013 Posted by John An Instrumented Library in ~30 Lines lmao if y...

@Jamie – 1) The main reason everything is an instance method is because anytime I have dealt with permissions, it always comes down to the object. Can the user do something to this object, which automatically leads to instance methods rather than class methods. Typically the view stuf...

It absolutely is over-engineering when you replace a 1-bit flag with a gem that needs to be source-controlled, included and tested on updates. That’s the definition of over-engineering. There are a few issues with this post. 1) the title is just wrong. I know it’s tongue-in-cheek, but...

A lot has changed over the years. I now do a lot more than just rails and having railstips as my domain seems to mentally put me in a corner. As such, I have revived johnnunemaker.com . While I may still post a rails topic here once in a while, I’ll be posting a lot more varied topics...

Update (6/13/2008): I posted a bit more on the topic with example uses in the wild . First, let me preface this article with a fact: I’m new to Ruby, however, new is relative in that statement. I’ve been toying with Ruby for over a year but only in the last two months have I really st...

Last week, coming off hernia surgery number two of the year (and hopefully the last for a while) I eased back into development by working on Gaug.es . In three days, I cranked out tracking of three new features. The only reason this was possible is because I have tried, failed, and su...

Every web service related gem I’ve written makes requests and parses responses into ruby objects. So first let’s start with requests. The request methods that you make the most use of are get and post, with put and delete occasionally sliding in. I don’t know about you but I constantl...

A few weeks back, we publicly released the Gauges API . Despite building Gauges from the ground up as an API , it was a lot of work. You really have to cross your t’s and dot your i’s when releasing an API . 1. Document as You Build We made the mistake of documenting after most of the...

I have been using mongo and MM for a project the last few months. I was initially very enthusiastic but as my data model has gotten more complex, I struggled to map it to the mongo way of thinking. Mongo does not do joins, so you are encouraged to store things hierarchically. So if I ...

Related:

Now that we know the difference between an instance method and a class method , let’s cover the difference between include and extend in regards to modules. Include is for adding methods to an instance of a class and extend is for adding class methods. Let’s take a look at a small exa...

Related:

Great stuff. Starting a new project and evaluating this vs. Ohm. Our target is primarily Redis but I could see Mongo in the future and like that this is ActiveModel based. However, echoing some of the above comments, it seems deficient in not only multi-get and transaction support but...

In a moment of either genius or delirium I decided to name my newest project after myself. Why? Well, here is the story whether you want to know or not. Why Nunes? Naming is always the hardest part of a project. Originally, it was named Railsd. The idea of the gem is automatically sub...

My last post, Keep ’Em Separated , made me realize I should start sharing more about what we are doing to make Gauges maintainable. This post is another in the same vein. Gauges allows you to share a gauge with someone else by email. That email does not have to exist prior to your add...

Related:

Regarding naming … absolutely agree. It is worth arguing about. The more critical the class is to the system design, the more I might go to the mat and wrestle a good name to the ground. The decision on a name can be a fleeting event, but it will have everlasting impact. Think: Write ...

Related:

I relate to your testimonial here, as I do believe it’s the most accurate description of how to achieve proficiency at something. Another fellow programmer gave his opinion on the matter, and I would like to reproduce my comment on his post here: This discussion about “Inate Talent” v...

The only people that don’t like “unless” are either: A) Old school programmers, which I can understand. B) Blog followers, the people that let the hip blogs choose their mindset. I’ve personally thought, from back in my C/C++ days, that “if not” sounded like the most obscure piece of ...

Related:

Yesterday, one of my inter-web buddies IM’d me and asked if I had used Typhoeus before. I said yes, so he asked me if it was possible to follow redirects using it. He said he google’d it and nothing turned up. I sharply responded, “LOOK AT THE CODE ! ”. We had some banter back and for...

The other day I was explaining the difference between class and instance methods to a friend and I realized that I should probably write up a post. I figured since I’m on a plane headed back home, now was as good of time as ever. If you want a little history, you can read about the di...

Related:

I have seen this around and this morning finally decided to try it out. Thus far I am finding it surprisingly helpful. If you put the following in your bash profile, it will show the current git branch in your terminal prompt. bash profile addition function parse_git_branch { ref=$(gi...

For the first time ever, I am going to lead with the end of the story. Here is the full ~30 lines that I will break down in detail during the rest of this post. require 'forwardable' module Foo module Instrumenters class Noop def self.instrument(name, payload = {}) yield payload if bl...

I don’t find this post a very persuasive sell for state machines (although I realize the example was designed to be short and easily digestible). There are times when I look at a code base and think “oh good, we’re using XYZ technique, that’ll go smoothly.” I have literally never had ...

Related:

October 10, 2012 Posted by John Older: Four Guidelines That I Feel Have Improved My Code Booleans are Baaaaaaaaaad First off, did you pronounce the title of this article like a sheep? That was definitely the intent. Anyway, onward to the purpose of this here text. One of the things I ...

Related:

I have seen this around and this morning finally decided to try it out. Thus far I am finding it surprisingly helpful. If you put the following in your bash profile, it will show the current git branch in your terminal prompt. bash profile addition function parse_git_branch { ref=$(gi...

@Luigi – I always took relational to mean ‘mapping relationships between incompatible type systems’ not a literal reference to the most common underlying storage type. Then again I’m self taught so what do I know :P Ignoring the abbreviation aren’t common problems are being repeatedly...

I have been thinking a lot about isolation, dependencies and clean code of late. I know there is a lot of disagreement with people vehemently standing in both camps. I certainly will not say either side is right or wrong, but what follows is what I feel has improved my code. I post it...

Related:

The other day I wanted to do some queries in production, but our servers are pretty locked down to the outside world. I was well aware that I could just make an ssh tunnel to connect to the database server, but I decided I wanted to do it in Ruby. I am not the brightest of crayons in ...

The other day I was explaining the difference between class and instance methods to a friend and I realized that I should probably write up a post. I figured since I’m on a plane headed back home, now was as good of time as ever. If you want a little history, you can read about the di...