category : JavaScript

localStorage Script Caching With basket.js

Downloading JavaScript files halts rendering and downloading of other files, and therefore can add significant amounts of time to your website’s downloading speed. Adding your scripts into your footer and using script loaders can help, but a new project is looking to make things even faster by caching in localStorage.

How to Build a Custom Carousel With jQuery and Roundabout

Sliders and Carousels are one of the coolest ways to display information on websites. They can contain tons of information in a smaller area, and the animation of automatic sliding and the large, beautiful images that are usually included draw the user’s attention. Well, I’ll show you how to set up an awesome carousel with jQuery and the Roundabout plugin.

1024 Bytes of JavaScript Power

Once again, JavaScript programmers all over the world are being called to show off their skills in a competition. What is the most amazing thing you can program in JavaScript? Here’s the catch, though: you can only use 1 kilobyte of JavaScript code.

3 Simple Things to Make Your jQuery Code Awesome

jQuery is one of the most popular (if not the most) JavaScript libraries in existence and a great number of people use it to do some amazing things. Personally, jQuery is what got me excited for learning JavaScript. The problem is that a lot of programmers don’t understand that with all that power massive amounts of CPU cycles are used. As much as jQuery engineers try to optimize jQuery, they are always limited in how fast they can make it go. There are a few things that you, as a user of jQuery, can do to make your jQuery code faster.

The Great Mystery of the Tilde(~)

When was the last time you typed in a tilde? Did you even know that little squiggle on the top left corner of your keyboard is called a tilde? More importantly to this blog, do you know what the tilde does in JavaScript? Probably not, but you’ll soon find out.

JavaScript Cookies: Yummy

Most of the time cookies are handled by the server using languages like PHP or Ruby, but there are times when using JavaScript to handle the cookies is the best option. Cookies are a strange beast in JavaScript and many developers don’t know how to use them. That’s all about to change!

JavaScript Mixins for Functional Inheritance

Mixins are a way to add the functionality of 1 or more objects to a new object, essentially creating a non-standard means of inheritance. This inheritance is also done functionally, which is the way JavaScript seems to like having things done. Basically all we’re doing is reusing functions without the need for the standard inheritance model.

JavaScript Design Patterns: Chain of Responsibility

We’ve made it to the final installment in the JavaScript Design Patterns series. That’s right, after this you’ll no longer have any clue what post will be coming out every Monday! Well today, we’ll be talking about the Chain of Responsibility Pattern. This pattern decouples the sender and receiver of a request. This is done with a chain of objects, each of which can handle the request itself or pass it on to the next object. Confused? Read on.

JavaScript Design Patterns: Command

The Command Pattern is a strange beast in the context of object-oriented programming. Unlike most objects, a command object represents a verb, rather than a noun. This is a little less odd in a language like JavaScript where functions are actually a type of object, but the classical sense of the Command pattern is still different than a function.

JavaScript Templating: Adding HTML the Right Way

If you’ve been using JavaScript for any semi-substantial amount of time, you’ve probably had to add some HTML to your page dynamically. If you haven’t then you’re missing out on some of the greatest power of JavaScript. There’s a problem though: It’s a pain in the buttocks to write HTML code inside a JavaScript string – especially when it’s a large amount of HTML and/or some of the tags have attributes – and adding in values from variables. It’s just a giant mess of quotes and plus signs.