Cellular automaton #3 – Get to coding

Last week I finally implemented something, an elementary cellular automaton with one hardcoded rule. I also added some development tools (debugger, testing framework). Not much, but I’m happy that I could see some results and now I have some base for next iterations.

More setup


Pry – debugger and powerful tool, is a popular choice for development in Ruby.
To use it, we just need to add in Gemfile this: gem 'pry', and then this line in code where we want a break point:

require 'pry'; binding.pry



RSpec – when it comes to testing (especially in Rails apps), this is the most used framework and DSL. After adding gem 'rspec' in Gemfile, we can generate initial config for it:

$ rspec --init
 create .rspec
 create spec/spec_helper.rb

There is good RSpec documentation and guidelines on the web.

Environment groups

In Sinatra default environment is “development” and since there is no config for that – all dependencies are required in every environment. In order to fix this and also
to introduce “test” environment I needed to make some configuration tweaks.

For testing, I’ve added this line on top of spec/spec_helper.rb:

ENV['RACK_ENV'] = 'test'

For dependencies, we can group them in Gemfile as described in Bundler docs.
To require gems in particular group I’ve added this line on top of config.ru:

Bundler.require(:default, ENV['RACK_ENV'].to_sym)


Elementary (one-dimensional) cellular automaton is really easy to code in Ruby. My first implementation has 40 lines of code. It’s a class with few instance methods. Object created from it can hold a generation in an array. Elements of an array are cells, their state is defined by integer (0 or 1). Method named “step” (no idea if it’s good name) returns new array generated basing on neighborhood of cells and some rule, in this case rule 30. (more…)


WDI 2017 – small report

March 28-29th – I partially attended at Warszawskie Dni Informatyki in Warsaw.

It was the 7th edition of the biggest IT event for students and professionals in Poland with job fairs, presentations, talks, workshops, contests, free pizza and t-shirt.

Presentations I was at:

  • JVM alternative languages by Mateusz Chrzonstowski and Piotr Pawlak: comparison of some features in Groovy and Gosu to the Java


  • SOLID and DRY, how to write good code in JS? by Damian Wielgosik: live coding of simple shopping cart in JavaScript (ES6)
  • Startups vs corporations: discussion panel with Mateusz Mikulski, Artur Wiza, Paweł Wadyl, Borys Musielak, led by Maciej Aniserowicz: pros and cons of working at them, career possibilities, skill requirements
  • JavaScript on the back-end, yes or no? by Piotr Radosz: Node.js from dev-ops perspective
  • Android Dev – from zero to hero by Grzegorz Sołdatowski – workshops about coding simple app in Android Studio
  • The way of architect by Jarosław Pałka: myths and facts in developer’s career
  • How technology is changing our future? Q&A session with Maciej Aniserowicz, Arek Benedykt, Mirosław Burnejko and Jarosław Pałka

dav (more…)

Cellular automaton #2 – First deploy

TL;DR: Nanobox is free but requires paid service on DigitalOcean or AWS, so I deployed to Heroku.

I wanted to use something other than Heroku but after all it’s still the best free platform for small web applications. I spent about 2 hours setting up Nanobox Desktop just to discover that it will create Amazon EC2 instance of $6/month cost (Nanobox itself is free for open source apps) when I connected AWS as cloud provider, which I could do on the beginning. I don’t need 100% uptime or advanced managing, monitoring and scaling features for that small application, good old Heroku will be just fine and quick. There is AWS Free Tier for 12 months but I expect some longer fiddling on the first time, I might try it later for other projects.

In this post I will present some steps done with Nanobox.

Installing Nanobox Desktop

After creating Nanobox account I had to install Nanobox Desktop to start development.



How to discover direct download URL?

Let’s say we need a link to file placed somewhere on the server in the Internet, but not just to copy it and paste in the browser. Example case can be like this: write a program that downloads files from a service or save the link and provide it somewhere else. Basically our goal is to automate some things and skip human interaction.

Most of the time resources like files are handled and managed by different services. This means that sometimes we aren’t given direct access to the file because it’s controlled by application. Reasons are often simple: authorization, increase download count, show ads, prepare file to download, prevent hotlinking, it’s all server-side processing in general.


We will use GitHub service as an example. Repositories that are hosted there can be downloaded as a ZIP file. I imagine GitHub doesn’t store all files of all repositories at once, but generates them on demand and delete later to save space. With Chrome Dev Tools (Network tab) we can see what is happening after clicking the Download ZIP button.


Actually two requests was made. First to https://github.com/shakiba/planck.js/archive/master.zip was redirected (HTTP status 302) to real file address: https://codeload.github.com/shakiba/planck.js/zip/master. In response headers of the first one we can check redirect location:



Cellular automaton #1 – Intro

Hello again! Week is ending soon almost finished, it is time for a second post.

I wanted to keep some schedule for posts publishing or at least for one, but I’m afraid this is impossible at the moment. Simply I’m not used to this and I had to handle something else over the week.

About me

I didn’t introduce myself before so let me do it quickly now.
I am a young programmer that recently started his career as a web developer. Before that I was studying computer science. Generally my main interests were always around computers, PC games, software,  Internet and how it all works. My language of choice is Ruby, which I learned while doing final project in the college. Currently I’m working as a full time back-end developer using Ruby (mostly Ruby on Rails), Elixir and JavaScript.

About project

After very long thinking on what to do or what technology to use I’m going to do web application that will allow sort of playing with cellular automata (this is plural form, singular is: automaton). Ever heard of Game of life? If not then it is actually a two-dimensional cellular automaton. The topic itself is very well described here.

Maybe it isn’t very ambitious but now I just want to have some fun and do something in the fairly comfortable environment for me. Basic implementation  (1-D cellular automaton specifically) can be done in one evening – I guess, as it’s just algorithm with input and output. However there are many variants and visualization is another thing. If I will finish early, then I can add more features that I already thought about.


Why web app? Clearly there won’t be any advanced calculations and there is no need for persistence so using server in this case seems like big overkill. All stuff could be done on client side. I’m not sure yet about all features and if I will need database, then there is no problem with adding it.

Last details: I will start with Sinatra framework, application will be deployed with nanobox (first time trying out this platform). Later I will try to extract cellular automata logic to a gem (which is Ruby library or package).

Next part: Initial setup.




As a developer I want to have a blog

Is this thing on? OK then…

Hello World, because now is a good moment to finally start writing a blog. Something that was at the back of my head for some time now. I created this WordPress account about 2 years ago with 1 draft post which was never published. No excuses this time. Why?

Get Noticed!

Currently we have on-going contest for programmers in Poland, it’s original name is Daj Się Poznać, which translates to “Get noticed”. Here is the main page. General rules and challenges are:

  • developing an open source project on GitHub
  • writing blog posts along with it (2 times weekly)
  • do above activities for 3 months

The organizer is Maciej Aniserowicz, a well known man in the IT community. He is writing blog, doing podcast and many more things related to the programming world. Lately he started making daily vlogs on YouTube, which I find totally epic. I also watch his snapchat, it’s really funny sometimes, I think this is the thing that motivated me the most to take part in this great event, so I recommend it.


Currently the are more than 700 people registered in the contest and it’s already 2 times more than in last year edition. This is the big list of all participants.

Before registering I had to decide on blogging platform and subject of the project (more on this later). I postponed it to the last day and I hit the submit button in the last minute. Fortunately registration period was extended to 12 March so I can still update my profile.

Most of us doesn’t like to do something difficult for free and I feel it will be a huge challenge for me to the very end, but I need to try. Besides chance on winning great prizes I pointed out priceless profits that I and other developers can gain for sure:

  • writing training (bonus points if it’s english)
  • publishing side project on GitHub
  • presentation of skills learned up to now
  • self development
  • leaving so called “comfort zone”
  • getting noticed, obviously

That’s all for now. Good luck, have fun. See you later 🙂