<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title type="html">Javier Julio</title>
  <subtitle>A Brooklyn based full stack developer with an eye for design and details. Currently, designing, building and automating solutions at Jackpocket in NYC.</subtitle>
  <id>https://javierjulio.com/feed.xml</id>
  <link href="https://javierjulio.com/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="https://javierjulio.com" rel="alternate" type="text/html"/>
  <icon>https://javierjulio.com/assets/logo-6948cfaf.svg</icon>
  <generator uri="https://sitepress.cc" version="5.0.0.beta1">Sitepress</generator>
  <updated>2026-03-09T20:45:43Z</updated>
    <entry>
      <title type="html">A Leap of Faith for my iPhone</title>
      <id>https://javierjulio.com/blog/a-leap-of-faith-for-my-phone</id>
      <link href="https://javierjulio.com/blog/a-leap-of-faith-for-my-phone" rel="alternate" type="text/html" title="A Leap of Faith for my iPhone"/>
      <published>2011-11-06</published>
      <updated>2011-11-06</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>With the outpouring over Steve Jobs recent passing I&#39;ve read some touching and moving stories. While I don&#39;t have any Steve run-ins or early Apple experiences to share I did have an incident with my iPhone a few years ago that reminded me of how much I love using that device and how important it is to me.</p>

<p>Whenever I&#39;m on the subway platform waiting I pull out my phone and start reading articles I have saved with Instapaper. One day I was rather careless and the phone slipped out of my hands. It fell on the edge of the platform and then on the tracks below.</p>

<p>For that second my heart sank but I knew better since I was near the end of the platform where their is a small gate into the tunnel. I figured from there I could walk on to the tracks, pick up my phone and come back the same way. One problem. The train was arriving in less than 2 minutes. I wouldn&#39;t make it back in time.</p>

<p>While that thought came to mind, two men just a few feet away had a better idea. They told me to jump. I didn&#39;t have much time. Did you honestly think I was going to leave my phone there? No way! So I jumped down onto the subway tracks, picked up my phone and the two men lifted me back up on the platform. Two complete strangers were kind enough to help without asking. I was very grateful.</p>

<p>What I left out though is that was an iPhone 3G. I have an iPhone 4 now. I dread finding out what crazy thing I&#39;ll do next if something happens to it. I love the iPhone. Thanks Steve.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Matching a format only Rails route</title>
      <id>https://javierjulio.com/blog/matching-a-format-only-rails-route</id>
      <link href="https://javierjulio.com/blog/matching-a-format-only-rails-route" rel="alternate" type="text/html" title="Matching a format only Rails route"/>
      <published>2014-01-09</published>
      <updated>2014-01-09</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>On a recent project I noticed several errors for an invalid route requested by a search bot where the URL looked something like:</p>
<pre class="highlight"><code>/people/123706399_571n.jpg
</code></pre>
<p>which in turn triggered the people show route that looks for:</p>
<pre class="highlight"><code>/people/123-full-name
</code></pre>
<p>Since the parsed value 123706399_571n isn&#39;t a valid person id we&#39;d be receiving about 4-5 daily errors in Airbrake.</p>

<p>I figured this should be easy enough to fix with a one line redirect in the routes config that after a week or so I could remove as the search bot would have picked up the redirect by then. Since the invalid URL is matching the people show route, I just duplicated that and added the necessary format specific properties below:</p>
<pre class="highlight"><code data-lang="ruby"><span class="n">get</span> <span class="s1">'people/:id'</span><span class="p">,</span>
  <span class="ss">format: </span><span class="kp">true</span><span class="p">,</span>
  <span class="ss">constraints: </span><span class="p">{</span> <span class="ss">format: </span><span class="sr">/(jpg|jpeg)/</span> <span class="p">},</span>
  <span class="ss">to: </span><span class="n">redirect</span><span class="p">(</span><span class="s2">"/people"</span><span class="p">)</span>

<span class="n">get</span> <span class="s1">'people/:id'</span> <span class="o">=&gt;</span> <span class="s1">'people#show'</span>
</code></pre>
<p>At first I just had the constraints hash since from my understanding I thought that was all that was needed. Testing proved otherwise as even a valid request for a person detail page would result in a redirect when it shouldn&#39;t. The reason is that <a href="https://github.com/rails/rails/issues/5548#issuecomment-5806078">Rails will match both versions of the route</a>, one with the format and the other without (which is the default) despite setting the format constraints. To avoid the behavior of the default route match we also set <code>format: true</code> so the redirect route is only applied if the URL has a jpg format.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Running Thin and Sass using a single Rake task</title>
      <id>https://javierjulio.com/blog/running-thin-and-sass-using-a-single-rake-task</id>
      <link href="https://javierjulio.com/blog/running-thin-and-sass-using-a-single-rake-task" rel="alternate" type="text/html" title="Running Thin and Sass using a single Rake task"/>
      <published>2012-05-17</published>
      <updated>2012-05-17</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>I&#39;ve been working with Sass lately on the <a href="https://myfdb.com">redesigned MyFDB</a> and figured would be good to learn how to implement it on my site where I use Sinatra.</p>

<p>Sinatra has the capability built in to process Sass but I wanted to compile the files locally so they don&#39;t have to be generated on each request. Since I&#39;m running a Thin server I needed to run a second process but without having to open a new Terminal tab to start it. Not only is it an unnecessary extra step, I was afraid I&#39;d forget to.</p>

<p>With Thin I found I can run it as a daemon and since I would be focusing on content and CSS updates, any Ruby related error output in Terminal wasn&#39;t vital. The trick is to start Thin first as a daemon and then the Sass watcher as it&#39;ll be the process that takes up that shell session. Once you quit (CTRL+C) a Rake task <code>server:stop</code> will run that terminates the Thin daemon and removes the <code>tmp</code> and <code>log</code> folders that Thin generated. Working <code>Rakefile</code>:</p>
<pre class="highlight"><code data-lang="ruby"><span class="nb">require</span> <span class="s1">'fileutils'</span>

<span class="n">namespace</span> <span class="ss">:server</span> <span class="k">do</span>

  <span class="n">desc</span> <span class="s2">"Starts the daemon Thin server and Sass watcher"</span>
  <span class="n">task</span> <span class="ss">:processes</span> <span class="k">do</span>
    <span class="nb">puts</span> <span class="s2">"Start Thin as a daemon and Sass normally"</span>

    <span class="nb">system</span> <span class="s2">"thin start -d"</span>
    <span class="nb">system</span> <span class="s2">"sass --watch assets/stylesheets:assets/stylesheets --style compressed"</span>
  <span class="k">end</span>

  <span class="n">desc</span> <span class="s2">"Stops the daemon Thin server"</span>
  <span class="n">task</span> <span class="ss">:stop</span> <span class="k">do</span>
    <span class="n">file</span> <span class="o">=</span> <span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s2">"tmp/pids/thin.pid"</span><span class="p">,</span> <span class="s2">"rb"</span><span class="p">)</span>
    <span class="n">process_id</span> <span class="o">=</span> <span class="n">file</span><span class="p">.</span><span class="nf">read</span>

    <span class="nb">puts</span> <span class="s2">"Stopping Thin server (process </span><span class="si">#{</span><span class="n">process_id</span><span class="si">}</span><span class="s2">)"</span>

    <span class="nb">system</span> <span class="s2">"kill </span><span class="si">#{</span><span class="n">process_id</span><span class="si">}</span><span class="s2">"</span>

    <span class="no">FileUtils</span><span class="p">.</span><span class="nf">remove_dir</span><span class="p">(</span><span class="s2">"log"</span><span class="p">)</span> <span class="k">if</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span> <span class="s2">"log"</span>
    <span class="no">FileUtils</span><span class="p">.</span><span class="nf">remove_dir</span><span class="p">(</span><span class="s2">"tmp"</span><span class="p">)</span> <span class="k">if</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span> <span class="s2">"tmp"</span>
  <span class="k">end</span>

  <span class="n">desc</span> <span class="s2">"Starts server at localhost:3000 with Sass enabled"</span>
  <span class="n">task</span> <span class="ss">:start</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="ss">:processes</span><span class="p">,</span> <span class="ss">:stop</span><span class="p">]</span> <span class="k">do</span>
    <span class="nb">puts</span> <span class="s2">"Bye!"</span>
  <span class="k">end</span>

<span class="k">end</span>
</code></pre>
<p>While I learned a lot from that approach it was a bit of a waste since the Foreman gem solves this problem and makes it super easy to implement. You just specify a unique name for each command (used as identifier for any command output in Terminal) in a <code>Procfile</code>. The following is what I use for my site:</p>
<pre class="highlight"><code>web: bundle exec shotgun --server=thin --port=3000
sass: bundle exec sass --watch assets/stylesheets:assets/stylesheets --style compressed
</code></pre>
<p>From there I just run <code>foreman start</code> and the gem handles the rest. I started off using Thin directly but switched to the Shotgun gem (which still uses Thin) as it reloads the entire Sinatra app on every request. If you ran the app with Thin directly you&#39;d have to restart the server anytime you make Ruby/Sinatra related changes.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Detect at runtime when XCode tests are running</title>
      <id>https://javierjulio.com/blog/detect-at-runtime-when-xcode-tests-are-running</id>
      <link href="https://javierjulio.com/blog/detect-at-runtime-when-xcode-tests-are-running" rel="alternate" type="text/html" title="Detect at runtime when XCode tests are running"/>
      <published>2014-12-05</published>
      <updated>2014-12-05</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>I&#39;ve been using a simple flag in Swift that detects if I&#39;m running tests so I can modify my AppDelegate all programmatically so I can safely run the app or run tests without having to change code. For the past month or so I&#39;ve been using something like the following in my AppDelegate:</p>
<pre class="highlight"><code data-lang="swift"><span class="kd">class</span> <span class="kt">AppDelegate</span><span class="p">:</span> <span class="kt">UIResponder</span><span class="p">,</span> <span class="kt">UIApplicationDelegate</span> <span class="p">{</span>

  <span class="kd">func</span> <span class="nf">application</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="kt">UIApplication</span><span class="p">,</span> <span class="n">didFinishLaunchingWithOptions</span> <span class="nv">launchOptions</span><span class="p">:</span> <span class="p">[</span><span class="kt">NSObject</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
    <span class="k">let</span> <span class="nv">runningTests</span> <span class="o">=</span> <span class="p">(</span><span class="kt">NSClassFromString</span><span class="p">(</span><span class="s">"XCTest"</span><span class="p">)</span> <span class="o">!=</span> <span class="kc">nil</span><span class="p">)</span>
    <span class="c1">// ...</span>
  <span class="p">}</span>

<span class="p">}</span>
</code></pre>
<p>This proved to work when running the app or tests in the simulator or building to a device.. until today. I spent hours debugging why this app I&#39;ve just setup with TestFlight was crashing at the launch image. I finally learned that <code>runningTests</code> line was the culprit. I tried other alternatives like how Artsy does in their <a href="https://github.com/artsy/eidolon">Eidolon app</a>. I updated my code to use that approach, uploaded a new binary and installed an update through TestFlight. That update showed that the device was executing that test environment specific code although we weren&#39;t running tests, the app is in a release state.</p>

<p>As a last resort I ported the <code>isRunningTests</code> approach in the <a href="https://www.objc.io/issue-1/testing-view-controllers.html">objc.io Testing View Controllers article</a> to Swift and included it in my app (the final code can be seen below). Thankfully after uploading the binary and installing the app from TestFlight it proved successful.</p>
<pre class="highlight"><code data-lang="swift"><span class="kd">class</span> <span class="kt">AppDelegate</span><span class="p">:</span> <span class="kt">UIResponder</span><span class="p">,</span> <span class="kt">UIApplicationDelegate</span> <span class="p">{</span>

  <span class="kd">func</span> <span class="nf">application</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="kt">UIApplication</span><span class="p">,</span> <span class="n">didFinishLaunchingWithOptions</span> <span class="nv">launchOptions</span><span class="p">:</span> <span class="p">[</span><span class="kt">NSObject</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
    <span class="k">if</span> <span class="nf">isRunningTests</span><span class="p">()</span> <span class="p">{</span>
      <span class="c1">// ..</span>
    <span class="p">}</span>
  <span class="p">}</span>

  <span class="kd">func</span> <span class="nf">isRunningTests</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
    <span class="k">let</span> <span class="nv">environment</span> <span class="o">=</span> <span class="kt">NSProcessInfo</span><span class="o">.</span><span class="nf">processInfo</span><span class="p">()</span><span class="o">.</span><span class="n">environment</span>
    <span class="k">let</span> <span class="nv">injectBundle</span> <span class="o">=</span> <span class="n">environment</span><span class="p">[</span><span class="s">"XCInjectBundle"</span><span class="p">]</span> <span class="k">as</span> <span class="kt">String</span><span class="p">?</span>
    <span class="nf">return</span> <span class="p">(</span><span class="n">injectBundle</span><span class="p">?</span><span class="o">.</span><span class="n">pathExtension</span> <span class="o">==</span> <span class="s">"xctest"</span><span class="p">)</span>
  <span class="p">}</span>

<span class="p">}</span>
</code></pre>
<p>I&#39;ve seen approaches on changing build settings. I wasn&#39;t familiar with the differences in developing, building and releasing so I wanted a simple code only solution. Luckily this worked great. Be careful if using NSClassFromString in this case (releasing an app) and probably best to avoid it.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Expanding TextArea with no clone or ghost element</title>
      <id>https://javierjulio.com/blog/expanding-textarea-with-no-clone-or-ghost-element</id>
      <link href="https://javierjulio.com/blog/expanding-textarea-with-no-clone-or-ghost-element" rel="alternate" type="text/html" title="Expanding TextArea with no clone or ghost element"/>
      <published>2014-04-24</published>
      <updated>2014-04-24</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>I&#39;ve been working on a small project called <a href="https://javierjulio.github.io/textarea-autosize/">textarea-autosize</a> for some time now that is a jQuery plugin for vertically expanding textareas through user input <strong>without</strong> using a clone or ghost element. The plugin is available on both <a href="https://www.npmjs.com/package/textarea-autosize">NPM</a> and <a href="https://bower.io/search/?q=textarea-autosize">Bower</a>.</p>

<h4>So why build this?</h4>

<p>Many solutions I came across just didn&#39;t feel smooth. In some the textarea would flicker on entering new lines with a noticeable delay in resizing. Most were outdated and all were a lot bulkier than they had to be. The bulk came from needing a cloned textarea or ghost element to determine the new height after each input action.</p>

<h4>A different approach</h4>

<p>The solution I have in place relies on a property called <code>scrollHeight</code>. Whenever the textarea value changes the height of the textarea is temporarily changed to <code>auto</code> and then immediately set back to whatever the <code>scrollHeight</code> value is. This is what keeps the plugin very lightweight yet achieving the same result of an expanding textarea on input without a flicker or delay. Also the expanding can be controlled all using CSS by simply setting a <code>max-height</code>.</p>

<p>To learn more <a href="https://javierjulio.github.io/textarea-autosize/">try the demo on the project page</a>. If you encounter any issues please <a href="https://github.com/javierjulio/textarea-autosize/issues">submit a report</a>. Thanks!</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">On Learning Ruby</title>
      <id>https://javierjulio.com/blog/on-learning-ruby</id>
      <link href="https://javierjulio.com/blog/on-learning-ruby" rel="alternate" type="text/html" title="On Learning Ruby"/>
      <published>2011-10-07</published>
      <updated>2011-10-07</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>Having written so much code in AS3 I wanted to learn a similar language but that was simpler. Lighter. I had my own ideas of what I&#39;d like in a language and I&#39;ve found that Ruby has several of them. A simple example that stood out for me was defining a constant. In AS3 this requires a lot of typing that I felt could be implied.</p>
<pre class="highlight"><code data-lang="as3"><span class="kr">public</span> <span class="kr">static</span> <span class="kr">const</span> <span class="nx">FIRST_NAME</span><span class="o">:</span><span class="nx">String</span> <span class="o">=</span> <span class="s2">"Javier"</span>
</code></pre>
<p>In Ruby it&#39;s no different than declaring a variable but you type the name in all caps.</p>
<pre class="highlight"><code data-lang="ruby"><span class="no">FIRST_NAME</span> <span class="o">=</span> <span class="s2">"Javier"</span>
</code></pre>
<p>Short and sweet. In another example I was impressed in how expressive Ruby can be. I had been figuring out the different ways I could repeat a string when I noticed in the documentation that operators were implemented as methods. Why can&#39;t I just multiply the string by the number of times I want to repeat it? For example:</p>
<pre class="highlight"><code data-lang="ruby"><span class="s2">"Ruby! "</span> <span class="o">*</span> <span class="mi">5</span>
</code></pre>
<p>And that worked as expected! Simple things like this have made learning Ruby a joy.</p>

<p>Although I&#39;ve written <a href="https://github.com/javierjulio/ruby-notes">small scripts</a> and <a href="https://github.com/javierjulio/website">re-written my site</a> to learn Ruby I wanted something else that was structured. I had discovered two invaluable resources: <a href="https://github.com/edgecase/ruby_koans">Ruby Koans</a> and <a href="https://learncodethehardway.org/ruby/">Learning Ruby The Hard Way</a>. While I&#39;m half way through Learning Ruby The Hard Way I haven&#39;t enjoyed it as much as completing the Ruby Koans. The koans are a collection of units tests where you fill in the blanks or write scripts against pre-written unit tests. I don&#39;t remember ever learning a new language so much as I did by completing those koans. If you have any experience programming it is a great way to pick up Ruby fast.</p>

<p>If you have any resources you&#39;d like to share I&#39;d love to hear from you.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Fixing Games for Windows login failed after changing Live login</title>
      <id>https://javierjulio.com/blog/fixing-games-for-windows-login-failed-after-changing-live-login</id>
      <link href="https://javierjulio.com/blog/fixing-games-for-windows-login-failed-after-changing-live-login" rel="alternate" type="text/html" title="Fixing Games for Windows login failed after changing Live login"/>
      <published>2011-07-24</published>
      <updated>2011-07-24</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>Since I bought an Xbox 360 recently I could finally change my Live ID to use a live.com account and get rid of my Hotmail one (I closed it out, good riddance). Anytime though I would start up a Steam game that had Games for Windows support such as Fallout 3 or Red Faction: Guerilla my login would fail despite entering it correctly. As expected it would work fine anywhere else such as on xbox.com and on my Xbox 360 so what gives?</p>

<p>Finally occurred to me to just delete my profile. In one of the games I mentioned earlier I just started it up and hit the HOME button to bring up the Games for Windows overlay and since you aren&#39;t logged in just hit cancel on the login form and you&#39;ll be presented with 3 options, the last being &quot;Delete Profiles.&quot; From there you can delete your profile and log back in with the same account. No more login failed or login incorrect errors.</p>

<p>Your information and save games are kept intact so don&#39;t worry, they don&#39;t get deleted. I guess a profile is a local setting or storage on your PC for your account. Hope this helps someone.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Avoiding sudo when installing command line tools from source</title>
      <id>https://javierjulio.com/blog/avoiding-sudo-when-installing-command-line-tools</id>
      <link href="https://javierjulio.com/blog/avoiding-sudo-when-installing-command-line-tools" rel="alternate" type="text/html" title="Avoiding sudo when installing command line tools from source"/>
      <published>2011-11-29</published>
      <updated>2011-11-29</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>Recently, I came across <a href="https://increaseyourgeek.wordpress.com/2010/08/18/install-node-js-without-using-sudo/">an excellent and detailed Node.js installation post</a> that caught my attention since it focused on how to avoid using <code>sudo</code>. The &quot;Long Version&quot; part proved most helped as it goes into detail on the what and why of every action you perform. A great read if command line isn&#39;t your strongest area.</p>

<p>I realized a lot of what was discussed I had done earlier for installing the excellent <a href="https://github.com/sstephenson/rbenv">rbenv tool</a> so I deviated a little from the instructions by installing Node.js into a hidden folder in my home directory (e.g. <code>~/.node</code>) and then updating my path in my <code>~/.bash_profile</code> file. That last step I had to change to the following:</p>
<pre class="highlight"><code>$ echo 'export PATH="$HOME/.node/bin:$PATH"' &gt;&gt; ~/.bash_profile
</code></pre>
<p>I&#39;ve grown used to installing from source lately where in the past I wouldn&#39;t have but with enough of the projects I&#39;m interested being hosted on GitHub (which I love) the workflow I know well and remains consistent so it makes sense. Its worth the effort rather than installing from a third party like Homebrew where it might not have the latest version (which I encountered when attempting to install Node.js).</p>

<p>For some of you this might seem trivial but a lot of this I didn&#39;t take the time to understand. Now though I know the difference that by installing into my home directory I can avoid using <code>sudo</code> and take control of the tools I depend on.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Using Callbacks in Rails 3 ActionMailer</title>
      <id>https://javierjulio.com/blog/using-callbacks-in-rails-3-actionmailer</id>
      <link href="https://javierjulio.com/blog/using-callbacks-in-rails-3-actionmailer" rel="alternate" type="text/html" title="Using Callbacks in Rails 3 ActionMailer"/>
      <published>2013-03-29</published>
      <updated>2013-03-29</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>When working with ActionMailer (Rails 3) it feels so similar to how controllers work that I thought it was odd that I couldn&#39;t use callbacks such as <code>before_filter</code> or <code>after_filter</code>. While there are <a href="https://thoughtbot.com/blog/delivering-all-email-from-staging-to-a-group-email">drop in gems</a> or <a href="https://thepugautomatic.com/2012/08/abort-mail-delivery-with-rails-3-interceptors/">examples showing how to use interceptors</a> I figured there had to be a way to reuse callbacks.</p>

<p>Luckily, I came across an accepted <a href="https://github.com/rails/rails/pull/5372">pull request that includes callbacks in ActionMailer</a> but only for Rails 4. After reviewing the commit its very easy to add support for Rails 3 since all we need to do is include the <code>AbstractController::Callbacks</code> module in our mailer class and from there we can define our callbacks.</p>

<p>The example below shows how I resolved an issue where I needed to change the recipient address for any outgoing emails when in the staging environment.</p>
<pre class="highlight"><code data-lang="ruby"><span class="k">class</span> <span class="nc">Mailer</span> <span class="o">&lt;</span> <span class="no">ActionMailer</span><span class="o">::</span><span class="no">Base</span>
  <span class="kp">include</span> <span class="no">AbstractController</span><span class="o">::</span><span class="no">Callbacks</span>

  <span class="n">after_filter</span> <span class="ss">:send_to_admin_if_staging</span>

  <span class="k">def</span> <span class="nf">send_to_admin_if_staging</span>
    <span class="k">if</span> <span class="no">Rails</span><span class="p">.</span><span class="nf">env</span><span class="p">.</span><span class="nf">staging?</span>
      <span class="n">message</span><span class="p">.</span><span class="nf">to</span> <span class="o">=</span> <span class="s1">'admin@my-app.com'</span>
    <span class="k">end</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Besides access to <code>message</code> we also have access to <code>mail</code> in callbacks. This is useful if you prefer to <a href="https://coderwall.com/p/mwrsvw/rails-4-before_filter-and-after_filter-in-your-mailers">stop email delivery</a> or perhaps change other mail settings.</p>
<pre class="highlight"><code data-lang="ruby"><span class="n">after_filter</span> <span class="ss">:stop_delivery_if_staging</span>

<span class="k">def</span> <span class="nf">stop_delivery_if_staging</span>
  <span class="k">if</span> <span class="no">Rails</span><span class="p">.</span><span class="nf">env</span><span class="p">.</span><span class="nf">staging?</span>
    <span class="n">mail</span><span class="p">.</span><span class="nf">perform_deliveries</span> <span class="o">=</span> <span class="kp">false</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre>
        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Solution for PS3 data transfer utility not working or connecting</title>
      <id>https://javierjulio.com/blog/solution-for-ps3-data-transfer-utility-not-working-or-connecting</id>
      <link href="https://javierjulio.com/blog/solution-for-ps3-data-transfer-utility-not-working-or-connecting" rel="alternate" type="text/html" title="Solution for PS3 data transfer utility not working or connecting"/>
      <published>2011-07-11</published>
      <updated>2011-07-11</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>This weekend I was setting up my new PS3 Slim and needed to transfer the data I have from my old 80GB PS3 but ran into some connection trouble. The problem was a timeout error stating that the systems weren&#39;t connected via an ethernet cable when they were.</p>

<p>I followed the <a href="https://manuals.playstation.net/document/en/ps3/current/settings/transferutility.html">instruction manual</a> but after researching online at least 2 key steps were missing. Make sure you <strong>disable</strong> the Internet Connection and Media Server Connection on <strong>both systems</strong>. You&#39;ll find both options in the (Settings) &gt; (Network Settings) area. Once I did this the data transfer worked.</p>

<p>When you attempt to transfer again it might take several minutes to connect (was about 5-10 minutes for me) so be patient!</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">No Ubisoft, your DRM is not a success</title>
      <id>https://javierjulio.com/blog/no-ubisoft-your-drm-isnt-a-success</id>
      <link href="https://javierjulio.com/blog/no-ubisoft-your-drm-isnt-a-success" rel="alternate" type="text/html" title="No Ubisoft, your DRM is not a success"/>
      <published>2011-07-30</published>
      <updated>2011-07-30</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p><a href="https://kotaku.com/ubisoft-thinks-its-pc-drm-is-a-success-it-is-wrong-5825822">Luke Plunkett</a>:</p>

<blockquote>
<p>Yet by placing ridiculous restrictions on paying, loyal customers, Ubisoft surely dissuades people from buying its games. With piracy an issue that will never go away, isn&#39;t that what the company should be worried about?</p>
</blockquote>

<p>Ubisoft has shown more concern for piracy than customer convenience. Forcing me to always be online to play a single player game does just one thing. It stops me from buying it.</p>

<p>Recently I passed on Splinter Cell: Conviction on Steam&#39;s Summer Sale. I played a trial on OnLive awhile back and loved it. Would have been great to play it on PC but of course my first thought when purchasing was to check if their was DRM that required I be online to play and it did. No thanks.</p>

<p>This is a bigger deal than you think. The internet isn&#39;t available everywhere and simply isn&#39;t reliable enough. Worse yet you become completely dependent on Ubisoft and their servers to play a title you legitimately bought. What if Ubisoft decides to shut down the servers for that game after a year or two? What if Ubisoft is no longer in business? You can no longer play that game.</p>

<p>While this does happen for some console games thats just for the multiplayer portion. In this case a PC game with Ubisoft DRM would stop you from even playing single-player!</p>

<p>In the end DRM only hurts the paying customer.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">How I Started My Career With ColdFusion</title>
      <id>https://javierjulio.com/blog/how-i-started-my-career-with-coldfusion</id>
      <link href="https://javierjulio.com/blog/how-i-started-my-career-with-coldfusion" rel="alternate" type="text/html" title="How I Started My Career With ColdFusion"/>
      <published>2011-08-01</published>
      <updated>2011-08-01</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>I discovered web development in my junior year of high school in a class that taught HTML, Photoshop, FileMaker and a few other areas I don&#39;t remember. I took what I learned and applied it by making several sites at geocities.com that I worked on regularly. I fell in love with how easy it was to make a website. I had no interest in pursuing anything else.</p>

<p>In Fall 2001 I started at <a href="https://www.montgomerycollege.edu/">Montgomery College</a> in Rockville, Maryland for an associate degree in Web Programming. The first two years there, I was learning HTML, CSS, JavaScript, C++, Java, and Unix.</p>

<p>In the fall semester of 2003, I was doing poorly in a class. At the time, I was working at Gamestop as an Assistant Manager. It was difficult attending college full-time and also working in retail full-time, so I quit my job the first week of January to focus on my studies. My father was quite angry since I was supporting my mother and sister financially. My parents were divorced. It was a rough moment, but I knew it was necessary.</p>

<p>I had scheduled a required class called CA278 Web Database Applications for the Spring 2004 semester (I still remember the class code after all these years). I didn&#39;t know what I was getting into. That class taught me a language called <a href="https://www.adobe.com/products/coldfusion-family.html">ColdFusion</a>. I took to it instantly because it was an easy-to-understand programming language for someone starting off since it was tag-based. You couldn&#39;t stop me. I loved it.</p>

<p>The best part: within four months of starting the course (it hadn&#39;t finished!) I was hired as an intern at the <a href="https://www.wri.org/">World Resources Institute</a> in April 2004. This was a breakthrough for me as I was earning a higher hourly wage than I had in retail. My father was very proud. I was more relieved than anything. I had to pay the bills. The decision to focus on school and have that free time to learn the language really paid off.</p>

<p>From there, ColdFusion took me to a few different jobs. In 2007, I moved to New York City to find better work. Since then, I&#39;ve moved away from ColdFusion professionally, but I continue to work with it in my spare time to see what&#39;s new. ColdFusion is a great language with a friendly community that I&#39;m proud to be a part of. I can&#39;t wait for its 10th release!</p>

<p>This post was inspired by <a href="https://www.bryantwebconsulting.com/blog/index.cfm/2011/7/20/August-1-2011-is-How-I-Started-ColdFusion-Day">Steve Bryant&#39;s suggestion</a> to make August 1, 2011 the &quot;How I Got Started in ColdFusion&quot; day.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Using .irbrc with the Heroku Console</title>
      <id>https://javierjulio.com/blog/using-irbrc-with-the-heroku-console</id>
      <link href="https://javierjulio.com/blog/using-irbrc-with-the-heroku-console" rel="alternate" type="text/html" title="Using .irbrc with the Heroku Console"/>
      <published>2013-07-18</published>
      <updated>2013-07-18</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>As a Ruby developer having a local <code>.irbrc</code> file is really handy for specifying custom settings and method helpers to help speed up tasks when in the IRB or Rails console. I always wondered if this would also work in the Heroku console as I work in that environment all the time. I&#39;m often checking on data, particularly delayed jobs if I&#39;ve recently deployed or have to run a rake task.</p>

<p>I had kept forgetting to give it a try but today I added an <code>.irbrc</code> file (with the contents you see below) to a project repository and deployed to staging.</p>
<pre class="highlight"><code data-lang="ruby"><span class="c1">#!/usr/bin/ruby</span>

<span class="k">def</span> <span class="nf">q</span>
  <span class="nb">exit</span>
<span class="k">end</span>

<span class="k">def</span> <span class="nf">dj</span>
  <span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span>
<span class="k">end</span>

<span class="k">def</span> <span class="nf">djc</span>
  <span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span><span class="p">.</span><span class="nf">count</span>
<span class="k">end</span>
</code></pre>
<p>Just as you would expect the above methods run successfully in the Heroku console. No special configuration needed. Just a normal <code>.irbrc</code> file in the root of your git project and you&#39;re all set.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Fixing Heroku Toolbelt in Bundler Executed Rake Tasks</title>
      <id>https://javierjulio.com/blog/fixing-heroku-toolbelt-in-bundler-executed-rake-tasks</id>
      <link href="https://javierjulio.com/blog/fixing-heroku-toolbelt-in-bundler-executed-rake-tasks" rel="alternate" type="text/html" title="Fixing Heroku Toolbelt in Bundler Executed Rake Tasks"/>
      <published>2013-07-16</published>
      <updated>2013-07-16</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>If you have any rake tasks that use the <code>heroku</code> command (should be using the <a href="https://devcenter.heroku.com/articles/heroku-cli">Heroku Toolbelt CLI</a> and not the Ruby gem) make sure to wrap any code with Bundler.with<em>clean</em>env which takes a block like in the example below:</p>
<pre class="highlight"><code data-lang="ruby"><span class="n">namespace</span> <span class="ss">:my_app</span> <span class="k">do</span>
  <span class="n">task</span> <span class="ss">:example</span> <span class="k">do</span>
    <span class="no">Bundler</span><span class="p">.</span><span class="nf">with_clean_env</span> <span class="k">do</span>
      <span class="nb">system</span> <span class="s2">"heroku version"</span>
    <span class="k">end</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Before coming across <a href="https://github.com/sstephenson/rbenv/issues/400#issuecomment-18744931">the solution</a> I ran into two different errors. The first was due to a Bundler error about a Ruby version mismatch since a project related rake task running on Ruby 2.0 but the Heroku Toolbelt uses Ruby 1.9.3. The second occurred on Tddium as it needs a post build rake task for deploying to Heroku with the error message stating that it could not find a gem (e.g. rake) in any of the sources.</p>

<p>If you run a rake task using Bundler (e.g. <code>bundle exec rake</code>) any subprocesses like the <code>heroku</code> command will inherit the environment variables rake creates. Perhaps running rake without Bundler might prevent any errors but you&#39;d have to make sure your rake task doesn&#39;t depend on any of bundled gems.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Thoughts on Halo: ODST and Halo: Reach</title>
      <id>https://javierjulio.com/blog/thoughts-on-halo-odst-and-halo-reach</id>
      <link href="https://javierjulio.com/blog/thoughts-on-halo-odst-and-halo-reach" rel="alternate" type="text/html" title="Thoughts on Halo: ODST and Halo: Reach"/>
      <published>2011-07-25</published>
      <updated>2011-07-25</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>This past weekend I finished playing Halo ODST. I found it to be harder than expected but quickly learned that several fights (especially those as the rookie) are best avoided. I enjoyed the title a great deal but was hoping for more teamwork throughout and not just lone-wolf style gameplay. I&#39;d love to play a Halo game more along the lines of say a Republic Commando where your squadmates are at your side the majority of the game.</p>

<p>From there I started Halo Reach. Both games I played on Normal. The game starts off with some firefights that are pretty brutal and I had to repeat them many times over. You have to use cover a great deal and not be afraid to fallback. Worth noting that the enemies CONSTANTLY move around non-stop in comparison to ODST. Drove me insane at points as they can get good shots off but its a good challenge. The game isn&#39;t repetitive when it comes to environments. It has in earlier titles but not here. Bungie did an incredible in making this game feel epic.</p>

<p>The best part about these games, particularly Reach, is by far the aerial and space combat. The controls where spot on and never did I feel like I was struggling to take enemies down or having trouble to maneuver. I&#39;d love to see more games around space and aerial combat just like this. Bungie really blew me away here. Expecting to see more of this in Halo 4.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Using a Laptop Script to Install and Document Development Tools</title>
      <id>https://javierjulio.com/blog/using-a-laptop-script-to-install-and-document-development-tools</id>
      <link href="https://javierjulio.com/blog/using-a-laptop-script-to-install-and-document-development-tools" rel="alternate" type="text/html" title="Using a Laptop Script to Install and Document Development Tools"/>
      <published>2012-02-07</published>
      <updated>2012-02-07</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>Not to long ago I read Thoughbot&#39;s excellent <a href="https://thoughtbot.com/blog/2011-rubyists-guide-to-a-mac-os-x-development">Ruby guide to Mac OSX development</a> that lists all the development tools they install on their laptops. The big takeaway for me was the last step their laptop script which is just a bash script that runs various install commands for Ruby Gems and other tools. While it may seem so simple I couldn&#39;t believe I didn&#39;t think about this before. What a useful tool. This inspired me to create <a href="https://github.com/javierjulio/laptop">my own laptop script</a>.</p>

<p>You might ask &quot;why bother?&quot; as I wouldn&#39;t be going through laptops that often to have a need for this and you&#39;d be right. The real motivator has always been documentation. Recently, I learned the hard way that the most important part isn&#39;t so much knowing what tools I have installed but <strong>how</strong> I installed them. Big difference.</p>

<p>This past summer I had installed Node.js when it was on version 0.4.x but didn&#39;t do much with it until this past December when Node was updated to version 0.6.7. I wanted to update but for the life of me I couldn&#39;t remember how I installed Node. Did I install using Homebrew? From source? From one of the downloadable installers? Honestly, I couldn&#39;t remember. Coming across Thoughtbot&#39;s post, I realized this wouldn&#39;t be an issue if I had with a simple shell script that would double as documentation.</p>

<p>I&#39;d like to expand the script to account for tools that have been installed so as to not reinstall them or better yet to perform updates. For now though I&#39;m pleased with it serving mainly as documentation.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Overcoming Fear When Presenting</title>
      <id>https://javierjulio.com/blog/overcoming-fear-when-presenting</id>
      <link href="https://javierjulio.com/blog/overcoming-fear-when-presenting" rel="alternate" type="text/html" title="Overcoming Fear When Presenting"/>
      <published>2011-08-09</published>
      <updated>2011-08-09</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p><a href="https://brettkelly.org">Brett Kelly</a> on his fear when presenting:</p>

<blockquote>
<p>My brain moves faster than my lips and I very often turn into a yammering idiot when I get halfway through saying something before realizing that it&#39;s either unclear or inaccurate and I start quickly qualifying or rewording what I haven&#39;t even finished saying yet and it turns into a big ball of suck.</p>
</blockquote>

<p>This a tough habit to break. I&#39;ve learned that it&#39;s essential to practice early and often to pinpoint these areas quickly so you don&#39;t repeat it. The following are my suggestions that have helped me in avoiding this and in becoming a better presenter.</p>

<h2>Brainstorming</h2>

<p>Take notes on the sections and points you&#39;ll be covering. These are just notes so you don&#39;t want to draft out what you&#39;ll be saying out loud. That&#39;s just a waste of time. Keep these concise. You&#39;ll be changing it as you go.</p>

<h2>Practice Makes Perfect</h2>

<p>No magic here. You need to practice. Once you have a good draft of notes (whether its written down or simple slides with your bullet points) take it with you, bring your laptop and lock yourself in a room. If you have access to a projector, use it. From here start practicing by speaking out loud as if you were giving the presentation in front of a real audience. This will help you find major problem areas now rather than later.</p>

<h2>Timing Is Everything</h2>

<p>If you find yourself covering a section for about 15 minutes and you have another 4 or 5 more to go and only 50 minutes total that&#39;s a good sign that you need to streamline your content. Review your notes and make sure you cover only what is necessary.</p>

<h2>The Babbling On Dilemma</h2>

<p>Sometimes the issue isn&#39;t your notes but that you&#39;re talking about a point for to long which has a high chance of not making any sense to you or the audience. Our minds tend to wander much faster than we can speak so its easy to get caught up in this but don&#39;t get distraught. It happens to everyone.</p>

<p>It&#39;s a hard habit to break so remember when these moments happen, stop, beat yourself up (just a little) and start over. With enough repetition you&#39;ll memorize those areas to know to stop speaking. Which now leads me to another excellent tip...</p>

<h2>Take A Break!</h2>

<p>When moving from point to point don&#39;t be afraid to stop and catch your breath. The audience won&#39;t find it awkward and in fact they&#39;ll appreciate it. It gives them the opportunity to absorb what they&#39;ve just learned and allows you to gather your thoughts before moving on to the next section.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Recovering Deleted Files From SVN</title>
      <id>https://javierjulio.com/blog/recovering-deleted-files-from-svn</id>
      <link href="https://javierjulio.com/blog/recovering-deleted-files-from-svn" rel="alternate" type="text/html" title="Recovering Deleted Files From SVN"/>
      <published>2011-09-18</published>
      <updated>2011-09-18</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>Recently, I had accidentally deleted a project file from SVN that was still required. Searching on how to recover it I came across different methods (mainly using svn copy) but <a href="https://pointbeing.net/weblog/2010/02/recovering-a-deleted-file-from-subversion.html">an example using svn merge</a> is what worked for me. All you need is the revision number that deleted the file(s) that you want back.</p>

<p>The following is the command format you&#39;ll want to use:</p>
<pre class="highlight"><code>$ svn merge -r [rev]:[rev-1] [file-path-or-current-dir]
</code></pre>
<p>As an example, lets say I wanted to retrieve a post I had deleted for my site and the revision number that deleted the file was 50. That would look something like this:</p>
<pre class="highlight"><code>$ cd Projects/website/posts/
$ svn merge -r 50:49 .
</code></pre>
<p>If you made other changes that were part of that revision they will be retrieved but are not committed so you can modify them as you like. In my case I had deleted 2 other files so I just re-deleted them, kept the one I needed and committed my changes. The revision history for the file you retain is preserved.</p>

        ]]>
      </content>
    </entry>
    <entry>
      <title type="html">Git tagging a forked Ruby gem project for Bundler</title>
      <id>https://javierjulio.com/blog/git-tagging-a-forked-ruby-gem-project-for-bundler</id>
      <link href="https://javierjulio.com/blog/git-tagging-a-forked-ruby-gem-project-for-bundler" rel="alternate" type="text/html" title="Git tagging a forked Ruby gem project for Bundler"/>
      <published>2011-12-06</published>
      <updated>2011-12-06</updated>
      <author>
        <name>Javier Julio</name>
      </author>
      <content type="html">
        <![CDATA[
          <p>If you ever have to customize or patch a Ruby gem and you are using <a href="https://bundler.io">Bundler</a>, its a good idea when forking that project to create a branch and then tag new releases.</p>

<p>I found this out recently as I used and patched two Ruby gems, <a href="https://github.com/javierjulio/databasedotcom">databasedotcom</a> and <a href="https://github.com/javierjulio/salesforce_bulk">salesforce_bulk</a>, to sync data to Salesforce for reporting. I ran into showstoppers with both but luckily they are hosted on <a href="https://github.com/">GitHub</a> so I was able to fork them and make the necessary changes to resolve the issues I encountered while being able to contribute those changes back.</p>

<p>The project <code>Gemfile</code> was updated with my two forked git branches and then I ran <code>bundle install</code>. While Bundler does support specifying a git branch I found that as I made further code updates and would run <code>bundle install</code> again, Bundler wouldn&#39;t download those changes. I figured out that I should be tagging releases of that branch instead as that would require the <code>Gemfile</code> to be updated with a new tag name. After that running <code>bundle install</code> would download the latest changes I made.</p>

        ]]>
      </content>
    </entry>
</feed>
