Bootstrap Git Submodule Workflow

bootstrapI have used Bootstrap for projects in the past, but I have always downloaded the precompiled bootstrap files.  While this has worked easily in the past, there are some downsides:

  1. When Bootstrap is updated I have to remember to download the precompiled code and update the files in my local Git repository.  Not that difficult if I remember to actually do it.
  2. I do not get the benefit of using the bootstrap less mixins and variables.
  3. Any changes I make to the bootstrap code is siloed in my own private Git repository for the project.

So, it’s time to tackle adding Bootstrap as a submodule within my Git repository.  First I will fork Bootstrap, then I will add the submodule and compile bootstrap.

Continue reading

Twitter Sign In using OAuth and ColdFusion

Enabling your users to authenticate to your website using a popular social media service such as Facebook or Twitter can increase your sign-up conversion rates.  Having too many choices has been proven to be reduce conversion rates, as it provides your users with too many options and can lead to complexity or confusion.  However, having one or two social media sign up links on your sign up page is a good thing.

So, how do we add a Sign In with Twitter button to our website?  It’s not that hard.  We will use the OAuth 1.0 package that I have shared on GitHub to make it easier.  The OAuth authentication follows a three-step authentication process:

  • Obtain request token for application.
  • Redirect user to Twitter authentication page with the providing the request token.  Twitter handles the authentication and application approval steps and then sends the user back to our website after they have successfully signed in.
  • Using the request token and another piece of data (oauth_verifier) we can obtain the access token that can be used for subsequent API requests.

Continue reading

Simple OAuth 1.0 using ColdFusion

As part of a project to integrate with the BuzzStream API I have developed a small project for OAuth 1.0 using ColdFusion.  The components are all written in script syntax, so ColdFusion 9 is required to run it.  The goal was to minimally implement the OAuth two step process quickly and easily.  I thought I would share it here in case you are looking for a CFML solution to OAuth 1.0.

Continue reading

One Day With Expressjs

I have spent one day learning expressjs — a node.js framework for a web application server.  After a couple of hours I think I might be hooked, but I also have a lot more to learn.  I wanted to document some of the lessons that I learned going through this process.  I will cover the following topics in this article.

  • Getting started with express
  • Starting up the server
  • Using the body-parser middleware
  • Enabling cross original resource sharing (CORS)
  • Debugging with console.log
  • Setting status code and response

Continue reading

Lowercase Your URIs

For SEO purposes, it is often necessary to enforce lowercase URIs on your website.  Google (and I believe all other search engines) are case sensitive.  In other words, they will recognize the following URLs as two separate and distinct pages:

  • http://yourwebsite.com/this-page-is-different.html
  • http://yourwebsite.com/This-Page-Is-Different.html

This is especially problematic if you are using a case insensitive file system such as Windows.  Further, as these pages are seen as separate and distinct and contain the same content, you may be penalized for duplicate content.  In essence, you are splitting the value of the content between the pages that are distinct, which will water down the SEO value of the page.

The common solution to this problem is to enforce lowercase URIs on your website.  We will look at implementing this using Apache’s mod_rewrite module, IIS rewriting (available in IIS 7 and greater), and the ISAPI rewrite extension for IIS.

Continue reading

15 Tips for Mobile Game Development

The 15 things developers should consider when creating a mobile game

Developing mobile games has never been so popular, with around 1.2 million apps being stored in both Google Play and the App Store. On top of this, the gaming apps currently hold the highest market share with upward of 244,000 apps on the market as per the reported metrics by Pocketgamer, a website focusing on mobile and handheld games.

Continue reading

Retina and Responsive HTML5 Images

With the popularity of retina and high definition displays on the rise it is now more important than ever for web developers to use high definition images.  There are a couple of ways to tackle this.  I am going to cover the following methods:

  • Load 2x images everywhere and set the image height and width to the 1x size
  • Use a JavaScript library (or roll your own) to load 2x images
  • Use the srcset HTML5 attribute
  • Using the picture HTML5 element

Continue reading

WordPress Plugin using HTTPS

This post is mainly focused at those using a WordPress plugin that is old (and probably should not be used anymore) and is causing issues when attempting to load your WordPress blog over SSL via HTTPS. Here is what happens: the browser is directed to https://yourblog.com and you notice that one of your plugins is not working. If you look in the JavaScript console you will see an error like this:

The page at ‘https://yourblog.com’ was loaded over HTTPS, but ran insecure content from ‘http://yourblog.com/wp-content/plugins/bad-plugin/required-asset.js’

The issue here is that the plugin is not using the correct URL when specifying the required-asset.js file path. The fix it pretty easy so Ichose to try to fix it myself. Upon looking into the plugin code I noticed that it was using the deprecated constantWP_PLUGIN_URL. We were using an old Silverlight plugin to support videos that were created years ago, so I had to make a simple replacement.

DEPRECATED CODE:

define ('PLAYERSS_URL', WP_PLUGIN_URL .'/'. plugin_basename(dirname(__FILE__)) );

REPLACED CODE:

define ('PLAYERSS_URL', plugins_url( '/', __FILE__));

Now that the plugin is no longer using the deprecated constant the plugin correctly loads the JavaScript via HTTPS when the page is requested using HTTPS.