domain for sale $5k usd (negotiable). Em@il me t0: alex at israstage dot com

My Git activity


20 September 2007

Painless PNG plugin MOD

Thru the pains of PNG in (IE <img>'ing png icons..

First i've started from HERE.
Go here and read some instructions that are simple ( i dont want to repost them here!)

I've been uploaded updated completely modified and working to my blog.
With this modifications (by Naixn and some by me) you *dont* need any modification to your css/html/ruby code.

1.Unpack content of ZIP into vendor/plugin
2.Copy blank.gif from ZIP to public/images.

Restart server and enjoy !


09 September 2007

What is that ?

Does anyone can define this function ?

range.inject({|h,e| h[e] += 1; h}

range is array of integers like: [1,22,12,8,45,3,etc..]

02 September 2007

:conditions => ["created BETWEEN...

Best way to get query by "from" date and "till date" is:

range = "created_at #{(}"

Will result in creating String = "created_at BETWEEN "03-09-2006" AND "03-09-2007""
AND then

@data = MyModel.find(:all, :conditions => ["code=? AND #{range}", 2])

link_to_back helper

It will take referer, @params and redirect you back to same page you been before.

Useful then sorting search results, paging, editing different objects via same _form...
This is code for helper file, i prefer application helper.

def link_to_back (description = "Back")
referer = request.env["HTTP_REFERER"]
return false if !referer
getIt = request.env["REQUEST_URI"].split("?")[1]
if getIt.nil?
getIt = ""
getIt = "?" + getIt if !getIt.match(/\?/)
link_to description, referer + getIt

then just do:
<%= link_to_back %> or
<%= link_to_back "Cancel" %>