email github twitter twitter twitter

nasseri.io

The Blog of Dean Nasseri

I Did Some Podcasts

Posted on Saturday, Dec 01, 2018

Hello folks! I just wanted to give a PSA that I recently did a couple of podcasts. One with the fine folks of Ruby Rogues, which you can find here, wherein we discuss the open source ruby repl Fir I have been working on. I also did an episode of My Ruby Story, where we talk a little bit more about the project and also about myself and who I am generally. If you are curious, go check them out!

Introducing Fir, the Friendly, Interactive Ruby REPL

Posted on Tuesday, Jan 23, 2018

I haven’t been posting here much because most of my free time has been spent working on a ruby REPL that I call fir, which stands for friendly-interactive-ruby. The ruby community has no shortage of great REPL’s — the default irb is pretty good, and pry offers a fantastic repl as well as an interactive debugger that really highlights some of the great features of the ruby language. In my daily work, I also really enjoy some of the autosuggestion features that the fish-shell offers, so much so that I got to thinking about integrating those features into a ruby repl. If your not familiar with the fish shell, this is what some of those features look like in action:

image-title-here

The Structure and Interpretation of Ruby Programs

Posted on Wednesday, Aug 16, 2017

Whenever a ruby program is run, the program is first lexed into tokens, then the tokens are assembled into an abstract syntax tree, and finally the AST is compiled into virtual machine instructions. In this post, we will explore each of these steps in detail.

tokenize-parse-compile

Understanding Posrgres Window Functions

Posted on Thursday, Jun 02, 2016

Recently I stumbled into a very handy feature of Postgres — window functions. A window function gives you a “window” into other rows which are somehow related to the current row. You can then preform a calculation across that set of rows. Window functions behave much like regular aggregate functions, with the caveat that the rows do not become grouped into a single row! Let’s explore this feature, and why it might be useful.

How One Ruby Method Let us Delete Thousands of Lines of Code.

Posted on Saturday, Mar 05, 2016

At VTS we have a saying: code is a liability. As an application grows, legacy code develops. This code might not ever be covered in your production application, but you still incur the cost of maintaining it. Unfortunately, knowing what code is legacy and safe to remove can be difficult in a complex application. In order to try and determine what code was being hit we opted to use a gem called coverband. Coverband is a ruby gem to measure production code coverage. When enabled it logs every file and line number which has been hit to redis. Coverband can be used as a rack middleware which means that, once configured, we were able to trace the execution path of requests on our production servers.

Threading in MRI Ruby for Fun and Performance

Posted on Thursday, Dec 24, 2015

Frequently in our applications as software engineers, we run into situations where we want our code to do multiple things at once. This is the problem of concurrency. Concurrency has an infinite number of use cases. One such use case is that of a webserver. If you were to use a non-concurrent webserver, it would only be able to handle one request at a time. Imagine your site received several requests at the same time. Now the webserver must process each request one at a time, unable to move on to the next request in the queue until the previous one has completed. In order to alleviate this, we might use a concurrent webserver which is capable of processing multiple requests at once.

Ruby Metaprogramming by Example

Posted on Thursday, Nov 19, 2015

In Ruby the term metaprogramming refers to the dynamic nature of the language, which allows you to define and redefine methods and classes at runtime. Metaprogramming is often presented as a very nebulous and dangerous concept, one that is difficult to explain and hard to wrap your head around, and thus should be avoided. I’d like to to take some time to show a few powerful uses of metaprogramming techniques in real live code.