Jason Draper2022-03-10T16:14:02+00:00http://drapergeek.comJason DraperStatic Typing in Ruby with a Side of Sorbet2019-10-31T00:00:00+00:00http://drapergeek.com/posts/static-typing-in-ruby-with-a-side-of-sorbetI Guess I'm A Minimalist Now2018-09-19T00:00:00+00:00http://drapergeek.com/posts/i-guess-i-m-a-minimalist-now<h2 id="how-it-started">How It Started</h2>
<p>I’ve never been a tidy person. I’m not very organized when it comes to my desk,
my house or my car. To be honest: this hasn’t ever really bothered me even
though I’d prefer it were better. Then I started to work from home and things
changed, a lot.</p>
<p>Suddenly, those shelves crammed with junk I hadn’t touched in months really
bothered me. Previously, I only had to deal with my clutter during the short few
hours at home in the evening with my family and that barely provided enough time
to think, much less worry about cleaning! Now that I was at home most of the
week, lunch time was often frustrating because I wanted to feel comfortable and
relaxed but I was bothered by the mess. I wondered “are we messy people?” For a
while, it really bugged me and I spent a lot of free time cleaning and
reorganizing to no avail. Then, somehow I stumbled upon <a href="https://www.theminimalists.com/minimalism/">minimalism</a>. Please,
if you don’t know what minimalism is, read that before continuing. I’m not going
to give a great explanation at all and it’s a very in depth topic.</p>
<p>It sounds weird but I felt like my eyes had been opened. For years, I’ve
struggled with not being organized and to be candid, being deeply in debt
despite being gainfully employed for many years. After reading and watching
everything I could on minimalism, I felt stupid for all that I owned. Most of
these things meant nothing to me and oddly enough, the ones that I really
valued, lost value because I had multiple of them. (I’m looking at you Oakley
sunglasses collection!)</p>
<p>I’ve constantly wanted a smaller place and fewer things but for some reason, I
never really took action on that. Minimalism was the answer to a lot of my
questions. I can simplify my life including finances, wardrobe and family life?
These people may be on to something…</p>
<p>At this point I didn’t think, I didn’t plan, I just started ripping my house to
pieces. I started in my office, I wanted to make sure that I had a calm space to
work in everyday. It was also an easy target as almost all of the office was
“mine” so I didn’t have to discuss anything with my wife first. Within two days,
I had taken out 4 trash bags worth of things and 3 boxes to go for donation and
I felt amazing!</p>
<p>What “rules” did I follow? If it doesn’t spark joy or it wasn’t absolutely
required, it was gone! If I had more than 1 of something, there had to be a
really good reason and 2 of something was almost unthinkable.</p>
<p>Miranda asked me about what was going on and I gave a very short answer about
these “crazy minimalist guys” and that I thought it would make me happier. Being
the loving wife that she is, she didn’t make fun but simply smiled and said “you
do you baby”. I didn’t try and push it on her and she didn’t push back.</p>
<p>The office was a great start but I wanted more! The next Saturday Miranda was
kind enough to take the kids out while I slept in a bit. When I got up, I made
some tea and immediately started decluttering my closet. By the time they came
home, I was down to 20 things hanging in my closet, all my drawers had been
“minimized”, and there was nothing on my nightstand or dresser. I was loving it!</p>
<p>This is when it really became fun: without a word, Miranda came in and started
doing the same to her closet! She didn’t say a word, just started clearing with
reckless abandon. She would perk up and ask questions here and there: “Is there
a reason we should keep this?” or “Are you OK if I get rid of this?”. She even
encouraged our son Zach to fill a bag with some of his old toys to give away. it
seems that within a couple weeks we went from “minimalism, what is that?” to
“So…I guess we’re minimalists”.</p>
<h2 id="hows-it-going">How’s It Going</h2>
<p>That was about 2 months ago. Since then, we have made 6 trips to the donation
center with my truck packed to the brim and more trips to the dump than I’d like
to admit. We’ve also sold a multitude of things on craigslist. We’ve cleared
about 50% of our house and we’re still going strong. Some of our major
milestones so far:</p>
<ul>
<li>I eliminated an entire section of our closet</li>
<li>For the first time since we moved into our home, we pulled the car into the
garage.</li>
<li>Our 4 yr old son, without any prompting, started going through his shoes
“Daddy, I don’t like these anymore, we can give them to someone who needs
them. These don’t fit, we can take those too.”</li>
<li>We’ve removed two dressers, 2 storage cabinets, 2 garage storage units, 10
storage tubs in our garage and a desk.</li>
<li>I have an entire empty cabinet in my kitchen along with two empty drawers.
While this may sound like a minor accomplishment,
I had planned to rennovate the kitchen next year and add a
lot more storage because I’ve been unhappy at the lack of it. Now I’m
thinking I may rip off the cabinets to make more open space!</li>
</ul>
<h2 id="hows-its-changed-things">How’s It’s Changed Things</h2>
<p>Unfortunately, I can’t <a href="https://www.tvfanatic.com/quotes/once-you-reach-level-16-you-can-see-the-color-blurple/">see the color blurple</a> yet, but wow, I’m loving this
change. Our house stays clean, it’s amazing! It take so little effort to clean
when you have fewer things. For the first time ever, we went out of town and
returned to a clean house. OH MY SWEET LORD, DO YOU KNOW HOW GREAT THAT FEELS?!
It was so nice!</p>
<p>It’s eased some tensions in our marriage as well. When you’re on the same page
of “we don’t need things”, it really helps with discussing finances. We know
where our values stand and it’s not in our material possessions. We thought we
knew that before but our spending disagreed. The house being cleaner has also
made things calmer for both us and the kids.</p>
<p>It’s calmed my ADHD a lot. I’ve struggled with my focus for a long time and
having fewer things has calmed that down significantly. There are fewer things
to distract me and in general I’m more calm. Combining minimalism with a regular
meditation routine has allowed me to make massive improvements there. It hasn’t
cured or even solved the problem but it’s improving and that’s my goal.</p>
<p>Travel suddenly became easier. Once you’ve learned that you don’t need as much
at home, packing a bag is super simple. You know exactly what you use everyday
and those “just in case” items aren’t necessary.</p>
<p>I’ve also changed a lot of personal habits and minimized my life outside of
clutter. I’ve removed a ton of apps on my phone and I spend significantly less
time there. I’ve replaced almost all “mindless screen time” with reading
instead. I also spend a lot more time just playing with the kids.</p>
<p>It has curbed our spending a lot. We now have a few questions to ask ourselves:</p>
<ul>
<li>Do I <strong>really</strong> need this or do I want it?</li>
<li>Do I want this item or do I want to be debt free? I truly enjoy paying on my
debt. If I have that addiction to go buy something, I move over to a debt
and make a payment there instead. I get the same dopamine hit and I’ve
solving problems instead of causing them.</li>
<li>What can I eliminate from my life if I purchase this item? Ideally anything
new should replace 2 items.</li>
<li>Where will this item live? When you live with fewer items, you need to think
about this beforehand and it really makes you consider how important it is.</li>
<li>How long will this last? I don’t want to buy something that’s cheap and goes
away. I want to purchase quality items that last a long time.</li>
<li>Could I purchase this used instead?</li>
</ul>
<p>I’m also a lot more willing to return items I’ve purchased and I’m not 100% happy with.</p>
<h2 id="whats-next">What’s Next</h2>
<p>At best, we’ve covered 50% of our house but that’s probably a bit on the
generous side. I plan on making another pass through the office and the kitchen.
The next big task is the kids room and toys. We’ve avoided it for a while
because I don’t want to make a rash decision without thinking it through when it
comes to them. I’ve been reading <a href="https://www.amazon.com/Simplicity-Parenting-Extraordinary-Calmer-Happier/dp/0345507983/ref=sr_1_1">Simplicity Parenting</a> and it’s given me some
great insights and we’re ready to make the big change there as soon the
grandparents take the kids for a weekend.</p>
<h2 id="my-goals">My Goals</h2>
<p>My goals for minimalism are pretty simple: I want to do more with less. I don’t
want to work 5 days a week, I’d like to work 4 and be able to spend another day
focusing on my family or community efforts. That’s a long way off but I’m
spending a lot more time now doing things that will prepare me for the future. I
would like to be able to live in a smaller home than we have now. I love our
home but it’s nice to know that you can go anywhere and be comfortable. I’d also
like to be able to travel as a family more. I want to spend more of my time at
home focusing on my family and not my things.</p>
<p>For now I’m enjoying the peace that comes from having fewer things in our home.
I’m also enjoying watching our debt go down quickly since we’re on track. Our
home feels calm and clean and that’s amazing.</p>
How DayOne Makes Minimalism Easier2018-09-15T00:00:00+00:00http://drapergeek.com/posts/how-dayone-makes-minimalism-easier<p>A couple months back, I discovered <a href="https://www.theminimalists.com/minimalism/">minimalism</a> and dove in deep. It’s made a
huge impact on our lives and I intend on writing a full post about it but for
now, I really wanted to share how <a href="http://dayoneapp.com/">DayOne</a> has made this process easier.</p>
<p>Part of decluttering is removing things that may have sentimental value but
don’t provide any true value in your life. This is where most people really have
a hard time in their minimalism journey. I don’t think we realize how often we
let these types of items accumulate in our lives. I’m not a sentimental person
but I definitely had way more of these items than I ever expected.</p>
<p>Getting rid of something that was given as a gift, especially from a beloved
family member can be really hard. When my grandfather passed, he left me a metal
dog nutcracker. I don’t eat nuts that require a nutcracker (and it was a pretty
ugly trinket) but for 5 years now, I’ve moved this thing from closet to closet
and from state to state. Each time I saw it, I remembered my grandpa and all the
things he taught me but the thing is: I only saw it once a year or so when we
moved. When I started minimalism, I decided that I wouldn’t waiver: if something
didn’t have a purpose or didn’t spark joy, it was going. I decided that anything
that was sentimental in anyway, I would snap a picture, put it in DayOne with a
quick note, and move on.</p>
<p>I had no idea how great this would be! A couple days in I started actively
looking forward to getting rid of these items. Their original purpose was to
bring me joy but they weren’t anymore. By adding them to my journal, I knew that
every single year, I would get to see that come back in my daily review and I’d
get to smile and think about the person that gave it to me and why it was
important.</p>
<p>My house is clear (or getting there) and my journal is packed! I can’t wait to
look back at my journal over the next year and remember all these wonderful
gifts and the loving people in my life.</p>
Bye Apple, Hello Tux2018-06-25T00:00:00+00:00http://drapergeek.com/posts/2018.markdown-bye-apple-hello-tuxHave you evaluated your toolchain recently?2018-06-19T00:00:00+00:00http://drapergeek.com/posts/have-you-evaluated-your-toolchain-recentlyPriming the pump2016-09-05T00:00:00+00:00http://drapergeek.com/posts/priming-the-pumpMy issues with Let2016-05-20T00:00:00+00:00http://drapergeek.com/posts/my-issues-with-letDocument an API with Paw2015-03-23T00:00:00+00:00http://drapergeek.com/posts/document-an-api-with-pawWhy I love working with Railsbridge2014-11-10T00:00:00+00:00http://drapergeek.com/posts/why-i-love-working-with-railsbridge<p>I’ve been volunteering with <a href="http://railsbridge.org/">RailsBridge</a> now for 3 years. I started out just
volunteering as a coach and moved up to helping organize in <a href="http://railsbridgeboston.org/">Boston</a> and
recently in the <a href="http://www.meetup.com/raleighrb/events/211776592/">Triangle</a>. RailsBridge has been one of the most fun and
rewarding opportunities I’ve ever had I’d like to share why.</p>
<p>I will be omitting the obvious answer here - “we need more diversity in
technology”. That is the mission of RailsBridge and that should be your primary
reason for helping out. I’m going to list the other reasons that may not be quite
so obvious.</p>
<h2 id="you-get-to-check-your-own-learning">You get to check your own learning</h2>
<p>It has been a while since I’ve had the opportunity to work with someone brand
new to the world of web development. A lot of RailsBridge participants have
never heard the words we use daily such as ‘DOM’ or ‘EC2’. When you’re asked
questions about these things, you are forced to really stretch your
understanding of a concept to be able to simplify it enough to make sense but
not to the point that the answer is useless.</p>
<p>I have been forced to question a lot of my own understanding of how things work
after a participant questioned my reasoning. Having a fresh perspective on
things is always nice. Each time I’ve volunteered, I’ve received a ton of new
perspectives.</p>
<h2 id="you-get-to-work-with-different-types-of-users">You get to work with different types of users</h2>
<p>RailsBridge brings in people from all kinds of backgrounds. I’ve had the
opportunity to work with founders of non-profits, secretaries who were looking
for their next career, parents wanting to learn to program so they could teach
their kids and PHP addicts looking to drop the habit. All the users have
different operating systems, environments, text editor choices and browser
choices.</p>
<p>In the Rails ecosystem we tend to have a very narrow scope of “mac or
linux”. That isn’t the case here, Windows XP is still quite prevalent on a bunch
of the machines that come in. I’ve spent hours installing Rails on a Mac OS
10.4. You learn to work with whatever they bring to the table. Having to
troubleshoot different environments reminds us to keep all those users in mind
when we’re developing tools for other developers. We don’t all use Macs!</p>
<h2 id="we-get-to-be-nice">We get to be nice!</h2>
<p>I’ve said for a while now that the point of RailsBridge is not to teach
programming, it is to be a commercial for those interested in programming. We
give those who are interested in programming the chance to see how awesome
programming is in a weekend and they can decide if they want to learn more from
there.</p>
<p>I stand by that point; but I think it serves another, possibly more necessary
function: to show others that the programming community is friendly! Most of the
people I’ve encountered in this community have been ridiculously friendly and
letting people new to our community see that can go a long way. All communities
have outliers that screw up the system, we have more than our fair share,
but getting all the people together who want to be nice and help allows us to put
our best foot forward and show that we want diversity and that we want to be
helpful.</p>
<h2 id="give-back">GIVE BACK</h2>
<p>We’ve all been blessed by being in this community. <a href="http://railsbridge.org/">RailsBridge</a> allows us to
give back. It allows us to give someone else the chance to take part in a
community that I really love.</p>
<p>Explaining “rails server” to someone in a weekend and finding out a year later
that she went on to get a programming job has to be one of the most rewarding
things I’ve ever done. I can’t encourage you enough to find your local chapter
and give back any chance you can!</p>
Ember is for Designers2014-11-06T00:00:00+00:00http://drapergeek.com/posts/ember-is-for-designersMove with regex2014-11-05T00:00:00+00:00http://drapergeek.com/posts/move-with-regex<p>Let’s say you want to move a file between two adjacent folders. The most
straightforward way would be as such:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mv ~/app/models/builder.rb ~/app/services/builder.rb
</code></pre></div></div>
<p>For years now, this is how I moved my files. Then I paired with a coworker who
gave me a strange look when I ran this command. In ZSH there is a faster way to
make this change:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mv ~/app/{models,services}/builder.rb
</code></pre></div></div>
<p>Using the glob <code class="language-plaintext highlighter-rouge">{models,services}</code> ZSH will make the exact same move with nearly
half the typing! This is all made possible through the wonderful power of
<a href="http://zsh.sourceforge.net/Doc/Release/Expansion.html">expansion</a>.</p>
<p>There are so many more tricks available in the shell, it is well
worth some time spent reading the manpages!</p>
I don't like writing code2014-11-04T00:00:00+00:00http://drapergeek.com/posts/i-don-t-like-writing-code<p>Honest confession: I don’t like writing code.</p>
<p>WHAT?! You don’t like writing code?</p>
<p>Nope! I love solving problems. I love building products for clients. I love
being able to spend 30 hours pouring over a problem and have someone respond
with “you made my job so much easier”. That is what I get my pleasure from,
that is what fuels me.</p>
<p>I don’t write code for a living. I’m a developer. I develop solutions. When
clients come to us, they’re not looking for lines of code – that is not the
deliverable. The deliverable is a product that provides value in some way to
them. The code is just a requirement to get to that product.</p>
<p>Code is an unavoidable part of developing software. Code is the part of product
design that slows us down, it is the part that breaks, the part that causes
exceptions and the part that causes confusion. Our primary goal as developers is
to do as much as possible with as little code as possible. This is why we spend
so much time focusing on good coding techniques so that when we interact with
the code, we can make it as easy as possible to work with it in the future.</p>
<p>I love that more frameworks are coming out and abstracting more concepts away
from us. Most applications aren’t that unique, we build them on the same basic
ideas. Anything that helps us to put these concepts into practice with less code
and less effort is great thing and I welcome every new opportunity to try it
out.</p>
<p>I should be clear – I don’t hate writing code. I love playing around with
techniques and seeing how I can make the code more clear and expressive but only
because that is something that is required for me to be able to build my
software more effectively and quickly. I love learning new programming languages
and frameworks and I love practicing my craft but it is all in service of
developing software. If there ever comes a day that we can write software with
no code, I’ll still call myself a developer. I’m still developing, the
underlying tools don’t define my job.</p>
Developer Survival Tactics2014-11-03T00:00:00+00:00http://drapergeek.com/posts/developer-survival-tactics<p>I was recently asked to give a presentation to a class of new Rails developers
from a local bootcamp. I really struggled with what to talk about. Web
Development today is a wide field and there are a ton of things that one could
present to new people in our field. After a lot of debating I settled on a few
‘rules’ that would help out new developers in the field.</p>
<p>These rules, though they are perfect for new developers, are also for the
seasoned developer. I’m willing to bet that most successful programmers are doing
most, if not all of these already. They are not new or unique. I extracted these
rules from various sources. Part of them came from books I’ve read and part of
them are distilling down principles that we use at <a href="http://thoughtbot.com/">thoughtbot</a> to run a great
company.</p>
<h2 id="get-involved-in-open-source">Get Involved In Open Source</h2>
<p>If you’re a Rails developer, your job is made possible by open source so it seems
obvious that you should somehow give back. If you’re a new developer, it may
seem scary after first to jump into the open source world but never fear, there
are places in the community for everyone!</p>
<p>One thing that people new to open source often complain about is
lack of documentation. We love to write code but hate writing documentation. As
someone who is new to the community, you are perfectly placed to help out! If
you run across a README that has an incorrect command, put in a pull request to
help out the author. If you figure out why something didn’t work, but you can’t
figure out how to fix it, be sure to submit an issue. More importantly:
get feedback to the maintainers, somehow, someway. If you have an
issue with a library and never speak up, there may be hundreds more out there
that are also suffering and the maintainer may never know.</p>
<p>Most open source maintainers are very friendly and love to hear feedback about
their libraries, don’t be afraid to speak up!</p>
<p>Open source contributions also look great on a resume!
Employers can easily see that you’re willing to help in the community.
They will also get a view into how well you can explain your thoughts
and opinions.</p>
<h2 id="constant-learning">Constant Learning</h2>
<p>Your journey into the depths of programming has only just begun! You will soon
come to find out that there are tons of things you need to learn to keep up. One
day, Rails will be gone, that is OK because you’ll be prepared way before that
happens!</p>
<p>Here are some general guidelines on what you should follow for continuing your
learning. These are based on ideas from the <a href="https://pragprog.com/book/tpp/the-pragmatic-programmer">Pragmatic Programmer</a>:</p>
<ul>
<li>Read one technical book a quarter.</li>
<li>Learn one new technology a year. A new programming language, a new database
type, a JavaScript framework, etc.</li>
<li>Practice coding two hours a week. This can be anything from code katas to just
writing a side project in a new language.</li>
</ul>
<p>Note: your job does not count as practice!</p>
<h2 id="share-what-you-learn">Share What You Learn</h2>
<p>As you learn new things, write a blog about them! It may be scary at first to
put your thoughts on view but I assure you, there is always someone who will benefit
from your insights into these problems.</p>
<p>Think about what you would have liked to read one week ago. What example or
explanation of a programming concept could have helped you to move forward? Put
that into a blog post!</p>
<p>Even if no one ever reads you blog posts, if you write down
what you learn, you will end up referencing your own blog posts in the future.</p>
<p>Another benefit of blogging is that it provides another great way for employers
to see what you know. Your potential employer can very quickly see that
you understand concepts and you can explain them. Communication is
one of the greatest skills a developer can have and blogging helps to sharpen that
skill.</p>
<h2 id="get-feedback-and-give-some-too">Get Feedback (and give some too!)</h2>
<p>You will never know if you’re writing bad code if no one else is looking at it.
Ask regularly for your code to be reviewed. Ask you boss, your friends, or your
coworkers. I even ask for code reviews on my side projects! If you’re trying to
be better at a skill, you need input from others.</p>
<p>Giving feedback to others is also a great way to learn. You’ll get to see how
others make decisions and techniques they use. If you work at a company that has
pull request code reviews I highly encourage you to read and comment on as many
as time allows. The more code you see, the quicker your experience level is
going to grow.</p>
<h2 id="work-sustainably">Work Sustainably</h2>
<p>40 hours a week is not where you start, it is where you stop being productive!</p>
<p>Your brain does not function well when you push it to do the same thing over and
over. You need to get some rest and do things other than programming. Find a
hobby, spend time with your family or just go for a walk!</p>
<p>It is a very strange occurrence but when you allow yourself more time away from
the computer, you will find that the time your spend at the computer is
actually more productive.</p>
<h2 id="be-social">Be Social</h2>
<p>The programming community, and the ruby community in particular, is very
friendly and inviting. Attend a meetup in your area. Most of them offer beginner
topics along with the more advanced topics and most of us can benefit from
both! The important thing is to talk to developers and get as much knowledge as
possible from a wide variety of people.</p>
<p>Volunteering to help others can also be a great way to learn. Every time I
work with a new developer, I learn something.
If you’d like to help out and get involved but aren’t sure where, I would
recommend checking to see if you have a <a href="http://railsbridge.org/">RailsBridge</a> chapter in your area. It
is a great organization and I love helping out there.</p>
<h2 id="finally">Finally</h2>
<p>Being a developer is a great career. We get to combine creativity and logic to
build amazing products to make people’s live easier and better. We have to
continually work at our craft to perfect it but most of us enjoy that part!</p>
pkill and pgrep2014-03-29T00:00:00+00:00http://drapergeek.com/posts/pkill-and-pgrep<p>How often do you find yourself doing something like this?</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ps aux | grep 'myprocess'
#find the process id
kill -9 2414
</code></pre></div></div>
<p>While working with <a href="http://twitter.com/patbrisbin">Pat Brisbin</a> the other day, I
done this same thing and he taught me a great shortcut. There are built in
shortcuts for both of these functions.</p>
<p>If you only want to find the process information, you can use <code class="language-plaintext highlighter-rouge">pgrep -f
myprocess</code>. This does the same thing as ps and then piping that to grep. If you
want to actually kill a process you can shorten it all the way to simply <code class="language-plaintext highlighter-rouge">pkill
-f my_process</code>.</p>
<p>I’ve been wasting my time with extra commands for way too long!</p>
My Alfred Extensions2014-03-29T00:00:00+00:00http://drapergeek.com/posts/my-alfred-extensions<p>I love Alfred. I use it for everything I can. Recently one of the developers at
thoughtbot shared his list of extensions and I thought that was a great idea and
I decided to do the same. Here is my current setup.</p>
<p>Extensions:</p>
<ul>
<li><a href="https://files.app.net/2zwm2acCb">Omnifocus</a> - I use a plugin that <a href="https://twitter.com/gfontenot">Gordon Fontenot</a> wrote to quickly add items to my omnifocus list.</li>
<li><a href="https://github.com/zenorocha/alfred-workflows/tree/master/dash">Dash</a> - For documentation</li>
<li><a href="https://github.com/drapergeek/alred-dayone">Day One Log</a> - I like being able to quickly add entries to day one. This is a
quick script I put together to use the command line.</li>
<li><a href="http://destroytoday.com/blog/gif-workflow/">Gif Filter</a> - I like gifs. This allows me to easily lookup the gifs in my
folder by their name.</li>
<li><a href="https://github.com/zenorocha/alfred-workflows/tree/master/ip-address">Ip</a> - This is stupid simple but it is a great way to find my external IP
quickly.</li>
<li><a href="https://github.com/zenorocha/alfred-workflows/tree/master/kill-process">Kill
Process</a> - Allows me to quickly kill a process. I don’t use this a lot
because I’m usually in the terminal but it is handy when a browser crashes.</li>
<li><a href="http://www.alfredforum.com/topic/1993-menu-search/">Menu Bar Search</a> - Use alfred to hit any menu bar item! Crazy!</li>
<li><a href="https://github.com/drapergeek/alfred-open-project">Open Project</a> - I use pow and tmuxinator which means that I can use this one
workflow to open my terminal to the directories I need as well as get my
browser ready. This is great when switching between projects.</li>
</ul>
EmberJS with a Separate Rails API2014-02-25T00:00:00+00:00http://drapergeek.com/posts/emberjs-with-a-separate-rails-apiCustom Ember Computed Properties2014-02-14T00:00:00+00:00http://drapergeek.com/posts/custom-ember-computed-propertiesr unin=in2014-01-07T00:00:00+00:00http://drapergeek.com/posts/runin<p>Here is a quick ZSH trick I learned from my awesome coworker <a href="http://gabebw.com/">Gabe
Berke-Williams</a>. In ZSH, you can re-run your last command
using r.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bundle install
r #=> bundle install
</code></pre></div></div>
<p>This isn’t terribly help until you find out that you can perform some basic
substitution on your command. How about the following scenario? You’ve
upgraded postgres and need to reinstall the gem.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem uninstall pg
r unin=in #=> gem install pg
</code></pre></div></div>
<p>It is a small trick but can come in handy.</p>
repeat2014-01-06T00:00:00+00:00http://drapergeek.com/posts/repeat<p>This is a simple command I learned a while back. If you use zsh and want to run
a command multiple times, you can simply use the <code class="language-plaintext highlighter-rouge">repeat</code> command.</p>
<p>I have a problem in my test suite currently, there are a few specs that will
intermittently fail when I run the entire suite. This is a really big pain to
investigate because it requires running the entire suite multiple times.
Fortunately using the repeat command made it much easier. I done some work on
the test suite to try and resolve the issues, then I simply fire up a shell and
run:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> repeat 10 bundle exec rake
</code></pre></div></div>
<p>and then I go grab some more coffee! The test suite is fairly quick (about 2
minutes) so I can just let it run. After the suite has ran 10 times, if I don’t
have any failures, I can feel fairly confident I’ve fixed the issue.</p>
<p>The repeat command takes a number as the first argument and then the rest of the
command as the rest of the arguments. An example of running a single spec 200
times would be:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> repeat 200 rspec spec/models/idea_spec.rb:25
</code></pre></div></div>
<p>Repeat is a great tool to have in your chest anytime you want to do the same
thing multiple times.</p>
WARNING: The file has been changed since reading it!2014-01-05T00:00:00+00:00http://drapergeek.com/posts/warning-the-file-has-been-changed-since-reading-it<p>Papercuts, hitting your pinky toe, and that message have to rank among the most
annoying things that can happen to a human being!</p>
<p>Here is a simple trick that can cut down on how often you see that
message.</p>
<p>You’ve changed branches or you’ve done a rebase; when you move back into VIM
just toss in:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>:windo e!
</code></pre></div></div>
<p>This will tell VIM to edit all the buffers in the current window using their
current file. This forces a reload of all your files so that if anything changed, you
will see the most recent version of the file and VIM won’t complain that it has
changed since you last read it.</p>
<p>You can save yourself a bit more work by tossing in an alias such as ge (git
edit):</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>map <Leader>ge :windo e!<CR>
</code></pre></div></div>
<p>Hopefully this can save you a tiny bit of annoyance!</p>
git-bisect2013-08-09T00:00:00+00:00http://drapergeek.com/posts/git-bisectSSH Config2013-05-29T00:00:00+00:00http://drapergeek.com/posts/ssh-config<p>Seriously, how did I not know about SSH config before? I’ve been using SSH regularly for at least 5 years and did not know that a config file existed. I’ve actually written custom functions to help me out! Do not make the same mistake, use the awesome config file!</p>
<p>The ssh config file lives in your home directory at <code class="language-plaintext highlighter-rouge">~/.ssh/config</code> and has a very basic format. Check out a simple example here:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Host staging
Hostname staging.example.com
User deployer
Port 3333
</code></pre></div></div>
<p>With a simple config file, we can specify an alternate port (handy to avoid people banging on the door all the time), a hostname and a port. Now we can simply call <code class="language-plaintext highlighter-rouge">ssh staging</code> and it all works perfectly. Compare that to <code class="language-plaintext highlighter-rouge">ssh deployer@staging.example.com -p 3333</code> and this file becomes nearly magical!</p>
<p>To find more information just check out the <a href="http://linux.die.net/man/5/ssh_config">manpage</a>.</p>
Shoulda Matchers 2.02013-04-03T00:00:00+00:00http://drapergeek.com/posts/shoulda-matchers-2-0Change Around2012-05-15T00:00:00+00:00http://drapergeek.com/posts/change-around<p>For a while now I’ve been using the change inside command. If you simply hit:</p>
<pre>ci</pre>
<p>while inside a set of “blocks”(in this case a block can be single-quotes, double-quotes, parens, square braces, etc), vim will remove all the text inside that block and you are automatically put in to insert mode to replace the text. This is an awesome command. Today I learned another offset command, the change around command!</p>
<p>Lets say you have text that is just like this:</p>
<pre>output = 'Jason'</pre>
<p>and you want to replace the string with a reference to a variable called name. Normally I would probably go to the first single quote and just delete till the other quote however there is a better way! You can simply hit:</p>
<pre>ca</pre>
<p>which stands for ‘change around’ and vim will remove the entire ‘block’ including the quotes and you can just type your variable name! How hot is that?</p>
Reselect in vim2012-05-13T00:00:00+00:00http://drapergeek.com/posts/reselect-in-vim<p>If you have a block of text selected in vim, and you move off of it and want to reselect it, you can simply hit</p>
<pre>gv</pre>
<p>and all the text you had selected previously will be re-selected!</p>
Relative Copy in vim2012-05-13T00:00:00+00:00http://drapergeek.com/posts/relative-copy-in-vim<p>It surprises me that I’ve not found or used this before!</p>
<p>In vim, you can use relative line numbers to copy and paste code(it can actually be used for other commands as well but I stick to one command at a time). Using this command:</p>
<pre>:-5t.</pre>
<p>Will copy the line of code that is 5 lines above your current cursor to your current position.</p>
<p>This line:</p>
<pre>:-10, -8 t.</pre>
<p>Will copy from 10 lines above your cursor to 8 lines above your cursor and put it to your current position.</p>
<p>This is incredibly handy when trying to rearrange text and prevents you from needing to move to the line you need to copy, only to move back to where you need to paste it.</p>
I Suck at Testing2012-04-04T00:00:00+00:00http://drapergeek.com/posts/i-suck-at-testingMigration Alias2012-03-28T00:00:00+00:00http://drapergeek.com/posts/migration-alias<p>One thing I don’t do that I know I should, is validate that my down migration works properly. I also always seem to forget to migrate my test database after I’ve set up a migration. To help me out with this, I set up a simple alias to take care of both of these problems. This is what I have in my zsh aliases:</p>
<pre>alias rdb='rake db:migrate && rake db:migrate:redo && rake db:test:prepare'
</pre>
<p>This allows me, with one command, to migrate to the new version, pull back the migration, run it again and make sure that my test database is set up and ready.</p>
diff this in vim2012-03-28T00:00:00+00:00http://drapergeek.com/posts/diff-this-in-vim<p>In vim, if you pull up two files side by side, you can simply run</p>
<pre>:diffthis</pre>
<p>and see the differences quickly. Hotness.</p>
binding.pry2012-03-28T00:00:00+00:00http://drapergeek.com/posts/bindingpry<p>Quick tip: if you use <a href="http://pry.github.com/">pry</a>, you can simply throw binding.pry into your rails code and it will toss you out to a pry session to play around with your environment.</p>
Why I chose apprentice.io2012-03-26T00:00:00+00:00http://drapergeek.com/posts/why-i-chose-apprentice-ioRinvert2012-03-17T00:00:00+00:00http://drapergeek.com/posts/rinvert<p><img src="http://media.tumblr.com/tumblr_m0sonuflLu1r91fem.png"/></p>
<p>In case you’re not aware, <a href="https://github.com/tpope/vim-rails">rails.vim</a> is great. One of the commands that I just found out about is Rinvert. If you’re working on a migration such as:</p>
<pre>class AddAwesomeColumnsToAwesomeTable < ActiveRecord::Migration
def change
add_column :awesome_people, :awesome_level, :integer
add_column :awesome_people, :awesome_explanation, :string
end
def down
end
end
</pre>
<p>and you get to the down migration, you’re welcome to begin typing out the commands to drop the columns, however if you simply highlight the up method and call:</p>
<pre>:Rinvert</pre>
<p>all the magic will be done for you! Rails.vim will read what you’re doing and add the appropriate drops. If the migration is too complicated for it, it will add what it can and then mark it with an irreversible migration exception which then you can take out and change the more complicated stuff by hand.</p>
<p>Please note, in the newer versions of rails you can simply use change instead of up and down but there are times this won’t work. Even when it does, legacy code unfortunately still exists so this command can come in very handy.</p>
method: :delete2012-03-16T00:00:00+00:00http://drapergeek.com/posts/method-delete<p><img src="http://media.tumblr.com/tumblr_m0sos5ndEV1r91fem.png"/></p>
<p>I’m sure we’ve all seen the following code before:</p>
<pre><%= link_to “Destroy”, my_object, method: :delete %></pre>
<p>minus the new hash calls in 1.9.2, this is a pretty standard delete link rails. Here’s the issue though, links can’t make actually delete requests so how does this work exactly?</p>
<p>What rails is doing, is on the fly, if you’ve added this method, its actually makes your application execute a javascript function when clicked that then creates a delete request on the server side so that the routes work properly. The only downside to this is that if your users don’t have javascript running, this links fails epically. If you have users who don’t use javascript you basically have two options:</p>
<ul><li>Use button_to, this will create a whole form which actually allows the delete request and does not require javascript</li>
<li>Ignore those users. They’re weird anyway</li>
</ul><p>Personally, I’d opt for two but the choice is yours. Either way, you should be aware of what you are presenting to users.</p>
What My Blog Is2012-03-12T00:00:00+00:00http://drapergeek.com/posts/what-my-blog-is<p>Before I begin posting, I want to give a short explanation of what this blog really is. I look at this blog the same way that most open source is viewed: I am creating it for me and if it happens to benefits others then great! I need a place to dumb all this information, if in the process of doing so, this helps someone out, that is awesome. Sometimes when I describe a topic I may go into detail, most times though I will probably simply drop one of two lines in and move on just because its something fun I want to remember.</p>
vim git blame2012-03-12T00:00:00+00:00http://drapergeek.com/posts/vim-git-blame<p><img src="http://media.tumblr.com/tumblr_m0so4ya9Lt1r91fem.png"/></p>
<p>Often when working on a project in git, you may want to be able to quickly see made the code addition that you’re working on. If you’re in vim this is simple. Add the command below to your vimrc file:</p>
<pre>vmap b :!git blame =expand("%:p") \| sed -n =line("',=line("'>") p </pre>
<p>Now if you highlight any section of code and then press Leader+b, git will show you who edited the lines of code.</p>
tcomment2012-03-12T00:00:00+00:00http://drapergeek.com/posts/tcomment<p><img src="http://media.tumblr.com/tumblr_m0so5ezcXw1r91fem.png"/></p>
<p>When working with code, there are plenty of times you want to comment out large sections of code. I do this a lot when refactoring or going through a new codebase. There are plenty of tricks in vim for commenting out blocks of code however they may operate differently based on the language you’re working in. The best way I’ve found to comment multiple lines is <a href="https://github.com/tomtom/tcomment_vim" title="tcomment">tcomment</a>. This little vim plugin allows you to comment out large blocks of code in almost any language. Once you’ve set it up (I use <a href="https://github.com/tpope/vim-pathogen">pathogen</a>), you can use the command:</p>
<pre>:TComment</pre>
<p>after highlighting a section of text and like magic, its all commented out. The only time that I’ve ran into issues is when I’m editing a rails html.erb file and I wish to comment out a section of html. In that case I use the command:</p>
<pre>:TComment As html</pre>
<p>because tcomment assumes that I am working in ruby. This will only provide html comments, the ruby inside would still be executed.</p>
<p>I added the two lines below to my vimrc file. This gives me the ability to simply highlight the text and then use <Leader>cc to comment out ruby or <Leader>ch to comment out html blocks in a rails file.</p>
<pre>"map over the tcomment command
map cc :TComment
"This does tcomment for html
map ch :TCommentAs html
</pre>
supertab2012-03-12T00:00:00+00:00http://drapergeek.com/posts/supertab<p>Just wanted to put up a quick note here that <a href="https://github.com/tsaleh/vim-supertab">vim-supertab</a> is a sweet plugin. I haven’t really looked into it fully but so far the simple fact that if I have MyAwesomeClass defined somewhere in my project, if I type MyAwe and then hit tab, it will offer to finish it for me, is awesome. Check it out!</p>
apprenticeship @ thoughbot2012-03-11T00:00:00+00:00http://drapergeek.com/posts/apprenticeship--thoughbot<p><img src="http://media.tumblr.com/tumblr_m0qz5b0Gwt1r91fem.png"/></p>
<p>I have been accepted as an apprentice at <a href="http://thoughtbot.com">thoughtbot, inc</a> through the <a href="http://apprentice.io">apprentice.io</a> program! This is a VERY exciting adventure for me and as such I will be chronicling it on this blog(at least the new stuff I’m learning). I am going to try and keep this blog almost as a “tech journal” of sorts primarily for myself so that I can reference all the things I learn while at thoughtbot. I’ll also be blogging over on robots.thoughtbot probably once a week so check that out.</p>