Programming

Full Browser Support for localStorage without Cookies

A while back I posted a script that used cookies to simulate the localStorage interface for the HTML5 spec. While building simpleCart(js) v3, I revisited this script with the hopes achieving the same goal without using cookies. For the impatient, the 1.2kb script can be found on github.

(more…)

SimpleCart(js) V3 Beta

We are proud to announce that simpleCart(js) version 3 is ready for beta testing! We have learned a lot about what our users need and want over the past 3 years, and version 3 is a huge improvement that we hope you are going to love.

(more…)

April Fool’s Floating Text Script

This year’s javascript trick involves taking individual words on your page and let them float or creep away.  Every time the user does not move their mouse for 5 seconds (you can change this interval), the words will start to creep.  Once they move their mouse again, the words will return to their original spot. (more…)

Simulating HTML5 Local Storage Support

I have been wanting to use HTML5′s local storage for a while, but I haven’t had a project where I can just ignore the older browsers.  So I put together a little ( <1Kb gzipped ) script that checks for HTML5′s local storage API, and simulates the method for browsers that do not support it. For those browsers, the script implements a nearly identical interface to localStorage for persistent storage of name/value pairs, except it uses cookies.  For the impatient types, you can see the repo at github or download the script(more…)

simpleCart(js) Version 2.0 Released!

We are happy to announce the release of simpleCart(js) version 2.0 today.  We have been working hard to add several features that you all have requested, and we’re excited to get this script in your hands.  There are several new features, including GoogleCheckout, easy currency settings, tax, shipping, and a new method for adding items to your cart that requires no javascript, and allows for different inputs and options. There is also a brand new site to go along with this update: simplecartjs.com .  Please take a minute to check out all the new features, documentation, and demo.  Thanks to all those who have been helping test for the past few weeks, we couldn’t have released this new version without your help. (more…)

Javascript Number.toCurrency()

While working on simpleCart(js) 2.0 and a few shopping carts for clients, I found myself writing several helper functions for formatting strings and numbers.  One of the most useful helpers was a toCurrency() method for numbers:

var myNumber = 8.3;

alert( myNumber.toCurrency() );   //alerts "$8.30"

myNumber = 119427.23529;

alert( myNumber.toCurrency() );    //alerts "$119,427.24"

myNumber = 1231;

alert( myNumber.toCurrency( "€" ) );   //alerts "€1,231.00"

The dollar sign is default, but you can replace it with any symbol in the function call.

Just copy this code to your js file and enjoy! (This code also implements a reverse() method for strings that you might find useful.)

String.prototype.reverse=function(){
    return this.split("").reverse().join("");
}
Number.prototype.withCommas=function(){
    var x=6,y=parseFloat(this).toFixed(2).toString().reverse();
    while(x&lt;y.length){y=y.substring(0,x)+","+y.substring(x);x+=4;}
    return y.reverse();
}
Number.prototype.toCurrency=function(){
    return(arguments[0]?arguments[0]:"$")+this.withCommas();
}

Simple Pagination with Rails

While I was developing Motionspire, I needed to implement a pagination system for the video content.  I looked through the existing plugins, but found that I really desired something extremely simple and custom to work within my search controller.  With only a few lines of code, I created a very basic system for managing pagination that can be ported to other sites with ease. (more…)

Twetris: twitter + tetris

We developed a little creation called Twetris that uses the twitter timeline to create blocks for a tetris game. The high score list is published automatically to @twetris and you can even retweet your high scores right from the game. It's a simple javascript/html/css creation thats great for wasting time.
Check it out!

(more…)

April Fools ‘flip text’ Script

Over breakfast this morning, I put together a little JS script that will flip all the text on a page.  Just put this link AT THE BOTTOM of your page, and it should provide a little April Fools joke for some visitors:

</p>
<p>&lt;script type=&quot;text/javascript&quot; src=&quot;http://wojodesign.com/flipEm.js&quot; &gt;&lt;/script&gt;</p>
<p>

**Make sure to test this on your site, some flash objects or other plugins may not work properly

Enjoy!

Developing vs Programming

I'm a mediocre programmer, at best.

When I'm programming, I need 8 different tabs open with every reference site I can get for a particular language.  I google function names constantly, most of my debugging time is spent with dumb syntax errors, and I'm never going to be able to use Regular Expressions off the top of my head.

So what can mediocre programmers like myself do? Develop. I'm going to go over a few tips for good application development, and how to use development methods that can improve your programming, even if you lack superstar skills.

(more…)