Blog (ruby)

@fredwu 5 years ago | 1 min read | no comments
Seven years ago in 2012 I spoke at RubyConf China 2012. It was a technical talk on how to become a better developer, if you're interested you can check out the video recording. Seven years later in August 2019, I headed back to Shanghai again to speak at this year's RubyConf China. And this time around, it was a non-technical talk on how to develop one's career. Check out the video recording below: video: https://www.youtube.com/watch?v=MBczdO7RgNo And, here are some photos of yours truly. :) ...
@fredwu 8 years ago | 11 min read | no comments
About a month ago I was in-between jobs - I had two weeks to rest up, recharge and get ready for my new job. So I thought, I should use those two weeks to learn something new. Years ago I briefly looked into Elixir when it was first released to the wild, at the time I wasn’t interested in picking it up due to its syntax similarity to Ruby, despite their vastly different underlying semantics. I love Ruby, and it’s been my weapon of choice for the past 6-7 years, so when it came time for me to lea...
@fredwu 11 years ago | 2 min read | no comments
Please also see this blog post on tweaking your ruby GC settings. I use and love DatabaseCleaner, although historically I had never paid too much attention on the performance of its varies cleaning strategies - I’d always used truncation. We use Postgres, and after digging around and finding out the difference between DELETE and TRUNCATE, I ended up improving our test suite speed by about 30-40% simply by tweaking the cleaning strategies. RSpec.configure do |config| config.before :su...
@fredwu 11 years ago | 1 min read | no comments
It was made apparent to me that many ruby devs either aren’t aware or couldn’t be bothered to tweak their ruby garbage collector settings. Well, if you are using MRI, please start tweaking your GC settings. Here’s what I use (on my 15" Macbook Pro Retina): export RUBY_GC_MALLOC_LIMIT=90000000 export RUBY_FREE_MIN=200000 Not only can you tweak it for your local dev machine, you can also tweak Jenkins, Travis CI, Wercker and other CI solutions, making instant speed gain for your test sui...
@fredwu 11 years ago | 2 min read | no comments
I haven’t really used Sequel much therefore I am definitely a newbie. However, after days and nights of frustration, endless debugging and some search-fu during the development of Datamappify, I have finally arrived at the conclusion that Sequel is a capable library, as long as you are aware of the gotchas. Gotcha 1: Always use "select"/"select_all", or your data records will mysteriously have wrong IDs! In ActiveRecord, joining an associated model couldn’t be simpler: Post.joins(:author) ...
@fredwu 11 years ago | 15 min read | no comments
A while ago I translated an interview with Matz done by a Chinese book publisher. The interview and the translation were well received, so this time I am translating another interview with Matz, done by Ito, the editor-in-chief from Japanese website Engineer Type. Since I don’t read Japanese, the translation is based on Turing Book’s Chinese translation. The Chinese translator has done a great job translating the interview, but there are still many words and sentences lack sufficient context and...
@fredwu 11 years ago | 11 min read | no comments
This post is about the ruby library we are building - Datamappify, please go check it out. At Locomote we are building a relatively large web application using Rails. Before we began to lay the foundation, we knew very well that if we wanted the project to be maintainable we had to architect the system with extra care and attention. More specifically, we can’t rely on simply using ActiveRecord which combines behaviour and persistence as our domain models. We began our search for something that ...
@fredwu 11 years ago | 2 min read | no comments
Update: You might also want to check out reset_column_information. So a few days ago we started seeing the following errors on our Jenkins builds (swapped with fictional model and attribute names): NoMethodError: undefined method `attack_power=' for #<Ironman:0x00000008525d20> attack_power is a new attribute we recently added to the Ironman ActiveRecord model. I was baffled, as the table column is clearly there but ActiveRecord couldn’t see it. This weird behaviour is confirmed by ...
@fredwu 12 years ago | 1 min read | no comments
It was the first time I presented in front of 400+ people so I was really nervous - I blasted through the talk in under 30 minutes even though I was supposed to talk for 45 minutes, oh well. ;) video: https://www.youtube.com/embed/DeBsmdDmB9A Also, my slides are available too. P.S. If you’re located in China, you may view the talk at Railscasts China.
@fredwu 12 years ago | 18 min read | no comments
Update: Please check out this new interview with Matz, done by Engineer Type. A week ago I went to Shanghai, China to attend and to give a talk at RubyConf China. The day before the conference’s first day a bunch of us were invited to a VIP dinner where we met with Matz and got to play with a device running MRuby. And I heard that earlier on that day Matz was ‘adopted’ by a book publisher to do an interview. I have found the interview (in Chinese), and found it to be really useful. So I transla...