<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michał `fazibear` Kalbarczyk on Medium]]></title>
        <description><![CDATA[Stories by Michał `fazibear` Kalbarczyk on Medium]]></description>
        <link>https://medium.com/@fazibear?source=rss-8a3ff09977a7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zx50N9vUHU2RPobzeeu1Nw.png</url>
            <title>Stories by Michał `fazibear` Kalbarczyk on Medium</title>
            <link>https://medium.com/@fazibear?source=rss-8a3ff09977a7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 19:33:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fazibear/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sprint Poker — Free Agile Estimating Tool]]></title>
            <link>https://medium.com/elpassion/sprint-poker-free-agile-estimating-tool-b8ff00d53e48?source=rss-8a3ff09977a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ff00d53e48</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[sprint]]></category>
            <category><![CDATA[project-estimating]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[agile-development]]></category>
            <dc:creator><![CDATA[Michał `fazibear` Kalbarczyk]]></dc:creator>
            <pubDate>Thu, 22 Oct 2015 13:24:28 GMT</pubDate>
            <atom:updated>2016-12-19T20:35:45.862Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://sprintpoker.io/">Sprint Poker</a> is the new and completely free tool for Agile estimating. With its help you will plan tickets with your team quickly and efficiently. You don’t even have to register to start using it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*LHHliKnn2_uOkIt6yoPxfg.jpeg" /><figcaption><a href="http://sprintpoker.io/">Sprint Poker</a> is the new and completely free tool that will help you will plan tickets with your team quickly and efficiently.</figcaption></figure><p>All you need to do is type in the session name and your nickname. To invite other team members, you simply send them a link to your session and that’s it. After adding tickets you can start estimating.</p><h4>What Makes It Special For Me</h4><figure><img alt="sprintpoker_start" src="https://cdn-images-1.medium.com/max/300/0*exYZTFnPKqsE9OLH.png" /></figure><p><a href="http://sprintpoker.io/">Sprint Poker</a> is the application that I always wanted to create. Here’s what makes me proud of it:</p><ul><li>Asynchronous communication between client and server.</li><li>Modern React based frontend.</li><li>Elixir powered backend on the top of Erlang VM.</li><li>Every single thing makes this application cool.</li></ul><p>We want to share our experience and open source it. You can <a href="https://github.com/elpassion/sprint-poker">check it out</a> and run it. If you’ll find any bug, report an issue or create pull request please!</p><h4>Technical Background</h4><h4>Long time ago</h4><p>When client’s side application became real and websocket connection became standard I really wanted to make communication between client and server asynchronous. I didn’t want to request server just to check if something changed and wait for a response. With websocket it’s quite easy. Both sides can push messages and listen to them. To update user client, you simply send “user:update” message and … that’s it. When server updates it, it sends “user” message with current user. Also when some background job updates it, server sends it too. Client simply waits for the message and when it arrives, it changes stored data. A perfect solution for Sprint Poker.</p><figure><img alt="sprint poker dashboard" src="https://cdn-images-1.medium.com/max/1024/0*ScZcsqQ3uSrBlDup.png" /></figure><h4>Phoenix and Elixir</h4><p>Rails is a great framework, but not so asynchronous. For websocket thing node.js is doing better. But I don’t want to write a lot of javascript. Seriously.<br>Recently Elixir has reached 1.0 version. Elixir is a Ruby like functional language on top of Erlang VM. With Phoenix Framework they’re a great tandem. They give you speed and maintainability at once. This is a very good choice for websocket backend. Especially when you like Ruby.</p><h4>React</h4><p>There are a lot of frontend frameworks. Angular, Ember.js, React. They’ve passed a long way to become what they are now. But for Sprint Poker I needed something small that fits into small asynchronous application. React was a bullseye. Of course React is only a view layer, but with Reflux it’s a really powerful tool. Stores, actions and components — it’s all there. Actions change a state, components render a state and can invoke actions. Pretty simple. But wait, there’s a one catch. A websocket.<br>We need to change a state, when websocket message comes in. No problem. Store implements websocket communication and updates it when messages arrive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ff00d53e48" width="1" height="1" alt=""><hr><p><a href="https://medium.com/elpassion/sprint-poker-free-agile-estimating-tool-b8ff00d53e48">Sprint Poker — Free Agile Estimating Tool</a> was originally published in <a href="https://medium.com/elpassion">EL Passion Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Playing with Phoenix Framework — Rails’ younger brother]]></title>
            <link>https://medium.com/elpassion/playing-with-phoenix-framework-rails-younger-brother-ee1d55d63f14?source=rss-8a3ff09977a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee1d55d63f14</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[phoenix]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Michał `fazibear` Kalbarczyk]]></dc:creator>
            <pubDate>Tue, 28 Jul 2015 14:58:44 GMT</pubDate>
            <atom:updated>2016-12-19T20:34:09.277Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you heard about <a href="http://phoenixframework.org/">Phoenix</a>? It’s a new web framework written in <a href="http://elixir-lang.org/">Elixir</a> language. And Elixir itself is a <a href="https://www.ruby-lang.org/">Ruby</a> inspired language that runs on <a href="http://www.erlang.org/">Erlang</a> Virtual Machine. Yes, a lot of ties and references, but we are all one big family here, aren’t we?</p><p>Let’s see how closely related are <a href="http://phoenixframework.org/">Phoenix</a> and <a href="http://rubyonrails.org/">Rails</a>. We’ll do it all from scratch on OS X, with some help from <a href="http://brew.sh/">Homebrew</a> package manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*O69pxWd-poMoaqJmkLdAkw.jpeg" /></figure><h4>The Environment</h4><p>We’ll start with installing both languages that the frameworks rely on. Just like Ruby, Elixir already has several version managers to choose from, like <a href="https://github.com/mururu/exenv">exenv</a> and <a href="http://taylor.github.io/kiex/">kiex</a>. But we won’t use them for the sake of simplicity.</p><p>Ruby installation:</p><pre>$ brew install ruby</pre><p>Elixir installation:</p><pre>$ brew install elixir</pre><p>Next thing we need is a package manager. Just like Ruby has its <a href="https://rubygems.org/">Gems</a>, Elixir’s package manager is called <a href="https://hex.pm/">Hex</a>. Equivalent for Ruby’s Rake is Elixir’s Mix. Hex + Mix combined give us Ruby’s Bundler dependencies management functionality.</p><p>So we use Mix task to install Hex package manager:</p><pre>$ mix local.hex</pre><h4>The Foundation</h4><p>We don’t do it often, so let’s recall how to install the Rails framework:</p><pre>$ gem install rails</pre><p>Phoenix framework installation is no harder:</p><pre>$ mix archive install phoenix</pre><p>We’re ready to create a new application. In Rails it’s nothing more than running everyone’s most beloved command:</p><pre>$ rails new railsapp</pre><p>The command created new app with its directory structure, and then Bundler downloaded and installed all dependencies.</p><p>Let’s see how Phoenix deals with the task:</p><pre>$ mix phoenix.new phoenixapp</pre><p>Wow! New application created, dependencies downloaded. Beautiful.</p><p>To test our sample application we have to start a web server.</p><p>A Rails server:</p><pre>$ rails server</pre><p>And Phoenix server:</p><pre>$ mix phoenix.server</pre><h4>GET /hello_phoenix</h4><p>Both frameworks are MVC based, so our main building blocks are models, views and controllers. Just like Rails, Phoenix has generators for those:</p><pre>$ rails generate model</pre><p>vs.</p><pre>$ mix phoenix.gen.model</pre><p>…but this is the easy way. I want to compare how to add the base features by hand, just to figure out the differences.</p><p>We’ll create sample page displaying a welcome message.</p><p>First things first, we’ll add a route for it. With Rails, we create new route by editing config/routes.rb file:</p><pre>Rails.application.routes.draw do<br>  get &#39;/hello&#39; =&gt; &#39;hello#index&#39;<br>end</pre><p>In Phoenix we have web/router.ex:</p><pre>defmodule Phoenixapp.Router do<br>  use Phoenixapp.Web, :router<br>  ...<br>  scope &quot;/&quot;, Phoenixapp do<br>    pipe_through :browser # Use the default browser stack<br>    get &quot;/hello&quot;, HelloController, :index<br>  end<br>end</pre><p>Now, controllers time!</p><p>Within Rails app create app/controllers/hello_controller.rb file:</p><pre>class HelloController &lt; ApplicationController<br>  def index<br>    @text = &#39;Hello from Controller&#39;<br>  end<br>end</pre><p>Within Phoenix create web/controllers/hello_controller.ex file:</p><pre>defmodule Phoenixapp.HelloController do<br>  use Phoenixapp.Web, :controller</pre><pre>def index(conn, _params) do<br>    conn |&gt; render &quot;index.html&quot;, text: &quot;Hello from Controller&quot;<br>  end<br>end</pre><p>For the view we’ll use Rails’ erb and Elixir’s equivalent: eex.</p><p>For Rails we only need to create one file: app/views/hello/index.html.erb</p><pre>&lt;h1&gt;&lt;%= @text %&gt;&lt;/h1&gt;</pre><p>Phoenix requires us to create a view module beside the template. It’s (more or less) like a view helper in Rails. It will sit in web/views/hello_view.ex:</p><pre>defmodule Phoenixapp.HelloView do<br>  use Phoenixapp.Web, :view<br>end</pre><p>The accompanying template file will be web/templates/hello/index.html.eex:</p><pre>&lt;h1&gt;&lt;%= @text %&gt;&lt;/h1&gt;</pre><p>Run servers once again. Go to the browser, type http://localhost:3000/hello for Rails and http://localhost:4000/hello for Phoenix. It just works! Do you have this feeling again?</p><h4>Rising from the ashes</h4><p>Who doesn’t like benchmarks and numbers? So here they are. Rails app was benchmarked with Passenger in production environment. Phoenix app was running with built-in cowboy server. The machine was Macbook Pro (2014, 2.6GHz i5, 8GB RAM).</p><p>Rails:</p><pre>$ passenger start -e production<br>$ wrk -c100 -d10s <a href="http://localhost:3000/hello/">http://localhost:3000/hello/</a></pre><pre>Running 10s test @ <a href="http://localhost:3000/hello/">http://localhost:3000/hello/</a><br>  2 threads and 100 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency   143.47ms   21.31ms 295.32ms   91.25%<br>    Req/Sec   346.55     39.50   440.00     74.50%<br>  6927 requests in 10.05s, 8.96MB read<br>Requests/sec:    689.55<br>Transfer/sec:      0.89MB</pre><p>Phoenix:</p><pre>$ MIX_ENV=prod mix compile.protocols<br>$ MIX_ENV=prod PORT=4001 elixir -pa _build/prod/consolidated -S mix phoenix.server<br>$ wrk -c100 -d10s <a href="http://localhost:4001/hello/">http://localhost:4001/hello/</a></pre><pre>Running 10s test @ <a href="http://localhost:4001/hello/">http://localhost:4001/hello/</a><br>  2 threads and 100 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency    16.73ms    3.78ms  78.27ms   91.46%<br>    Req/Sec     3.02k   290.98     3.58k    83.00%<br>  60097 requests in 10.01s, 72.67MB read<br>Requests/sec:   6003.29<br>Transfer/sec:      7.26MB</pre><p>Note that it is just a simple benchmark with empty controller. You have been warned :)</p><p>Oh, there is one important thing. Phoenix is Elixir, and Elixir is not Ruby. It looks a lot like Ruby but there are differences.</p><p>What else? In both frameworks’ controllers we have a params hash to manage url params. Error pages are very similar. There are more equalities. Asking for models? Rails has <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html">ActiveRecord</a>, Phoenix has <a href="http://www.phoenixframework.org/docs/ecto-models">ecto</a>. Both support various database drivers, tasks for managing the database and its schema through migrations. Both frameworks ship with built-in testing frameworks.</p><p>If you know Rails, you already are familiar with Phoenix. It is still very young, so you have the chance to be an early adopter, and I highly encourage you to play with it while it’s hot!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee1d55d63f14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/elpassion/playing-with-phoenix-framework-rails-younger-brother-ee1d55d63f14">Playing with Phoenix Framework — Rails’ younger brother</a> was originally published in <a href="https://medium.com/elpassion">EL Passion Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opal on Rails: Replacing CoffeeScript with client-side Ruby]]></title>
            <link>https://medium.com/elpassion/opal-on-rails-replacing-coffeescript-with-client-side-ruby-b362118c7e02?source=rss-8a3ff09977a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b362118c7e02</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[opal]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Michał `fazibear` Kalbarczyk]]></dc:creator>
            <pubDate>Tue, 30 Jun 2015 13:44:29 GMT</pubDate>
            <atom:updated>2016-12-19T20:35:18.691Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://coffeescript.org/">CoffeeScript</a> is one of the best things that happened to JavaScript. With its clear, easy to read, semicolon-less syntax, it feels almost like Ruby. Almost…</p><p>There has been a lot of discussion about isomorphic app development, where both server and client-side parts are written in the same language. One of the most mature and popular attempts to enable isomorphic development in Ruby is <a href="http://opalrb.org/">Opal</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Xq2qkRmU_jcppFnVm6u9_g.jpeg" /></figure><p>In this article I’ll show you how easy it is to start writing your client-side scripts in Ruby. Right here, right now, with no excuses! :)</p><h4>Merging two worlds with opal-rails</h4><p>First, let’s install opal-rails gem:</p><pre>$ gem install opal-rails</pre><p>This gem enables us to generate new Rails application with Opal support (note the — javascript=opal option):</p><pre>$ rails new opal-on-rails --javascript=opal</pre><p>When bundle is complete we’re ready to start. Let’s create a controller for manipulating Colors:</p><pre>$ cd opal-on-rails<br>$ rails g controller Colors</pre><p>Then add it to config/routes.rb as a root:</p><pre>Rails.application.routes.draw do<br>  root &#39;colors#index&#39;<br>end</pre><p>Now it’s time for some HTML. Create a view app/views/colors/index.erb:</p><pre>&lt;h1&gt;Hello Opal&lt;/h1&gt;<br>&lt;p&gt;This is simple Opal application&lt;/p&gt;</pre><p>Launch the server and open <a href="http://localhost:3000/">http://localhost:3000</a> in your browser.</p><pre>$ rails s</pre><h4>First encounter</h4><p>Until now we saw nothing fancy, nothing more than some standard Rails bootstrap app. But take a look at what the controller generator created in app/assets/javascripts/colors_view.js.rb!</p><pre>class ColorsView<br>  def initialize(selector = &#39;body.controller-colors&#39;, parent = Element)<br>    @element = parent.find(selector)<br>    setup<br>  end<br>  attr_reader :element</pre><pre>def setup<br>    # Put here the setup for the view behavior<br>    say_hello_when_a_link_is_clicked<br>  end</pre><pre>def say_hello_when_a_link_is_clicked<br>    all_links.on :click do |event|<br>      # Use prevent_default to stop default behavior (as you would do in jQuery)<br>      # event.prevent_default</pre><pre>puts &quot;Hello! (You just clicked on a link: #{event.current_target.text})&quot;<br>    end<br>  end</pre><pre>private</pre><pre>def all_links<br>    @all_links ||= element.find(&#39;a&#39;)<br>  end<br>end</pre><p>It’s a nice piece of pure Ruby code that logs all clicked links to the browser console. Yup, a <em>real</em> Ruby script that works in a browser!</p><p>To see what Opal will generate from this Ruby code, checkout <a href="http://opalrb.org/try/?code:class%20ColorsView%0A%20%20def%20initialize(selector%20%3D%20%27body.controller-colors%27%2C%20parent%20%3D%20Element)%0A%20%20%20%20%40element%20%3D%20parent.find(selector)%0A%20%20%20%20setup%0A%20%20end%0A%20%20attr_reader%20%3Aelement%0A%20%0A%20%20def%20setup%0A%20%20%20%20%23%20Put%20here%20the%20setup%20for%20the%20view%20behavior%0A%20%20%20%20say_hello_when_a_link_is_clicked%0A%20%20end%0A%20%0A%20%20def%20say_hello_when_a_link_is_clicked%0A%20%20%20%20all_links.on%20%3Aclick%20do%20%7Cevent%7C%0A%20%20%20%20%20%20%23%20Use%20prevent_default%20to%20stop%20default%20behavior%20(as%20you%20would%20do%20in%20jQuery)%0A%20%20%20%20%20%20%23%20event.prevent_default%0A%20%0A%20%20%20%20%20%20puts%20%22Hello!%20(You%20just%20clicked%20on%20a%20link%3A%20%23%7Bevent.current_target.text%7D)%22%0A%20%20%20%20end%0A%20%20end%0A%20%0A%20%0A%20%20private%0A%20%0A%20%20def%20all_links%0A%20%20%20%20%40all_links%20%7C%7C%3D%20element.find(%27a%27)%0A%20%20end%0Aend">Try Opal</a> online Opal-JS compiler.</p><p>To make the script work, we need to edit our template. Open app/views/layouts/application.html.erb, find body tag and edit it:</p><pre>&lt;body class=&quot;controller-&lt;%= controller_name %&gt;&quot;&gt;</pre><p>We also want to initialize ColorsView when the document is loaded. Remember jQuery? rails-opal supports it. At the end of the file just add:</p><pre>Document.ready? do<br>  ColorsView.new<br>end</pre><p>Looks familiar, right?</p><p>The last thing is to add some links to our template, and we’re ready to test the script. Edit app/views/colors/index.erb:</p><pre>&lt;a href=&quot;#&quot;&gt;Click me!&lt;/a&gt;</pre><p>Does it work? Of course it does. It’s Ruby :) After clicking on a link we’ll see our JavaScript console flooded with Hello! (You just clicked on a link: Click me!) messages. Perfect.</p><h4>Digging deeper</h4><p>Want more? Let’s create some fancier client-side Ruby thing: add links that will change the header color on click.</p><p>Add links section to the template:</p><pre>&lt;section&gt;<br>  &lt;h3&gt;Change header color to:&lt;/h3&gt;<br>  &lt;ul&gt;<br>    &lt;li&gt;&lt;a href=&quot;#&quot; data-color=&quot;red&quot;&gt;red&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;#&quot; data-color=&quot;green&quot;&gt;green&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;#&quot; data-color=&quot;blue&quot;&gt;blue&lt;/a&gt;&lt;/li&gt;<br>  &lt;/ul&gt;<br>&lt;/section&gt;</pre><p>Create another method in ColorsView:</p><pre>def change_header_color_when_a_link_is_clicked<br>    all_links.on :click do |event|<br>      event.prevent_default<br>      Element[&#39;h1&#39;].css &#39;color&#39;, event.current_target.data(&#39;color&#39;)<br>    end<br>  end</pre><p>Change setup method:</p><pre>def setup<br>    # Put here the setup for the view behavior<br>    # say_hello_when_a_link_is_clicked<br>    change_header_color_when_a_link_is_clicked<br>  end</pre><p>And we’re done. Refresh the browser and have fun playing with your isomorphic Ruby app :)</p><h4>Any color you like, as long as it’s ruby</h4><p><a href="http://opalrb.org/">Opal</a> is a fully featured Ruby implementation, including both corelib and stdlib. You have your much loved blocks, iterators, even method_missing is here! The more I use it, the more I love it. It’s like discovering Ruby again!</p><p>The project itself is moving forward pretty fast. The codebase is tested against RubySpec to make Opal as compatible with MRI as possible. There are still some bugs and glitches, but still it’s worth the try. Version 0.8 is around the corner, with working <a href="http://blog-backup.elpassion.com/opal-on-rails-coffeescript-ruby/opal%20source%20map">source maps</a> and lots of bug fixes.</p><p>What about support for native JavaScript libraries? Well, it’s not that simple like with CoffeeScript. You have to write a wrapper or include pure JavaScript code within backticks (just like executing shell commands in Ruby), although most popular jQuery code works out of the box.</p><p>How do you like the idea of writing client-side Ruby? Do you think Opal can replace CoffeeScript? Should it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b362118c7e02" width="1" height="1" alt=""><hr><p><a href="https://medium.com/elpassion/opal-on-rails-replacing-coffeescript-with-client-side-ruby-b362118c7e02">Opal on Rails: Replacing CoffeeScript with client-side Ruby</a> was originally published in <a href="https://medium.com/elpassion">EL Passion Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>