Dev box
I'm a 32-year-old Ruby on Rails web developer. With the help of friends and co-workers, I've been teaching myself Rails. I worked as a Rails developer for Crowd911 in Colorado. I live in Berlin.
In my developer blog I publish a stochastic array of thoughts and ideas, lessons, mistakes, questions and attempts as answers about Rails and Ruby. I am also posting Anki cards that I used to help myself study. In my view most knowledge is about practice. If you have thoughts, questions, ideas, corrections, arguments, feel free to email me at henryvw@gmail.com.

What's the best way to see a method inside a gem? Answer: binding.pry's show-method (method_name_want_to_checkout)

Say you have a method that you keep thinking... where is this activity coming from?

You search the codebase, and you can't find it. Where is it defined? How is it working?

It turns out... it might be from a Gem. In that case, using binding.pry's show-method (method_name_you_want_to_checkout) can be really useful. 

Read More
Binding.pry, Figuring Out Where A Method Comes From

What is SSH?

SSH means "Secure Shell". It's a UNIX command-interface and protocol for securely getting access to a remote computer. It is widely used to access and make changes on Web and other kinds of servers remotely.

Read More
Servers, SSH

Atomic Design and BEM

Periodic table html 5 elements

There are two philosophical movements to improve web design that are of great interest.

Atomic Design - http://bradfrost.com/blog/post/atomic-web-design/ - A philosophy of thinking about design components like natural objects: atoms, molecules, organisms and then templates / pages.

Table of HTML Elements - http://madebymike.com.au/html5-periodic-table/ (an image to help think about part of Atomic Design)

BEM - https://en.bem.info/ - A convention to structure among other things CSS file names

 

Read More
CSS, Atomic Design, Design, BEM

What is the difference between Web Servers, App Servers and Ruby's Rack, and a Template Engine?

What is the difference between Web Servers, App Servers and Ruby's Rack?

Web Server

A web server is a program that takes an HTTP request from a client user. The web server processes the HTTP requst and does one of two things. It might send the request to your Ruby, PHP, Python, etc. application. In this case the Ruby, PHP or Python application would generate a response. Alternatively, the web server processing might reveal that it only needs an HTML or CSS file. In that case the Web Server can handle the HTTP request by itself. It will simply render up the relevant HTML or CSS file. 

App Server

The app server handles the requests going to the application, e.g. your Rails application. Examples of app servers for Rails are Unicorn, Thin and Puma.

Node.js is ALSO an application server. Using Node.js you can write an HTTP Web Server. (Or more quickly, add the HTTP server NPM module). 

In development, you often run an App Server without a Web Server. Web servers are generally used for production. Hence in many Gem lists you see Thin, Unicorn and Puma - or gems like Rails12factor - in the Production Section.

Rack

Rack in short enables HTTP and Ruby to talk to one another. It enables for example a Web Server to speak to a an App Server which then uses Rack to speak to a Rails app. (Which in turn then routes it to the appropriate Controller/ Action Pack). Rack is called a "Web Server Interface". 

Template Engine

 

Read More
Web Server, App Server, Rack

What are 'params' in Rails?

params are a key-value pair that are part of the HTTP GET request that Rails handles specially and turns into a variable for you with these key-value pairs as a HASH.

For example: 

http://www.example.com/?foo=1&boo=octopus

Contains the HTTP extra of ?foo=1&boo=octopus

Rails turns this into a Params hash:

params = { :foo => "1", :boo => "octopus" }

Read More
Hash, params






Footerfull