barbarian meets coding

WebDev, UX & a Pinch of Fantasy

Angular 2 CLI: Bootstrap Your Angular 2 App in a Breeze

| Comments

I have run a couple of workshops on Angular 2 and the most number of issues that prevented (or slowed down) participants from enjoying Angular 2 were related to setting up their development environment. I also get questions often in my blog and mailbox about JavaScript and Angular 2 and there’s a surprising number of them related not to Angular itself but issues with module loading and the dev environment. All of this is because “modern” web development (as it’s often referred to) is not easy.

We have all these awesome new languages and tools that improve our development experience like TypeScript, ES6, SASS, eslint, Karma, etc but they come at a price because the browsers can’t quite understand them or they require additional configuration. So we need that transpilation/automation layer, territory of the so called front-end build pipeline, to do that job for us. And that means that as web developers there’s now an extra skill that we need to learn and master. Indeed if you’ve worked with any sizeable JavaScript project in the past two years chances are that you’ve gone through the non-trivial task of building your own pipeline with grunt, gulp, broccoli or webpack.

Fortunately for us, the Angular 2 team is on a quest to make the Angular 2 ecosystem the most awesome possible. That’s why they are working on a tool that will help you create an Angular 2 app from scratch with all necessary configuration with just three words: ng new my-app.

Angular 2 CLI

The Angular 2 CLI. Sounds interesting?

Updating Your Angular 2 App From RC4 to RC5: A Practical Guide (Also Works for RC6, RC7 and Angular 2 Final)

| Comments

UPDATE 14th Sep 2016: This guide also works for updating your apps to RC6, RC7 and Angular 2 Final.

Earlier this week we got the RC5 release of Angular 2, a version of Angular 2 that “represents the expected public API for our 2.0.0 release, including router and forms APIs” according to Rob Wormald of the Angular 2 team. Yey!

I’ve spent this week updating my getting started series and compiled the most important changes you need to do to update your application from Angular 2 RC4 to RC5 including the new router.

Angular 2 Getting Started

Updating Your Angular 2 App to Use the New Forms API: A Practical Guide

| Comments

Hi! I have slowly continued to update my Getting Started with Angular 2 Step by Step series from the beta to the latest version of Angular which is now RC4. This time it was the turn of the Forms and Validation article where I used what is known as template driven forms.

Again, just like with the router, there are some changes that you’ll need perform to update your Angular 2 app forms to the latest version, albeit at a much smaller scale. I thought it would be a nice to have these updates in the form of a brief and very practical guide and here we are. Enjoy!

Angular 2 Getting Started

Updating Your Angular 2 App to Use the New Router: A Practical Guide

| Comments

UPDATE 14th Sep 2016: Hi there! I have added an additional step to update your router from RC4 to RC5, RC6, RC7 and Angular 2 Final.

This week I’ve been updating my Getting Started with Angular 2 Step by Step series from the beta in which they were written to the latest version of Angular which is now RC4.

I had heard about the router debacle but I wasn’t aware of the massive changes required to move from the router in the beta until I updated the articles. I thought it would be helpful to write a quick, super practical guide while it’s fresh in my head. So if you’ve been postponing the router update until now, I hope this guide will help you.

Angular 2 Getting Started

Functional Programming in JavaScript

| Comments

The Mastering the Arcane Art of JavaScript-mancy series are my humble attempt at bringing my love for JavaScript to all other C# developers that haven’t yet discovered how awesome this language and its whole ecosystem are. These articles are excerpts of the super duper awesome JavaScript-Mancy book a compendium of all things JavaScript for C# developers.

Functions are one of the most foundational and common constructs in JavaScript. We use them for all kinds of things: to abstract, encapsulate and reuse functionality, as object factories and constructors, to simulate data privacy, to create namespaces and modules, we can compose them with other functions… They are everywhere.

The fact that functions are so prevalent in JavaScript, that they are first-class citizens and that it is very natural to use higher-order functions, makes JavaScript a great language to do functional style programming.

But what does all this nonsense of first class citizenship and higher-order functions means? Why should you care about functional programming in the first place? And moreover… What the heck is functional programming?

Barbaric Tip of the Week: How to Recover a Lost Commit With Git

| Comments

Barbaric Tip of the Week is a weekly series whose main purpose is to share tiny bits of knowledge that I find specially useful and interesting.

Last week I experienced one of the weirdest moments I have ever had with git and something that should never ever happen within the secure confines of a version control system: I lost a commit. My source code, everything that I had been working on for 3 hours wiped out from existence.

Has this ever happened to you? Would you like to know how you can recover a lost commit?

My Talk at Devsum 2016 and Some Interesting JavaScript Links

| Comments

Hi! Last week was intense!! I came back from spending a greeeeat long week in New York, powered through jet lag and a nasty cold and did my talk at Devsum 2016 about the mysterious, arcane and obscure art of JavaScript-mancy!

Devsum 2016

It was a ton of fun as usual. The conference was awesome, the organizers did a great job, everything ran super smoothly, the speakers were very kind and great to hang out with, the attendees were engaged and great to have a random conversation with here and there, and the people at Active Solution were a blast to be around. So thank you everyone for making it happen!

I think my talk went pretty well although perhaps there was a little bit too much information and speed towards the end. You’ll be able to be the judge of that because there’s going to be a recording coming out in the near future (which I am looking forward to watching myself by the way hehe).

Anyhow, here are my slides and a bunch of useful links that serve as a superb companion for the presentation.

Argument Destructuring and Type Annotations in TypeScript

| Comments

I often use destructuring in ES6 when I want to have a function with an options object. I described options objects in “More useful function patterns – function overloading as a way to achieve function overloading in JavaScript with the added benefits of named arguments and extensibility.

Recently I was trying to use the same pattern in TypeScript adding some type annotations but it did not work! If you have had the same issue yourself read through to find out how to solve it.

A Screenshot of me testing destructuring in TypeScript

A Look at ES6 Sets

| Comments

The Mastering the Arcane Art of JavaScript-mancy series are my humble attempt at bringing my love for JavaScript to all other C# developers that haven’t yet discovered how awesome this language and its whole ecosystem are. These articles are excerpts of the super duper awesome JavaScript-Mancy book a compendium of all things JavaScript for C# developers.

A Set is a data structure that represents a distinct collection of items in which each item is unique and only appears once. If you have been working with JavaScript for a little while chances are that you have need to roll your own implementation of a Set. Well, you’ll need to do that no longer beause ES6 comes with a native Set implementation.