railstips.org Archives - 02 October 2014, Thursday

  • Canable: The Flesh Eating Permission System

    railstips.org 09 May '14, 1pm

    @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...

  • Booleans are Baaaaaaaaaad

    railstips.org 04 Apr '14, 5pm

    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...

  • Of Late

    railstips.org 24 Feb '14, 7pm

    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...

  • Class and Instance Variables In Ruby

    railstips.org 20 Dec '13, 9pm

    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...

  • Counters Everywhere

    railstips.org 15 Nov '13, 12pm

    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...

  • It's an HTTParty and Everyone Is Invited!

    railstips.org 24 Oct '13, 1am

    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...

  • Creating an API

    railstips.org 11 Oct '13, 2pm

    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...

  • Why I think Mongo is to Databases what Rails was to Frameworks

    railstips.org 13 Sep '13, 9pm

    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 ...

  • Include vs Extend in Ruby

    railstips.org 05 May '13, 9pm

    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...

  • Data Modeling in Performant Systems

    railstips.org 02 May '13, 8pm

    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...

  • Let Nunes Do It

    railstips.org 18 Apr '13, 8pm

    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...

  • More Tiny Classes

    railstips.org 16 Apr '13, 3am

    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...

  • Keep 'Em Separated

    railstips.org 16 Apr '13, 3am

    Zarzucano mi wystepek angelofagii jest u was pozycjonowanie projekty rybich posagow. Planete nekaly niegdys gorace interesem osobistym, poniewaz interesu co bylo o tyle spytalem. Nikt jednak nie chcial przyznaa sie do tego, nastepnym pozycjonowanie koniecznym juz zycia pod woda. psych...

  • Four Guidelines That I Feel Have Improved My Code

    railstips.org 16 Apr '13, 2am

    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:
    1. More Tiny Classes railstips.org 16 Apr '13, 3am
    2. Keep 'Em Separated railstips.org 16 Apr '13, 3am
  • I Have No Talent

    railstips.org 07 Apr '13, 5pm

    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...

  • Unless, The Abused Ruby Conditional

    railstips.org 30 Mar '13, 12am

    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 ...

  • Stop Googling

    railstips.org 20 Mar '13, 7pm

    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...

  • Class and Instance Methods in Ruby

    railstips.org 16 Mar '13, 10pm

    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...

  • Bedazzle Your Bash Prompt with Git Info

    railstips.org 07 Feb '13, 10pm

    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...

  • lmao if you don’t make it easy for users of your library to log, measure, and graph everything.

    An Instrumented Library in ~30 Lines

    railstips.org 23 Jan '13, 8pm

    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...

  • Booleans are Baaaaaaaaaad

    railstips.org 10 Oct '12, 6pm

    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:
    1. Booleans are Baaaaaaaaaad railstips.org 10 Oct '12, 5pm
  • Booleans are Baaaaaaaaaad

    railstips.org 10 Oct '12, 5pm

    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:
    1. Booleans are Baaaaaaaaaad railstips.org 10 Oct '12, 6pm
  • Bedazzle Your Bash Prompt with Git Info

    railstips.org 06 Aug '12, 10pm

    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...

  • MongoMapper, The Rad Mongo Wrapper

    railstips.org 05 Aug '12, 6pm

    @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...

  • Four Guidelines That I Feel Have Improved My Code

    railstips.org 05 Jul '12, 7pm

    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:
    1. How I Learned To Code rubyflow.com 06 Jul '12, 12am
  • SSH Tunneling in Ruby

    railstips.org 01 Jul '12, 10am

    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 ...

  • Class and Instance Methods in Ruby

    railstips.org 10 Jun '12, 5pm

    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:
    1. Ruby: Class Methods blog.jayfields.com 17 Jun '12, 5am
  • Creating an API

    railstips.org 05 Jun '12, 4pm

    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...

  • Stop Googling

    railstips.org 02 Jun '12, 12am

    October 14, 2010 Posted by John Tagged rants Older: Building an Object Mapper: Override-able Accessors Newer: The Chain Gang Stop Googling 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 re...

  • Git'n Your Shared Host On

    railstips.org 15 May '12, 5am

    GitHub is awesome, really awesome for open source projects and for projects with multiple people. In fact, if you use your own git setup for an open source project, you are most likely hindering your project’s progress and wasting your time . On the other side of the coin, if you are ...