Migrating WordPress

After another WordPress migration [1], here’s my 2p on WordPress migrations: Don’t even think about following WordPress’s standard backup-and-restore instructions. The Duplicator plugin captures everything in one go, including comments, themes, etc as it dumps both the database and the...

Logging the caller

It’s so useful to automagically log caller line number and so on. Most languages make it possible via hack involving throwing an exception to yield a stack trace. Some languages explicitly provide this info. In Ruby, it’s possible with the...

Clearing Sidekiq Queues

This is useful in development. Do this: [ruby] class SidekiqUtil def self.queues ::Sidekiq::Stats.new.queues.keys.map { |name| ::Sidekiq::Queue.new(name) } end def self.clear_all self.queues.each { |q| q.clear } end end [/ruby] Based on the Sidekiq API

Rails quirk: Adding to DateTime

Just came across a weird one with DateTime. Adding an int value will increment by a day, not a second as you may expect: [ruby] $ x=1 1 $ x.class Fixnum $ DateTime.new(2000, 1, 1, 0, 0, 0)+x Sun, 02...