Posts from July 2009
- All (18)
- Entries (2)
- Links (16)
- Photos (0)
Let's make the web faster
Google has a great selection of tips on how to make your website faster. I posted a little while back about several frontend optimizations I’ve made to make my site faster.
The Perfect Git Workflow for a One Person Project
A few months ago, I started investigating Git, and I fell in love with how much easier it made managing my code. I’m managing the source code to this site with Git, and along the way I’ve come up with a pretty good workflow for myself. The basic steps are:
- Branch
- Commit
- Rebase
- Merge
- Deploy
Let’s go through each one to see how it all works together.
Branch
With SVN, I found myself hating branching–it was always a complicated procedure, and I could never remember how to do it. In Git it’s as easy as git checkout -b <branch-name>, and you’re ready to go. Once you have a branch, you can modify it however you want, and you don’t have to worry about interfering with the master branch. In order to keep your master branch bug free, commit only to branches, not to master itself.
In addition to creating new branches for major features, I always have a few branches around that I pop into for certain things:
- “design” - any changes I want to make to the design go here
- “optimize” - optimizations to the site
- “bugfixes” - a place to work on minor bugfixes
Having these branches allows me to make small fixes to the site, and if it turns out it’s more than just a small fix, it doesn’t interfere with anything else.
Commit
In the Subversion world, it’s a pretty common practice to make very large commits, consisting of many changes. With Git, you should constantly be committing. By making many commits, you make it easier to find bugs you may have introduced, and it makes it a lot easier to track your progress. If you don’t like the thought of wading through long lists of commits in your logs, don’t worry–before bringing it over to the master branch, you can consolidate things with interactive rebasing, but while you’re hacking away on a branch, it really is advantageous to have many small commits.
Rebase
Rebasing is one of the harder things to grasp when you’re first learning about Git. For in-depth coverage of the topic, check out the Rebasing page in the Git Community Book. In a nutshell, doing git rebase master takes any commits to master and inserts them into your current branch, so you can then make sure your new code still works, and it’s a lot less hazardous than doing a merge. Rebasing your branch before putting into master is really important because it allows you to deal with any merge issues before the code goes to your main branch. To rebase, just run git rebase master.
Merge
After rebasing the branch, it’s safe to merge it into master. Since I’ve already dealt with any merge issues with the previous step, it’s as simple as checking out the master branch and running git merge <branch-name>
Deploy
I use Capistrano to deploy my code, so I’m constantly typing git push followed by cap deploy to deploy changes to my server. To make it easier, I just put both commands into one git alias:
deploy = !git push && cap deploy
Now I just need to run git deploy and it automatically pushes all of my changes to the remote Git repository and then deploys the site using Capistrano. Here’s some more information about Git aliases.
Useful tools
Though I primarily use Git through the command line, I really like using GitX to visualize branches. To host my repositories on my server, I use Gitosis, though if I had a few more projects, I’d dole out the money for a paid account at GitHub.
Have a great Git workflow? Think mine’s terrible? Let me know in the comments!
Mars is Hard
IEEE Spectrum goes through just how difficult it would be to get humans to Mars:
The shortest one-way trip, using conventional chemical propulsion, would take six months. If you include the time spent on Mars waiting for the two planets to move back into optimal alignment and also the trip home, the total mission would last at least two and a half years. The crew would have to endure extremes of boredom, isolation, and radiation, and they would require a vast amount of fuel and rations packed into a vessel sturdy enough to shield them from the harshness of space. Simply landing a spacecraft safely on a planet with an atmosphere and substantial gravity poses stunning challenges. And then there’s the matter of keeping the crew alive on the Martian surface.
Just because it’s difficult doesn’t mean we shouldn’t try, and as JFK said, we do these things “not because they are easy, but because they are hard.”
LRO sees Apollo landing sites
NASA has posted photos of the Apollo landing sites as seen by the Lunar Reconnaisance Orbiter (LRO). This is the first time the sites have been photographed, as no Earth based telescope, or even any satellites such as the Hubble Space Telescope, have the resolution to resolve anything on the moon that’s smaller than about a mile wide.

The giant Apollo 11 post
Jason Kottke posted an enormous collection of links, videos, an articles related to Apollo 11. I haven’t had any chance to look through these yet, but I definitely plan on taking a couple hours and reading just about everything.
Using Twitter favorites to retain value and reduce distraction
Colin Devroe writes about how he uses Twitter favorites to save links for later. It’s nothing new to use favorites to track links, but Colin takes it one step further: he subscribes to his favorites RSS feed, so when he goes through Google Reader, he sees all the links he saved to read later. Brilliant.
Apollo 11 Videos
In celebration of the 40th anniversary of Apollo 11, NASA released several restored videos of the mission. I went ahead and put the videos on Viddler, so they’re easy to embed. My favorite is the intro video:
An Explanation of Photoshop Blend Modes
A really in-depth look at each of the blend modes in Photoshop. Definitely saving this one for later.
Remembering Apollo 11
40 years ago today, Apollo 11 lifted off from Earth on its way to the moon. The Big Picture has some great photos from the misson. Looking at the photos makes me really wish I were alive at the time, but hopefully we’ll be back sometime soon.
Visual Event
This is an amazing bookmarklet, that highlights all of the events associated with different elements on the page. I’m definitely going to be using this all the time, now that I found it.
Google's Microsoft Moment
Anil Dash takes a look at recent Google developments and decides they’ve reached their “Microsoft Moment”:
Is Google evil? It doesn’t matter. They’ve reached the point of corporate ambition and changing corporate culture that means they’re going to be perceived as if they are. Whether they’re able to truly internalize that lesson, accept it, and act accordingly will determine if they’re able to extend their dominance in the years to come.
Simple APIs using SerializeWithOptions
Viget Labs rolls out a Rails plugin to cleanup your API’s code.
Instead of doing this in the controller:
@speaker.to_xml(
:methods => [:average_rating, :avatar_url],
:except => [:email, :claim_code],
:include => {
:talks => {
:methods => :average_rating,
:except => :creator_id
}
}
)
You move it to the class like this:
class Speaker < ActiveRecord::Base
serialize_with_options do
methods :average_rating, :avatar_url
except :email,
:claim_code
includes :talks
end
end
Great way to DRY up your code.
