Category Archives: web 2.0

Refactor my Code

If there’s one thing that current blogs suck at it’s sharing code. Ok, some have plugins to highlight code in your post, but what about the comments? Blogging is all about having conversations! How many times have you seen on blogs the author asking to replace > and < with something else. Oh! and forget about indentation HTML eats those, WordPress replace " with some weird character, etc, etc and etc! (etc)

Wouldn’t it be great to have a site that cares about your code ? That threats it as a piece of art and at the same time, encourage people to make it better and more beautiful ? logo

That’s why I created You submit your code, people refactor it!

# Behave like +link_to_remote+, but shows a spinner while the request is processing.
#   link_to_remote_with_spinner 'Hi', :url => hi_path
# You can specify the spinner and the container to hide
#   link_to_remote_with_spinner 'Hi', :url => hi_path, :container_id => 'container', :spinner => 'spinner'
def link_to_remote_with_spinner(title, options)
  element_id = options.delete(:id) || ('link_to_' +' ', '_'))
  container_id = options.delete(:container_id) || element_id
  returning '' do |out|
    unless spinner = options.delete(:spinner)
      spinner = "#{element_id}_spinner"
      out << image_tag('spinner.gif', :id => spinner, :style => 'display:none')
    options[:complete] = "$('#{spinner}').hide(); " + (options[:complete] || "$('#{container_id}').show()")
    out << link_to_remote(title, { :loading => "$('#{container_id}').hide(); $('#{spinner}').show()" }.merge(options),
                                 { :id => element_id })


On RefactorMyCode, you’ll find:

  • Gorgeous syntax highlighting to show your code in all its glory!
  • Split your code in sections with more then 150 supported syntaxes.
  • Have the honour of being the best refactorer of the net.
  • Pastable version of your beautifully highlighted code to put on your blog.
  • Trackback support for sending comments back to your blog (hey! why not drive traffic to your blog at the same time ?)
  • Atom Feeds for everything you should care about.
  • Spam filtering on comments (by Defensio) so you know it stays clean
  • No account creation! Enter your OpenID and you’re done! How’s that? Plus you get an avatar if your email is registered on Gravatar. All that in one step!
  • And when you get to be one of the best refactorers out there, be sure to put your badge on your blog! (See mine on the side =>, Boooo! I’m 5th 😦 )

But apart from all those Web-2.0-AJAX-semantic-aggregated compliant features, good things happened since I started using it with Daniel, Gary, James and Hampton (!). I learned new tricks, refactored some poor and ugly code in my apps and shared what I knew at the same time. It’s the best learning tool ever, but mostly it’s the best place to brag about your skills and have fun while doing what we love: coding!

I have a dream! That someday, ugly code will be no more! I know we can do it. This is a call for action to kill all ugly code that pollute our lives! Spread the news and help bad code disappear forever!

Now on to some refactoring!

Update: Help spread the word, Digg RefactorMyCode, Reddit it and Hacker News it (what?) !


Filed under rails, refactormycode, ruby, web 2.0

Better late then ever : joining twitter

While I was eating today, someone came by and stole my delicious Pad Thai. He swore I wouldn’t have it back unless I join Twitter…

Well, I was ungry!

You can add me as a friend in the name of all the Pad Thai supporters that didn’t had as much chance as I had!

1 Comment

Filed under Misc, web 2.0

The secret of creating successful web services

Jeff Atwood and Jason Kottke got some great insights about what makes a successful web service.

According to them, the secret is porting an old unix command to the web or making public something that was private, like IM became Twitter.

Hum, what’s next ? cat, chattr, cd, chmod, chown, chgrp, cp, du, df, file, fsck, ln, lsof, mkdir, mv, pwd, rm, rmdir, split, touch ?

1 Comment

Filed under links, web 2.0

AJAX and the whole 2.0 stuff

Some are all buzzed about it, some others are angry that someone has even thought about naming a fashion Web 2.0. Like their was a version for the “Web”. It’s like naming your own child “Version 1.2” (I know some guy did… That’s not my point). I’m not angry at this, I think it’s a marketing stuff, “hey come with us we got the next version of the internet wright now!”, hum… Pretty tempting. But all that matters to us programmers (and users) is if it will make our live easier.
Today I get to try Yahoo Mail boosted on Ajax. You can drag and drop stuff all around, and you even get a popup menu to tickle you mail. But man! It’s slow! I thought that AJAX was all about asynchronous processing to make web pages more fast. Now I have to wait 5 full seconds to even check if I got mail. I switched back to my old and comforting yahoo mail without all the glamour stuff, but the efficiency.

At the same time I’m building a web app and using AJAX to boost up my … ego. But on the functional side, It’s great, having to interact remotely with the server without posting or without not-so-cool spaghetti javascript packed with collections loaded at post time… hurrrrr… You know when you got a child collection to be modified on a web page without reloading, that’s the kind of stuff that makes your life easier and your code cleaner.

All my work has been done with Castle, MonoRail and ActiveRecord are like Ruby on Rails, but it’s the MicroKernel Container of Ioc that makes it super powerful. You can hack services (full of dependencies if you wish or have to), test them with mocks and them plug it in the container. Then you only add the interface to your service in the Controller’s constructor like this:

public ServiceController(IMyCoolService service)
  _service = service;

No factory, no crazy xml config file, cool!

1 Comment

Filed under Castle, web 2.0