Tag Archives: HTML5

2048 Chess


2048 Chess:

I know I am about two years late to the 2048 Clone Wars, but I finally got around to finishing my variant, 2048 Chess.  Originally I wanted to have multiple chess pieces on a larger 2048 board.  What I ended up developing was simply the kings.  The gameplay doesn’t lead to terribly interesting strategy.  It’s ultimately a game of button mashing and luck.  Whatever, I’m calling it done: http://danielbank.github.io/2048-chess/.

Making a GitHub page for a forked repository that already has a gh-pages branch:

My biggest hurdle in finishing this project was when I attempted to view the GitHub page for the repository. GitHub was overriding the game’s index.html with an automatically generated GitHub page.  I found this incredibly useful StackOverflow question for fixing that problem.  The prescribed steps were to:

  1. Make a file called index.md.
  2. Edit the contents of index.md to be:
    ---
    layout: index
    ---
  3. Make a file called _config.yml.
  4. Edit the contents of the _config.yml to be:
    markdown: redcarpet
  5. Create a _layouts folder.
  6. Move your index.html into the _layouts folder.
  7. Commit the changes and push them to the gh-pages branch of your repository on GitHub.
  8. The automatically generated page should be replaced by your page when Jekyll generates it.
2048 Chess
2048 Chess
Advertisements

OfflineSaveQueue, an HTML5 Local Storage Solution


I created a new JavaScript library called OfflineSaveQueue.  The purpose of this library is to temporarily save JSON objects in HTML5 Local Storage in the event that an internet connection is not available.

The creation of this library arose out of my need to save data to Parse.com from a PhoneGap application.  The app was not guaranteed to have internet connectivity so I needed a way to put the data in a temporary queue where it could be kept until I got a success callback from Parse.

OfflineSaveQueue is not being maintained anymore and I don’t recommend using it.  However, if interested you can still take a peek at the GitHub repository.

Usage of OfflineSaveQueue is simple:

Instantiate an OfflineSaveQueue object:

var offlineSaveQueue = new OfflineSaveQueue();

Set the callback function which is executed when the queue is processed:

offlineSaveQueue.setCallback(function(objectInstance, objectName){

//Do stuff here...

});

Start periodic queue processing:

offlineSaveQueue.startQueueProcessing(60000);

Stop periodic queue processing:

offlineSaveQueue.stopQueueProcessing();

Save an item into the queue

offlineSaveQueue.saveObject({"foo": "bar"}, "DummyObject");

Manually process the queue

offlineSaveQueue.processQueue();

Get the number of items in the queue:

offlineSaveQueue.count()