Active Record Queries: Specifying Conditions on Associations
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 […]
Styling Select Elements with JCF
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 […]
Dropbox & Webpack
I’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 “it’s Tmux’s fault” and […]
Testing Modules in Rspec
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’s subject class; extending it with SomeProject::MyHelpers to unit test a method called :helpfulness.
Rails Forms: Validating and Persisting Duplicate Parameter Names
Building Rails forms is a pretty straightforward process but, once in a while, I run into a ‘gotcha’ 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 […]
Rename a Phoenix Application
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 […]
Common Table Expressions in Postgres
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 […]
Evernote to Blog Post
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 […]
Recursion in Elixir
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’s recursion? Recursion is solving a problem whereby one applies the same solution to smaller instances of that problem. […]
Angular 1.x Dropdown Menus
(Removing The Blank Option)
Over the past week I kept running into the issue of iterating over an array or an object in a <select> field with ng-repeat, only to find that I had a blank option as the first item in the dropdown. After trying several strategies, I finally found one that worked. Let’s say you want to […]
Animating height with only CSS
CSS transitions allows smooth animation of containers using max-height. Using height will not work.
Example:
Efficient Object Oriented Design with UML Sequence Diagrams
So, you have a feature to write. Now what? Do you start coding right away and hope for the best? Hopefully not. Here’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 […]
Increase Productivity On Your Mac
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 […]
The Power of 3 [micro team edition]
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 […]
Environment Variables in Webpack
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 […]