Posts Tagged ‘snippet’

More free animated explosions on transparent backgrounds

Posted in Geekdom, Web Development on March 2nd, 2012 by Jarred – Comments Off on More free animated explosions on transparent backgrounds

I don’t really know why or how but for some reason the single post on my blog that has received the most traffic has been my post back in 7/11 titled “free Animated explosion on transparent background. This does seem a bit strange to me as it really is not all that relevant to the keywords I am trying to target with my blog. Nonetheless, I am currently working on another HTML5 game and have some additional animated explosion sprite sheets and am going to post there here as kind of an experiment to see what happens.  You can save them by right click – save image as.

explosion with transparent background

Free animated explosion

Free animated explosion small

Free animated explosion small

I did not draw these, I simply re-sized them and removed the background. They are saved in .png format and have a transparent background making them perfect for use as a sprite sheet in a game. You are free to use them in any way you see fit. I got the original files from

If you are looking for some more free animated sprite sheets I highly recommend you take a look around all the things Lostgarden has to offer. There are a lot of free to use pixel art animations including several other explosions. They do not however have transparent backgrounds so you will have to edit them out yourself.

JavaScript to Calculate the angle between two points in degrees

Posted in Geekdom, Programing, Web Development on February 19th, 2012 by Jarred – Comments Off on JavaScript to Calculate the angle between two points in degrees

Quick little snippet here for later reference (Yeah this one took me a bit to figure out).  The below function will return the angle between two points and return it in degrees from 0-360.



		function calcAngle(x1, x2, y1, y2)
		calcAngle = Math.atan2(x1-x2,y1-y2)*(180/Math.PI);	
		if(calcAngle < 0)	
		calcAngle = Math.abs(calcAngle);
		calcAngle = 360 - calcAngle;		
		return calcAngle;





Universal AJAX function

Posted in Geekdom, Programing, Web Development on February 13th, 2012 by Jarred – 1 Comment

Here is my universal AJAX function. I am posting it here for reference. Over the months I have adapted/revised this function and now have finally gotten it to do pretty much what I want it. I did not write all of this myself I pulled most of it off of somewhere, but I can not remember so I can not give proper credit. Let me know if you have any suggestions on how to improve it.


// ******************************************************
// Universal Ajax Function
// Useage Example:  universalAJAX('', "var1=true&var2=false", functionWhenDone, functionWhenWaiting, functionWhenFail);
// ******************************************************

function universalAJAX(URL, DataToSend, doneFunction, waitingFunction, errorFunction)

var json_http;
if (window.XMLHttpRequest)
{json_http=new XMLHttpRequest();}
{json_http=new ActiveXObject("Microsoft.XMLHTTP");}

   if (json_http.readyState==1)
  if (json_http.readyState==4 && json_http.status==200)
	if (json_http.status==200)
  json_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded")

  var timeOutVarCancel=setTimeout(errorFunction,10000);

Iterating through properties of a JavaScript Object with the “For In” loop

Posted in Geekdom, Programing, Web Development on January 16th, 2012 by Jarred – Comments Off on Iterating through properties of a JavaScript Object with the “For In” loop

As I have mentioned before I am a novice self taught programmer and I often come across little problems that take me quite a while to figure them out. I like to post them here so I can come back and remember how I solved the problem and also so hopefully others can benefit from my struggles. I came access one of these said problems this weekend trying to iterate through a object in JavaScript using a “for in” loop. I understood the looping mechanism quite well, however getting the syntax to work for me through me for a loop.


Incorrect (This is how I would assume it would work)

 for (var x in someObject.someProperty)

newVar = someObject.someProperty.x.anotherProperty;

This is how I got it to work

 for (var x in someObject.someProperty)

newVar = someObject.someProperty[x].anotherProperty;

You will notice you cant use .x to access the property the loop is currently processing,  you must use the [x] In truth I do not understand why this is so if anybody out there cares to enlighten me that would be appreciated. Either way hopefully this might save some frustration.

PHP code snippet to put mySQL query results into a 2 dimensional array

Posted in Geekdom, Programing, Web Development on December 16th, 2011 by Jarred – Comments Off on PHP code snippet to put mySQL query results into a 2 dimensional array

More often then not when I am are working with a mySQL database using PHP I want to put my results into a 2 dimensional array. A while back I found a snippet of code that very effectively does this. However, I am constantly digging through old projects trying to remember/find the piece the code that does this, So I figured I would post it here for reference. The code is only one line and will put the results of a mySQL query ($mySQLresults) into a 2 dimensional array.


while(($resultArray[] = @mysql_fetch_assoc($mySQLresults)) || array_pop($resultArray));





Free 2 Column Webpage Template with Sticky Footer

Posted in Programing, Web Development on November 25th, 2011 by Jarred – Comments Off on Free 2 Column Webpage Template with Sticky Footer

Here is my first installment for my recent “Do more, Write Less” initiative I started for myself. I find myself constantly rewriting the same basic building blocks for my webpages and figure its about time to create a template that I can reuse to save myself time. I will post my code snippits here to not only archive them for my own use but also provided them to my visitors for free to try and help attract more traffic to my blog.

This is a free template for a webpage with a two column layout with a header and footer. This layout is very common and is used widely on the web. The template is just a basic building block for a web page and can be customized to however you see fit. One of the trickier things I find myself having to figure out over and over again is the sticky footer. This has also been included in the template and should work in all browsers. I have also included the basic template for the CSS which should probably be pasted into an external style sheet for bigger sites.  This template is free to use in any way you like and can be used for personal, commercial, or any other type of project.  Let me know if you find anything that does not work. Right click on the link below to download the free template (You may have to view source and then copy/past the HTML into a new file if your browser will not download the HTML file).

Free Website Template 2 Columns with Sticky Footer




Do more – Write less

Posted in Geekdom, Web Development on November 21st, 2011 by Jarred – Comments Off on Do more – Write less

Something occurred to me today that is likely quite obvious to seasoned professionals but I really never gave it much thought. Over the past few years I have started numerous website projects. They usually are a significant undertaking and require lots of time to complete(seems like I rarely finish them). The thing I realized is that on each one I always start from scratch. When I have an idea to make a website I will create a brand new text document and start from building from there. I never save a template or code snippets to reuse. I have to reinvent the wheel every time and it is taking me a lot of time.

My Idea is that I need to start reusing some of my code and writing/developing it in such a way that my work can be useful for other projects. I think it may take a bit more effort initially to do this, however in the long run it could save me countless hours. I am positive that as soon as my current project is completed (hopefully I will finish it someday)I will just come up with yet another one to start. If I already have some of the building blocks ready to go this greatly increase the odds of me finishing and decrease the amount of time it will take. In the end I hope this will enhance my ability to monetize my various online efforts. I think the best place to archive some of these snippets is right here on my blog. I am almost positive that closely follows this blog yet, but if there is or when you do come (hopefully) you can expect to see some of my templates and code snippets coming. Best of all is I intend to release them all free to use for any reason.