How to Get the Name of an Instance of a Class in Javascript

I was using JSONP (note that I prefer CORS but this was a special case where CORS wasn’t possible) and wanted an object that needed to call a method within itself. As you know, JSONP involves adding a script tag to the DOM which will return the JSON data encapsulated …

Asterisk PBX, Google Voice and an Old Buffalo TeraStation NAS

Compiling Asterisk came to be a little bit of a bother. The main issue is that you’re dealing with a fairly old NAS so some of the shared libraries may not be compatible.  I had an old Buffalo TeraStation (Model #HD-H0.6TGL/R5) laying around that I was trying to figure out …

How to Wrap an Element Within a New Element Using Javascript

Here’s a simple way of wrapping an HTML fragment that exists in the DOM within another element, in this case a div: var wrapper = document.createElement(‘div’); wrapper.id = ‘the-wrapper’; wrapper.appendChild(document.querySelector(‘#the-html-fragment’)); At this point, the HTML fragment that was selected via the #the-html-fragment selector was removed from the DOM and attached …