Simpler CLI tools

grep, find, sed, awk are powerful and fast, but their APIs are hard to memorize and sometimes very awkward; so that’s why I use some tools that are slower but are way more user friendly.

Haters gonna hate, and there is definitely a hidden cost on using theses tools (you won’t learn the standard ones); but there is also a huge benefit on the ease of use.

Read more…

Tags: , ,


Type check is a code smell

Will try to be brief, so it might not be clear unless you are experienced, will add more references at the end to make things clearer and maybe revise this subject later… - Time is a very limited resource nowadays.

How I got into this conclusion?

JavaScript is a dynamic (and confusing), language, the way inheritance and typeof and instanceof works is not clear to most developers:

typeof [1, 2] // 'object'
typeof null // 'object'
typeof 'foo' // 'string'
typeof new String('foo') // 'object'
'foo' instanceof String // false
new String('foo') instanceof String // true
new String('foo') instanceof Object // true

And things gets way more complicated when you have objects that come from different documents/frames/workers (they are created using different constructors, so instanceof doesn’t work)… So because of that I started to avoid typeof and instanceof and ended up realizing how cleaner the code becomes when you avoid type checking.

PS: I know that we can use Object.prototype.toString.call() for type checking, I’m mainly saying that most type checks are a bad idea, doesn’t matter what is the implementation.

Read more…


Being a noob

I have no idea what I am doing

I was reading some of my old blog posts, and also some code that I wrote during the past few years, and it’s really hard to not notice that I was a total noob.

Don’t call it Impostor Syndrome, I’m talking about a different feeling. It’s more a realization that over the past few years I improved A LOT, both my writing and coding skills. Nowadays I can spot mistakes and misconceptions that I couldn’t see before. It’s also important to remind that being a noob is totally subjective and that there are different levels of noobness.

Read more…


Static Site Generators

Yes, they are popular; Yes, there are hundreds of implementations; Yes, they all suck; Yes, this is sort of a rant; Yes, I also wrote a few static site generators before; Yes, I have this opinion for a while; Yes, a lot of people will disagree…

Since my goal with this post is to question the current trend towards static site generators, lets start with a bold a statement: PHP is the best static site generator that you can get.

Read more…

Tags: , ,


Improving Vim auto complete for CSS class names

Just a quick tip about Vim autocompletion.

I’ve been using the excellent SuperTab Vim Plugin for a couple years, it works reasonably well (autocompletes based on words from all buffers, file names, tags, context, etc…) but it doesn’t work really well for text that is split by dashes - CSS contains lots of these… - so I started to get frustrated with it.

You can change the auto complete behavior with set iskeyword which also changes the behavior of standard motion commands like w, e, b (it changes the word delimiters) – which a find a PITA since I got used to these motions. My quick and dirty solution to the problem was to keep iskeyword with the minimal value as possible and only change it during InsertEnter. That way I can still use cw, ve, db to edit each fragment, autocomplete will work properly for words like foo-bar__baz, and you can still use W, B and E if you want to quickly jump around. For me that’s the best of both worlds!

Read more…

Tags: , ,