Skip to content

Instantly share code, notes, and snippets.

View justinabrahms's full-sized avatar

Justin Abrahms justinabrahms

View GitHub Profile

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

Purpose

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
// Make a single api call to meetup.com 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 pyladies.com/locations page.
//helper function to discover event urls and make active links
//credit to http://www.sencha.com/forum/archive/index.php/t-12379.html 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
@justinabrahms
justinabrahms / colortest.py
Created June 26, 2011 17:10 — forked from graven/colortest.py
Small utility to test terminal support for 256-color output.
#!/usr/bin/env python
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349
print "Color indexes should be drawn in bold text of the same color."
print
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 = {
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('irc.freenode.net', 'iShouldChangeBotName', {
channels: ['#node.js']
});
@justinabrahms
justinabrahms / djpydoc
Created June 25, 2009 11:45 — forked from ask/djpydoc
# A pydoc that can read modules using Django.
#!/usr/bin/env python
from django.conf import settings
if not settings.configured:
settings.configure()
import pydoc
if __name__ == "__main__":
pydoc.cli()
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():
form.save()
return HttpResponseRedirect("")
else:
form = FormCls()
return render_to_response(template, {"form": form})
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'):
continue
# single element nome/value fields
if input['type'] in ('text', 'hidden', 'password', 'submit', 'image'):