Jun. 19, 2010 at 12:22pmUnderscore Trick

JavaScript Callbacks with Arguments

I had an idea today while coding something for a personal project. Sometimes in JavaScript, you need to pass arguments to a function that you want to use as a callback. Imagine passing a callback to a click event where you want a state variable included. Well, you'd need to create a callback wrapper, until now. Read more →

May. 28, 2010 at 10:00amSizzle (jQuery) Selector Pitfalls

It's so easy, but so slow!

The slowest thing you can do in JavaScript is touch the DOM. The most common slowdowns are caused by finding and manipulating elements. This is because of how everything in the DOM relates to each other and what the browser has to do to maintain the element tree. But without the DOM, JavaScript on the web would be useless. So it has become a necessary evil. Frameworks, such as jQuery, have made the problem much easier, but hides a great deal of the performance hits that are caused by DOM access. This blog entry will go through some common slow coding practices and show how to use better selectors to speed up your JavaScript. Read more →

Apr. 29, 2010 at 10:30amjQuery and Cufon Don't Mix!

IE7+8 Bugs with VML break Sizzle

When using Sizzle (the selector engine in jQuery 1.3+, Prototype 1.7+, dojo, and others) and Cufon together, you need to make sure that your selectors are excluding Cufon elements. Internet Explorer 7 and Internet Explorer 8 both have a bug that cause Sizzle to break for some selectors with VML elements. I'll describe the problem, and some simple fixes, after the break. Read more →

Apr. 16, 2010 at 4:35pmMan Scroll Bookmarklet

Another Friday Fun Bookmarklet

Happy Friday! For all you Unix lovers out there, we have a treat. Do you miss the days of "more" and "man"? Do you often miss the pleasure of knowing right where you are at in a document? Introducing the Man Scroll bookmarklet!

Read more →

Apr. 9, 2010 at 12:14amMobile Safari Keyboard Selection

Choosing the keyboard for your user

While running through my morning blogs, I came across one by Jon Snook on HTML5 Form Elements. He talks about some interesting, future-looking elements that will hopefully be in the browser of tomorrow. But the part I found most interesting was talking about Mobile Safari and how it handles input elements. Read more →

Apr. 7, 2010 at 10:00am$.delegate() and you

What jQuery delegate does and why you care

jQuery 1.4.2 added a set of new functions: $.delegate() and $.undelegate(). $.delegate() is a hybrid between $.bind() and $.live(). Here is an example of how the three functions differ, and how to implement $.delegate() in existing code.
Read more →

Apr. 1, 2010 at 10:50amHow's Your Website Look Naked?

Bookmarklet to Reveal All!

You have a beautiful website. You have filled it with love and content. You know your website better then anyone else. But have you ever seen your website naked?

Read more →

Feb. 16, 2010 at 12:30pmFunction Caching in PHP

Using static variable as a function's cache

Web apps become notoriously slow when running database queries. Often times we find ourselves writing a useful look up as a function, and then forget that it requires a query each time. This is where caching comes in. And PHP has a really clean way to do it.
Read more →

Jan. 13, 2010 at 1:28pmSVN Files Since Revision

Need List of File Since a Revision

An SVN command that gives a list of modified files between revisions. It is very useful when uploading files to a live server and when running through quality assurance. Another command to keep in your bag of tricks.
Read more →

Nov. 10, 2009 at 11:02amHiding Behind a Maintenance Wall

Using .htaccess and Cookies to manage a maintenance page

A common task in web development is updating a live server. There are many ways to do it, but some of them require downtime. Rather then turn users away, it is best practice to put up a maintenance page. But what if you still need access to the site while you are updating it? .htaccess and Cookies to the rescue!
Read more →

Oct. 9, 2009 at 9:06amPHP String Concat vs Array Implode

Which is faster? Does it matter?

When creating large strings a programming axiom has been to create an array, then join all it's pieces together at once. It is suggested this is better for memory and for speed. PHP, however, is optimized for string manipulation. Does this change the axiom? Read on and find out!
Read more →

Jul. 28, 2009 at 9:11amPHP getCaller?

How to get the calling function in PHP

PHP has great debugging functions. By wrapping one we can find out who the caller of a function is. This blog entry gives a code snippet that returns the name of the function who called the current function by looking at the debug of the stack.

Read more →

Jul. 23, 2009 at 9:38amjQuery 1.3 Closest Function

A quick look at an awesome function

The jQuery function $.closest() is a particularly handy function when doing DOM manipulation. I'll discuss it's power along with an example of it's use.

Read more →

Jul. 21, 2009 at 10:36amjQuery UI Live

Make jQuery UI Widgets Attach Dynamically

jQuery has some awesome widgets, but all of them need to be attached after an element is added to the page. With some quick changes, your widget can be added dynamically to any element using $.live(). Read more →

Jun. 30, 2009 at 9:13amFirefox 3.5 and PHP 5.3 Released

Dyslexic Developers Cry Shenanigans

Firefox 3.5 and PHP 5.3 were released today, making a challenge for our lysdextic developers. Read more →

Jun. 20, 2009 at 8:45amLESS is More

Leaner CSS with LESS

A new module for Ruby was recently released which shows a promise for what CSS could be. It expands on the ideas every developer has  Read more →

May. 26, 2009 at 10:44amThings that were cool when IE6 was released

2001 was the year of the snake. People born in the year of the Snake are romantic and deep-thinking, wise and charming, although they tend to dismiss others too quickly and are a bit stingy with money. Ideal jobs for them include teaching or psychiatry. In this entry, we take a quick look at what was cool back in the year of the Snake, 2001.

Read more →

May. 8, 2009 at 12:41pmjQuery Caching Convention

A Way To Name Your jQuery Objects

This blog entry shows you how to cache a jQuery object into a variable for future use. I present a naming convention that I have been using that visually separates jQuery objects from other JavaScript variables. Read more →

Apr. 27, 2009 at 6:35pmPercentage Width Margin Table IE Bug

Do I win the prize for longest title?

Internet Explorer has its share of bad bugs. IE6 in particular is well known for it laundry list of CSS bugs. While troubleshooting some code for a newsletter I discovered a rather bizarre one. After testing, I found that it affects everything from IE6 to the recently released IE8. It is mostly just for fun because the chances of running into it are pretty slim. Read more →

Apr. 10, 2009 at 1:23pmHow to Center a Div

Finally, a pure CSS solution!

Centering a div horizontally and vertically has always been a pain for CSS. Not any more! With this trick, you can create a centered block in no time.

Read more →

Apr. 2, 2009 at 12:39pmThe Multiple Interval JavaScript Problem

The Phantom Menace

Using intervals in JavaScript for pausing/unpausing events can sometimes cause a phantom interval which you can't control. Learn how to stop that phantom in it's tracks with one line of code. Read more →

Mar. 11, 2009 at 12:59pmjQuery.live()

A new way to setup events

jQuery 1.3 has added support for live events, and it makes developing a breeze. Before, you'd have to wait until the page is completely loaded to add events to elements. And if you added new elements to the page, they would need special attention to have events added. Not anymore! Read more →

Jan. 22, 2009 at 11:21amGiving Actions to Classes

Actions without JavaScript!

A concept of how to define actions using classes. Best part is, there's no need to know JavaScript!

Read more →

Jan. 19, 2009 at 2:35pmStyling Inputs is Hard

jQuery to the rescue!

Internet Explorer 6 is just too old to support all the fun CSS tricks of the modern web. The Input Type selector is one of the most problematic. I suggest a quick jQuery function to get around this.

Read more →

Oct. 27, 2008 at 12:01pmHow to use jQuery in a Prototype world

jQuery Namespace Workarounds

Prototype and jQuery conflict over the $ function. In the entry, I will show you how you can start to include jQuery code in the an environment that is already Prototype heavy.  Read more →

Oct. 10, 2008 at 10:43amGoto Code in PHP

It's not as bad as you'd think

Sometimes, you just need a way to GOTO. Here is a little trick that will duck out of a section of code using break

Read more →

Sep. 25, 2008 at 4:43pmJSCommandlet Released

JavaScript Development Made Easier

We're happy to announce a new bookmarklet called JSCommandlet. It is a JavaScript console developed for use within SiteCrafting. If you do any kind of JavaScript development, especially working with Internet Explorer, JSCommandlet is for you.

Read more →

Aug. 15, 2008 at 11:24amWindow.Name experiment

Does anyone use it yet?

I am starting an experiment to see whether the recent blog chatter about window.name is actually being used. Included is some JavaScript that you can put in GreaseMonkey to help me in my search. Read more →

Jul. 22, 2008 at 4:41pmOnload Collisions and How to Fix them

Harry Potter and the Onload Collisions

There is no other variable more fought over then the coveted window.onload. Its job is to run a function after a page has been loaded. The problem is that there is only one variable, and therefore only one function can run. Once you have set this you would think you are in the clear. That is until another script comes in and overwrites onload.

But all can be made well in JavaScript land once one of four choices is made. I give four ways to get around this problem, and suggest a way for modern browsers to be rid of this problem once and for all.
Read more →

Jun. 30, 2008 at 8:00amFaux Paw in the Footer

Why do we put a copyright in the footer? Why not a publish date?

In web design we commonly put footers in the bottom of the page which include links, legal information, and usually a copyright date. But why? And is there something else we should include?
Read on and I promise not to use any more bad puns.

Read more →

Jan. 4, 2008 at 3:21pmAnonymous Recursion with JavaScript

A new way of solving an old problem

A nice feature of JavaScript is that functions are objects. As such, they do not need a name if they are used right away. But what if you need a short anonymous recursive function? arguments.callee becomes your new best friend.

Read more →