Making Travis build more efficiently

March 15, 2015

If you use open-source projects, I’m sure you’ve encountered Travis CI. Travis CI builds at every single commit. Each build can take up to a couple of minutes. I imagine Travis need to deploy the instance and run your build.

Here are some tips to speed that up.

Use Docker containers

Consider using Travis’ Docker containers as they’re much faster. I observed it shaved of 30% of my build time.

You can do that by setting sudo to false.

Caching your dependencies

If you use Bundler or Node, you can easily cache your dependencies as well.

Example in Node:

Example in Ruby:

Skipping the commit’s build

If it doesn’t need to be built, don’t build it. Add “[ci skip]” without quotes in your commit messages to skip a CI build.

That’s all

My typical .travis.yml.

And remember to give io.js some love as well. :)

CI is tremendously helpful. I use a combination of Travis and most of the time. I’ll write more on Codeship if there’s interest. Hope this helps.

How much of a web page is on React.js

March 1, 2015

This is pretty cool — curious how much a page is using React.js?

One the Web Inspector and run the following:

Source: Pete Hunt

New jsdom released with Node.js support

February 23, 2015

So the new jsdom no longer supports v4.0.0. I can’t say I am too excited over this!

This release relies on the newly-overhauled vm module of io.js to eliminate the Contextify native module dependency. jsdom should now be much easier to use and install, without requiring a C++ compiler toolchain!

Note that as of this release, jsdom no longer works with Node.js™, and instead requires io.js. You are still welcome to install a release in the 3.x series if you are stuck on legacy technology like Node.js™.

From GitHub

Underscore 1.8.0 released

February 21, 2015

Announced in Twitter:

You can see the full changelog.

There are some aliases that are now needed in Lodash for Underscore 1.8 methods as detailed here. I think it’s probably not worth maintaining parity to Underscore. Lodash clearly has proven itself as being more consistent and developer-friendly. It’s what an ideal open-source project should be, they have almost zero issues in the backlog and I appreciate they make decisions in the open through Github issues.

Underscore served me really well in the past but it’s time to move on.

jQuery shuts down plugin registry

February 20, 2015

…And endorses the npm approach. This is just so great:

The jQuery Plugin Registry is in read-only mode. New plugin releases will not be processed.

We recommend moving to npm, using “jquery-plugin” as the keyword in your package.json. The npm blog has instructions for publishing your plugin to npm.

jQuery plugin registry served well in the past but with more modern dev practices today, this approached has seemed outdated.

Some key advantages of using npm:

  • Easier to manage releases. Through semver you can indicate the likelihood to your release breaking a previous release.
  • Github centered. A common site where most devs are at. People can collaborate and post issues there.
  • Well integrated with CI. Most CIs (continuous integration) has support for npm and if you’re on Github and your repository is open-source, you can use Travis CI.

Resolving weekly php5-fpm crashes

February 20, 2015

My php5-fpm has been crashing for unknown reasons and this solved it for me! Thanks to this site — Puccinelli Digital — the author discovered what went wrong.

There was something wrong with logrotate and this is changed by an additional check whether php5-fpm is running.

This is my old configuration:

Rolling back a pushed commit in git

January 20, 2015

On the unfortunate occasion where you have to change your git history to revert. This is how to move back one commit and do a force push to master.

The other solution is to do a revert and commit it.

Try ES6 when you’re free

January 7, 2015

ECMAScript 6 (ES6) is coming and if you can like to use some of the features, you will need a transpiler for this. Try using 6to5.

From this:

To this:

Try it using

Start your product with Node.js

January 6, 2015

RisingStack discusses some of the benefits of Node.js in the enterprise. One of the highlights is productivity:

When PayPal started using Node.js they reported an 2x increase in productivity compared to the previous Java stack. How is that even possible?

First of all – as I already mentioned – NPM has an incredible amount of modules that can be used instantly. This saves a lot of development effort on your part.

Secondly, as Node.js applications are written using JavaScript, front-end developers can also easily understand what’s going on, and make changes as necessary. This saves you valuable time again as developers will use thesame language on the entire stack.

This really resonated. Coming from the background of working on non-Node.js environment, the biggest problem is understanding and sharing business logic with backend’s code. We found ourselves often coding it twice. Sometimes rules that are applied in frontend is not added in the backend.

We run a primarily Java stack and the paradigm is so different from another Express.js stack we run. Each time there are bugs, triage on whether it is a backend and frontend problem takes longer too.

Keep this in mind when you’re starting a product and consider using Node.js for that.

%d bloggers like this: