If you’re an avid user of ThreeJS you have more than likely at some point run into the situation where you need to either create a texture from scratch for the point of coloring it, or have had the need to update/draw on a texture for one reason or another. The following will walk you […]
Tag: javascript
I consider myself an avid speed cuber. Not world class, but fast enough and not too obsessed with it. That being said all the sites I’ve seen in the past with references to algorithms all seem to use really clunky client side Java or Flash plugins to handle the demonstration of moves. I wanted to […]
D3 and jQuery utilize distinctly different approaches to node manipulation and internal array storage. However, there are mechanisms available for converting between D3 and jQuery, and vice versa. D3 and jQuery Internals Let’s assume the following HTML structure: [codesyntax lang=”html4strict”] <div class=”test-node”>Test One</div> <div class=”test-node”>Test Two</div> <div class=”test-node”>Test Three</div> <div class=”test-node”>Test Four</div> [/codesyntax] Now let’s […]
If you’re a solid user of jQuery or just a tinkerer you may have thought to yourself “I have a great idea for a jQuery plugin”. Your next steps of course would probably be to look at the jQuery documentation and eventually to have a look at someone else’s jQuery plugin source code. In doing […]
You may or may not have heard the new buzz about promises being introduced into JavaScript and if you don’t know what they are, you’re not alone. I’ll attempt to explain what they are and why you should or maybe shouldn’t care about them. First let’s understand what promises are. Promise defined: “The Promise interface represents a […]
Implementing drag and drop in D3 (http://d3js.org/) is a pretty simple task when you know how to do it, the following is a walkthrough from setup to execution and the events along the way. First thing we are going to want to do is setup our drag behavior. This is the object that will be […]
Foreword The following highlights what I believe to be the best tools for web development and best of all, they’re all free. This is a living reference which will be updated as new and better tools are found. Feedback and suggestions are always welcome. The List Google Chrome Light, extremely fast, jam packed with features […]
Forword The following javascript examples and notation demonstrate a few alternatives to well known methods for common tasks. Advanced Notation Tilde Operator The tilde operator “~” literally equates to “-(n+1)”. For example: [codesyntax lang=”javascript”] var a = ~1; //returns -2 var myString = “hello world”; ~myString.indexOf(“hello”); //returns true [/codesyntax] Large Denary Numbers Large denary numbers […]
Foreword The following is a quick crash course in using jQuery. If you’ve never used jQuery before and want to know to how without reading a ton, this is the tutorial for you. Getting Started First download the latest version and include it in a page. Grab the minified version for speed or if you […]
For this example of a Command pattern, we will create a simple “Interpreter” object and a basic “Command” object and demonstrate their respective use. Let’s first start with the “Interpreter”: [codesyntax lang=”javascript”] var Interpreter = { execute: function(command){ //split on the space var commandArray = command.split(” “); try{ //use first entry as command name var […]