Event-Driven Programming with Node.js

Lately I have been playing a lot with Node.js and event-driven programming, and several ‘gotcha’ moments occurred. Below you’ll find of them. Event-Driven Programming: As the name implies, a programming paradigm where the flow of the program is governed by events. There is a main loop monitoring things and triggering the appropriate callbacks. Noje.js: Contrary […]

How to Deploy a Node.js App to Heroku

Below you’ll find the basic steps to deploy a Node.js (should apply to other languages and frameworks as well) on Heroku. It assumes you have Git and Heroku toolbelt installed. You can view a more detailed tutorial here. 1. Create the app locally (you can view a “Hello World” example here) 2. git init 3. […]

Git Basic Commands

Git is one of the most popular version control systems out there. Below you’ll find the basic commands you need to get started with it. Note: One important aspect to understand about Git is that it thinks about data as snapshots of files over time. Every commit will generate a new snapshot, that is independent […]

Facebook Webhook Integration Code in PHP

Many types of applications that interact with Facebook will need to use webhooks. Messenger chat bots are an example. If you follow Facebook’s setup guide, you’ll notice that the example provided to activate a webhook for the first time is in Node.js:   app.get('/webhook', function (req, res) {     if (req.query['hub.verify_token'] === 'YOUR_VERIFY_TOKEN') {       res.send(req.query['hub.challenge']);     } else […]

Modern JavaScript Development

It looks like JavaScript is taking the crown from Ruby for modern web development. I never used it in the backend, so I was curious to research about the libraries and frameworks that the cool kids are using these days. Here are some of them: node.js – event-driven runtime environment for developing server-side applications . […]

How to Set a Cron Job 24 Hours from Now

On the latest project I am working, a mobile app, upon a certain action of the user on the server, I need to schedule a task to run exactly 24 hours later. Cron to the rescue! My first, naive idea, however, was to add a new cron job to the crontab whenever a user hit […]

Two Great Tools to Build and Test Your API

My latest mobile project relies heavily on an API, so a lot of development time was spent defining, implementing and testing the API. During the process I used two tools mainly, and they were very helpful. Below you’ll find them in case you are in a similar position. 1. Apiary.io This neat little tool helps […]

Halloween Party Problem Solution in Lisp

The problem: Alex is attending a Halloween party with his girlfriend Silvia. At the party, Silvia spots a giant chocolate bar. If the chocolate can be served as only 1 x 1 sized pieces and Alex can cut the chocolate bar exactly K times, what is the maximum number of chocolate pieces Alex can cut […]