This is part 2 of my series on tricks I’ve used in shell scripts. In this post, I’ll share a few ways a custom shebang can be used in ruby scripts.
This is part 1 of a series of quick and dirty tricks I’ve used in various scripts over the years. In this post, I’ll show how I like to provide help text for shell scripts.
Homebrew recently added bottles for Vim/MacVim – but they depend on
Homebrew-installed Ruby, Python, and Perl. I prefer to build these from source
so they will use whatever versions of these dependencies currently installed
on my system. Instead of constantly remembering
brew install -s vim to
install from source, I created a couple small formulae that disable bottles.
I mentioned in my last post that
WP-CLI’s Homebrew Formula includes a dependency on Composer I don’t need. I
spent a few minutes and came up with a simpler Formula
with no dependencies. To install, just run
brew install [--HEAD]
itspriddle/brews/wp-cli. The Formula just downloads pre-compiled phar files
directly from GitHub, this works great for my needs.
I’ve been working with WordPress a lot more lately, and I wanted a way to run it on OS X with as few dependencies as possible. Thanks to WP-CLI and PHP’s built in web server this is now easier than ever before.
GitHub allows a shorthand syntax for linking to commits, pull requests and issues: user/project@SHA for a commit and user/project#Num for an issue or pull request. I frequently paste links into Vim when writing git commit or pull request messages, and wanted a way to automatically convert these to the shorthand syntax on save.
I found a great list of signals in Linux.
In 2013 Dropbox added the ability to save your screenshots in Dropbox This is an awesome feature that I’ve used almost daily since it was announced. It’s always annoyed me you can’t configure this to use your Dropbox Public Folder. I finally came up with a way to do this using launchd. Head on over to the README for more info on how to set it up on your own system.
Vim allows you to run commands from the command line using the
vim +PlugUpdate or
vim -c ":PlugUpdate". Many plugin commands aren’t
available until you have opened a buffer (eg. rails.vim or git.vim). This has
bugged me for a while and I finally figured out how to make it work.
I maintain a small Homebrew tap for projects I work on at Site5, homebrew-site5. I came across a “meta” brew in Josh Peek’s homebrew-github Homebrew tap that allows you to install multiple dependencies with a single command. I adapted it for my own needs at Site5 and it has worked great.
I use the awesome hub utility to open pull requests on GitHub from the command line. I love being able to do this from the terminal. Since I almost always need to push a branch and copy the pull request URL to my clipboard, I wrote a wrapper to handle these steps in one command.
Rails comes with the ability to customize the IRB console when you run
console. This can be useful to preconfigure behavior for your console when
any developer runs it from any environment.
When developing a RubyGem, it is often helpful to launch an IRB console preloaded with your library. There are a few ways you can do this.
I finally got around to revamping this blog’s layout. Jekyll now includes a nice starting theme that I tweaked a bit. Now to remember to post more.
I wrote a blog post over at Eng5 outlining how we use TomDoc and GitHub pages for documentation at Site5. Check it out!
I stumbled across this video for the Tomy Racing Turbo. I totally remember using this when I was 4 or 5 years old.
I read an interesting article today about the show Mastercrafts. Mastering a craft like blacksmithing or stone masonry seems a lot like mastering computer programming, but much less forgiving. Definitely worth a read.
I came across this document a few months ago. It is an inside look at Gears, the game engine used to develop Final Fantasy VII.
Hacking for Site5 Engineering is an awesome gig. I work with an amazing team of highly opinionated developers from a wide background. In early 2012, we adopted a semi-formal process for working on software. We’ve been very happy with how this has worked out, so I thought it was time to share.
Today, I learned about a bunch of escape sequences that SSH supports.
Just over a year ago, I left for Railsconf and made one of the best decisions of my life: I was going to use the week in Austin to force myself to quit smoking.
Today, I wondered what the difference between
$@ in Bash were. This
is a tough one to Google for, so I’m copying the answer I found here:
I just came across this list of OS X Lion tricks and tips. A few I didn’t know about yet, such as Tip #22, resizing windows with Shift and Option.
I’ve been having trouble compiling Ruby 1.9.3 since updating to Xcode 4.6. After a little Googling, it turns out that the error is with some invalid CFLAGS set in Ruby’s compile scripts.
Today, I finally got a new MacBook Pro with Retina Display to replace my aging early-2009 model.
Today, I finally got
:make working for RSpec files in Vim.
Vim has a handy feature that allows you to run commands from a file when you open a new session.
Yesterday, I decided I wanted to edit a bunch of Jekyll posts. Specifically,
I wanted to move the
title field in each post’s YAML front matter to the
bottom. Instead of having to manually edit a few hundred files, I finally
remembered to use Vim macros.
My girlfriend has recently begun learning Java for college. The shittyness of Java aside, I’ve realized that its lack of a REPL makes it much harder to play around with its features.
Today, Sega re-released one of my favorite childhood games from Sega Saturn: NiGHTS into DREAMS….
ActiveRecord provides a
serialize method, which can be used to transparently
store a Hash, etc in a single database column.
I use Time Machine on OS X to keep backups of my hard drive. Overall it is a great program. However, restoring files can be a slow and cumbersome process.
I was sent this Credit Card Number Generator the other day. It has fake numbers to test a variety of cards with, and explains how the numbers are validated.
I installed OS X Mountain Lion today and have had a pretty good experience.
Font bomb is too much fun.
It looks like James Cameron is going to be recording three new Avatar films. I can’t wait to see the next installments!
A Law professor breaks down the lyrics from Jay-Z’s 99 Problems.
This is a good read on design principles in software applications.
I stumbled on Animate.css today. It contains a bunch of pure CSS animations for use in your own projects.
I found this very comprehensive comparison of iOS text editors today. I’m still not happy editing without a filesystem, but perhaps one of these apps handles it in a non-shitty-cloud-syncing way.
Railsconf was a blast. Here are just a few links I gathered during the various talks: https://gist.github.com/2495211
Beyond excited to be attending Railsconf in Austin, TX this year! Can’t wait to finally meet the rest of Site5 Engineering team in person. If you’re at any of the bars afterward, make sure to flag down Site5 for a drink!
This was a pretty cool story about how the developer of the original Prince of Persia game was able to recover it’s source code after 20 years. It almost makes me wish I had kept my pile of floppy disks!
This is a pretty comprehensive article that discusses the overall shittiness of PHP. Many of the points listed here are reasons I love Ruby over PHP.
Today I learned that gifs can have more than 256 colors. Using more seems unpractical, but it’s still a cool trick.
This was an interesting article about resizing vector icons – in short, the details count, and SVG is no replacement for a designer’s keen eye.
This is just a test post from Heroku :)
Blargging this so I remember to read it later :)
This made me laugh, Gradients, motherfucker.
While working on a project managed with Git, I needed to split some files into
a new repository. In order to maintain the git history on these files, I used
git filter-branch. Here are two methods I used.
Take note of the Apple products. I had no idea they were so, inspired, by Braun.
Bundler has a feature called
binstubs, which places stubs for gem bin
./bin. Unfortunately, ZSH doesn’t seem to complete these files
out of the box.
I found these excellent cheat sheets for Vim – nice and simple keyboard overlays.
Wow, I had no idea there were so many emoji icons! Use this cheat sheet to make your Github issues and pull requests diamonds.
A post from 37Signals about how they made the new Basecamp fly.
A pretty accurate description of what it’s like to be a developer.
I’ve been using this patch for a few weeks, and the speed increases on a Rails 3.2 app are definitely noticeable. It installed for me without any problems.
@erichatesyou sent me this tip today. It removes Finder from the OS X app switcher.
A few years ago I blogged about how I setup Vim on a shared web host. I needed to do this again today; but with a bit more control as to the features that were compiled:
An article describing the usage of that weird
~> operator found in gemspecs
and Gemfiles. I read this a while back but keep forgetting where it is when I
want a technical explanation.
Researchers have shown it takes about ten years to develop expertise in any of a wide variety of areas.
Another reason I like iOS better than Android.
I ran into an annoying issue trying to configure
ctrl-q as a Vim mapping in
Terminal.app for OS X. It turns out that flow
control was blocking it. I had
mistakenly thought that the flow control keys only applied to things like
Finally, someone has released a decent command line tool for Titanium Mobile! I haven’t had a chance to do much mobile development in a while, but I’ll be giving this a try if I go back to Titanium.
An interesting article about how the author of LiveReload almost chose the GPL license for his project.
This post covers some vim anti-patterns and includes a few tricks I had not
known about (such as
I just discovered Marked today. It adds one of the few things I still miss from TextMate to vim, a live preview window for markdown.
People desire more choices, yet are unable to choose when the selection is greater, that is the paradox of choice.
It was just about two years ago that I converted my Wordpress blog into a Jekyll blog. Overall, I am very happy with the decision, here’s why.
Eric sent me this a while back - a very useful site for choosing fonts for multiple operating systems.
Typechart is a great gallery of CSS typeface settings.
Allusis sent me this link with a bunch of great free web design patterns. I know I’ll be using this one soon!
This is a great page that handles generating CSS for a wide range of techniques.
I found this excellent CSS gradient generator a while back. Very useful for playing around with CSS3 background.
I’ve been using Vim full time for a while now and wanted a decent way to manage blog posts in my Github Pages powered blog.
The year is coming to a close, so I thought it would be a good time to reflect at some of the projects I’ve worked on in 2011.
I can’t believe it’s already been six months since I joined the engineering crew at Site5. I’ve been having a blast!
This quote from Bleach sums up my thoughts on perfection pretty well:
I was having trouble getting Pow working with rbenv, and I found this detailed article that goes through the process, and a lot more. Check it out if you want to take another look at your OS X ruby development setup.
Need to use Apache alongside Pow? I found this guide that explains how to setup Apache to use IPv6.
A friend of mine sent me this article today, a very interesting read about taking chances in business.
I wrote my first vim plugin, a simple command to strip trailing whitespace from buffers. Check it out if you think whitespace is the devil too.
Yesterday, I pushed Snuggie, a gem that wraps the Softaculous API in a warm, loving ruby embrace. Check it out if you use Softaculous!
Check out FannyPack if you use the Fantastico API with Ruby.
I’ve been itching to get ahold of this Adium mod since seeing it on MacThemes about a year ago. I decided to check back in the other day, and was pleasantly surprised to see that iDium had finally been publicly released.
If you have an HP PSC 2110 and need to scan, check out this blog post.
I saw this article today and thought it was worth sharing.
I was contracted recently by Allusis Productions to create a backend for the soon-to-be-released Liberty Sports Group site. After going over the client’s requirements, I decided WordPress would be the best fit for the site. Here is an overview of my experience setting up and theming WordPress 3.1.
I threw together a tiny little wrapper for PHP’s PDO library. It probably sucks, but it may be useful to someone stuck with PHP :)
I forked a Jekyll TextMate bundle and added a new post template and a tmLanguage file. Check it out if you blog with Jekyll and TextMate.
Cool video on making vector icons in Fireworks using alpha transparency.
I found this article the other day about why one developer says “no” when it comes to NDAs. It was a very interesting read, and I think I may follow suit when consulting in the future.
I recently extracted some of my DotBlock work to create WHMCS API Bindings in PHP and Ruby. Check out the blog post at DotBlock.
Over the last 10 months, I’ve had the opportunity to work with Titanium
Mobile for a few different projects. I was immediately drawn to Titanium
but I still found myself missing things from jQuery, like
My projects’ production environments consist of Git, Ruby, Apache, and usually a hand full of RubyGems. These are the steps I took to set these up using Ubuntu 10.04 on my new DotBlock VPS. These steps were performed immediately after the VPS was setup, so there weren’t any additional packages/dependencies yet installed.
I’ve written a few gems for work that I can’t host on RubyGems. It turned out to be easier to host these than I thought.
I’ve been working with Titanium Mobile to build an iPhone app. Using Titanium Developer to launch the app in the iPhone simulator is a pain in the ass. It would be great if I could build via the command line.
I use this Capistrano recipe at work to send a broadcast to the office when I deploy an update. We use Jabber, and have a broadcast user that forwards messages to every user.
I extracted a few pieces of code into Rails Plugins.
Recently, I needed to write an API to work with an iPhone application. I used Clearance for authentication. Unfortunately, it doesn’t support HTTP Basic Authentication out of the box, which made it difficult to use in an API.
If you’re using Jekyll and pagination (see Template data),
make sure you’re using
index.html and NOT
I’ve been using TextMate nearly every day for 2
years. Over that time I’ve customized it exactly to my liking with a bunch of
extra bundles, plugins, and theme tweaks. I’ve tried a few different things
to try to manage my
~/Library/Application Support/TextMate directory.
I found this git hook that lets you deploy a project with a git push rather than having to use a full deployment library such as Capistrano. I use this on a bunch of PHP projects that don’t need all the features Capistrano provides.
I work on a few apps that deal with phone numbers. I usually store these
bigint(11) in MySQL. My migrations always seemed to ignore this.
If you’ve ever used the MySQL module with Asterisk, you’ve probably had loads of fun formatting queries.
It took me a while to find a clearly documented way to manage
gems without having to use
sudo. Just drop these lines into your
Redmine has an awesome feature built in that lets you check an email account to import new tickets into your project.
For my own reference really, here are the steps I took to setup an Apache vhost to redirect all non-SSL requests to https:
After migrating my blog from Wordpress to Jekyll, one thing I was missing was a functional search box. I threw one together last night.
I’ve had to do this a few times when I wasn’t able to just drop the entire database, so I threw together a small PHP script that will do it for you.
I’ve been playing around with the Asterisk Manager lately (which is pretty damn cool, if you ask me).
This might not be a problem for everyone, but I got used to using home, end, page up, and page down to navigate through the command line and documents through the console. I was quite surprised to see that these seemingly basic features were missing from OS X’s Terminal.app.
It took me a while to get used to the quirks, but I have not only gotten used to OS X, but it is now my favorite operating system.
The font rendering is ruining my life.
I finally bit the bullet and bought one, and its delicious.
I’ve decided that I am going to purchase a Mac Mini with my tax refund. I am sick of Windows on my old laptop, and Fireworks in Wine is slow as death. The Mac will give me the tastiness of Fireworks with the stability of Unix. I can’t wait.
I know I’ve blogged this before, but these are the steps I took most recently to get Asterisk running on a fresh Ubuntu Server (Dapper) installation. The instructions will also work on Feisty or Gutsy server.
The KDE text editor Kate is my latest weapon. Its great if you’re on a slower connection (or you’re torrenting and killing a faster one) as it downloads the file to your hard drive before you edit it. I love me some vim - but it is no fun on a slow connection, waiting 30 seconds to move between lines.
Did I mention I am officially a web designer according to ITT?
Well, I’ve just finished building my first site with CodeIgniter, and I have to say it was an absolute blast. The framework is wonderfull. Using it, I was able to completely redesign Inglenook Realty in about 3 weeks with leaner, more sensible code than I had implemented previously. Granted, there is about twice as much code now as there was previously, but everything works perfectly now - and I won’t need to scrap the whole thing again if the owners want more revisions down the road. Thank you CI!
So I learned yet another awesome feature in vim today - code folding.
Earlier today, I noticed the A/C adapter for my laptop seemed to be broken. It took a few minutes to realize that there was a kink in the wiring under the shielding. If I moved that around just a bit, it would work properly. “That sucks,” I thought. “At least I have the warranty and it should be a quick phone call to get a new one out.” Wrong.
I figured out this easy way to make a backup over ssh.
I did this about 8 months ago and never wrote down my steps. I just had to figure it out again for another server, and thought I’d write it down here to save myself (and possibly someone else) time.
So I decided today I was going to make a DVD backup of my music collection. I also decided I was going to use rar to do this.
I just had a hell of a time trying to unzip a bunch of zip’s on Linux.
So with the help of a friend at work, I successfully made my first incoming and outgoing calls with Asterisk this weekend. I haven’t gotten all of the kinks worked out yet, but its definitely been a good time.
The project I mentioned a few weeks back with IMDB lookups, will be my official ITT Tech Fest project.
If you’ve been reading this over the last 8 months or so, you know that I’ve gone through somewhat of a love/hate relationship with Linux. I installed Fedora Core 4 at first and liked it for about a day. As soon as I went to play an MP3 and realized I couldn’t, I was quickly back to Windows.
My first week at ViaTalk was awesome.
Indeed, I am 21 today. Wasn’t very fun, and I don’t drink. Hoorah!!