I'm trying to teach myself some Japanese. Well, sort of.
So I've written the application Happy-Nippo that might help you to memorize the first two, hiragana and katakana Japanese alphabets.
Looks quite nice.
Saturday, August 15, 2009
Thursday, August 13, 2009
FrontCompiler Updates
FrontCompiler is a Ruby based JavaScript compression tool of mine. And I've just updated the self-builds feature of it.
Formerly it used a literal based hashes and special markers, and I've reworked it the way it used numbers and arrays, similarly how the Base62 encryption algorithm works.
Anyway. Now both, compression and decompression processes work faster, and the result builds are slightly (3-8%) smaller.
This is pretty much it. Enjoy!
Formerly it used a literal based hashes and special markers, and I've reworked it the way it used numbers and arrays, similarly how the Base62 encryption algorithm works.
Anyway. Now both, compression and decompression processes work faster, and the result builds are slightly (3-8%) smaller.
This is pretty much it. Enjoy!
Sunday, August 9, 2009
RightJS Now Rocks In IE8 Too
As you probably know, the new version of RightJS is coming. I've done some optimizations in the native css-selectors support in this version and now RightJS is the fastest one in IE8 too. The only condition, it has to have a correct document definition or to be switched to the XA-Compatible mode manually.
Thursday, August 6, 2009
RightJS Rocks In Firefox 3.5
A newer version of RightJS is coming, it will come with some further native method optimizations and now it beats everyone in the new upcoming Firefox 3.5

Saturday, August 1, 2009
HTML Code For A Close Button Icon
Some people like use chars and html-codes as a default content for buttons and links. The idea is to put some simple character or code which will look like an icon, and later, if necessary, replace it with a real icon at the css-level. A "close" button is a pretty common case and people usually use the "X" character in there. The problem with it is that it has wrong dimensions and doesn't look like a normal cross on a close button. Luckily there is a better way. There is a standard html code for the mathematical multiplication symbol ×.
It looks like that
×
As you see it has the correct shape of the close symbol, and it still a normal character which you can paint with css just as you like, use hover effects, etc.
It looks like that
As you see it has the correct shape of the close symbol, and it still a normal character which you can paint with css just as you like, use hover effects, etc.
Saturday, July 25, 2009
RightJS Is Faster Than Pure Dom
Well, I'm cooking a new version of RightJS. I've optimized this and that, tuned here and there. And then I've run the TaskSpeed test and it looks like RightJS works faster than pure dom.

That's not a fake, seriously, I've got this result from Safari 4. jQuery has in this test 883 points.
Sure, that's because of the way the original test was written, but the result is just hilarious 8)
PS: Goin' to publish the new version in the next couple of days
That's not a fake, seriously, I've got this result from Safari 4. jQuery has in this test 883 points.
Sure, that's because of the way the original test was written, but the result is just hilarious 8)
PS: Goin' to publish the new version in the next couple of days
Thursday, July 23, 2009
Transparent Dates and Times Internationalization in Rails
The basic internationalization approach in Ruby on Rails supposes that you translate the dates and times like that
But most of us use the "to_s" method to format times, like that
Mostly because you usually don't think much about i18n when a project is just starting up, and then it's kinda sweet, nice and short way of doing that.
So, usually when it comes to the internationalization, the project is already pretty much covered with the to_s methods. If you were lucky you might had created a single helper method which processes all the dates and times in your project and then it's simple, but if you didn't you might think about highjacking the "to_s" method of the Time class. Like that.
But if you do so, you will probably broke the things. Because first of all the "to_s" method supposed to work like an alias for the "strftime" method, secondly this method is used to convert times and dates in the :db format and if it was not translated properly it will break your models, thirdly it's naughty when you completely replace such a method.
Okay here is a better way of doing that
It keeps the original method and doesn't touch the custom and database formats. The ActiveSupport::TimeWithZone class is the Rails class for the UTC times you need to process it too.
Created at: <%= I18n.localize @model.created_at, :format => :short %>
But most of us use the "to_s" method to format times, like that
Created at: <%= @model.created_at.to_s :short %>
Mostly because you usually don't think much about i18n when a project is just starting up, and then it's kinda sweet, nice and short way of doing that.
So, usually when it comes to the internationalization, the project is already pretty much covered with the to_s methods. If you were lucky you might had created a single helper method which processes all the dates and times in your project and then it's simple, but if you didn't you might think about highjacking the "to_s" method of the Time class. Like that.
class Time
def to_s(format=:default)
I18n.localize self, :format => format
end
end
But if you do so, you will probably broke the things. Because first of all the "to_s" method supposed to work like an alias for the "strftime" method, secondly this method is used to convert times and dates in the :db format and if it was not translated properly it will break your models, thirdly it's naughty when you completely replace such a method.
Okay here is a better way of doing that
[Date, Time, ActiveSupport::TimeWithZone].each do |klass|
klass.instance_eval do
define_method :to_s_with_i18n do |*args|
format = args.first || :default
if format.is_a?(Symbol) && format != :db
I18n.localize(self, :format => format)
else
to_s_without_i18n(*args)
end
end
alias_method_chain :to_s, :i18n
end
end
It keeps the original method and doesn't touch the custom and database formats. The ActiveSupport::TimeWithZone class is the Rails class for the UTC times you need to process it too.
Subscribe to:
Posts (Atom)