Blog (ruby)

@fredwu 11 years ago | 1 min read | no comments
Contrary to what the title of the talk suggests, I am by no means a superstar developer myself. Though I would like to think that I am extremely passionate about what I do, therefore I love to share my thoughts and tips on web development and software engineering. Below is the version I used for my actual talk: https://speakerdeck.com/fredwu/2012-become-a-better-developer-you-can Since I had been preparing for my talk for over a month, I’ve done many revisions to my slides. Here’s an uncut ver...
@fredwu 11 years ago | 1 min read | no comments
I had such a wonderful time at RubyConf China! So here are some photos from the conference. :) Gallery of photos of yours truly on stage: [] Gallery of photos I took mostly on the VIP dinner event the day before the conference: []
@fredwu 11 years ago | 1 min read | no comments
The other day a colleague asked whether or not it’s possible to have SimpleCov return a group that only contains uncommitted changes. The answer is yes! After some digging around, we found the following way: # in spec_helper.rb SimpleCov.start 'rails' do add_group 'Changed' do |source_file| `git ls-files --exclude-standard --others \ && git diff --name-only \ && git diff --name-only --cached`.split("\n").detect do |filename| source_file.filena...
@fredwu 12 years ago | 1 min read | no comments
Don’t you just hate it when you have a fresh intall of Mountain Lion, RVM and some rubies - then all of a sudden you hit this OpenSSL::SSL::SSLError error message: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed The fix is quite simple actually, all you need to do is to download a CA root certificate: curl http://curl.haxx.se/ca/cacert.pem -o ~/.rvm/usr/ssl/cert.pem And that’s it! Enjoy!
@fredwu 12 years ago | 4 min read | no comments
TL;DR - PHP is still a useful tool, but as a PHP developer, have you started playing with other useful tools? Here’s my story. Today Jeff Atwood’s new piece "The PHP Singularity" and Marco Arment’s "PHP Addiction" have started another round of heated discussion on PHP. As someone who started his career as a PHP developer, I feel like sharing my thoughts from a different perspective. I began my career as a freelancer - since JavaScript and PHP were the two programming languages I learnt at scho...
@fredwu 12 years ago | 1 min read | no comments
Ever wondered how you could utilise the render method outside the context of Rails controllers and views? If you wonder why anyone would do that. Well, imagine you are building an awesome form builder, you need to output and/or store rendered partials in the buffer. How do you do that? For example, what if you want to do this in your view? <%=raw Awesome::FormBuilder.new(some_options).html %> You could do something like this: module Awesome class FormBuilder < AbstractController...
@fredwu 13 years ago | 1 min read | no comments
[] My entry to the RubyCommitters design contest. View it in action at http://heroesofruby.heroku.com/ :-)
@fredwu 13 years ago | 1 min read | no comments
So, you are using Slim, right? If not, go check it out because it’s awesome. ;) Now, I don’t know about you but prior to Slim I use Haml quite a bit, and even though syntax-wise Haml and Slim have a lot in common, it’s still quite a challenge to convert all Haml templates to Slim templates. As a result, let me present you with a quick n’ dirty Haml2Slim converter! Check out the source code.
@fredwu 14 years ago | 1 min read | no comments
At Envato we have a few dozen sites residing on multiple servers. The data on a portion of the servers need to be regularly backed up to Amazon S3. The Envato Mad Scientist Ryan Allen has worked on a script called Sir Sync-A-Lot which syncs the data to S3. This was done after evaluating a bunch of scripts including s3sync. Today I turned Ryan’s original script into a little Rubygem and added a bit more features. Go check out the source code!
@fredwu 14 years ago | 1 min read | no comments
For the past few weeks I have started contributing to a small project - Slim. Slim is a fast, lightweight templating engine for Rails 3. It has been tested on Ruby 1.9.2 and Ruby/REE 1.8.7. Slim is heavily influenced by Haml and Jade. Andrew Stone who is the author of the project has posted a quick update on the latest feature additions to Slim. Please go check it out. The source code of Slim is available on Github.