JavaScript callback simple example

July 21st, 2015 by

I was trying to show a functional example of an as-simple-as-possible JavaScript callback recently to a colleague, and this was it:

 /* callback function setup */
 function one( callback ){
 setTimeout( function(){
 // pretend this is making an ajax request or something that takes longer than "two" would take to execute
 console.log( '"one" has completed' );
 }, 2000 );

function two(){
 console.log( '`two` comes after `one` because it is the callback' );

/* now we make use of the callback */
 one( function(){
 // "one" triggers "two" as soon as it is done, note how "two" is a parameter

Certainly a callback’s functionality goes far further than that (such as with everything you see in jQuery and Node.js for instance), but I’m hoping this easy-to-read example helps someone wrapping their head around the concept.

All URLs now redirect to

June 21st, 2015 by

All entries to should now point to a respective URL.

Teravoxel is a cool name and all (really I like it… I’ve been sitting on that domain and using it for a long time), but I felt like taking things in a more professional direction, and maybe actually finishing this site.

For those looking at it, the design of this webpage is a few years old now. Its a custom WordPress theme developed as a means of practicing WordPress development, on which I was doing quite a bit of at work at the time. It is a little dated looking now in my opinion, but my primary focus is outside my personal website.

My favorite resources for non-Computer-Science majors learning the craft

January 23rd, 2015 by

I’d like to compile my short-list of good learning resources for those who did not major in Computer Science, but are developers that have moved beyond “beginner” stage (meaning you’re looking for something more complex than Codecademy). In my case, I write Java code, and see that it compiles, but I’d like to further understand what actually happens inside the JVM once “run” is clicked in an IDE.

There are a some threads on Quora about this, but many seem to result in a list of 100 books and online courses being posted. Don’t get me wrong — theres lots of fantastic information, but I think it can be distilled a little bit more.

First, start with How to Count (Programming for Mere Mortals Book 1) at the Kindle store for $3. It is a quick, and fairly easy read on bits vs bytes. Limited programming knowledge required, just helps you understand memory.

If you have a solid understanding of object-oriented programming concepts, I’d look at these no-cost ebooks:

There are other resources of course, but those are my top choices.

Guide to posting Gravity Forms submission to third party and capture response cookie

May 30th, 2014 by

Gravity Forms for WordPress allows form submissions to be posted to a third party, but what if you need the form submission to that 3rd party to also place a cookie on the browser submitting the form? This is a problem with these generic “insert URL to post data to” solutions — oftentimes a form submission is more than just POSTing data, and involves some sort of tracking or authentication.

I wrote something to make this work in PHP version 5+ (requires cURL library, though that is pretty much standard now). All you need is for your external form resource (which you are posting data to).

This guide assumes the URL you are posting to will respond with a set-cookie inside the response header.

Step 1:

Get your external URL you want to accept POSTs from. This URL should also respond with a cookie (via set-cookie in the response header).

Step 2:

In your WordPress admin interface, navigate to the editor for your Gravity Forms and note the field IDs.

Step 3:

Next you will want to paste the following code into a valid spot of your theme’s functions.php file:

Class to implement:

“Warning: Cannot modify header information – headers already sent by …” error

August 13th, 2013 by

Just saw a scary error when I attempted to load the wordpress login page, and saw no username/pass available.:

"Warning: Cannot modify header information - headers already sent by ..."

The fix is to open up functions.php and remove any empty spaces (un-needed line breaks) at the bottom of the file and save.

Fix for redirection

May 16th, 2013 by

For some reason all of Google’s documention on how to change your Google Mail Exchange (Sync) settings say to visit if you want to change your sync settings. You’ll notice this will redirect you to their general help site, which doesn’t provide any helpful settings.

The correct place to go is

This took me a little while to figure out, so there ya go…

CSS3 border-radius property support in popular mail clients

May 11th, 2013 by

There is a lot of incorrect documentation floating around about this. Here is the status of border-radius property support as of today.

Note: This includes all the vendor prefixes as well.

Gmail: Yes (Elsewhere you will see documentation denying this. Perhaps Google changed this recently?) Yes
Outlook for Mac: Yes
Apple Mail (Mac and iOS): Yes
Yahoo web mail: No
Outlook for Windows (all versions): No

In non-supported clients, your rounded rectangles and squares will simply be sharp-edged rectangles and squares. Not the end of the world.

The lack of consistency among Outlook versions (Windows vs Mac vs web) is interesting. Outlook for Windows uses the Microsoft Word HTML renderer which is horrible, so I’m glad to see that development decision didn’t make it over to the Mac or web team.

And of course the Apple Mail clients work here. Apple uses their standard WebKit rendering engine for email markup and its so nice — if your newsletter looks good on Safari you can bet it will look good when emailed to Apple’s mail clients.

2X DPI image versions available

May 5th, 2013 by

I’ve replaced the logo and a few other images with “retina” quality resolution versions on qualifying devices.

Currently this is implemented by uploading an asset with twice the needed resolution and then using the CSS height: XXXpx; width: YYYpx; tag to set them at exactly 50% their actual resolution. Hi-DPI devices will fill in the space with the extra pixels their screens allow.

Downside: I realize this is a somewhat inefficient method as far as bandwidth goes and doesn’t scale, but the file sizes are fairly small for just the logo and few other images in this case.

Responsive design with Google mail applications (CSS Media Queries)

December 16th, 2012 by

A unfortunate design choice by Google in their Gmail mobile application which has not been noted elsewhere:

Fix for collapsed tables in HTML emails sent to Google Mail accounts

December 5th, 2012 by

Here’s a fix for when HTML emails sent to Google Mail accounts entirely omit some table cells during rendering. If you’re like me, you were probably tearing your hair out since your HTML/CSS is  100% valid. The table cells are there — they’re just collapsed and need to be forced to show. It’s a strange fix, so the explanation below is a little lengthy. Bear with me…

Copyright © 2015 by Jeremy Collins.