rand(Ø)

> beautiful code & photos

about <

Posts tagged: english

Nunjucks: inject Express request to templates

On my free time, I recently started to think about the next version of my photography portfolio which starts to be old and especially is not designed to be effectively browsable on tablets.
And, there are also other things I'd like to fix...

Anyway, as I recently got some basic skills in NodeJS, I challenged myself to rewrite my dear portfolio with this technology. I looked for an interesting templating engine not too far from Twig which I like a lot then I chose to go with Nunjucks, which is very similar and seems not to be dead.

In my

> Continue Reading

JS: Singleton as a module

When you develop a NodeJS application, you probably get to work with services and as much as possible with service dependency injection.
As I worked quite a lot with Symfony lately, I wanted to be able to manage my NodeJS services as it should be, and in some case, like a database connection: a single instance for the whole script.

I quicky looked onto Internet to see how to build a singleton in JavaScript (pardon my weak skills in this language) and I quickly found what I was (almost) looking for.

Code examples provided in the different posts I've read

> Continue Reading

NodeJS: Quick dev server

I'm on a nice project where I need to develop a kind of proxy in NodeJS. When you work to forward data after possible filtering or transformation, it's never too easy to quickly set up an environment in order to test your on-going development.

Using NodeJS, I extended my colleague very small HTTP server that just returns a 201 HTTP code and prints the request body in the console:

// debug-server.js
var http = require('http');
var port = process.env.PORT || 8080;
var host = '127.0.0.1';

http.createServer(function (request, response) {
    // console.log(request.headers);
    request.pipe(process.stdout)
> Continue Reading

RabbitMQ installation on Vagrant/Centos

Today I wanted to update our AMQP producer payload so I needed to have RabbitMQ installed and ready in my Vagrant virtual machine. We use Centos 6.

In our Vagrantfile:

config.vm.network :private_network, ip: "192.168.x.x"

The EPEL rabbitmq-server is in version 3.1.5 while the latest version (and the version where the plugin management command sits) is the 3.5.3.

So, in order to install the RabbitMQ server:

$ sudo yum install erlang
$ wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.3/rabbitmq-server-3.5.3-1.noarch.rpm
$ sudo rpm --import https:
> Continue Reading

Android: Remote screenshot with adb

Hi there and happy new year!

Not that it's not easy to find this information but I recently signed up on Snapchat and let's be honest, it's not easy to capture the device screen when long tapping the screen.

Fortunately, Android development kit comes with a shell that allows to control your device from your computer through adb. No teaching you anything today.

I quickly wrote a tiny script that would allow anyone who found the way to install adb to capture your device screen remotely.

Create a screenshot file in the same folder of the adb binary and paste

> Continue Reading

Android: Nyan Cat boot animation

I was running with AOSP Strawberry Jelly Bean for a while and it started to be really slow and unresponsive so I tried AOSP SlimBean Build 5.
Didn't suit because I had random reboot even the UI was smooth enough... By the way, if your smart-phone is recent enough, I would recommend this one because it's highly customizable.

I finally ended up using the latest RC of CyanogenMod 10 (including Android 4.2) which seems to work perfectly and seems stable on my old Google Nexus S (codename crespo).

I used to use Titanium Backup to backup and restore my

> Continue Reading