class Commentor
def comment_type
self.class.to_s.downcase
...
Ruby On Too many assignments and co...
by Adam,
August 29, 2008 21:03
I couldn't quite discern wh...
def test_web_browser
%w(Firefox/3 Firefox/2 MSIE\ 6 MSIE\ 7 Opera).detect do |agent|
request.user_agent =~ Regexp.new(agent)
...
Ruby On Code to detect the web browser
by Adam,
August 28, 2008 22:02
@Nicolás - I don't think t...
def test_web_browser
catch(:match) do
["Firefox/3", "Firefox/2", "MSIE 6", "MSIE 7", "Opera"].each do |ua|
...
<span class="bluelinks-allsmall"> <% if user.normal? %> ...
Ruby On Link to if else simple cond...
by Adam,
August 20, 2008 13:51
You should be using named r...
//msg is the string to show in the alert.
//obj is the input to focus
function msgFocus(msg, obj){
...
JavaScript On Setting focus after alert
by Juha Hollanti,
August 20, 2008 11:19
Form elements can be disabl...
def sort(array)
array.inject([]) do |sorted,element|
small, large = sorted.partition { |item| item < element }
...
def self.favorite?(object)
if reflection = object.class.reflect_on_association(:favorites)
send("find_by_#{reflection.primary_key_name}", object)
...
class Report < ActiveRecord::Base
%w[hits uniques].each { |const| const_set(const.upcase, const) }
end
PHP On Resize image to canvas
by Juha Hollanti,
August 14, 2008 08:11
Checking for GD lib might a...
PHP On Adding seconds to a MySQL t...
by Juha Hollanti,
August 13, 2008 13:53
Wow, that's neat! And you'r...
/** * Scale an image according to input canvas dimensions. * No cropping will occur, the scaled image is "centered" to canvas. ...
PHP Resize image to canvas
The built in image function...
echo '<qdapi>';
foreach($payload as $key => $value) {
echo "<$key>$value</$key>";
...
PHP On Array and ForEach Loop
by Juha Hollanti,
August 12, 2008 19:26
Yeah you're right, parsing ...
ActionScript On Isometric X/Y Grid pattern ...
by Juha Hollanti,
August 12, 2008 10:28
Umm, i don't know what you'...
PHP On Adding seconds to a MySQL t...
by Juha Hollanti,
July 15, 2008 19:42
Good stuff!
Gotta hate mys...
On a forum I was reading, s...