Instantly share code, notes, and snippets.


Code Review

A guide for reviewing code and having your code reviewed.

Peer code reviews are the single biggest thing you can do to improve your code - Jeff Atwood


Code review is an important part of a team's development process. It helps to:

  • disseminate knowledge about the codebase/technology/techniques across teams
  • increase awareness of the features being developed
View meetups_indiv.js
// Make a single api call to and grab event info for all (11) PyLadies locations. Create individual objects for each so that meetups can be added to each pyladies group's div on page.
//helper function to discover event urls and make active links
//credit to for code this is based on
function create_urls(input) {
return input
.replace(/(ftp|http|https|file):\/\/[\S]+(\b|$)/gim, '"$&" target="_blank"')
.replace(/([^\/])(www[\S]+(\b|$))/gim, '"http://$2" target="_blank"');
} //end url parsing helper function
#!/usr/bin/env python
# Ported to Python from
print "Color indexes should be drawn in bold text of the same color."
colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
colored_palette = [
"%02x/%02x/%02x" % (r, g, b)
for r in colored
from flask import Module, request, redirect, url_for, render_template, abort
from formalchemy import FieldSet
from example import db
from example import Service, User, Forum, Category, Topic, Post
mod = Module(__name__)
models = {
View botthingy.js
require.paths.unshift(__dirname + '/../lib');
var sys = require('sys');
var irc = require('irc');
var http = require('http');
var fs = require('fs');
var bot = new irc.Client('', 'iShouldChangeBotName', {
channels: ['#node.js']
View djpydoc
# A pydoc that can read modules using Django.
#!/usr/bin/env python
from django.conf import settings
if not settings.configured:
import pydoc
if __name__ == "__main__":
We couldn’t find that file to show.
# Traditional - 9 lines
def view(request, template):
if request.method == "POST":
form = FormCls(request.POST)
if form.is_valid():
return HttpResponseRedirect("")
form = FormCls()
return render_to_response(template, {"form": form})
View gist:105014
def extract_form_fields(self, soup):
"Turn a BeautifulSoup form in to a dict of fields and default values"
fields = {}
for input in soup.findAll('input'):
# ignore submit/image with no name attribute
if input['type'] in ('submit', 'image') and not input.has_key('name'):
# single element nome/value fields
if input['type'] in ('text', 'hidden', 'password', 'submit', 'image'):