Bogdan Gusiev's blog

How to make good software for people

Improve your Email delivery code with Mailtrap
18 Nov 2011

Today, I want introduce the Mailtrap web service aimed to help developers build and improve their email delivery functionality.

Usually people use same SMTP settings for all environments, but this actually creates many problems in Staging and Development environments. Mailtrap is a special SMTP service for these environments aimed to solve specific problems.

smtp development service environment

Slides: Fighting with fat models
11 Nov 2011

Here are my slides from RubyC conference.

This presentation covers a hot topic for projects that are more than a year old - it’s fat models. The problem appear naturally as models are the best place to allocate business logic code. There are number of existing techniques to manage large amount of code in Rails application. But they are suitable only in a half of use cases. For the rest of them we can use Traits pattern that is described well in this presentation.

Fighting with fat models

model service dry slides rails

17 Oct 2011

My article about Resque was posted on Engine Yard last week. It has very good notes from EY engineers and doesn’t have my regular grammar mistakes. Enjoy your reading.

resque framework contribution

Advanced RSpec Techniques presentation
08 Jul 2011

I’ve always pay attention to Rspec and posted some articles about Advanced Rspec features. Right now about 2k tests written by me personally in 3 years of development with Rails.

Here is the slides from my talk about all invented patterns and best practices:
Do rspec: fogotten features of RSpec

subject rspec context behavior dry slides

Reporting made easy by Datagrid gem for Rails
26 Jun 2011

4 years ago I was working on some enterprise projects with a lot of reports. From that time I was thinking about perfect report gem that would provide easy DSL for making filters and sortable columns to build reports and make it all reusable with standard OOP techniques. Since that time this idea never left my head and now finally I have enough knowledge and opportunities to build such tool.

rails activerecord datagrid gem report

Patching dbext vim plugin to support Rails naming conventions
30 May 2011

dbext is an excellent vim plugin that allows you to execute SQL queries directly from vim. For example: select * from <word under cursor>. When dbext is used with Rails there is a problem that you can work with some variation of table name like:

  • UserRole
  • user_role_id
  • user_role_ids
  • user_role

But still wants to use it as table name in your database queries so that you won’t type it manually.

rails vim dbext patch convention sql

Logging HTTP api calls just like database queries
24 May 2011

Http api calls are pretty similar to SQL queries - they query data from external source to process them in ruby space. So I think it's a good idea to log them just like ActiveRecord does with SQL queries.
  Location Load (25.1ms)   SELECT * FROM "locations" WHERE ("locations"."id" = 2548) ORDER BY title

api http logging ruby rails debug gem

Finally get rid of WordPress and PHP
20 May 2011

After a few tries migrate to blog engine with programming language I know well, I finally found jekyll - lightweight static site generator. My main concerns in this choice was:

  • Edit posts in my favorite text editor with favorite markup
  • NO PHP
  • Syntax highlight out of the box

jekyll wordpress php migration liquid criticism

JavaScript injection in JSON inserted directly into script tag
06 Apr 2011

Pass data from backend to javascript is done in many different ways. One of the most simple is to inject(<%= %>) value as function argument inside of script tag. Unfortunately this pattern has well known XSS vulnerability but in a little different form than same injection in html template.

javascript html xss escape json

Do git commits associated to hoptoad errors
28 Mar 2011

We are trying to build a better development workflow by connecting all our tools together. So, this time we tried to connect HopToad Application with git commits because sometimes it's better to just paste the link to hoptoad error rather than describe all steps to reproduce. This idea was resulted in the command line interface for hoptoad api with a little git integration - Shelltoad.

ruby git hoptoad commit