New Blog with New Design and Gatsby.js - Loving JavaScript Again

In 2010 I set up this blog on Tumblr mostly due to the ease of publishing and not having to worry about the hosting. I also went through two design iterations done in Photoshop:You can probably tell that these designs were done before the flat and minimalist design trend we are seeing in recent years.As I decided to revamp my blog once again, I thought I'd use Sketch this time around and aim for a simpler, cleaner and more mature design approach that's quicker to design and to build. And this is…


Coding and Learning Should Never Stop, Open Sourcing is Caring

I’ve had a productive coding weekend, and so I decided to share my experience. Now, many developers choose to treat their career as a series of 9-5 jobs, but if you’re reading this, I assume you’re like the rest of us who love continuous learning and self improvement.PrefaceAbout a year ago I started learning Elixir. So as part of the learning experience, I wrote two matching learning related libraries: Stemmer and Simple Bayes. It was a great, really enjoyable experience and I learnt a lot…


Elixir and Doctest - Help Writing Better Programs, One Function At A Time

Aug 07, 2017|4 Min Read|Comments|

PrefaceIf memory serves right, it’s been several years since I first dabbled in Elixir, but it was about a year ago I really started putting some serious effort into learning Elixir, and as a result I made two libraries in the machine learning space: Simple Bayes, a Naive Bayes text classifier implementation, and Stemmer, an English (Porter2) stemming implementation.Unfortunately after I’ve released those two libraries, I hadn’t had much opportunities to work with Elixir. My day jobs have been…


I Accidentally Some Machine Learning - My Story of A Month of Learning Elixir

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…


Developers, Being Treated Poorly? You Are Not Alone!

Apr 05, 2016|8 Min Read|Comments

UPDATE: Reading Hacker News comments it is apparent to me that I have not explained my position and intention very well. Please allow me to clarify - I do not resent the people involved in these moments, if anything, I thought those encounters were good learning experience for me, as I know there are things I would do and say differently so others around me won’t feel I’ve been too harsh on them. I did not share these moments to complain, but to raise the awareness that kinder communication…


History Text Analysis Over Spreadsheets - A Poker Player and Developer's Road to Agile Project Management

Mar 09, 2015|5 Min Read|Comments|

Ever since I started transitioning into a team leadership role over three years ago, I had been trying to find ways to eliminate waste caused by repetitive work and to keep myself on the fringe of pushing the technical boundaries.Four months ago I started my current role where my official job title is Delivery Lead. People don’t often know what a delivery lead is, but in my mind it is a role to ensure the success of the project delivery by identifying and closing the gaps in the team and in the…


Leading Snowflakes by Oren Ellenbogen - A Pragmatic Book on Software Team Leadership I Wish I Read Sooner

Two weeks ago as I was reading Software Lead Weekly which I had subscribed to for a while, I discovered its curator, Oren Ellenbogen’s book - Leading Snowflakes.It was a moment of discovery that lead to a stream of delightfulness.It Started with a Long Day at Work…After a long day at work, I was so beat I couldn’t even listen to audio books like I always do on my way to and from work. So I drove home that night in total silence. One thing that was on my mind at the time was - who should I reach…


Photos from JSConf AU 2014

Apr 10, 2014|1 Min Read|Comments|

JSConf AU has been fun - great talks and great venue! It was also a wonderful opportunity for me to test out my new camera kit: SONY A7r + Sony Sonnar T* FE 35mm f/2.8 ZA + Voigtlander Color Skopar 20mm f/3.5 SL-II with Novoflex SONY E-Mount to Nikon adapter.Here’s the kit (taken by Nikon D800 + Tamron SP 24-70mm F/2.8 Di VC USD):Photos from JSConf AU 2014:Breakfast in North Melbourne:Conference:Check out my Google+ Photo Album for larger versions.


On Hiring: Trial Week - Yay or Nay?

Oct 29, 2013|5 Min Read|Comments|

Today a blog post titled "Trial Week: Our Hiring Secret" has made to the Hacker News homepage. I naively tweeted my dislike and now I feel obligated to share my thoughts in a more meaningful and constructive way.First of all, congratulations to the Weebly team, as this trial week strategy is clearly working very well for them.I, on the other hand, am against using a trial week for vetting candidates, and I am going to share my thoughts.Let this serve as a reminder to the rest of us: every…


Protip: Unsync the "Index" Folder of Sublime Text 3 from Dropbox

Oct 12, 2013|1 Min Read|Comments|

If you’re like me who uses both Sublime Text 3 and Dropbox, chances are you have your Sublime Text 3 folder synced in Dropbox.I use my laptop as my primary workstation so most of the time it’s docked and charged. Occasionally when I do use it on battery power however I notice the extremely poor battery life - typically only 2-3 hours.Eventually I realised the power consumption was caused by Sublime Text 3 generating a temp file in its "Index" folder every second or so, and that triggers Dropbox…


Protip: Faster Ruby Tests with DatabaseCleaner and DatabaseRewinder

Sep 18, 2013|2 Min Read|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.Essentially, we want to truncate the DB only once before the…


Protip: Ruby Devs, Please Tweak Your GC Settings for Tests!

Sep 06, 2013|1 Min Read|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):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 suite!Here’s what we get:YMMV depending on your system and available RAM.


Writing Sensible Tests for Happiness

Writing good, sensible tests is hard. As a Rubyist, I feel lucky to be part of a community that embraces tests. Though at the same time, I have come across too many projects that suffered from not having sensible tests.What are Sensible Tests?There often isn’t a silver bullet when it comes to software development. Technical stuff aside, many things contribute to the solution to a given problem - the team, the project and the business to name a few. This article does not attempt to present any…


Gotchas in the Ruby Sequel Gem

Aug 21, 2013|2 Min Read|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:In Sequel, despite having a…


The Future of Computing, The Future of Computer Programmers - An Interview with Yukihiro "Matz" Matsumoto

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…


Datamappify - A New Take on Decoupling Domain, Form and Persistence in Rails

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…


would you be interested in reading such a book

Apr 29, 2013|1 Min Read|Comments|

Would you be interested in reading such a book?


ActiveRecord and DB Migration Ate My Model Attributes!

Feb 27, 2013|2 Min Read|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):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 debugging the model:And by debugging the schema:So apparently somehow ActiveRecord ate our attack…


"Become A Better Developer You Can" - Video of My RubyConf China 2012 Talk

Dec 03, 2012|1 Min Read|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. ;)Also, my slides are available too.P.S. If you’re located in China, you may view the talk at Railscasts China.


An Interview with Yukihiro "Matz" Matsumoto

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 translated…


"Become A Better Developer You Can" - Slides of My RubyConf China 2012 Talk

Nov 25, 2012|1 Min Read|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-canSince I had been preparing for my talk for over a month, I’ve done many revisions to my slides. Here’s an uncut version…


Photos from RubyConf China 2012

Nov 24, 2012|1 Min Read|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:


SimpleCov: Test Coverage for Changed Files Only

Nov 13, 2012|1 Min Read|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:Basically use git ls-files --exclude-standard --others for untracked files, git diff --name-only for unstaged files and git diff --name-only --cached for staged files.


Skinny Coffee Machine - A Simple State Machine with Observers

After a few nights of working on the 2.0 rewrite of jQuery Endless Scroll, I am now releasing one of the tools I built for the project: Skinny Coffee Machine.Skinny Coffee Machine is a simple JavaScript state machine written in CoffeeScript.It is fairly simple to use, with the flexibility of adding and removing observers for state transitions.Define State MachinesSwitch/Change StatesObserversGo check out the source code now! :)


Brewing Node.js on OS X without Xcode

If you are like me who has no need for a full Xcode installation just to get the command line tools, chances are you are using one of these: Apple’s Command Line Tools or the osx-gcc-installer.Recently Node.js has made some changes so that it no longer installs on OS X via homebrew if you don’t have Xcode installed.If you run brew install nodejs, you will get the following error:And if you run brew install -v nodejs, you will discover this line:The fix? It’s actually quite easy, simply do:And…


Fix OpenSSL Error on Mountain Lion (and RVM)

Aug 06, 2012|1 Min Read|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 failedThe fix is quite simple actually, all you need to do is to download a CA root certificate:And that’s it! Enjoy!


API Taster: Visually Test Rails Application API

Jul 02, 2012|1 Min Read|Comments|

Like a lot of places, at Locomote we are building a platform that is API-based. As much as I like having comprehensive test suites, I often feel the need to manually test API endpoints to see exactly what the responses are.Tools such as Postman solves part of the issue: they allow us to quickly test API endpoints without messing with cURL.But as a lazy developer, I want more. ;)I want something that:automatically generates API endpoints from Rails routes definitiondefines input params as easy as…


PHP Devs: Have You Started Playing with More Toys?

Jun 29, 2012|4 Min Read|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 school…


[Rails Tip] Render views outside of Controllers or Views

Jun 20, 2012|1 Min Read|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?You could do something like this:The idea is to mixin the render method, but also ensuring the view buffer is correctly reset with flush_output_buffer.Hope that…


Agile is not a Sham

Mar 28, 2012|2 Min Read|Comments|

This blog post titled "Agile is a Sham" offends me a little bit. The post screams hey, I am a cowboy programmer, and it almost implies that if you employ processes then you are stupid.In this day and age, I would have thought finding the right tool for the right job is common sense. Apparently not.Agile, among many other things, is not a silver bullet - it never was and it never will be. The key thing is to experiment and find what works for you, your team and your company. Most software…


Zend Framework - From Extreme Simplicity to Enterprise!

Today an interesting blog post on Zend Framework has made to the Hacker News front page. I have to agree with the author - Zend Framework is an over-engineered piece of software.A few years ago I was working full time as a PHP developer. Naturally, I had experimented with lots of frameworks, including CakePHP, CodeIgniter, Kohana, Yii, Symfony and obviously, Zend Framework.Over the years, I had developed many projects primarily using CodeIgniter and later on, Kohana. There was one project that…


On Hiring: Use Kanban for Managing Candidates and the Hiring Process

Feb 21, 2012|1 Min Read|Comments|

Hiring is usually a long and difficult process - in order to streamline and simply it, I use Kanban to manage the whole process. I believe, hiring should be as lean and agile as our development process.My Kanban board for hiring (we just started hiring at SitePoint!):Using a Kanban board offers a number of advantages:a clear picture of the candidates with their feedback from code tests and interviewsa straightforward view of where a candidate is at in the hiring processlimited number of…


On Hiring: How To Be a Non-Technical Co-Founder

Jan 28, 2012|5 Min Read|Comments|

If you are looking at hiring developers, check out my article on this subject.The goal or the dream of working on your own startup is always full of excitement. And apart from some rare cases such as Dropbox, you probably need one or more co-founders to work with you on The Next Big Thing ™.Problem is, how do you (as a non-technical co-founder) find us? Or more specifically, how do you talk us into working with you instead of some other billion-dollar ideas?To answer this question, we need to…


On Hiring: How Not to Annoy Developers

Jan 26, 2012|3 Min Read|Comments|

If you are looking at finding technical co-founders, check out my article on this subject.In recent years developers become hotter and hotter - especially the good ones - they are hard to find, and they have plenty of employment options to choose from.Some companies (or individuals who are seeking freelancers) go the extra miles to impress developers with attractive salary/rate and perks, which is nice. But surprisingly, many companies and individuals seem to have a habit of keep doing things…


The Lean Startup - The Book Every Entrepreneur Should Read

Holidays period is the perfect time to gear up and learn a thing or two from the masters - and as it turned out, reading Eric Ries’ The Lean Startup is one of the most exciting and joyful things I’ve done during the holidays.In this book you won’t find long-winded and boring theories, instead the book is full of real world use cases and practical advices.If you are an entrepreneur, or if you are responsible for product development, I urge you to read this book if you haven’t already. :)


Blog Redesigned For 2012, And New Challenges Ahead

Dec 26, 2011|1 Min Read|Comments|

After four days of sketching, designing and cutting up HTML/CSS, the new design (as you are seeing now) is finally live!The new design is structurally similar to the old design, but with a fresh header and better use of space.A new year warrants a fresh start. Apart from the redesign, I have also started heading up the development effort at SitePoint - dozens of interesting and challenging projects ahead!2012 will be an awesome year! :)


Startup, VC, and the Things I Learnt from Open-sourcing A 200+ Hour Client Project

A couple of days ago, a blog post titled "First employee of startup? You are probably getting screwed!" has made to the Hacker News front page and has spawned some great discussion and debate.Since I had just been screwed recently, I thought it might be a good opportunity for me to share what I’ve learnt.After my story got picked up by Hacker News and some other sites, I was contacted by my client. It was a very interesting and surreal experience which included keywords such as sue, settle…


Skype.com - A Quick Example of UX Failure

Aug 31, 2011|1 Min Read|Comments|

Today I noticed that I don’t have Skype installed, so naturally, I went to Skype.com. Then I was presented with their homepage:The problem? No "Download" action button above the fold, or below the fold for that matter. That is, quite frankly, shocking.So I hovered on the "Get Skype" drop down menu and clicked on the one for Mac. On the new page I was presented with, I clicked on the "Download Skype" button. And then …Oh snap! You’d have to either create an account or sign in before you could…


Open-sourcing A 200+ Hour Project - The Story Behind It

Update: I have blogged about the things I have learnt from this.Last night, after some long overdue frustration, I have open sourced Angel Nest - an online platform for connecting entrepreneurs and investors, similar to AngelList.Shortly after I open sourced my work, the news got picked up by Hacker News and went onto its front page. (Update: I was just informed that the story was picked up by Reddit as well.) The Github repository has since been followed by 250+ people and forked by 60+ times…


It's Year 2011, Why Aren't People More Open-minded?

On a cold windy day, we are comfortably sitting in our chairs beside the fireplace, holding a mug full of hot tasty latte. We are slowly and calmly sipping on our coffee, imagining that things could be far worse outside of our safe and warm house.Exactly how do we know that things could be far worse? We don’t, because we are too comfortable and too familiar with what we currently have.Being happy with where you are is one thing, being ignorant is another.Inventions and innovations aren’t born…


comic because activerecord is slow

Jul 06, 2011|1 Min Read|Comments|

Comic: Because ActiveRecord is Slow!


Moving On From Envato, What's Next?

Mar 17, 2011|2 Min Read|Comments|

Today is my last day at Envato. I have been working here for a year and half and it has been, without a doubt the most fulfilling experience I have ever had in my professional career.I was hired as a PHP developer initially. Who knew, several months into the job I was ‘converted’ voluntarily to a full time Ruby developer - and it has been the highlight of my career progression. It is hard to imagine what I would have become if it wasn’t for Envato’s support behind my conversion.During my time at…


my entry to the rubycommitters design contest

Jan 18, 2011|1 Min Read|Comments|

My entry to the RubyCommitters design contest. View it in action at http://heroesofruby.heroku.com/ :-)


sneak peak of the redesign of slim langcom

Dec 22, 2010|1 Min Read|Comments|

Sneak peak of the redesign of slim-lang.com. :)


[Ruby] Haml2Slim, Convert Your HAML Templates to Slim Templates

Dec 16, 2010|1 Min Read|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.


[Ruby] Releasing Ssync - An Optimised S3 Sync Tool Using the Power of Unix!

Nov 12, 2010|1 Min Read|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!


Slim, a Fast and Lightweight Rails Template Engine!

Oct 17, 2010|1 Min Read|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.


A Speedier Rails App using Rails 3.1 + Arel 2.0

Sep 29, 2010|1 Min Read|Comments|

Before (Rails 3.0.1pre stable branch + Arel 1.0.1):After (Rails 3.1.0 master branch + Arel 2.0.0dev master branch:Thanks to the awesome work done by Aaron Patterson (@tenderlove) and others. :-)UPDATE:After Aaron Patteron’s tweet, I ran the tests again on Rails 3.0.1pre stable branch + Arel 2.0.0dev master branch, and the result blew my mind:


`bundle: command not found` or `Could not find RubyGem bundler (>= 0)` During Capistrano Deployment? No Problems!

Sep 16, 2010|1 Min Read|Comments|

Don’t you just hate it when you get the following errors during a Capistrano deployment?In fact, even if you don’t use bundler, you might still get errors like this:It turns out this has something to do with the $PATH and $GEM_HOME variables.So here’s the quick fix.Log in to your deployment server, as a root user, add the following line to /etc/ssh/sshd_config:Don’t forget to restart ssh:Now, log in as the deployment user, and create ’~/.ssh/environment’ with the following content:* The above…


wuit trademarked in australia now the

Aug 27, 2010|1 Min Read|Comments|

Wuit trademarked in Australia now! :-)The trademark application in the US is being progressed as well.If you don’t already know, Wuit is my soon to be launched studio identity.


[Rails] RailsConfig, A New Iteration of AppConfig for Rails 3

Aug 11, 2010|1 Min Read|Comments|

If you haven’t already been using AppConfig in your Rails project, well, you should!Jacques Crocker has recently released his new version of the original AppConfig - RailsConfig. I was invited to join the development of this new tool, so make sure you go check it out. :-)


[Rails] Inherited Resources Views Now Supports Rails 2.x

I have just pushed a commit that added Rails 2.x compatibility to Inherited Resources Views. Please give it a spin! :-)P.S. I’ve only tested it on Rails 2.3.8.


Reinvigorate - Realtime Website Traffic Analysis

It isn’t the first time realtime website traffic analysis has been introduced. Reinvigorate is one of the services that provides realtime traffic tracking and analysis.The thing I like it most though, is in fact the heatmap. :-)Heatmap is a great tool to help identify convoluted interface and improve the user experience.


Poke me on Github! :D

Aug 06, 2010|1 Min Read|Comments|

I have just added a Github ribbon to my blog (look at the top left corner!). Please feel free to poke me! :DReferences:Redoing the GitHub Ribbon in CSSGitHub Ribbon Using CSS Transforms


[Rails] Releasing Inherited Resources Views - DRY Your View Files

Using Inherited Resources is an excellent way to reduce the amount of repetition in your controllers. But what about views? A lot of times resources share the same views, so why not DRY ‘em up using Inherited Resources Views!Go check out the code! :-)


released my first ruby gem

Aug 04, 2010|1 Min Read|Comments|

Released my first ruby gem. :-)


looks like its time for a reboot

Aug 04, 2010|1 Min Read|Comments|

Looks like it’s time for a reboot…


[jQuery] Releasing Inline Confirmation, Confirm Actions Done Right

Aug 03, 2010|1 Min Read|Comments|

In a web app, it is very common to have actions that destroy (delete/remove) data. These actions, if you don’t already know, should always map to POST methods. On top of that, because these actions are destructive, the UI should always ask the user for confirmation.But how do we actually implement the confirmation dialogue though? The vanilla JavaScript confirm box would be the easiest but at the same time the ugliest - this thing stalls most web browsers until the user acts on it.An inline…


I'm Now a Ruby on Rails Contributor

Aug 02, 2010|1 Min Read|Comments|

I am extremely happy that my patch was accepted, so I am now one of the 1600 odd people who have contributed to the Rails project! :D


[PHP] Releasing KThrottler, A Kohana Module for Throttling Actions

Jul 28, 2010|1 Min Read|Comments|

Similarly to Action Throttler for Rails, KThrottler is an easy to use Kohana module to quickly throttle application actions based on configurable duration and limit.Go check out the code now! :)


#whatdatingislike What Dating Is Like

Jul 26, 2010|2 Min Read|Comments|

Dating girls is like calling a callback function without knowing the accepted arguments. Random exceptions would throw right in your face.Dating girls is like running prerelease ruby gems. Things might not be compatible, there might be memory leaks and other weirdnesses.Dating girls is like reading a tutorial in a foreign language. You think you got it, but you don’t.Dating girls is like using a ruby class with lots of mixins. You’re looking right at a class method, but you don’t know where it…


[Rails] Introducing Datamappify - ActiveRecord Without DB Migrations

IntroductionActiveRecord is without doubt the de facto ORM library for Rails and many Ruby web frameworks. Many developers however, do not like database migrations and prefer to use DSL for data mapping. Datamappify is created with the sole purpose of getting rid of the DB migration headaches.Why Not DB Migrations?Well, depending on your specific project, DB migrations might create more trouble than it’s worth. Besides, your code is already version controlled, so why create a separate version…


Fuck GPL!

Jul 15, 2010|1 Min Read|Comments

Fuck GPL!


just some late night sketches done with a finger

Jul 14, 2010|1 Min Read|Comments|

Just some late night sketches, done with a finger, an iPad and some wine.


Wuit.com Now Runs on Padrino

A few days ago I discovered Padrino, an excellent ruby framework built on top of Sinatra. What can be a better than experimenting with it? Build an actual website with it!So last night I ported Wuit.com from using vanilla PHP + Flourish to using Padrino + DataMapper + Haml.The entire porting experience was positive, albeit the website only has two pages.I did encounter a strange problem with Capistrano though - both current_release and latest_release were giving me strange results. In the end I…


[PHP] Releasing PHamlP Module for Kohana, Use Haml and Sass with Kohana 3.0!

Jun 27, 2010|1 Min Read|Comments|

Haml and Sass are two extremely useful template engines. They are very popular amongst the Ruby and Rails community.I am happy to release a module for Kohana v3 that uses the PHamlP library to offer Haml/Sass support for Kohana.Right now the module only supports Haml but I will be adding Sass support in the very near future.Head over to GitHub to check out the source code. :)


Deploy PHP Websites Using Capistrano (and Git)

Jun 21, 2010|3 Min Read|Comments|

The Rails deployment flow is really smooth thanks to the powerful (and easy to use) Capistrano.Capistrano not only works with Rails and other Ruby code bases, but also code bases in any programming languages, such as PHP!Here is an overview of what I did to get one of our PHP production sites up and running with Capistrano.If you don’t already have Ruby and Rubygems installed, install them!After you got ruby and rubygems, install Capistrano and its related gems -Now, navigate to your application…


[jQuery] Endless Scroll Updated, Now Works with Any DOM Elements

jQuery Endless Scroll has now been updated to work with any DOM elements, not just $(document).Click here for the project page (with usage examples).Click here for a simple demo.Enjoy!


[Rails] Releasing Action Throttler, A Rails Plugin for Throttling Actions

Sometimes we would want to throttle certain application actions. For instance, a user should only be allowed to send x amount of emails to other members of the site in order to reduce the spam risk.Since this is a quite common task, I thought I might as well make it as a Rails plugin for better code reusability.I am now releasing Action Throttler, an easy to use Rails plugin to quickly throttle application actions based on configurable duration and limit. Go check out the code now! :)There is…


A Whole World of Difference: Phusion Passenger Apache to Nginx, Ruby Enterprise Edition 1.8.6 to 1.8.7

Yesterday we have launched the new design of Creattica. It runs well during the testing and staging phase, unfortunately the server quickly became overloaded and unresponsive after the relaunch was made public.The site was running fine with its old design, but because the new design has many added features such as search filters, followers and more, system resources were very quickly drained.After some optimisation of the database (which itself has increased the site performance by up to 30…


busy at work

May 27, 2010|1 Min Read|Comments|

Busy at work…


[Rails] Use App_Config For Your Application Specific Configuration

May 25, 2010|1 Min Read|Comments|

A simple Google search will reveal that there are a number of different App_Config plugins for Rails. After comparing them side by side, I have decided to use the one by Christopher J. Bottaro.It features:simple YAML config filesconfig files support ERBconfig files support inheritanceaccess config information via convenient object member notationI just fixed a bug last night (which was pulled in to the main repository) where it could throw errors when used as a Rails plugin (i.e. via rails…


[Rails Tip] Model Attributes Not Updating? `reset_column_information` To the Rescue!

May 25, 2010|1 Min Read|Comments|

So you were wondering why some of your model attributes weren’t updating properly? Well, it is perhaps because the db schema has changed but the changed schema has not been passed onto ActiveRecord, as is often the case in DB migration.Taken from the ActiveRecord documentation:Resets all the cached information about columns, which will cause them to be reloaded on the next request.The most common usage pattern for this method is probably in a migration, when just after creating a table you want…


[jQuery Tip] Traverse/Parse HTML String

Apr 28, 2010|1 Min Read|Comments|

When you are getting an HTML string from an external source (e.g. from an AJAX get result) and you want to rip out a certain part of the HTML source, you need to make sure that the ‘certain part’ is not at the top level of the HTML source.For example, we have the following HTML string:If we want to get the first paragraph element by using:The above code won’t work, because the p tags are at the top level. Instead, we can simply wrap the HTML source with a div tag and that’ll do it. :)


[Rails Tip] DataMapper M:M Association Bug and Workaround

Apr 26, 2010|1 Min Read|Comments|

It was confirmed that DataMapper is incorrectly setting table names in SQL JOINs.So for instance, the following code would generate an SQL error:There is a workaround, however the workaround requires manual looping of the dataset thus produces N+1 queries.But at least it works. ;)


[Rails Tip] DataMapper Timestamps Bug and Workaround

It has been confirmed by DataMapper’s core developer Martin Gamsjaeger (snusnu) that it is a bug.In short, created_[at|on] can be manually overridden, but updated_[at|on] cannot.The workaround is simple, do it in two steps, for example:Please check the bug ticket to see when it’s getting fixed.


[Rails Tip] Run Specs Faster!

Apr 09, 2010|1 Min Read|Comments|

If you are using rake spec to run the specs. Try using spec spec instead! It avoids doing some preliminary tasks and therefore is quicker to execute.You can verify the difference using Unix’s time command, i.e. time spec spec and time rake spec.


[Rails] Run Queued Tasks Using 'delayed_job', Now With Intervals!

If you don’t already know, ’delayed_job’ is a database based asynchronously priority queue system extracted from Shopify.I was seeking for a lightweight, easy to use solution for queueing tasks, ‘delayed_job’ fits the bill almost perfectly. ;)One thing we needed to do for a Rails 2 project at Envato, was to queue the tasks and to run them one after another, at a set interval. 'delayed_job’ unfortunately doesn’t come with this feature.So, instead of searching for more complicated solutions or…


i need textmate 2 or a 3d monitorprojector to

Mar 17, 2010|1 Min Read|Comments|

I need Textmate 2 (or a 3D monitor/projector) to come out sooner, otherwise there will be a day where I will just be totally lost in dozens of windows.


[Rails] MongoMapper on Rails 3 Master, Undefined 'to_key' Method

Mar 17, 2010|1 Min Read|Comments|

Rails 3 has recently renamed key method to to_key, which consequently rendered MongoMapper unusable.You might see an error that looks like:After some twiddling I’ve submitted a patch to address this issue. Feel free to pull my fork until the fix makes its way into John Nunemaker’s main repository.


Use the 'textmate' Command to Quickly Install Bundle Files

Mar 14, 2010|1 Min Read|Comments|

Initially developed by Yehuda Katz, the Textmate gem is an extremely handy tool for installing and managing your Textmate bundle files.The tool works very well, for the most part. But due to the way the GitHub search query was built, the tool failed at finding Textmate bundles that do not honour the ’-tmbundle’ suffix in the name of their repositories.I was waiting for GitHub to fix their API bug which I reported here, but today I discovered a workaround that solves this issue.So, here, I…


i hate it when this happens and i have a dozen of

Mar 14, 2010|1 Min Read|Comments|

I hate it when this happens and I have a dozen of Textmate and Terminal windows open…


[Rails] Use HAML templates with Devise

Mar 13, 2010|1 Min Read|Comments|

If you are a Rails developers, chances are you have heard of, or are using either Devise or HAML in your projects.And if you’re like me who uses both, then surely you’d wish these two worked together, i.e. generate devise views in HAML.Today is your lucky day! I’ve just committed some changes that enable you to do so! The changes are already merged back to the primary repository.In order to generate HAML views instead of ERb views, simply do:You can use the master branch of Devise, i.e. in your…


first photoshop now textmate whats next

Mar 09, 2010|1 Min Read|Comments|

First Photoshop, now Textmate, what’s next?


Advanced Search Query on GitHub

Mar 09, 2010|1 Min Read|Comments|

Did you know, you can perform advanced search queries on GitHub?For example:The above query will search everything containing ruby, as well as either textmate or tmbundle.Unfortunately at this stage the GitHub API does not support it. I’ve opened a ticket here.


[Rails Tip] Making i18n Forms, the Easy Way

Web applications normally have many forms. Building forms is always a mind-boggling task because it involves repetition and chaos.A shortcut is to use a form builder / DSL, such as Formtastic.As I am using Rails 3, and the Rails 3 port of Formtastic isn’t complete yet, I thought I’d just use the plain vanilla Rails built-in form helper.First of all, I am using Haml instead of ERb. Already, I got the out-of-box clean looking Haml markup.Some of you might not be aware of the fact that Rails’ built…


this is from an email newsletter i received in my

Mar 05, 2010|1 Min Read|Comments|

This is from an email newsletter I received in my Gmail inbox from Macheist. Note to all the designers out there, please don’t use fancy CSS, not even some of the basic ones, because they don’t work in email clients! Here’s a great table of contents on what you can and cannot use for different email clients.


okay this is actually an archive post from my

Mar 05, 2010|1 Min Read|Comments|

Okay, this is actually an archive post from my other blog Beyond Coding, but I feel like reposting it here for some humour. :)Today I decided to upgrade my Windows 7 build 7000 to the latest build 7057. The system is installed on my Fujitsu P1610 which I use as an e-book reader and ultra-portable.I ran the DVD inside Windows, then I chose to archive the old installation and install the new version from scratch.Here is a screenshot of the archived Windows folder, apparently Microsoft has…


PunyPNG > Smush.it

Mar 03, 2010|1 Min Read|Comments|

In case you don’t already know, both PunyPNG and Smush.it are lossless image compression services.From my experience, PunyPNG produces better results than Smush.it does.The sprite image for this blog yields 160kb when it was created. Smush.it reduced the size by 30%, PunyPNG reduced the size by 50%.The PunyPNG API is going to be extremely useful when it is out of beta.


CSS Sprites or Data URI Sprites?

Mar 03, 2010|1 Min Read|Comments|

When making the new design of this blog, I inevitably come to the dilemma of whether to use traditional CSS sprites (i.e. to use background image positions to locate the images) or to use Data URI sprites (i.e. to use Data URI / MHTML to replace the actual image files).First of all, during the design and development stage, everything was built without any sprites in mind. It is just so much easier to build the template without worrying about background image positions.After the template is…


Blog Redesigned!

Mar 02, 2010|1 Min Read|Comments|

After spending the weekend coming up with the design, one night of chopping and slicing and half a night of Tumblr themeing, I have finally done it!Thanks to 960.gs and the Variable Grid System, they made making layout so easy!The theme is tested in all major browsers, except IE6. Let me know what you think! :-)


dear photoshop please dont just dont

Mar 01, 2010|1 Min Read|Comments|

Dear Photoshop, please don’t, just don’t.


dont you just hate that fortunately i have the

Feb 28, 2010|1 Min Read|Comments|

Don’t you just hate that. Fortunately I have the ‘CMD + S’ syndrome.


Browser JavaScript and DOM Benchmark Tests: Firefox, Minefield, Safari, Webkit, Chrome, Chromium and Opera 10.5

Today Opera has released its latest and greatest version of Opera browser 10.5 Beta for Mac. It features speed enhancement as well as a unified Cocoa interface. Just how speedy is it exactly? Let’s test it out against other major browsers.The benchmarks were run on my Macbook Pro (OS X 10.6.2, 2.53GHz CPU, 4GB RAM). I have performed three benchmark tests from Dromaeo - All JavaScript Tests, DOM Core Tests and JavaScript Library Tests. The following browsers are used:Firefox 3.6Minefield (Latest…


[Rails Tip] "String".constantize

Feb 26, 2010|1 Min Read|Comments|

So we want to dynamically instantiate an object (i.e. convert a string to a class constant).Instead of doing this:You can do this:See more about the constantize method in Rails’s API.


dear vodafone 3g please fix your network kthx

Feb 24, 2010|1 Min Read|Comments|

Dear Vodafone 3G, please fix your network. Kthx.


so i received my dell u2711 today even though i

Feb 22, 2010|1 Min Read|Comments|

So I received my Dell U2711 today, even though I was told by a sales rep it will be delivered tomorrow. ;-)The thing is, I ordered a Mini DisplayPort to DisplayPort connector and it’s not here yet. So instead of enjoying the native 2560x1440 resolution, I have to put up with 1920x1080 for now. It’s still a nice upgrade from my ViewSonic 20" (1680x1050).


Random Thoughts on Cassandra, Riak and MongoDB

Feb 20, 2010|2 Min Read|Comments|

A few days ago I was conducting some preliminary tests and benchmarks on a couple of NoSQL solutions such as Redis, Cassandra and Riak.As expected, Redis performed really really well, its speed is unmatchable by Cassandra and Riak.However, that’s not the point.One thing I noticed is that quite a few people don’t really get what ’scalability’ actually means. In this case, Redis does not scale (yet), so comparing the raw performance (on a single machine) isn’t entirely useful.Both Cassandra and…


Hello Tumblr!

Feb 20, 2010|1 Min Read|Comments|

I’m hoping to post more regularly by having this Tumblr blog. :)RubyPythonPHPFalcon