Lil Josh

A tech blog about web development with PHP, MySQL, jQuery, CSS3 and various other programming languages. You will not find anything about ColdFusion, ASP.NET, C# on this blog.

AJAX made easy using jQuery

January 14, 2014

AJAX can seem daunting but it’s never been easier to implement with jQuery! So first, let me give my explanation of what AJAX is and can be used for. Imagine you have a piece of content you’d like to have updated every so often (e.g. an average number from a database), but you don’t want […]

Velocity Cheat Sheet

October 28, 2013

Decided to make a velocity cheat sheet/quick start guide. Hopefully this is useful for anyone just starting out and also a good reference for experienced velocity developers. If I missed anything feel free to let me know. ## This line is a comment ## The next line is a variable assignment #set($foo = "hello world") […]

Swapping variables in PHP

I’ve created a short and sweet PHP function swap() to exchange/swap the values of two PHP variables. Here it is in action: <?php $cat = "cat"; $dog = "dog"; swap($cat,$dog); echo "$cat goes meow and $dog goes woof"; //dog goes meow and cat goes woof function swap(&$var1, &$var2) { $tmp = $var1; $var1 = $var2; […]

Matrix like background

October 17, 2013

<div id="background"></div> <script> var int=self.setInterval(function(){updateBackground()},100); function updateBackground() { var content = ""; for(var i=0;i<2048;i++){ content += Math.round(Math.random()).toString(); } $("#background").text(content); } </script> <style> #background { background: black; color: #0F0; width:100%; word-wrap:break-word; } </style>