robots.thoughtbot.com Archives - 23 October 2014, Thursday

  • A more efficient and organized workflow for SVGs

    robots.thoughtbot.com 22 Oct '14, 4pm

    SVGs can be messy to develop with, often times being exported from a graphics application and being pasted into a document. However, they become much more delightful to work with when you have a readable file and clean markup. Optimizing SVG for the web When an SVG is exported from an...

  • Introducing FormKeep

    Introducing FormKeep

    robots.thoughtbot.com 15 Oct '14, 7pm

    We are excited to announce FormKeep , the easiest way to create form endpoints for designers and developers. Why would you use FormKeep? You need to collect data from users, but you don’t want to build a backend yourself to view data, fight spam, or integrate with other services. In t...

  • Functional Swift for dealing with Optional values

    robots.thoughtbot.com 15 Oct '14, 3pm

    Implicitly Unwrapped Optionals ) is unfortunately an everyday part of our life as forward-looking iOS developers. The entirety of the Cocoa API won’t be audited for optionals for a good long while, so these things are here to stay. This means we’re going to introduce some actual runti...

  • Prototyping Animation with Keynote

    Prototyping Animation with Keynote

    robots.thoughtbot.com 13 Oct '14, 2pm

    One look on Dribbble, and you’ll notice the abundance of animations that emphasize interaction. The increasing number of devices, screens, and use cases have required designers to think of new ways to improve the usability of applications. Animation can be a tool for solving these pro...

  • Refactoring From Model to View Helper to Null Object

    robots.thoughtbot.com 10 Oct '14, 3pm

    We are working to add more thorough progress tracking to upcase.com . Chad and I were pairing on the backend for this feature, and we created a model called Status , that belongs both to a User and to an Exercise . This is a many-to-many relationship that holds a state attribute. That...

  • Back to Basics: Anonymous Functions and Closures

    robots.thoughtbot.com 10 Oct '14, 3pm

    method and the JavaScript library Lo-Dash’s map method. In both cases we provide a callback. The Ruby example uses a block and the JavaScript example uses a function. These callbacks are anonymous functions. We specify a bit of functionality, in this case multiplying the number provid...

  • How to Stop Voodoo Programming

    robots.thoughtbot.com 07 Oct '14, 4pm

    Voodoo programming is when we write code that we don’t really understand. We know we shouldn’t do it. But how do we stop? An example story We are running tests and making changes to our code when we see a new error. We decide we’ll upgrade all the Ruby gems (dependencies). Same error....

  • Writing Vim Syntax Plugins

    robots.thoughtbot.com 06 Oct '14, 3pm

    Finally we have the indent folder. Again, it contains a file named after the filetype for how indentation should work as we’re writing in Vim. Personally I think handling indentation is the hardest part of writing syntax plugins. The goal in these files is to do one specific thing. Se...

  • Upcoming Events for October, 2014

    robots.thoughtbot.com 03 Oct '14, 2pm

    Upcoming Events for October, 2014 Chad Pytel October 03, 2014 events Each month we organize and attend events at our offices, and around the world. Here is a summary of what’s happening this month. We often have thoughtbot stickers, and sometimes shirts. We’d love to see you at some o...

  • IO in Ruby

    robots.thoughtbot.com 01 Oct '14, 7am

    Since everything on a Unix-like system is a file, we can open an IO stream to a text file in the same way we would open a device. We just create a file descriptor with the path to our file and then create an IO object for that file descriptor. When we are done with it, we close the st...

  • Card Sorting

    Card Sorting

    robots.thoughtbot.com 30 Sep '14, 3pm

    Card sorting is a design exercise that guides us toward creating the most coherent information architecture of a product. During a card sorting session, participants are asked to associate two sets of flashcards by grouping them. While the first set of flashcards contains categories, ...

  • Parsing Embedded JSON and Arrays in Swift

    robots.thoughtbot.com 29 Sep '14, 3pm

    This works, but there are two other issues at play. First, you can see that reaching further into embedded JSON can result in a lot of syntax on one line. More importantly, Swift’s type inference starts to hit its limit. I experienced long build times because the Swift compiler had to...

  • Our iOS, Rails, and Backbone.js Books Are Now Available for Purchase

    robots.thoughtbot.com 24 Sep '14, 8pm

    Starting today, you can buy any of our books through these links. Our book offerings currently include: iOS on Rails (beta) Learn to write superb iOS apps with Ruby on Rails backends. Geocoding on Rails Your Map to Geocoding Rails Applications Ruby Science The reference for writing fa...

  • Validating JSON Schemas with an RSpec Matcher

    robots.thoughtbot.com 23 Sep '14, 5pm

    At thoughtbot we’ve been experimenting with using JSON Schema , a widely-used specification for describing the structure of JSON objects, to improve workflows for documenting and validating JSON APIs. Describing our JSON APIs using the JSON Schema standard allows us to automatically g...

  • ActiveRecord Eager Loading with Query Objects and Decorators

    robots.thoughtbot.com 19 Sep '14, 2pm

    We recently came across an interesting problem, which was discussed in a previous post, Postgres Window Functions : We want to get each post’s three most recent comments. As discussed, you can’t use simple eager loading: Post.order(created_at: :desc).limit(25).includes(:comments) This...

  • Real World JSON Parsing with Swift

    robots.thoughtbot.com 18 Sep '14, 4pm

    Last time , we looked at using concepts from Functional Programming and Generics to parse JSON received from a server into a User model. The final result of the JSON parsing looked like this: struct User: JSONDecodable { let id: Int let name: String let email: String static func creat...

  • Hound now reviews CoffeeScript for style violations

    Hound Reviews CoffeeScript For Style Violations

    robots.thoughtbot.com 17 Sep '14, 9pm

    Four months ago, we announced Hound , a hosted service that reviews Ruby code for style violations and comments about them on your GitHub pull requests. Since then, about 3,000 users have signed up for Hound. Today, we’re pleased to announce that Hound can review CoffeeScript code in ...

  • Use Git Hooks to Automate Necessary but Annoying Tasks

    robots.thoughtbot.com 17 Sep '14, 6pm

    Certain tasks like updating dependencies or migrating a database must be done after pulling code or checking out a branch. Other tasks such as re-indexing our ctags improve our development experience. Both kinds of tasks are easy to forget to do and are therefore error-prone. To addre...

  • Rails Refactoring Example: Introduce Null Object

    robots.thoughtbot.com 16 Sep '14, 4pm

    You probably don’t write code like this: if object.kind_of?(User) do_this else object.do_that end Why not? Because Ruby encourages duck typing and polymorphism. A hidden version Here’s the same principle: if object.nil? do_this else object.do_that else This checks that object is of ty...

  • Postgres Window Functions

    robots.thoughtbot.com 16 Sep '14, 12am

    We recently ran into a case where a join was getting out of hand and we were struggling with how to rein in the size of it. Then we found window functions . Window functions (Oracle calls them analytic functions ) are a part of the SQL standard and this post will explore how to use th...

  • Using Gestalt Principles for Natural Interactions

    Using Gestalt Principles for Natural Interactions

    robots.thoughtbot.com 15 Sep '14, 6pm

    Using Gestalt Principles for Natural Interactions Carolann Bonner September 15, 2014 design ui Gestalt is a term used in psychology which expresses the idea that the whole of something is more important to our understanding than the individual parts. The Gestalt principles describe th...

  • Say Hello to thoughtbot at Denver Startup Week

    robots.thoughtbot.com 12 Sep '14, 9pm

    Whoot! Denver Startup Week is next week and we are super excited to attend many of the wonderful sessions that are planned for the week! There is an amazing lineup of design and development related sessions that our folks are going to be heading to as well as a few events we’ll be hos...

  • How to Find Missing or Unused I18n Translations

    robots.thoughtbot.com 12 Sep '14, 3pm

    While I18n is a great tool for quick copy changes, translation files can quickly become large and multiply, leaving you with the feeling that there are missing or unused translations hiding under your nose. Enter i18n-tasks , which provides - you guessed it - I18n tasks. Among these t...

  • Write Reliable, Asynchronous Integration Tests With Capybara

    robots.thoughtbot.com 10 Sep '14, 6pm

    However, integration tests involving Ruby and JavaScript are fraught with danger. Developers frequently complain of tests which fail erratically. Debugging these tests can be somewhat of a mystery: you see records inserted into your test database during logs, but they somehow don’t sh...

  • Pluralizing I18n Translations in Your Rails Application

    robots.thoughtbot.com 09 Sep '14, 9pm

    Say we have some I18n text that tells users how many notifications they have. One option for dealing with a singular vs plural situation would look like this: # config/locales/en.yml en: single_notification: You have 1 notification other_notification_count: You have %{count} notificat...

  • An Introduction to WebGL

    An Introduction to WebGL

    robots.thoughtbot.com 05 Sep '14, 5pm

    WebGL is a thin wrapper around OpenGL ES 2.0 that is exposed through a JavaScript API. OpenGL is a low level library for drawing 2D graphics. This was a major misconception for me. I always thought that it was used to produce 3D. Instead, our job is to do the math to convert 3D coordi...

  • Back to Basics: SOLID

    robots.thoughtbot.com 03 Sep '14, 5pm

    In the above class we have a single command interface that processes commission payments for deals. At first glance the class seems simple enough, but let’s look at reasons we might want to change this class. Any change in how we calculate commissions would require a change to this cl...

  • Acceptance Tests at a Single Level of Abstraction

    robots.thoughtbot.com 02 Sep '14, 9pm

    Each acceptance test tells a story: a logical progression through a task within an application. As developers, it’s our responsibility to tell each story in a concise manner and to keep the reader (either other developers or our future selves) engaged, aware of what is happening, and ...

  • Paid Private Repos for Hound

    robots.thoughtbot.com 19 Aug '14, 3pm

    In April, we announced Hound , a hosted service that comments on Ruby style guide violations in your GitHub pull requests. Since then, about 2,000 users have signed up for Hound. We have been hard at work across 127 commits making Hound faster and more reliable. Recently, Hound has be...

  • A Primer for Working with SVG's

    Building Ralph with SVG

    robots.thoughtbot.com 18 Aug '14, 4pm

    SVG (Scalable Vector Graphic) is a graphic format, similar to PNG or JPEG, that’s great for icons, charts and supporting high-DPI displays. They’re vector-based, so you won’t lose visual fidelity or see any pixelation, no matter what size your graphic is. Because it’s written in XML, ...