Selasa, 18 September 2012

tcs-ruby: faster ruby for windows

As a rails developer using windows as my development machine I often getting annoyed on how much time needed to start things especially tests.
In case you're wondering why did I use windows instead of other OS-es better suited for ruby like MacOSX/linux it's because I'm comfortable with it and if you're disagree then feel free to stop reading at this point :)

Several days ago I found about this fork of ruby by TheCodeShop which will speed up things quiet significantly, I decided to try it and one of my project unit tests which needed around 45 sec to complete reduced to less than 20 sec.


This step assume you're using Win7 with pik to manage multiple ruby installation, if you don't have pik yet get it from https://github.com/vertiginous/pik

  1. Download one of ruby build from:
    (I'm using winio one)
  2. Extract it, for example to C:\Ruby-tcs193
  3. Modify Path to use ruby-tcs: go to Control Panel, System, Advanced System Settings, Environment Variables
  4. Edit Path in User variables, modify existing Ruby bin path to ruby-tcs bin (C:\Ruby-tcs193)
  5. Add new variable RUBYOPT with value: "-rfenix/replace"
  6. Next, add it to pik (you can stop here if you didn't use pik, but I recommend it in case you need to switch to standard ruby)
  7. open cmd, then enter "pik add [path to ruby-tcs bin]" for example "pik add C:\Ruby-tcs193\bin"
  8. Lastly install devkit for it, run "ruby c:\devkit\dk.rb init" then "ruby c:\devkit\dk.rb install"
  9. Done :)

Known problems

Heroku commands

heroku commands will raise error because of non existing fenix/replace, to fix simply remove RUBYOPT temporarily by entering "set RUBYOPT="

Standard ruby

same as above because standard ruby didn't use fenix so remove RUBYOPT temporarily

Kamis, 09 Agustus 2012

Web page Al Bhed translator javascript (bookmarklet)

well long time no post :D

recently I don't have much to do and rather than dying from boredom I created a simple javascript to translate a web page to Al Bhed language (from Final Fantasy X if you're wondering)

The Base translation mapping come from http://nysa.cx/albhed/ and I just converted it to javascript.

Anyway here are the script:
javascript: (function(){var f=document.createElement('script'); f.src = 'http://al-bhed-page-translator-js.googlecode.com/files/albhed.js'; document.head.appendChild(f);})();
just copy and paste it into the browser address bar in the page you want to translate. (keep in mind that newer firefox block this kind of script, and you need to use bookmarklet for that)

To translate the page back to original, simply use this script:
javascript: (function(){alTranslate(true);})();

That's it :)

Known bugs:
- html encoded character such as   didn't translate properly, it's fixable but I'm too lazy to fix it :P
- huge page might causing the browser to freeze, also should be fixable by adding some timeout but again, I'm lazy :D

Minggu, 01 Januari 2012

using compass in rails 3.1.3

group :assets do
  gem 'sass-rails',   '~> 3.1.5'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'compass', '>= 0.12.alpha'

config.assets.precompile << /(^[^_]|\/[^_])[^\/]*$/

Sabtu, 31 Desember 2011

ubuntu 11.10 rails 3 passenger


Senin, 03 Oktober 2011

install mysql2 > 0.3.6 for mysql 64bit in windows

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.5\include"'


copy  C:\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to ruby\bin

original source: http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/