Scaling the Web: Databases & NoSQL

Video and Slides from a guest lecture I presented at the University of Texas school of Information. This is an introduction to relational and non-relational databases and how their performance affects scaling a web application.

Keep Reading


Stack Overflow Needs Mentors

First off, I love Stack Overflow. In the way that only someone who taught himself programming via outdated books, and old-school programming forums can. I think it’s the best way to ask most programming questions on the web, but that doesn’t mean it can’t get better. 

Keep Reading


Likeable: Love your Objects with Redis

This is a re-post of an article I wrote for Gowalla’s Engineering Blog. You can view the original article here.

Likeable is a new open-source Ruby library that we built here at Gowalla to power all of the “loves” on stories, comments, highlights and photos that you see. It’s built on top of Redis to be extremely simple, isolated and fast. Likeable plays well with ActiveRecord objects, but can be used with any Ruby object that implements an #id method.

To see it in action, head over to my Gowalla profile and love the first thing you see. Immediately you’ll see the heart change colors and the love count increase by one. If you click on that number you’ll see everyone who has loved that object.

This might seem trivial at first glance. But consider that dozens of elements on the page must pull this information: how many people have loved it, whether the viewer has loved it, and (on some pages) which of your friends have loved it. Using Redis allows us to stay simple, flexible and fast.

The Code

Let’s say we’ve got a comment made on a recent Gowalla story.

@comment = Comment.last
@comment.like_count  #=> 0

If our user wants to like this comment, he can do so with ease:

@user = User.find_by_username('schneems')
@user.like! @comment

And that’s it. The comment now reports the details of the like.

@comment.like_count      #=> 1
@comment.likes           #=> [#<Likeable::Like ... >]
@comment.likes.last.user #=> #<User username: "schneems" ...>

The Install

For Rails apps, Likeable is extremely simple to set up.

First, add Likeable to your Gemfile:

gem 'likeable'

Set up your Redis connection in (e.g.) config/initializers/likeable.rb:

Likeable.setup do |likeable|
  likeable.redis = Redis.new
end

Next, add the Likeable::UserMethods module to your User model:

class User < ActiveRecord::Base
  include Likeable::UserMethods
end

Finally, add the Likeable module to any model you want to be likeable:

class Comment < ActiveRecord::Base
  include Likeable
end

To learn more, check out the Likeable source, look at the example Rails app or watch the Likeable screencast.

Contributing

We’d love to get contributions to Likeable. If you want it to do something it doesn’t already, open an issue on GitHub. Or, if you feel so inclined, create a patch and submit a pull request.

Keep Reading


So You Want to Hire an Intern?

This is a re-post of an article I wrote for Gowalla’s Engineering Blog. You can   view the original article here.  

Keep Reading


Gowalla's New Engineering Blog

Gowalla started and engineering blog, highlighting our open source projects and giving all of us devs a special place to talk about things we care about. 

Keep Reading


Git Aliases

Ever see someone checkout a git repo by simply typing `git co master` instead of the HORRIBLY LONG IMPOSSIBLY DIFFICULT `git checkout master` ? I know I have, so to save me HOURS a day I added these aliases to my ~/.gitconfig to my git config file. 

  [alias]
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff
    dc = diff --cached
    lg = log -p
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
    ls = ls-files
You can get even more helpful stuff through this handy cheat sheet https://cheat.errtheblog.com/s/git. Good luck and happy Git-ing

Keep Reading


Replace IRB with PRY for Rails Dev

I use PRY to develop Rails, so should you: Set up Pry with Rails

I use the .pryrc method, works great. I can reload! and still get the magic of Pry. 

If you’re new to pry check out this intro: Pry Railscast

Keep Reading


Custom Dotfiles

I use custom organization of my .bashrc and .bash_profile i.e. my “dotfiles”. Its great to keep all of my aliases clean and organized. I highly recommend Peepcode’s Advanced Command Line for more info on configuring your own set of custom dotfiles.


The one thing I always forget how to do whenever I move to a new computer or hard-drive is to set up the correct files and set up the proper sourcing, so here is my shorthand note to my future self.  

# First copy files to ~/bin/dotfiles
# Open bashrc
mate ~/.bashrc
# Paste this in
```
  source ~/bin/dotfiles/bashrc
```
# Open bash_profile
mate ~/.bash_profile
# Paste this in
```
if [ -f ~/.bashrc ]; then
  source ~/.bashrc 
fi

    

    

Keep Reading


Some of my Login UX featured in SmashingMagazine

Some of my Login UX featured in SmashingMagazine

When i first started working for Gowalla, I implemented some UX improvements to the existing login form. I thought it was pretty nifty and so did SmashingMagazine. Check out their writeup

Keep Reading


Rails 3 Beginner to Builder 2011 (Final) Week 8

This is final part of my Rails 3: Beginner to Builder series. https://www.schneems.com/beginner-to-builder-2011

Keep Reading


Subscribe to my Newsletter 😻 🤠

Join thousands of developers who get new code, writing, and programming links from me delivered to their inboxes.