<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://austenmadden.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://austenmadden.com/" rel="alternate" type="text/html" /><updated>2026-07-14T15:21:26+00:00</updated><id>https://austenmadden.com/feed.xml</id><title type="html">Austen Madden</title><entry><title type="html">Better IRB experience for Rails developers</title><link href="https://austenmadden.com/irb/ruby/rails/ruby-on-rails/2024/05/08/better-irb-experience-for-rails-developers.html" rel="alternate" type="text/html" title="Better IRB experience for Rails developers" /><published>2024-05-08T13:22:57+00:00</published><updated>2024-05-08T13:22:57+00:00</updated><id>https://austenmadden.com/irb/ruby/rails/ruby-on-rails/2024/05/08/better-irb-experience-for-rails-developers</id><content type="html" xml:base="https://austenmadden.com/irb/ruby/rails/ruby-on-rails/2024/05/08/better-irb-experience-for-rails-developers.html"><![CDATA[<p>I’ve been using irb sessions on the terminal for a long time to explore the Ruby language. Sometimes
for larger Rails apps I’ll also use it to test Ruby-isms that fall into more edge case territory
rather than the Rails console due to general bootup time.</p>

<p>However, a common gotcha that impacts all Rails developers is the differences between the standard
Ruby library and Rails provided behaviors such as ActiveSupport. This can derail (pun intended) this
use case. However, there’s an easy work around to that! Simply require ActiveSupport.</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">require</span> <span class="s1">'active_support/all'</span>

<span class="c1"># Can also selectively load only the parts of ActiveSupport you need.</span>
<span class="c1"># For example string extensions:</span>
<span class="nb">require</span> <span class="s1">'active_support/core_ext/string'</span>
</code></pre></div></div>

<p>If you’d like to make this behavior optional you could always define it in a method and call it
when you need it.</p>

<h4 id="on-demand-activesupport-example">On Demand ActiveSupport Example</h4>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">load_active_support</span>
  <span class="nb">require</span> <span class="s1">'active_support/all'</span>
<span class="k">end</span>

<span class="n">load_active_support</span>
</code></pre></div></div>

<h4 id="on-demand-activemodel-example">On Demand ActiveModel Example</h4>

<p>This could extend to other Rails provided  as well.</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">load_active_model</span>
  <span class="nb">require</span> <span class="s1">'active_model'</span>

  <span class="c1"># Most parts of rails provide `eager_load!` method to load eager loaded classes.</span>
  <span class="c1"># May or may not be  necessary depending on your use case.</span>
  <span class="no">ActiveModel</span><span class="p">.</span><span class="nf">eager_load!</span>
<span class="k">end</span>

<span class="n">load_active_model</span>
</code></pre></div></div>

<h4 id="the-irbrc-file">The “.irbrc” file</h4>

<p>To make these methods always available create a <code class="language-plaintext highlighter-rouge">.irbrc</code> file in your home directory (for example
run <code class="language-plaintext highlighter-rouge">touch ~/.irbrc</code>) and include the examples above. Your irb session will now have these methods
available automatically!</p>]]></content><author><name></name></author><category term="irb" /><category term="ruby" /><category term="rails" /><category term="ruby-on-rails" /><summary type="html"><![CDATA[I’ve been using irb sessions on the terminal for a long time to explore the Ruby language. Sometimes for larger Rails apps I’ll also use it to test Ruby-isms that fall into more edge case territory rather than the Rails console due to general bootup time.]]></summary></entry><entry><title type="html">Ruby Set#include? vs bitwise &amp;amp; benchmark</title><link href="https://austenmadden.com/ruby/performance/2020/09/07/set-include-vs-bitwise-and.html" rel="alternate" type="text/html" title="Ruby Set#include? vs bitwise &amp;amp; benchmark" /><published>2020-09-07T16:22:57+00:00</published><updated>2020-09-07T16:22:57+00:00</updated><id>https://austenmadden.com/ruby/performance/2020/09/07/set-include-vs-bitwise-and</id><content type="html" xml:base="https://austenmadden.com/ruby/performance/2020/09/07/set-include-vs-bitwise-and.html"><![CDATA[<p>I was reviewing some code recently which included <code class="language-plaintext highlighter-rouge">Set#include?</code>. I was curious about the
performance implications of <code class="language-plaintext highlighter-rouge">Set#include?</code> vs <code class="language-plaintext highlighter-rouge">Enumerable#include?</code> which can be <em>MUCH</em> slower than
say a bitwise <code class="language-plaintext highlighter-rouge">&amp;</code> and wanted to test it out.</p>

<h2 id="benchmark">Benchmark</h2>

<script src="https://gist.github.com/austenmadden/24c77205c119638a776741334c953c55.js"></script>

<p>As you can see <code class="language-plaintext highlighter-rouge">Set#include?</code> is quite fast. The reason is <code class="language-plaintext highlighter-rouge">Set</code> maintains a hash object
representing the <code class="language-plaintext highlighter-rouge">Set</code>. <a href="https://github.com/ruby/ruby/blob/b7d86e330c76b4f9615511307e1c40f4f2937c83/lib/set.rb#L243-L245">It checks against it for inclusion, making the operation
constant.</a></p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mo">014</span><span class="p">:</span><span class="mi">0</span><span class="o">&gt;</span> <span class="no">Set</span><span class="p">.</span><span class="nf">new</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">]).</span><span class="nf">instance_variable_get</span><span class="p">(</span><span class="s1">'@hash'</span><span class="p">)</span>
<span class="o">=&gt;</span> <span class="p">{</span><span class="mi">1</span><span class="o">=&gt;</span><span class="kp">true</span><span class="p">,</span> <span class="mi">2</span><span class="o">=&gt;</span><span class="kp">true</span><span class="p">,</span> <span class="mi">3</span><span class="o">=&gt;</span><span class="kp">true</span><span class="p">,</span> <span class="mi">4</span><span class="o">=&gt;</span><span class="kp">true</span><span class="p">}</span>
</code></pre></div></div>]]></content><author><name></name></author><category term="ruby" /><category term="performance" /><summary type="html"><![CDATA[I was reviewing some code recently which included Set#include?. I was curious about the performance implications of Set#include? vs Enumerable#include? which can be MUCH slower than say a bitwise &amp; and wanted to test it out.]]></summary></entry><entry><title type="html">Getting Started with Azure ML</title><link href="https://austenmadden.com/azure/machine-learning/ruby/2018/01/13/azure-ml-web-service.html" rel="alternate" type="text/html" title="Getting Started with Azure ML" /><published>2018-01-13T16:22:57+00:00</published><updated>2018-01-13T16:22:57+00:00</updated><id>https://austenmadden.com/azure/machine-learning/ruby/2018/01/13/azure-ml-web-service</id><content type="html" xml:base="https://austenmadden.com/azure/machine-learning/ruby/2018/01/13/azure-ml-web-service.html"><![CDATA[<p>Recently I attended <a href="http://www.codemash.org/">Codemash</a> for my second time. It’s a great conference that offers talks on a range of subjects. This year I gravitated towards Machine Learning sessions, embracing a hype train superseded only by this year’s Blockchain fad. Codemash has it’s roots in the .NET community and unsurprisingly many of the Machine Learning talks showcased some of Microsoft Azure’s related capabilities.</p>

<p>While I’m primarily interested in understanding the practice of Data Science, some of the tools I saw showed promise for delivering value quickly/reducing the effort required by some of the more menial tasks related to large data sets.</p>

<h2 id="azure-ml-studio">Azure ML Studio</h2>

<p>The first thing you’ll notice once you’ve setup an account with <a href="https://studio.azureml.net">Azure ML Studio</a> is that it has a somewhat daunting GUI interface with many options depending on what you are trying to accomplish (much like it’s other Azure counterparts). Fortunately Microsoft saw fit to equip it with a robust tutorial and many example projects.</p>

<p>Its most useful feature provides a GUI tool to construct a flow chart of models and data transformations (called an experiment) to solve various problems and build a practical machine learning solution. You are also able to drop down into Python or R to solve various tasks if you so choose. Additionally, it has support for notebooks if that is your preference. What I wanted to focus on in this post was the ability to setup a web service based on a model built in ML Studio.</p>

<p><img src="/img/azure-ml.png" alt="Web Service Example" style="width: 740px;" /></p>

<p>Through the interface you can setup a web service that exposes your model via a http endpoint accepting a JSON payload. Below is an example of an API call to the above model using ruby and the HTTParty gem!</p>

<h2 id="ruby-api-call-example">Ruby API Call Example</h2>

<script src="https://gist.github.com/austenmadden/adab728646bb097601c4c3735f55b539.js"></script>

<p>That’s all you need to make a valid API call. Additionally there is an API for batch calls. Still learning the ropes of the platform but so far it seems to ease the delivery of useful Data Science. There are quite a few things I’d desire before using this concept in a production environment, but for quick experimentation it’s hard to beat!</p>]]></content><author><name></name></author><category term="azure" /><category term="machine-learning" /><category term="ruby" /><summary type="html"><![CDATA[Recently I attended Codemash for my second time. It’s a great conference that offers talks on a range of subjects. This year I gravitated towards Machine Learning sessions, embracing a hype train superseded only by this year’s Blockchain fad. Codemash has it’s roots in the .NET community and unsurprisingly many of the Machine Learning talks showcased some of Microsoft Azure’s related capabilities.]]></summary></entry><entry><title type="html">Why I made this blog</title><link href="https://austenmadden.com/jekyll/blog/design/web/2017/05/07/lessons-from-a-personal-site.html" rel="alternate" type="text/html" title="Why I made this blog" /><published>2017-05-07T06:22:57+00:00</published><updated>2017-05-07T06:22:57+00:00</updated><id>https://austenmadden.com/jekyll/blog/design/web/2017/05/07/lessons-from-a-personal-site</id><content type="html" xml:base="https://austenmadden.com/jekyll/blog/design/web/2017/05/07/lessons-from-a-personal-site.html"><![CDATA[<p>A while back I started messing with my <a href="https://github.com/austenmadden/austenmadden.me">personal site</a> again. I had always wanted to use a framework like <a href="https://jekyll.com">Jekyll</a> to create a simple blog, but had never got around to doing so. After a bit of design work (wanting to try something different), I reached out to some co-workers for feedback on my latest iteration. One coworker asked why I was even updating my personal site.</p>

<p>After all, who looks at them these days? Most everyone who writes content regularly seems to be using services like <a href="https://medium.com/">Medium</a>, and if your audience is friends and co-workers, why not just write content on a platform they’re familiar with such as Facebook, Twitter, etc. I think the mistake in this thought process is approaching the task as creating content for others; the chief audience should be yourself.</p>

<h4 id="well-why-should-i-be-the-audience">Well why should I be the audience?</h4>

<p>I currently work at <a href="https://covermymeds.com">CoverMyMeds</a> as a Rails Developer. In my day to day, I cover a wide spectrum of languages, frameworks, and concepts. I write front end React components, Rails/web app constructs (Controllers, models, and views), some SQL now and then, and even some meta programming from time to time. With so many different concepts, rarely do I get time to hone the basic tools that the web is built on.</p>

<p>When working on a personal project as straight forward as a static web site, all the usual things that take precedence disappear. Is this or that bit of code performant? Am I making the right abstractions? How do I solve this weird edge case that might break X for user Y on browser Z, 3 years from now? In the context of a simple static web site, you get the freedom to focus on your own needs.</p>

<p>When I first wrote my website, it was inspired by a bad interview. I rambled on and on trying to explain why I was qualified for a position centered on front end web development. The important detail being I had never written a single line of Javascript, and at best 50 lines of CSS. Unsurprisingly, I went home without a job.</p>

<p>From that experience I started a simple site hosted on <a href="https://pages.github.com/">Github pages</a>. I was able to learn the basics of Javascript, making some JQuery soup, and construct a passable site. Eventually these skills helped me in my first development role (luckily for me a way better deal than the interview I messed up), my senior capstone project at Ohio State, and finally in my current position at CoverMyMeds.</p>

<p>In this latest iteration, I’ve gotten to learn about Jekyll, mess around with Gem development (Jekyll theme), play with some SCSS (vs. the older SASS standard I have used in the past), and mess around with Heroku configuration because Github Pages do not support custom Jekyll themes and I needed a new host :(.</p>

<h4 id="okay-i-get-the-idea-why-does-this-only-apply-to-personal-sites">Okay, I get the idea. Why does this only apply to personal sites?</h4>

<p>Well, it doesn’t. Any personal project is a great way to learn and become familiar with new ideas. A personal site is just my favorite kind! If you are a web developer, having a small space on the web somewhere to call your own is a great way to establish an identity. It can be a simple static page with some contact info, a blog like the one I have now, or even a full blown web app. At the end of the day, hopefully you’ll have practiced some old skills, learned something new, and most importantly had some fun!</p>

<p>And if you did a good job, others might enjoy it too!</p>]]></content><author><name></name></author><category term="jekyll" /><category term="blog" /><category term="design" /><category term="web" /><summary type="html"><![CDATA[A while back I started messing with my personal site again. I had always wanted to use a framework like Jekyll to create a simple blog, but had never got around to doing so. After a bit of design work (wanting to try something different), I reached out to some co-workers for feedback on my latest iteration. One coworker asked why I was even updating my personal site.]]></summary></entry><entry><title type="html">Cool, well now that I have a blog…</title><link href="https://austenmadden.com/jekyll/update/2017/04/09/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Cool, well now that I have a blog…" /><published>2017-04-09T02:22:57+00:00</published><updated>2017-04-09T02:22:57+00:00</updated><id>https://austenmadden.com/jekyll/update/2017/04/09/welcome-to-jekyll</id><content type="html" xml:base="https://austenmadden.com/jekyll/update/2017/04/09/welcome-to-jekyll.html"><![CDATA[<p>TODO: Figure out how to write good content.</p>]]></content><author><name></name></author><category term="jekyll" /><category term="update" /><summary type="html"><![CDATA[TODO: Figure out how to write good content.]]></summary></entry></feed>