JBerczel's Notes on learning Web Development

Back to the Basics - How the Internet Works

It can be frustrating when things just don’t work. It’s like a viscious cycle, where your thinking keeps going downhill. Generally I attribute it to programming too fast. You end up skipping steps and it punishes you eventually.

The remedy: slow down or take a break.

When my brain feels fried, I like to step back and review the basics. I think it helps to take a break from the low-level detail. Doing so also gives you a confidence booster when you know you can at least comprehend the high-level stuff.

Continue reading

Seeing is Believing gem

Just thought I’d share a cool little gem I came across recently. As mentioned in the README, it was inspired by Bret Victor’s thought-provoking talk Inventing on Principle .

The Principle:

Creators need an immediate connection to what they create.

Seeing is believing acts like a multi-line, editor-based REPL (Read Evaluate Print Loop). For ruby, think IRB.

Continue reading

Reverse a String in Ruby

Small challenge: Reverse a string in ruby without using the standard library #reverse method.

There were some interesting comparisons on stackoverflow . I decided to write my own solution and run some benchmarks with ruby 2.2.0.

My reverse function turned out similiar to one of the stackoverflow solutions, which used Enumerable#reduce method combined with #unshifting (enqueue) characters into a new array.

Continue reading

Transitioning to HAML

Well I finally experimented with haml. Surprisingly, it felt relatively easy transitioning from html files (embedded with erb) to haml files.

As the documentation suggests:

Give yourself 5 minutes to read the tutorial and then convert one of your ERB templates to Haml. Simplify. Enjoy. Laugh. 20 minutes later, you will never go back.

So that’s exactly what I did with my guitar forum website. Here’s one of the views displaying list of guitars before and after using haml (note I did some additional refactoring which I’ll explain below):

Continue reading

Getting Started with Vim

For the past year, I’ve coded using sublime text 3 (ST3). It’s a great text editor, especially when you’re getting started. I’ve gotten so comfortable writing code in ST3, that it was hard to even think about switching text editors.

I kept hearing about IDEs and other text editors such as emacs and vim. It appeared that a large proportion of Rails developers were using vim. I was curious as to why. After getting comfortable with Ruby and working my way through a few Rails projects, I decided it was time to experiment with vim to see if it was the right fit for me.

Continue reading