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


[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 files config files support ERB config files support inheritance access config information via convenient object member notation I 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…


[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. ;)