Sunday, January 17, 2016

Spaceship X - Game Launch on Android Play

Spaceship X - Timeless Hero

A retro flavoured Spaceship shooter saving the Galaxy!

I have released my first Game App to Google Play!

It is free to download:

The game's website:

Have fun!

Saturday, April 18, 2015

Simple Webapp example using Flux with React

If you've been following the latest Front-End news for Web for the past year,
you have probably seen the huge buzz around ReactJS.

Just in case you haven't, you can visit ReactJS on the Facebook Github's page at: or just Google it and read about it.

So for those of you that do know what React is all about, you may have also heard about Flux.
If you haven't :) I recommend you to read about it a bit
here as well

If I have to try and sum it up on one leg, I'd say that Flux is an application architecture for building
big web-apps on the front-end that scale.  - Well, that's pretty vague :)

A main concept regarding this architecture is about a Uni-directional flow where an "Action"
(a Application Event) is triggered by the View part (Your components, which are shown the users),
using a "Dispatcher" (Some kind of an Event Hub) which propagates the Actions
on to the "Stores" (Your application's model), which hold the state (data) of your application,
perform the necessary update and logic, and updates the View back using listeners.

This illustration might help understanding the Flux flow a little better:

Why is Flux a good idea? - There are several reasons, but I will mention only 2 which I think
are the most important.

1. Simple Application Architecture - You can show this diagram to someone who never
heard of Flux before, and explain it in 2 minutes.

2. Scalable - Flux lets you scale. Meaning, it's relatively easy to add new features to
your application, debug it, and keeping it performant.

There's a really good talk about it by Facebook which is worth watching:

After all that being said, I really wanted to do some basic implementation of Flux myself,
to "feel" how it works. And so I created a very small Repository on Github that implements
Flux which you are welcome to look at and use.

The example code

The application built on top of that is a classic Todo App:

The code uses several 3rd party libraries such as RequireJS and React Templates but even if you are not familiar with RequireJS, or with AMD, my guess is you will still be able to understand how
it works.
React Templates is an amazing 3rd party library that helps you implement the "render" method
of React Components in an HTML like syntax. Totally cool.

Good luck!

Saturday, January 25, 2014

Grunt - Create your custom local Grunt plugin

This post describes how you can write your own Grunt Plugin in Javascript and install it locally,
in order to use it on your own (Grunt) project build file.

If you don't know what Grunt is then to explain it on one leg -
"Grunt is a pluggable (JavaScript) task runner", which can be used to build JavaScript projects.

Such typical build of a Javascript project may contain a Linting task, minification task, and so on...

So, you can read more about Grunt if you want to get a better understanding.

And now, to the recipe!
1 NPM installed on your machine
1 GIT installed on your machine
1 Skill writing a tiny bit of Javascript
A zest of patience

1. First thing would be to install a Grunt plugin that is used for templates scaffolding.
In order to do that, you need to run the following in your shell:
$ npm install -g grunt-init
2. Clone a GIT repository which is going to be used as your template for creating your glorious
Grunt Plugin. (
So, run the following in your shell:
$ git clone ~/.grunt-init/gruntplugin
3. Create an empty directory where you want to place your Plugin like "my-custom-plugin", and cd into it.
$ mkdir my-custom-plugin
$ cd my-custom-plugin
Then run the following in your shell:
$ grunt-init gruntplugin
4. You should now be prompted with a serie of questions in the shell, in order to create your plugin.
You should be seeing something like this:

Please answer the following:

[?] Project name (grunt-my-custom-plugin)

[?] Description (The best Grunt plugin ever.) the best custom plugin ever!

[?] Version (0.1.0)

[?] Project git repository (ssh://<Your GIT remote Repository URL>)

[?] Project homepage (none)

[?] Project issues tracker (none)

[?] Licenses (MIT)

[?] Author name (nirgit) Nir M

[?] Author email (

[?] Author url (none)

[?] What versions of grunt does it require? (~0.4.2)

[?] What versions of node does it run on? (>= 0.8.0)

[?] Do you need to make any changes to the above before continuing? (y/N) N

Writing .gitignore...OK

Writing .jshintrc...OK

Writing Gruntfile.js...OK


Writing tasks/my_custom_plugin.js...OK

Writing test/expected/custom_options...OK

Writing test/expected/default_options...OK

Writing test/fixtures/123...OK

Writing test/fixtures/testing...OK

Writing test/my_custom_plugin_test.js...OK


Writing package.json...OK

Initialized from template "gruntplugin".

You should now install project dependencies with npm install. After that, you

may execute project tasks with grunt. For more information about installing

and configuring Grunt, please see the Getting Started guide:

Done, without errors.

5. Now you should have your directory containing a Grunt Plugin template.
Open the file you have inside the "tasks" directory in order to edit it.

6. The file should look as follows:

7. Just in order to get started, lets strip the file and change it to contain the following:
 * grunt-my-custom-plugin
 * Copyright (c) 2014 Nir M
 * Licensed under the MIT license.

'use strict';

module.exports = function(grunt) {

 grunt.file.defaultEncoding = 'utf8';

 // Please see the Grunt documentation for more information regarding task
 // creation:

 grunt.registerTask('my_custom_plugin', function() {
  grunt.log.writeln('Hello my great Grunt Plugin!') ;

The my_custom_plugin shown in bold above, is the name of your task in the Grunt build, that
you'll execute at the end.

Lets change the Gruntfile.js in the root directory of the Plugin so tests won't execute when
we will run "grunt" on the plugin's source. Otherwise the build would fail.
So now the Gruntfile.js last line should look like:
grunt.registerTask('default', ['jshint']);

8. Go back to the root directory of your Grunt Plugin and run the following:
$ npm install
$ grunt
Running "jshint:all" (jshint) task >> 3 files lint free. Done, without errors.
9. Almost done.
Now go to your own project where you want to use your plugin and add the following line to the
Gruntfile.js of your project:
This will load your Grunt plugin task to your Grunt's project.

10. Next step would be to install the plugin locally in the node modules of your Proect.
You should now run in the root directory of your Project (where you want to use your plugin) the following:
$ npm install /<PATH_TO_YOUR_PLUGIN>/my-custom-plugin
11. You should now be able to execute:
$ grunt my_custom_plugin
And see:
Running "my_custom_plugin" task

Hello my great Grunt Plugin!

Done, without errors.

That's all folks.
Hope this was helpful to get you started with Grunt Plugins.
Don't forget to publish it (npm publish) afterwards to the rest of the Node community if you think it may be helpful to others as well.

Check out the official guide for creating Grunt plugins at:

Good luck!

Sunday, June 16, 2013

Lottery for winning a copy of the "Android NDK Cookbook" is now opened

In continuation to last week's post for winning a free copy of the eBook "Android NDK Cookbook",
the lottery starts today!

3 Lucky people will be given a free copy of the "Android NDK Cookbook" sponsored by "Packt Publishing".

Description of the book

 Android Native Development Kit Cookbook will help you understand the development, building, and debugging of your native Android applications. You will discover and learn JNI programming and essential NDK APIs such as OpenGL ES, and the native application API. You will then explore the process of porting existing libraries and software to NDK. By the end of this book you will be able to build your own apps in NDK apps. 

Check it out on Packt Publishing:

How to participate?

Simply send an email by clicking here or by sending it to 
containing a subject line "Android NDK Cookbook lottery".


The contest will close on 30th June 2013. Winners will be contacted by email, so be sure to use 
your real email address! 

Good luck !

Saturday, June 8, 2013

Win a free eBook copy of "Android NDK Cookbook"

Are you an Android developer or interested in Android development?
This might interest you!

On the 16th of June 2013 I will conduct a lottery on the blog, to win a free eBook copy of "Android NDK Cookbook".

The lottery will last for 2 weeks (until June 30th) where you will be able to participate to win a free copy of the book.

Description of the book:

"Android Native Development Kit Cookbook" will help you understand the development, building, and debugging of your native Android applications. You will discover and learn JNI programming and essential NDK APIs such as OpenGL ES, and the native application API. You will then explore the process of porting existing libraries and software to NDK. By the end of this book you will be able to build your own apps in NDK apps. 

Further details of the book can be found here:

Stay tuned for the 16th of June!

* The copy of the book is sponsored thanks to "Packt Publishing".