Ruby on Rails Time Saver – delete development.log

When uploading your local build to a server delete your development.log file because they tend to get long and thus heavy on kilobytes.

  • Share/Bookmark

No Comments

Firefox 3.5 Supports Word-Break Break-Word

Ever had a situation where you are dealing with long unbroken strings? For example, say you have to display user-entered web URLs. Sometimes the user will paste in a really long URL, and it keeps overflowing the container. You can make the parent container overflow: hidden but then it will crop the URL. A potentially better solution is to force the browser to introduce line-breaks mid-word.

This has always been difficult to achieve cross-browser until now. Unlike most cross-browser quirks, this was one where Interenet Explorer actually had it right. Since IE 5.5, you have been able to use word-wrap: break-word to cause this behavior. Now, finally, Firefox has caught on. As of version 3.5, Firefox now supports this CSS property as well.

Here is the recommended code to cause this behavior:

white-space: pre-wrap; /* css-3 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ and Firefox 3.5+ */

Source: UnBlog

  • Share/Bookmark

, ,

1 Comment

How to order by most recently updated in Rails

This is a simple one but sometimes hard to figure out for beginners in Rails. There are a number of ways to do it but this is one of the most simple. It includes actually doing a sql query inside your find method.

@posts = Post.find(:all, :o rder => 'updated_at DESC')

That’s it. I’m ordering by the updated_at column in the Posts table.

  • Share/Bookmark

No Comments

Tracking What’s Hot with Ruby Toolbox

Knowing what software is popular, current and updated regularly is a crucial aspect to developing successful websites. All developers benefit from being knowledgeable about what software is kept up to date but for Ruby on Rails developers this is doubly true. Enter Ruby Toolbox, a website tracking Rails plugin popularity on Github. Read the rest of this entry »

  • Share/Bookmark

, ,

No Comments

Website Checklist

As a web developer, whenever you take on new projects you’ll often find yourself doing the same tasks, over and over. I find it convenient to keep a checklist as a template that I use for new projects. Read the rest of this entry »

  • Share/Bookmark

No Comments

Setting Up a Windows Vista Development Environment

I recently purchased a new computer and was faced with the task of setting up a fresh installation of Windows Vista with all of the web development goodies I’ve come to know and love.

Here’s a walkthrough for what I did to get set up, starting from square one. This is literally everything I did and installed from when I was first able to access the desktop after a fresh install.

Read the rest of this entry »

  • Share/Bookmark

, ,

No Comments

jQuery normal text to seo urls in real time

This is a way to mindlessly type in text to receive it an url in seo-friendly format.

It is also a good lesson on how jQuery can instantly return text and the use of simple regex.

demo: Read the rest of this entry »

  • Share/Bookmark

No Comments

Making IE have more than one background per element

Thanks to IE being a crappy browser we can hack it to do actually some interesting things. One being more than one background per element. For instance, to a single unique <div> you can give it more than one background. We can do this by utilizing IE’s filters.
Here’s an example, You can see two pictures if you have IE: Read the rest of this entry »
  • Share/Bookmark

No Comments

Calling Any JS Lightbox from Flash using jQuery


Thanks to Flash’s ExternalInferface’s API you can call JavaScript or receive a callback from JavaScript using Flash. In this example I will show you how to call any Lightbox that is in JavaScript from Flash.
Because almost all prebuilt lightboxes get all the info they need from the <a> anchor we will dynamically create an <a> tag with all the necessary information.
Flash:
import flash.external.ExternalInterface;
button.addEventListener(MouseEvent.CLICK, external, false, 0, true);
function external(evt:MouseEvent):void {
 ExternalInterface.call("external", "lightbox/photos/image1.jpg");
}
JavaScript:
function external(path) { // pass in the correct path to the function so we only need one  for infinite amount of calls from  flash
// if the lightbox does not exist we will make it
 if ($('a#lightbox').length == 0) {
  $("body").append("");
  $('a#lightbox').lightBox();
// if it already exists but the path is different we will set the new path
 } else if ($('a#lightbox').attr("href") != path) {
  $('a#lightbox').attr("href", path);
 }
// now we will simulate the click here.
 $('a#lightbox').trigger("click");
}
View demo Here
  • Share/Bookmark

1 Comment

CSS Naming Convention Best Practices

When building components, it is important to follow a set of guidelines when naming your IDs and classes. This article will explore best practices in choosing CSS names.

Read the rest of this entry »

  • Share/Bookmark

, , ,

No Comments