A little ruby array with symbols trick

In a Ruby on Rails application, when I would set up my routes I would always write:

I just found out that you can do this differently, syntactically, by using %i if creating an array of symbols. It looks like this:

This allows you to get rid of the symbols in the array as well as the comma. Just a different way to write it out but it does the same thing.

If you need to interpolate in the array. you would use a %I (uppercase). There are other ways to write percent string literals with ruby. Here is a list of some other ones:

React Router is a react package that enables you to use your url history to navigate and show different ‘pages’ on your browser. React router allows you to pass down props to these different pages as well which definitely comes in handy.

The first thing you have to do is…

Almost every Javascript interview will ask you what a closure is

For some reason, the definition of closure doesn’t seem to stick with me well. What is so closed about being able to access the variables inside your curly braces, the parent scope, as well as the global? I keep on having to look it up. But this is what I gather:

Closures are particular to Javascript. You will see them used more often with functions within functions.

It all has to do with scope and what is accessible within functions. Function inner() has access to constant a which is 23.

These are two built-in javascript methods I have recently found that come in handy when checking to see if there is an attribute in that appears once or multiple times. This came particularly handy to me when checking an array of objects. I’ll demonstrate!

Here is an array of objects…

During my time at my coding bootcamp, I learned and got pretty darn good at writing For loops. My understanding is that For loops iterate through an array and can perform an action on each element within the block of code. If I needed to hold onto a counter, or…

Node is Javascript that runs on the V8 engine that executes code outside of a web browser on the backend. Node is useful to know because you can have more direct control of your backend as well as it can keep your entire project uniform by only using Javascript and…

What I learned from my recent week-long Hackathon

Hackathons are a great way to contribute to your community through your talents, adding a project to your portfolio in a week, gain experience collaborating with a team, and have fun. They usually involve a group of engineers that must create an…

Alexander Gabriel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store