<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Trim Agency &#187; Today I Learned</title>
	<atom:link href="http://old.trimagency.com/category/today-i-learned/feed/" rel="self" type="application/rss+xml" />
	<link>http://old.trimagency.com</link>
	<description></description>
	<lastBuildDate>Mon, 29 Jun 2026 06:32:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Active Record Queries: Specifying Conditions on Associations</title>
		<link>http://old.trimagency.com/active-record-queries-specifying-conditions-on-associations/</link>
		<comments>http://old.trimagency.com/active-record-queries-specifying-conditions-on-associations/#comments</comments>
		<pubDate>Fri, 20 Oct 2017 20:00:14 +0000</pubDate>
		<dc:creator><![CDATA[Steph Ricardo]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.trimagency.com/?p=2713</guid>
		<description><![CDATA[<p>I ran into a ‘gotcha’ this week while setting up an active record query that already had an eager loaded association. My goal was to only find objects that had an appointment time from the current time until the end of the day. In this case, appointments were the association and the objects were already [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/active-record-queries-specifying-conditions-on-associations/">Active Record Queries: Specifying Conditions on Associations</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>I ran into a ‘gotcha’ this week while setting up an active record query that already had an eager loaded association.</p>
<p>My goal was to only find objects that had an appointment time from the current time until the end of the day. In this case, appointments were the association and the objects were already set up to display in descending order.</p>
<pre class="brush: ruby; title: ; notranslate">
Object.where(status: status)
      .includes(:appointments)
      .order('appointments.scheduled_datetime DESC')
</pre>
<p>The objects also needed to have a status of <strong>‘scheduled’</strong>, which was already set to the variable <code>status</code> at the start of the controller action.</p>
<p>Using array conditions in my <code>where</code> statement, I started with the following:</p>
<pre class="brush: ruby; title: ; notranslate">
Object.where(status: status)
      .includes(:appointments)
      .where('scheduled_datetime &gt;= ? AND scheduled_datetime &lt;= ?',             
        current_time, end_of_day)
      .order('appointments.scheduled_datetime DESC')
</pre>
<p>I had set the <code>current_time</code> and the <code>end_of_day</code> time to variables. The string making up the array condition looked good. Yet the above resulted in the following error:</p>
<pre class="brush: bash; title: ; notranslate">
PG::UndefinedTable: ERROR:  missing 
FROM-clause entry for table “appointments”
</pre>
<p>I realized that a <code>references</code> was needed for the conditions mentioned in the <code>where</code> statement. Using the example above doesn’t join the <code>appointments</code> table.</p>
<pre class="brush: ruby; title: ; notranslate">
Object.where(status: status)
      .includes(:appointments)
      .where('scheduled_datetime &gt;= ? AND scheduled_datetime &lt;= ?',             
        current_time, end_of_day)
      .references(:appointments)
      .order('appointments.scheduled_datetime DESC')
</pre>
<p>Using <code>references</code> allows the query to know that the string in the <code>where</code> statement references appointments. It joins the appointments table to the query.</p>
<p>You may be reading this and wondering, <em>“Couldn’t you also use <code>joins</code> here?”</em>. You are right, you can use <code>joins</code> here, it would look something like this:</p>
<pre class="brush: ruby; title: ; notranslate">
Object.where(status: status)
      .joins(:appointments)
      .where(
        'appointments.scheduled_datetime &gt;= ? AND ' + 
          'appointments.scheduled_datetime &lt;= ?',             
        current_time, end_of_day
       )
</pre>
<p>This looks cleaner, yet I also want to use <code>order</code> here. You cannot simply use <code>order</code> and <code>joins</code> when ordering on associations. You would need to use <code>merge</code> like this:</p>
<pre class="brush: ruby; title: ; notranslate">
Object.where(status: status)
      .joins(:appointments)
      .where(
        'appointments.scheduled_datetime &gt;= ? AND ' + 
          'appointments.scheduled_datetime &lt;= ?',             
         current_time, end_of_day
      ).merge(Appointment.order(scheduled_datetime: :desc))
</pre>
<p>There you have it! If you are using <code>includes</code> in queries don’t forget the <code>references</code>!</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/active-record-queries-specifying-conditions-on-associations/">Active Record Queries: Specifying Conditions on Associations</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/active-record-queries-specifying-conditions-on-associations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling Select Elements with JCF</title>
		<link>http://old.trimagency.com/styling-select-elements-with-jcf/</link>
		<comments>http://old.trimagency.com/styling-select-elements-with-jcf/#comments</comments>
		<pubDate>Fri, 22 Sep 2017 19:44:41 +0000</pubDate>
		<dc:creator><![CDATA[Steph Ricardo]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.trimagency.com/?p=2695</guid>
		<description><![CDATA[<p>As an Apprentice Product Developer at TRIM, I’ve had the amazing opportunity of working and learning alongside an exceptional team of developers, designers, and strategists. I’m nearing the end of my apprenticeship, and wanted to share a TIL I encountered while working with Angular and TypeScript. Having previous experience in Ruby, Rails, and JavaScript, working [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/styling-select-elements-with-jcf/">Styling Select Elements with JCF</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As an Apprentice Product Developer at TRIM, I’ve had the amazing opportunity of working and learning alongside an exceptional team of developers, designers, and strategists. I’m nearing the end of my apprenticeship, and wanted to share a TIL I encountered while working with Angular and TypeScript.</p>
<p>Having previous experience in Ruby, Rails, and JavaScript, working with Angular was different but also eye-opening. It is a lot of fun creating the functionality of a client app with components, modules, and services.</p>
<p>One of my biggest challenges was styling a <code>select</code> dropdown to match our designs. Thankfully the team ( <a href="https://github.com/dominiquemiller">Dom Miller</a>!) created a <a href="https://github.com/TrimAgency/angular-jcf-module">JCF module</a> that can be easily imported into an Angular project.</p>
<p>The <a href="https://github.com/w3co/jcf/blob/master/README.md">JavaScript Custom Forms library</a> (JCF) is a really great tool to customize form elements with CSS.  Once it’s imported to the project, you can place the <code>jcf</code> attribute in the desired element. Adding the attribute will style the element with the default <code>jcf</code> styles.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;select id=“dropdown-example” jcf&gt;
    &lt;option&gt;Pick me&lt;/option&gt;
    &lt;option&gt;No, Pick me!&lt;/option&gt;
&lt;/select&gt;
</pre>
<p>It is possible to include options with the <code>jcf</code> attribute for the <code>select</code> element. I’d like my dropdown to only show three options at a time. That would look something like this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;select id=“dropdown-example”         
        jcf='{&quot;maxVisibleItems&quot;: 3}'&gt;
    &lt;option&gt;I’m option 1&lt;/option&gt;
    &lt;option&gt;I’m option 2&lt;/option&gt;
&lt;/select&gt;
</pre>
<p>Now that the default styles and other options are set, we can add in our own styles by selecting and overriding the appropriate <code>jcf</code> classes. To do this, I created a file like this one within my assets folder:</p>
<p><strong>project-name/src/assets/scss/base/_jcf_overrides.scss</strong></p>
<pre class="brush: css; title: ; notranslate">
.jcf-scrollbar-vertical {
 display: none;
}

.jcf-scrollbar-horizontal {
 display: none;
}

.jcf-list .jcf-option {
 font-size: 18px;
 font-weight: bold;
 background-color: $white;
 padding: 11px 20px;
 margin: 0px;
 text-align: left;
 border-top: 1px solid #ccc;
 cursor: pointer;
}
</pre>
<p>You can view the different <code>jcf</code> classes by opening your chrome dev tools on the page where the element is located, and looking near the bottom of the html. You’ll see the <code>jcf</code> classes created by the module.</p>
<p>There you have it! You now have a customized form element.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/styling-select-elements-with-jcf/">Styling Select Elements with JCF</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/styling-select-elements-with-jcf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropbox &amp; Webpack</title>
		<link>http://old.trimagency.com/dropbox-webpack/</link>
		<comments>http://old.trimagency.com/dropbox-webpack/#comments</comments>
		<pubDate>Fri, 05 May 2017 18:47:10 +0000</pubDate>
		<dc:creator><![CDATA[Ryan Stone]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2660</guid>
		<description><![CDATA[<p>I&#8217;ve had a major issue with Angular 2/Webpack for the past few months. I store all my development files in Dropbox as a second layer of backup and an issue came up that would make me bounce the server every time I changed a file. Not cool. The office joke is &#8220;it&#8217;s Tmux&#8217;s fault&#8221; and [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/dropbox-webpack/">Dropbox &#038; Webpack</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve had a major issue with Angular 2/Webpack for the past few months. I store all my development files in Dropbox as a second layer of backup and an issue came up that would make me bounce the server every time I changed a file. Not cool.</p>
<p>The office joke is &#8220;it&#8217;s Tmux&#8217;s fault&#8221; and we eliminated Tmux, uninstalled Node, NPM, Yarn, etc. Nothing worked. My colleague Alex pointed out the repo was in Dropbox so I moved it to another folder and magically it started working again.</p>
<p>So take note, if you&#8217;re having live reload or similar issues and it&#8217;s in Dropbox, take it out.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/dropbox-webpack/">Dropbox &#038; Webpack</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/dropbox-webpack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Modules in Rspec</title>
		<link>http://old.trimagency.com/testing-modules-in-rspec/</link>
		<comments>http://old.trimagency.com/testing-modules-in-rspec/#comments</comments>
		<pubDate>Sun, 26 Mar 2017 17:30:50 +0000</pubDate>
		<dc:creator><![CDATA[Alex Miller]]></dc:creator>
				<category><![CDATA[Team Trim]]></category>
		<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2642</guid>
		<description><![CDATA[<p>There comes a time when we might need to write some unit tests for a module. To do this, we can just extend some class and test the methods on that class. Here is an example using Rspec&#8217;s subject class; extending it with SomeProject::MyHelpers to unit test a method called :helpfulness.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/testing-modules-in-rspec/">Testing Modules in Rspec</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>There comes a time when we might need to write some unit tests for a module.  To do this, we can just extend some class and test the methods on that class.  Here is an example using Rspec&#8217;s <code>subject</code> class; extending it with <code>SomeProject::MyHelpers</code> to unit test a method called <code>:helpfulness</code>.</p>
<pre class="brush: ruby; title: ; notranslate">
require 'spec_helper'

describe SomeProject::MyHelpers do

  # add the module methods as instance methods to Rspec's subject
  subject do
    self.extend(described_class)
  end

  describe 'The helpfulness of my helper' do
    it 'helps a lot' do
      expect(subject.helpfulness).to eq &quot;a lot&quot;
    end
  end
end
</pre>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/testing-modules-in-rspec/">Testing Modules in Rspec</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/testing-modules-in-rspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Forms: Validating and Persisting Duplicate Parameter Names</title>
		<link>http://old.trimagency.com/rails-forms-validating-and-persisting-duplicate-parameter-names/</link>
		<comments>http://old.trimagency.com/rails-forms-validating-and-persisting-duplicate-parameter-names/#comments</comments>
		<pubDate>Fri, 24 Mar 2017 15:22:43 +0000</pubDate>
		<dc:creator><![CDATA[Steve Gilliam]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2627</guid>
		<description><![CDATA[<p>Building Rails forms is a pretty straightforward process but, once in a while, I run into a ‘gotcha&#8217; that needs a simple solution. This week I was building a form where, if the user selects a particular subset of radio buttons, a text field is shown and the user is required to enter a string.  The [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/rails-forms-validating-and-persisting-duplicate-parameter-names/">Rails Forms: Validating and Persisting Duplicate Parameter Names</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Building Rails forms is a pretty straightforward process but, once in a while, I run into a ‘gotcha&#8217; that needs a simple solution. This week I was building a form where, if the user selects a particular subset of radio buttons, a text field is shown and the user is required to enter a string.  The form data is persisted using an enum to capture the radio button selection and a string attribute to capture the text entry if any.   The ‘gotcha’ is that the text field input needs to be placed in multiple places within the form,  and rails will ignore duplicate parameter names.</p>
<p>To allow the submission of the same input field multiple times, I added an empty array to the input name:</p>
<p>&nbsp;</p>
<pre style="padding-left: 20px;">   &lt;input id = “user_text_entry”, name=“user[text_entry]<b>[ ]</b>”, placeholder=“Enter text” &gt;
         =&gt; [,,”user’s text entered”]
</pre>
<p>&nbsp;</p>
<p>More on parameter naming conventions can be found <a href="http://guides.rubyonrails.org/form_helpers.html#understanding-parameter-naming-conventions">here</a>.</p>
<p>&nbsp;</p>
<p>To implement front end validations, I used <a href="https://www.w3schools.com/jquery/sel_visible.asp">jQuery’s :visible selector</a> to ignore the hidden text fields.</p>
<p>&nbsp;</p>
<pre style="padding-left: 20px;">var userTextEntry = $(‘.text-required-radio-box’).find(‘*’).filter(‘:input#user_text_entry:visible');</pre>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/rails-forms-validating-and-persisting-duplicate-parameter-names/">Rails Forms: Validating and Persisting Duplicate Parameter Names</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/rails-forms-validating-and-persisting-duplicate-parameter-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rename a Phoenix Application</title>
		<link>http://old.trimagency.com/rename-a-phoenix-application/</link>
		<comments>http://old.trimagency.com/rename-a-phoenix-application/#comments</comments>
		<pubDate>Sat, 18 Mar 2017 13:48:30 +0000</pubDate>
		<dc:creator><![CDATA[Alex Miller]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2624</guid>
		<description><![CDATA[<p>When we build a Phoenix application with $ mix phoenix.new my_app, our application module name is set to MyApp. This module name, as well as the snake case version, is referenced everywhere, making it very cumbersome if you need to ever rename the application. Here is a shell script I wrote the does the job [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/rename-a-phoenix-application/">Rename a Phoenix Application</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>When we build a Phoenix application with <code>$ mix phoenix.new my_app</code>, our application module name is set to <code>MyApp</code>. This module name, as well as the snake case version, is referenced everywhere, making it very cumbersome if you need to ever rename the application.  Here is a shell script I wrote the does the job in less than a second.  Just make the script executable and run it by passing a snake case version of the new name for your application. You will be shown a preview and asked to confirm before proceeding.</p>
<p><script src="https://gist.github.com/apmiller108/ad5bb208828b2d97f5b09d0c7a90c459.js"></script></p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/rename-a-phoenix-application/">Rename a Phoenix Application</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/rename-a-phoenix-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common Table Expressions in Postgres</title>
		<link>http://old.trimagency.com/postgressql-with-queries/</link>
		<comments>http://old.trimagency.com/postgressql-with-queries/#comments</comments>
		<pubDate>Fri, 10 Mar 2017 22:54:42 +0000</pubDate>
		<dc:creator><![CDATA[Alex Miller]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2615</guid>
		<description><![CDATA[<p>PostgresSQL WITH Queries, also known as Common Table Expressions (CTEs), allows us to write complex queries by defining temporary tables for use in a larger query. In other words, we can create in-memory temporary tables and query against them. Here is an (trivial) example where we want the email addresses of all the users who [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/postgressql-with-queries/">Common Table Expressions in Postgres</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>PostgresSQL <code>WITH</code> Queries, also known as Common Table Expressions (CTEs), allows us to write complex queries by defining temporary tables for use in a larger query.  In other words, we can create in-memory temporary tables and query against them.  Here is an (trivial) example where we want the email addresses of all the users who signed up on the biggest sales day.  </p>
<pre class="brush: sql; title: ; notranslate">
WITH top_sales_by_date AS (
  SELECT date, SUM(order_total) AS total_sales
  FROM orders
  GROUP BY date
  ORDER BY total_sales DESC
)
SELECT email
FROM users
WHERE sign_up_date = (
  SELECT date
  FROM top_sales_by_date LIMIT 1
)
</pre>
<p>The <code>top_sales_by_date</code> is a table created just for this query that aggregates the order totals grouped by date, the ordered by total sales.  We can use the date value from the top record in the temp table to find the emails of users who signed up on this date.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/postgressql-with-queries/">Common Table Expressions in Postgres</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/postgressql-with-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evernote to Blog Post</title>
		<link>http://old.trimagency.com/evernote-to-blog-post/</link>
		<comments>http://old.trimagency.com/evernote-to-blog-post/#comments</comments>
		<pubDate>Mon, 20 Feb 2017 04:28:09 +0000</pubDate>
		<dc:creator><![CDATA[Tim Hasse]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://www.trimagency.com/?p=2600</guid>
		<description><![CDATA[<p>Today I learned how to publish our TIL posts directly to our blog, straight from my favorite text tool, Evernote . We are simply making the connection with one of our go-to’s, Zapier . The concern with this integration is that our zap is searching for new notes every 15 minutes, so you would need [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/evernote-to-blog-post/">Evernote to Blog Post</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Today I learned how to publish our TIL posts directly to our blog, straight from my favorite text tool, <strong><a href="http://evernote.com">Evernote</a></strong> .</p>
<p>We are simply making the connection with one of our go-to’s, <strong><a href="http://zapier.com">Zapier</a></strong> . The concern with this integration is that our zap is searching for new notes every 15 minutes, so you would need to be aware of this as it relates to how you draft your content. For example, if you create a new post, and need to go back and edit this note beyond a 15 minute time frame, you run the risk of posting a partial blog post (depending on your Evernote sync settings). Therefore, we still have some tweaking to do to establish versioning workflow. For the time being, I will likely draft in my main notebook, and dump in my TIL notebook when ready to ship. Future versions will also need to handle images, as these are not included on my zap yet.</p>
<p>Additionally, we will need to handle code better in the future. Evernote has released a beta feature of a “Code Block,” which has to be manually be turned on in order to use, however, the zap is not pulling this in to the blog post. You can access it in the preferences: http://take.ms/6e0up</p>
<p>Overall, this is massively helpful in meeting our goal of using TIL as a repo, not a marketing tool.</p>
<p>Here is a random code snippet:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;div class=&quot;ipsType_normal ipsType_richText ipsContained&quot; data-role=&quot;commentContent&quot; data-controller=&quot;core.front.core.lightboxedImages&quot;&gt;
&lt;div class=&quot;ipsQuote_citation ipsQuote_open&quot;&gt;  &lt;a href=&quot;#&quot; data-action=&quot;toggleQuote&quot;&gt; &lt;/a&gt;     &lt;i class=&quot;fa fa-share&quot;&gt;&lt;/i&gt;    On 2/19/2016 at 10:16 AM,   &lt;a href=&quot;//discussion.evernote.com/?app=core&amp;amp;module=members&amp;amp;controller=profile&amp;amp;id=102218&quot; data-ipshover=&quot;&quot; data-ipshover-target=&quot;//discussion.evernote.com/?app=core&amp;amp;module=members&amp;amp;controller=profile&amp;amp;id=102218&amp;amp;do=hovercard&quot;&gt;bootislands&lt;/a&gt; said:&lt;/div&gt;&lt;/blockquote&gt;
&lt;/div&gt;
</pre>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/evernote-to-blog-post/">Evernote to Blog Post</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/evernote-to-blog-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursion in Elixir</title>
		<link>http://old.trimagency.com/recursion-in-elixir/</link>
		<comments>http://old.trimagency.com/recursion-in-elixir/#comments</comments>
		<pubDate>Sat, 18 Feb 2017 13:25:01 +0000</pubDate>
		<dc:creator><![CDATA[Alex Miller]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2580</guid>
		<description><![CDATA[<p>Coming from an object oriented language with data mutability, learning looping in Elixir required that I let go of my current understanding about iterating over a collection. In fact, just forget looping and think recursion. So, what&#8217;s recursion? Recursion is solving a problem whereby one applies the same solution to smaller instances of that problem. [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/recursion-in-elixir/">Recursion in Elixir</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Coming from an object oriented language with data mutability, learning looping in Elixir required that I let go of my current understanding about iterating over a collection.  In fact, just forget looping and think recursion.  So, what&#8217;s <a href="https://en.wikipedia.org/wiki/Recursion_(computer_science)">recursion</a>?</p>
<p>Recursion is solving a problem whereby one applies the same solution to smaller instances of that problem.  Think, a function calling itself.  So, here is what it looks like in Elixir:</p>
<pre class="brush: erlang; title: ; notranslate">
defmodule Recursionism do

  def operate_on_list_items([], _) do
    []
  end

  def operate_on_list_itmes([head | tail], fun) do
    [fun.(head) | operate_on_list_items(tail, fun)]
  end
end

Recursionism.operate_on_list_items([1, 2, 3], fn(n) -&gt; n * n end)
</pre>
<p>Let&#8217;s break this down:</p>
<ul>
<li>First we define a multi-clause function called <code>Recusionism.operate_on_list/2</code>.  Multi-cause functions are multiple functions of the same name and arity that are executed depending on the matching of the arguments.</li>
<li>Then, when we call <code>Recusionism.operate_on_list_items([1, 2, 3], fn(n) -> n * n end)</code>, it matches the second multi-clause function definition and executes it.</li>
<li>That second function, uses the anonymous function (it&#8217;s second argument) to operate on the first item in the list (<code>head</code>).  The result of applying the anonymous function (<code>fun.(head)</code>) becomes the first item in a new list.</li>
<li>In order to complete the list, the <code>operate_on_list_items</code> function calls itself by passing all the remaining items in the original list (<code>tail</code>) as the first argument, along with the same anonymous function as the second argument.</li>
<li>When there are no more items in the list, calling <code>operate_on_list_items</code> matches the first multi-clause function definition and returns an empty list, thereby stopping the recursion.</li>
<li>The end result is building a list by doing <code>[1 | [4 | [9 | []]]]</code>, which evaluates to <code>[1, 4, 9]</li>
<p></code>
</ul>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/recursion-in-elixir/">Recursion in Elixir</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/recursion-in-elixir/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Angular 1.x Dropdown Menus(Removing The Blank Option)</title>
		<link>http://old.trimagency.com/angular-dropdown-menus/</link>
		<comments>http://old.trimagency.com/angular-dropdown-menus/#comments</comments>
		<pubDate>Sat, 18 Feb 2017 00:36:00 +0000</pubDate>
		<dc:creator><![CDATA[Miguel Lozano]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>
		<category><![CDATA[Angular]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2529</guid>
		<description><![CDATA[<p>Over the past week I kept running into the issue of iterating over an array or an object in a &#60;select&#62; field with ng-repeat, only to find that I had a blank option as the first item in the dropdown. &#160;After trying several strategies, I finally found one that worked. Let&#8217;s say you want to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/angular-dropdown-menus/">Angular 1.x Dropdown Menus<br/>(Removing The Blank Option)</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Over the past week I kept running into the issue of iterating over an array or an object in a <code>&lt;select&gt;</code> field with <code>ng-repeat</code>, only to find that I had a blank option as the first item in the dropdown. &nbsp;After trying several strategies, I finally found one that worked.</p>
<p>Let&#8217;s say you want to iterate over the array <code>ctrl.items</code> in your <code>&lt;select&gt;</code> field.</p>
<p><strong>some.component.js</strong></p>
<pre class="brush: jscript; title: ; notranslate">
(function() {
  'use strict';

  function SomeController() {

    var ctrl = this;

    // item array for dropdown
    ctrl.items = [
      {
        select: 'data1',
        label: 'Option 1'
      }, {
        select: 'data2',
        label: 'Option 2'
      }, {
        select: 'data3',
        label: 'Option 3'
      }
    ];

  }

  angular
    .module('app')
    .component('someComponent', {
      controller: SomeController,
      templateUrl: '/app/components/some.component.html',
    });
})();
</pre>
<p><bg/><br />
Instead of using <code>ng-repeat</code>, this can be accomplished with <code>ng-options</code>.</p>
<p><strong><code>ng-options</code> Pattern Usage:</strong><br />
<code>select</code> <code><strong>as</strong></code> <code>label</code> <code><strong>for</strong></code> <code>value</code> <code><strong>in</strong></code> <code>array</code></p>
<p><strong>some.component.html</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;select name=&quot;selectName&quot;
        ng-model=&quot;$ctrl.formName.selectName&quot;
        ng-options=&quot;item.select as item.label for item in $ctrl.items&quot;&gt;

  &lt;!-- this option sets the dropdown placeholder --&gt;
  &lt;!-- value must be an empty string for this to work --&gt;
  &lt;option value=&quot;&quot; selected=&quot;selected&quot;&gt;Select an Item&lt;/option&gt;
&lt;/select&gt;
</pre>
<p><bg/><br />
<strong>Where:</strong><br />
<code>select</code>: value that will be submitted or bound to the model of the parent<br />
<code>label</code>: each <code>&lt;option&gt;</code> shown in dropdown list<br />
<code>value</code>: local variable for each <code>array</code> item or <code>object</code> property value being iterated over.</p>
<p>You can find more <code>ng-options</code> usage patterns in the <a href="https://docs.angularjs.org/api/ng/directive/ngOptions" target="_blank" rel="nofollow">AngularJS API Documentation</a></p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/angular-dropdown-menus/">Angular 1.x Dropdown Menus<br/>(Removing The Blank Option)</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/angular-dropdown-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animating height with only CSS</title>
		<link>http://old.trimagency.com/animating-height-with-only-css/</link>
		<comments>http://old.trimagency.com/animating-height-with-only-css/#comments</comments>
		<pubDate>Sun, 12 Feb 2017 21:11:11 +0000</pubDate>
		<dc:creator><![CDATA[Dom Miller]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://www.trimagency.com/?p=2524</guid>
		<description><![CDATA[<p>CSS transitions allows smooth animation of containers using max-height. Using height will not work. Example:</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/animating-height-with-only-css/">Animating height with only CSS</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>CSS transitions allows smooth animation of containers using max-height.  Using height will not work.</p>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
.container{ 
  margin: 1%;
  width: 70%; 
  
  &amp;:hover{
    .content{
      max-height: 300px;
    } 
  }
}

.content{
  transition: max-height 1s ease;
  overflow: hidden;
  max-height: 0;
}
</pre>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/animating-height-with-only-css/">Animating height with only CSS</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/animating-height-with-only-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Efficient Object Oriented Design with UML Sequence Diagrams</title>
		<link>http://old.trimagency.com/efficient-object-oriented-design-with-uml-sequence-diagrams/</link>
		<comments>http://old.trimagency.com/efficient-object-oriented-design-with-uml-sequence-diagrams/#comments</comments>
		<pubDate>Fri, 03 Feb 2017 22:22:37 +0000</pubDate>
		<dc:creator><![CDATA[Alex Miller]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2509</guid>
		<description><![CDATA[<p>So, you have a feature to write. Now what? Do you start coding right away and hope for the best? Hopefully not. Here&#8217;s an example of using a Universal Modeling Language (UML) Sequence Diagram to plan a feature. In this example, User calls the create() method on Post, which in turns calls the send() method [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/efficient-object-oriented-design-with-uml-sequence-diagrams/">Efficient Object Oriented Design with UML Sequence Diagrams</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>So, you have a feature to write.  Now what?  Do you start coding right away and hope for the best?  Hopefully not.  Here&#8217;s an example of using a Universal Modeling Language (UML) Sequence Diagram to plan a feature.</p>
<p><a href="/wp-content/uploads/2017/02/sequence_example.png"><img src="/wp-content/uploads/2017/02/sequence_example-300x215.png" alt="sequence_example" width="300" height="215" class="alignnone size-medium wp-image-2512" /></a></p>
<p>In this example, <code>User</code> calls the <code>create()</code> method on <code>Post</code>, which in turns calls the <code>send()</code> method on the <code>Messenger</code> class.  The dotted line is called the object&#8217;s <em>Lifeline</em>.  The part of the <em>Lifeline</em> that is wider, is where the object is active. </p>
<p>What are the benefits of a sequence diagram?  It turns the focus from the objects themselves to the messages that pass between them.  You can see what public interfaces you&#8217;ll need to implement.  As Sandi Metz writes in her book, <em>Practical Object-Oriented Design in Ruby</em>, this process can also reveal &#8216;hidden objects&#8217; &#8211; object you didn&#8217;t know you needed. If you do TDD, you also know what tests to write.  What happens if you make a mistake?  Just fix the diagram.  It&#8217;s a lot cheaper than fixing code.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/efficient-object-oriented-design-with-uml-sequence-diagrams/">Efficient Object Oriented Design with UML Sequence Diagrams</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/efficient-object-oriented-design-with-uml-sequence-diagrams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase Productivity On Your Mac</title>
		<link>http://old.trimagency.com/increase-productivity-on-your-mac/</link>
		<comments>http://old.trimagency.com/increase-productivity-on-your-mac/#comments</comments>
		<pubDate>Tue, 31 Jan 2017 18:30:56 +0000</pubDate>
		<dc:creator><![CDATA[Wilson Rook]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2507</guid>
		<description><![CDATA[<p>Today I learned about a tool to help with workflows on your mac. The Better Touch Tool allows the user to create custom workflows, keyboard shortcuts and snap areas. The custom keyboard shortcuts can be set to individual apps or to be enabled in certain circumstances. In addition to special keyboard shortcuts, the app also [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/increase-productivity-on-your-mac/">Increase Productivity On Your Mac</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Today I learned about a tool to help with workflows on your mac. The <a href="https://www.boastr.net/">Better Touch Tool</a> allows the user to create custom workflows, keyboard shortcuts and snap areas.</p>
<p>The custom keyboard shortcuts can be set to individual apps or to be enabled in certain circumstances. In addition to special keyboard shortcuts, the app also allows you to customize actions based on gestures input through the trackpad.</p>
<p>A feature I have started using is setting up custom snap areas. The basic level of this feature adds in the functionality found default in modern Windows environments. When dragging an app to the edge or top of the screen it will snap to take up half or a corner of your screen. The advanced functionality of this features allows you to set multiple drag zones that will allow you to size a window down to the specific pixel dimensions that work for you, then create a keyboard shortcut or drag zone to replicate these dimensions.</p>
<p>Finally, if you have a favorite mouse whose auxiliary buttons and features do not work natively with your mac, you can map the desired functions with this app.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/increase-productivity-on-your-mac/">Increase Productivity On Your Mac</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/increase-productivity-on-your-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Power of 3 [micro team edition]</title>
		<link>http://old.trimagency.com/the-power-of-3-micro-team-edition/</link>
		<comments>http://old.trimagency.com/the-power-of-3-micro-team-edition/#comments</comments>
		<pubDate>Sun, 29 Jan 2017 23:51:09 +0000</pubDate>
		<dc:creator><![CDATA[Tim Hasse]]></dc:creator>
				<category><![CDATA[Today I Learned]]></category>
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2499</guid>
		<description><![CDATA[<p>Today I learned that we need to keep doing something that we have found really works: At Trim, we believe that a lean, cross-functional team of three can build a product. To us, that team of three is made up of one product design lead, one product development lead, and one product strategist. We call this [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/the-power-of-3-micro-team-edition/">The Power of 3 [micro team edition]</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><em>Today I learned</em> that we need to keep doing something that we have found really works: At Trim, we believe that a lean, cross-functional team of three can build a product. To us, that team of three is made up of one product design lead, one product development lead, and one product strategist. <strong>We call this a micro team, and each team member&#8217;s role is required.</strong></p>
<p>We have [all] seen how greatly velocity can be impacted when teams invest too much human capital on a project. It is business law that your output does not grow at the same multiplier of &#8220;personnel&#8221; on a project. At some point, often said to be over 6 people on any team, you begin to see clear diminishing return as more and more team members contribute to one single business unit. On any given sprint, we will augment a team with more resources only if necessary, as we try to keep our efficiency as high as possible.</p>
<p>Our formula is to hire consultants that embody the skill <strong>and the empathy</strong> to make decisions in their domain and align with the value and core mission of the product owner&#8217;s feature set. Our developers need to flag designs that will double the scope versus an alternative solution, our designers need to flag a work-flow that strategy has over-complicated, and we all need to be able to assemble as often as needed to align with those pivots.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/the-power-of-3-micro-team-edition/">The Power of 3 [micro team edition]</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/the-power-of-3-micro-team-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Environment Variables in Webpack</title>
		<link>http://old.trimagency.com/environment-variables-in-webpack/</link>
		<comments>http://old.trimagency.com/environment-variables-in-webpack/#comments</comments>
		<pubDate>Sun, 29 Jan 2017 20:23:07 +0000</pubDate>
		<dc:creator><![CDATA[Dom Miller]]></dc:creator>
				<category><![CDATA[Team Trim]]></category>
		<category><![CDATA[Today I Learned]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webpack]]></category>

		<guid isPermaLink="false">http://trimagency.com/?p=2492</guid>
		<description><![CDATA[<p>Diving into webpack module loader can often seem like a confusing and daunting task. Luckily, setting environment variables is rather straight forward. At the top of your webpack.config.js file define your environment variables like so: Then in the plugins array use DefinePlugin method to define global variables configured at compile time: Re-compile and now your [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/environment-variables-in-webpack/">Environment Variables in Webpack</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Diving into webpack module loader can often seem like a confusing and daunting task.<br />
Luckily, setting environment variables is rather straight forward.</p>
<p>At the top of your webpack.config.js file define your environment variables like so:</p>
<pre class="brush: jscript; title: ; notranslate">
/**
 * Example Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const API_URL = process.env.API_URL = 'http://localhost:3000';
const METADATA = {
  API_URL: API_URL,
  ENV: ENV
};
</pre>
<p>Then in the plugins array use DefinePlugin method to define global variables configured at compile time:</p>
<pre class="brush: jscript; title: ; notranslate">
/**
 * Make Webpack Constants Available Globally
 */
   new webpack.DefinePlugin({
     'ENV': JSON.stringify(METADATA.ENV),
     'API_URL': JSON.stringify(METADATA.API_URL),
     'process.env': {
       'ENV': JSON.stringify(METADATA.ENV),
       'NODE_ENV': JSON.stringify(METADATA.ENV),
       'API_URL' : JSON.stringify(METADATA.API_URL),
     }
   }),
</pre>
<p>Re-compile and now your variables will be globally available.</p>
<p>The post <a rel="nofollow" href="http://old.trimagency.com/environment-variables-in-webpack/">Environment Variables in Webpack</a> appeared first on <a rel="nofollow" href="http://old.trimagency.com">Trim Agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.trimagency.com/environment-variables-in-webpack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
