ReactJS

ReactJS Bind() Hell

I (along with many others) hate having to call React's components methods with something that looks like: this.method.bind(this). If you don't know what I'm talking about, read more about it in this post. In my projects, I add to the React.Component class prototype, a helper method which helps me remove those crazy bindings. I do, at top level file, the following addition to the Component class: // Deps ========================================= import React from 'react'; ... // Adding _bind helper to Components ============ React.Component.prototype._bind = function _bind(...methods) { methods.forEach((method) => { this[method] = this[method].bind(this); }); }; Pretty neat, right…

Read More

Gulp Browserify ESLint

Gulp Multi-Bundles of Browserify

Browserify brings the beauty of CommonJS to the browser. It bundles up all your dependencies into one file. This works well with small projects or with Single Page Applications(SPA), where having just one JS file works well. But what happens if you're building a website with lots of views? If you're using browserify, you'll end up with a huge bundle file. What if we could split the bundle in a main bundle with all the global scripts and libs, and then have a bundle for different views? After a while of research, I could finally come up with a…

Read More

ReactJS jQuery

Communicate between components (ReactJS)

So I've been playing a lot with ReactJS lately and one of the problems I was facing was that I needed to comunicate from one component to another. They had different root components, so I couldn't pass the handlers between them. When the components can't communicate between any sort of parent-child relationship, the documentation recommends setting up a global event system. The solution I ended up using was a small snippet but rather elegant. I'm going to rely on JavaScript Events to create a small publish–subscribe pattern. If you have not used pub/sub before, its a messaging pattern…

Read More

Swift iOS8 StatusBar

Status Bar Style in iOS8

This one is a quick thing that I keep forgetting how to do. While developing iOS apps, sometimes we need to change the color of the font in the status bar (which is dark by default). We have the option to change the status bar to a white color (or "light" style). First we need to define the following to the app's info.plist: View controller-based status bar appearance. It takes a BOOL (YES or NO). Let's look at what each means: YES: This will allow us to to set the preferredStatusBarStyle in our view controllers, like so: override func…

Read More

NodeJS Coldfusion Benchmark

NodeJS vs. Coldfusion Benchmark

I started out as a front-end developer, my main skills lies in javascript. It was an obvious step for me to get involved with NodeJS, and I have loved every bit of it. On the other hand, at my day job, we use CFML to power our backend logic. So I decided to make some tests between how well does CFML performs against NodeJS and how do they compare. I prepared a couple of simple examples that goes from making a simple 'hello world' to querying a mysql db and displaying the results. The tests were done on a Digital…

Read More

NodeJS CLI

CLI-ate with NodeJS

I've always read about how easy it was to create a Command Line Utilities with node, but I never thought it was this easy... I'm doing this post(as always) for self documentation. In this post, I'm documenting the steps I follow in the creation of a Command Line Interface tool using NodeJS. This is useful because we can take advantage of how NodeJS can handle the filesystem, system status, command line interface, among others... We can encapsulate scripts to execute them as applications, create scripts for tasks automation and so on. 3 steps: We need to create a normal…

Read More