EC2 Instance with Ubuntu, Node, Nginx and MongoDB

The future is here. Tis Javascript ladies and gents. I got into it after my teach Jones started showing my how capable it is. It fits the bill for all things modern including scalable performance from a high powered database, web sockets, and serverside javascript in the form of NodeJS. Let’s get it all set up! Follow the tutorial here: http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/

Add Closure to your SetTimeout

Had a quick problem with getting my setTimout() function to run. I will usually run the function like w3schools recommends: function hello () { alert(“Hello World”); } setTimeout(“hello”, 5000); However, I couldn’t get it to run with a jQuery .get script inside the function. However, when I tried an alternate syntax called “closure”: setTimeout(function () { alert(“Hello World”); }, 5000);

Everyday git commands

After updating or creating a file: You’v created a file and want to update the repo. git add filename.txt Then commit the change: git commit -m “This is a message you can post with the commit” Now git knows that you want this change to update the git repo, but it still hasn’t pushed the change to git yet. It’s

Timellax Theme for WordPress

I started a new timeline theme for wordpress called “Timellax.” It’s just a parallax based theme that allows a user to post to a timeline easily. It allows users to create text posts, image posts, image posts with text tooltips and adjust their posts based on “year.” You can check out the original site from which the theme was based

Adding Effects to your Images with Canvas

You can add various effects to your images by placing them in a canvas element and adjusting the image pixel by pixel. I cam up with a couple different patterns simply by altering the opacity of the image in different places. First off there is a great tutorial over here, if you are new to the canvas element. I’ll recap:

HTML5 Video doesn’t work in Firefox

If you ever run into a problem where your html5 video doesn’t work in Firefox but works in Chrome when loading the video from Amazon S3, make sure you are sending the correct MIME types in your headers. I just ran into this issue so I thought I’d post it… Often times Amazon just slaps an “application/octet-stream” mime type onto

Converting MP4 to OGV on Mac

UPDATE: As of May 13th, 2012 I use something “MiroConverter” to do this for me. It’s has an easy to use GUI and ends up using FFMpeg anyway… Get MiroConverter. I use something called ffmpeg2theora. It works like a charm, the only downside is there is no GUI, so you have to do everything from the command line. However, as

Javscript Browser Detection

For all those interested, W3schools has a simple yet great script for javascript browser/client detection. It goes something like this: <script type=”text/javascript”> txt = “<p>Browser CodeName: ” + navigator.appCodeName + “</p>”; txt+= “<p>Browser Name: ” + navigator.appName + “</p>”; txt+= “<p>Browser Version: ” + navigator.appVersion + “</p>”; txt+= “<p>Cookies Enabled: ” + navigator.cookieEnabled + “</p>”; txt+= “<p>Platform: ” + navigator.platform

Grab the real width of elements with jQuery

This one took me about an hour to figure out so here goes… Explanation… Images don’t load into jQuery’s $(document).ready() function so you have to wait for the window to load. Then jQuery can get the image dimensions. Wrong… $(document).ready(function() { var imageWidth = $(“#image”).width(); }); Right… $(window).load(function() { var imageWidth = $(“#image”).width(); }); The difference is jQuery executing before

Using Inner Join and Where Clause

Often times when setting up database tables it’s easy to organize the same foreign key names in different tables. It’s even harder to maintain discipline in your MySQL calls by specifying the table name before the field name. I spent about 30 minutes trying to sort this out the other day and it turned out to be a simple mistake.