Randomsnippets - randomsnippets.com - Random Snippets

Latest News:

How to hide or show content based on links or urls via JavaScript/jQuery 10 Oct 2011 | 01:56 pm

I have been receiving many requests for a tutorial that shows how to hide or show content based on links or options that a user picks and reflected on a different page so here it is =) You can see th...

How to dynamically remove elements from the DOM via jQuery 22 Aug 2011 | 02:47 pm

jQuery is an awesome JavaScript library that can do some very heavy lifting in very small amounts of code. Take the example below where we are simply removing a div element from the DOM. Demo Remove...

JavaScript Date Ranges/Calculations with Datejs 30 Jul 2011 | 09:18 pm

If there is anything I hate more than the smell of durian, it is having to deal with date range calculations in JavaScript. Luckily though, we have the Datejs JavaScript Date Library to prevent us fro...

How to hide, show, or toggle your div with jQuery 11 Apr 2011 | 04:58 pm

Hiding and showing content is MUCH easier with the magic of jQuery. Here is a simple demo of the jQuery .toggle() function. Demo Toggle Button The content in this div will hide and show (toggle) wh...

Parsing XML data from hostip.info API service with PHP 3 Feb 2011 | 09:35 pm

If you ended up here, then you most likely experienced what I did in trying to figure out how to parse the XML data from the hostip.info web API service. Basically, it is down to the namespaces that ...

Groupon – Commission Junction (CJ) WordPress Widget Plugin that Displays Local Deals 16 Jan 2011 | 06:33 am

I have developed a Groupon -Commission Junction (CJ) WordPress Widget Plugin that automatically displays the local deals for the visitor. It allows you to plugin your Commission Junction (CJ) PID acco...

Sorting 2D associative arrays in PHP 14 Jul 2009 | 06:18 pm

Surprisingly, it took me a long time to find this solution so I decided to post it for anyone who had a situation similar to mine. Let’s say you have the following 2D associative array in PHP of frui...

Dynamic or on-the-fly percentage calculations with JavaScript 13 Jul 2009 | 09:34 am

Here is a simple JavaScript function that does dynamic or on-the-fly percentage calculations. Demo MSRP (in dollars) Sale Price (in dollars) You have saved 50 % The savings percentage will change...

The dangers of embedding the notorious “void(0)” JavaScript code in the href attribute of the “a” tag 9 Apr 2009 | 04:50 pm

I recent ran into an interesting IE bug involving the following bit of html code: I honestly did not write this one but I will leave names out of this to protect the innocent =) The void(0) JavaScri...

How to randomly order or select rows in a MySQL query 29 Oct 2008 | 05:04 pm

I was looking for a way to order the rows randomly in a MySQL query and the solution was not easy for me to come by. I am posting the solution here in hopes of helping others. RAND() returns a random...

Recently parsed news:

Recent searches: