a blog by Christian Snodgrass
about programming, web and game design, and everything else

Javascript

Keep It Sorted: Binary Search Sort

In a previous article, I discussed binary searching and mentioned that you could modify the function a bit to get the index of where to put the value to keep it sorted. This eliminates the need to sort it on demand and lose all the performance gains of the binary search. The Binary Search Sort [...]

June 19th, 2011 | No Comments | In Flash/ActionScript 3, Javascript, PHP

Classics to Remember: Binary Search

If you went to school for programming, you’ve likely seen the binary search algorithm. If you’re self taught, as many great programmers are, you may not have come across it before. What is the Binary Search Algorithm? The binary search algorithm is an algorithm which searches through a collection of sorted values. It does so [...]

June 17th, 2011 | No Comments | In Flash/ActionScript 3, Javascript, PHP

Quick Tip: Adding Commas to Numbers

A common problem that you may run into when you want to output a number is to add commas. It’s much easier to understand 1,000,000 than it is to read 1000000. I haven’t done this in a while so I did a quick search to see what others were doing to tackle this problem. A [...]

June 15th, 2011 | No Comments | In Flash/ActionScript 3, Javascript, PHP

Padding String in Javascript

Yesterday when I was working on a little Javascript for showing all unicode characters yesterday, I needed a way to pad the string. I did a bit of research and came across a very interesting and handy approach. The Typical Approach The typical approach is pretty simple. You create a loop and just add whatever [...]

June 14th, 2011 | No Comments | In Javascript

Back to Top