Unobtrusive Call Stack Logging for the discerning Rubyist I’ll put something here soon.


Bit Fields for Active Record What is a bit field? What is a bitwise operation? flag_shih_tzu supports both :bit_operator and :in_list query modes, but only :in_list can will utilize a database index. What does it look like? class Lead < ActiveRecord::Base include FlagShihTzu has_flags 1 => :warm_up_email_sent, 2 => :follow_up_call_made, 3 => :final_email_sent, 4 => :appointment_scheduled, 5 => :not_interested, # You can specify use any integer column to use for flags!


Keep slow gems on the bench. Gemfile analysis. I’ll put something here soon.


An Email Condom for your Ruby Server sanitize_email This gem allows you to override your mail delivery settings, globally or in a local context. It is like a Ruby encrusted condom for your email server, just in case it decides to have intercourse with other servers via sundry mail protocols. Summary It’s particularly helpful when you want to prevent the delivery of email (e.g. in development/test environments) or alter the to/cc/bcc (e.g.


LISTEN for Postgresql NOTIFY messages; Asynchronously process payloads celluloid-io-pg-listener (on github) Why? At Trumaker & Co we had a distributed data problem. Two data stores that needed to be kept synchronized, in real time, with inserts and updates allowed on both sides. There wasn’t a good solution available for that, so I did a lot of research and built celluloid-io-pg-listener to solve the problem. How? The data stores are both PostgreSQL databases living in different namespaces (i.e.

Introducing celluloid-io-pg-listener: Part 1

Introducing a new RubyGem celluloid-io-pg-listener (on github) Allows you to asynchronously LISTEN for Postgresql NOTIFY messages and do something with the payloads. Sure! It should work if you just run bin/setup from the root directory of the gem, then you can follow along the examples in the readme. All the data about db setup and structure is located in the spec/apps directory. In spec/apps/Rakefile you will find a test_db_setup task. Check it out.

Why Should You Use flag_shih_tzu

What is it? See the what is it post. Why should you use it? No migrations needed for new boolean attributes Avoids ALTER TABLE when adding a new boolean field to a model, which can be important for very large tables Only the one integer column needs to be indexed The index is actually meaningful, unlike a boolean column index Bitwise operations are fast, indexes are even faster, and you can use either one Adds scopes to easily access collections of records with specific fields Chained scopes to combine sql for different bit fields for maximum performance Provides condition builder methods for each bit field so you can construct your own custom SQL with the correct bit field values for the list.

archivist-client client I’ll put something here soon.


Gets the Rails flash object working with page cacheing. I’ll put something here soon.


For those engaged in the pillage and plunder of comma separated values. I’ll put something here soon.


Collect errors from multiple objects on a single object, especially useful with the Form Object Presenter Pattern. I’ll put something here soon.


Enhancer of Rails’ content_for system. Allows defaults, and no_content_for overrides in partials. For Rails 3, 4. Why? Keep the views dry with content_for_with_default and friends! Complete flexibility in defining defaults and overrides. Remove most or all logic from views. Allow for no content to override a default. DryViews provides extensions to ActionView::Helpers::CaptureHelper, which is part of ActionPack: * content_for_with_default * no_content_for * content_for (enhanced to play nice with the above methods) The rails rendering chain is sort of inside out so the template rendering happens first, and this is what makes it possible to override everything!


Performance Measured and Tuned Batch Processing of Records with Blocks in Rails. EachInBatches (Originally BolingForBatches) NOTE: I am resurrecting this code because I still have this recurring need, and Rail’s native batching doesn’t cut mustard. It is some of my most ancient code, and it isn’t pretty, but I hope to improve it over time. I often need to execute really large computations on really large data sets. I usually end up writing a rake task to do it, which calls methods in my models.


Bit Fields for Active Record What is a bit field? What is a bitwise operation? flag_shih_tzu supports both :bit_operator and :in_list query modes, but only :in_list can will utilize a database index. What does it look like? class Lead < ActiveRecord::Base include FlagShihTzu has_flags 1 => :warm_up_email_sent, 2 => :follow_up_call_made, 3 => :final_email_sent, 4 => :appointment_scheduled, 5 => :not_interested, # You can specify use any integer column to use for flags!


Allows you to customize (and normalize the length of!) the text and color used to write the log level to your logs. “error” can become red and say “noo”. “info” can become white and say “meh”. “debug” can become blue and say “wat”. Or whatever you want… I’ll put something here soon.


Organize data results from raw sql queries (as with PGresult, or Dossier) intelligently. I’ll put something here soon.


An endlessly customizable development toolbar added to your website. Successor of ye olde rack-bug. I’ll put something here soon.


Rack Middleware that injects things into the response body. I’ll put something here soon.


A reference implementation of a custom React renderer for Rails. Adds benchmarking info to Rails logs for parity with Rails view rendering benchmarking. I’ll put something here soon.


Mark specs pending or skipped for specific Ruby engine (e.g. MRI or JRuby) / version combinations. I’ll put something here soon.


Provides super powers to the Rails flash object. I’ll put something here soon.


Provides content_tag_for method signature to create customizable and logic-gated labels from objects. Also includes a presenter base class to allow any Ruby web framework to create logic around HTML tags. I’ll put something here soon.


Subdomain linking and routing for Rails written by Michael Bleigh, maintained by myself. I’ll put something here soon.

Upgrade to El Capitan with Homebrew, Ruby, qt5, & Java

I upgraded to El Capitan, with Homebrew & Ruby, and this is how I did it flawlessly. … and Xcode and Java, etc. Prepare If you don’t already have homebrew installed, do that first, so you don’t have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan. Hardware After the installs and forced reboots my 27” Thunderbolt display wouldn’t display anything.

Fix The Nokogiri Warning

One of the most consistent warnings that has been with me through the years has been that Nokogiri was built against a version of libXML that is different than the version that is dynamically loaded. WARNING: Nokogiri was built against LibXML version 2.6.30, but has dynamically loaded 2.9.0 I had most recently, out of frustration, and due to sundry circumstances, resorted to the --use-system-libraries flag in my project’s bundler config just to get shit done.

FOSS Ruby Projects

I have been writing RubyGems since 2008, and Rails plugins since 2005. Contributions to the community Along the way I have contributed to many projects, including rails’ active-record (PR #20921), hashie (PR #313, PR #314, PR #315, PR #316, and PR #318), memoist (PR #33), neography (PR #74 and PR #104), masonry-rails (PR #14), zues-parallel_tests (PR #28), rusen (PR #5, and PR #6), and gem-release (PR #37, and PR #38). Other Stuff: my Bash work→, my JavaScript work→, my Older Ruby work→ Ruby: I maintain that flag_shih_tzu→ Bit Fields for Active Record, (originally by XING Developers) cacheable-flash→ Rails flash object, but compatible with cacheing, (originally by Pivotal Labs) subdomain-fu→ Subdomain linking and routing for Rails, (written by Michael Bleigh) Ruby: I built that celluloid-io-pg-listener→ LISTEN for NOTIFY events from PostgreSQL and Asynchronously Do Something with the payload.