While trying to use the HTML5 web audio API with a music visualizer for three.js, I ran into a number of problems based on the documentation and examples I could find. Even though many of the demos are only a couple years old, many did not work or did not approach the problem using an embedded <audio> tag. In this post, we are going to look at getting audio data as FFT directly from an embedded <audio> tag using the web...
Read MoreIn this post, we will take a look at using a slightly non-traditional way of using a for loop to recursively loop through an object as a list. (I’m not referring to a for ... in loop.) The intent is to change the way you look at using a loop so that you can see it is more versatile than just looping until you hit the end of an array. Obligatory Context In arrays, we know that there will be a numeric index, and it is simple...
Read MoreI’ve often read on Stack Overflow and other programming places that solving problems with recursion creates more readable code at the usually acceptable cost of a slightly higher overhead for processing. While I think that it is more of a personal preference in terms of readability, learning how to think recursively is a valuable skill for a programmer. In this post, we will look at how to approach the idea of recursion by...
Read MoreArguments Pseudo Array The array-like arguments object is automatically made available to you in every function. This is true whether you have defined any arguments when declaring the function or not. The arguments object contains a list of all the arguments you have passed in to the current function. Consider the following: var func = function(){ console.log(arguments); }; func("these", "are", "multiple", "arguments"); // Will log...
Read MoreIn the last post, we discussed using this in JavaScript and how it might not refer to what you want or expect it to. In this post we will look at using .bind() to force JavaScript do your bidding when it comes to using the this that you want it to. Create a Method In simple terms, .bind() sets the context for this based on what you pass in as a parameter. Remember that this essentially functions as an argument in the function in which...
Read MoreThe keyword this is a common convention in object oriented programming languages. Its purpose is to perform actions or create properties on the specific instance of the class or object that is being worked with. We will look at the unpredictable and confusing effects of using this in JavaScript, and the steps to take to know exactly what this refers to in any given situation. In many cases, this does not refer to what your initial...
Read MoreDuring a short, one-hour Hackathon, our Hackathon ringleader was riffing on how much of a pain CSS can be. He said something about some interview questions at Apple, where they ask you to do crazy stuff, like make an American flag out with CSS. And if you can do that you are, and I quote, a “#B4D455”. So, feeling rather confident in my CSS chops, I thought I would give it a shot to see how fast I could crank it out. And as...
Read MoreSince this blog is at the moment somewhat new, it seems fitting to talk about creating new things. This post will be about the difference between using the new keyword and Object.create() in JavaScript. Using new and using Object.create() are both similar, in that they allow you to extend the properties of one object with another. For example, you might want to make some friends. Not in the illusory Facebook sort of way, but real...
Read MoreI’ve been building sites with WordPress since around October of 2007. Since that time, I have used WordPress for creating sites for small businesses, lead capture pages, marketing funnels, product launches, how-tos, aggregators, memberships, e-commerce, and as a front end for a VOD and live streaming platform. Rarely, however, have I used it for its initial intended purpose: blogging. Rather than agonizing over creating my own...
Read More