ES6 Depth-first object (tree) search

A co-worker recently asked about searching for properties in a JavaScript object, where the properties could be located in unspecified locations within the object (not nested though). This was the job for a depth-first tree search! I don’t get to post about more traditional computer science topics very frequently, so I thought I’d share my […]

Front-end Series: JavaScript debugging tips and tricks

Note: many of these tips are written with Chrome in mind, but are applicable to any modern browser with developer tools. Understand what is happening in your code Set and use Breakpoints Use the Console api De-minify Modify scripts locally Use a Unit-Testing framework 1. Understand what is happening in your code A prerequisite to […]

Creating your own JavaScript Library – part 2 – Event Handling

In Part 1 of Creating your own JavaScript library, we cover the library essentials: library design, creating a solid object constructor, and adding functions by extending the object prototype. This post focuses on extending our basic library with event handling. Out of the box event handling can be accessed  through Javascript and DOM apis, shown […]

Custom events system in JavaScript – LightEvents.js

Needing an event subscription and publishing system for a HTML5/canvas game I’m creating, I wrote a very light event system. Anything than can call JavaScript (link, button, etc) can raise an event: LightEvents.publishEvent('event name', data); Subscribing to events is equally easy:

Here is the LightEvents object, demo is embedded below

JS Bin

Quick and reliable ad-rotator

In the course of my work, I’ve created and refined a simple ad rotator. It is built in JavaScript, and does not rely on any library, like jQuery, to function.  In my experience, it defeats ad-block, and loads easily on all mobile, tablet, and desktop browsers. The rotator can be included multiple places on one […]

asp.net – getting user confirmation before a postback

In asp.net web applications, it is common to have dozens — if not hundreds — of user controls that perform postbacks to the server, actions initiated by a user such as a button click. Often before a save, delete, or other critical action is performed, it is desirable to ask the user if they are […]

Full-adders, 32-bit adders in JavaScript

Fascinated by a lecture as part of my CS degree pursuits (there is light at the end of the tunnel!), I  decided to build some digital circuitry beginning with logic gates and ending with a full 32-bit adder. LIVE DEMO So here’s my question: I’ve got a 32-bit adder… What now? Beginning with basic AND, and OR functions, (&& […]

Convert <address> tag to Google Maps embed automatically with jQuery

Converting an <address> tag into a Google maps link is something I’ve written about in the past, but user “Moose” was wondering if you can do the same thing, but transform it into an embedded map. Quick answer: Yes! Using jQuery, we search the document for <address> tags,  create some HTML to embed the map […]

100% height using jQuery

2016 Edit: This post is really out-dated. If you are looking for a solution for 100% height divs, please use modern css as described here http://www.mikedoesweb.com/2016/modern-100-percent-height-css/ I few years ago, I wrote a post about forcing two divs to be equal height — quite a feat if you’ve ever tried!  Since then, a great jQuery […]

Javascript Game Programming

(0/0 fps) Game play Press [Enter] start Use [Left] and [Right] arrows Press [Space] to fire missiles Game information Programmed using JavaScript, the melonJs game library, and the Tiled map editor. Source files: Game init/resources In game entities/logic