Skip to content

Instantly share code, notes, and snippets.

View amberj's full-sized avatar

Amber Jain amberj

View GitHub Profile
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@jpinnix
jpinnix / gist:547977
Created August 24, 2010 17:55
Help nginx+passenger serve static index pages
# Help nginx+passenger serve static index pages
# Site specific config
server {
listen 80;
server_name domain.com;
index index.html;
access_log logs/appname.access.log;
error_log logs/appname.error.log;
@hugs
hugs / selenium-examples.py
Created February 16, 2011 19:40
Example code for using the Selenium 2 Python bindings.
# To install the Python client library:
# pip install -U selenium
# Import the Selenium 2 namespace (aka "webdriver")
from selenium import webdriver
# iPhone
driver = webdriver.Remote(browser_name="iphone", command_executor='http://172.24.101.36:3001/hub')
# Android
@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@pamelafox
pamelafox / countryinfo.py
Last active February 13, 2024 00:57
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@wizardishungry
wizardishungry / Gemfile
Last active February 12, 2018 18:49
Vagrant snippet to set VirtualBox guest CPU count to the number of host cores on Linux or OS X (broken 2018)
gem 'concurrent'
@kisom
kisom / gist:3522220
Created August 30, 2012 04:07
The Yeelong: A Review

I'm sure many other people have reviewed the Lemote Yeelong 8089 netbook. I picked up mine for a specific use-case and for the most part, it does a decent enough job satisfying that use case. However, unless you're at an RMS level of free software dogmatism, you would probably be better served by an x86-based netbook. I use it for hacking in C on the bus, especially when working on code that is meant to run on OpenBSD systems. It is quite slow, making it sometimes painful to do much more than gvim (which can take a second or longer to pull up on screen)

Mine is configured with 1G of RAM and a 160G hard drive (I haven't looked at changing out any of the stock hardware), and runs OpenBSD 5.0/mipsel. For the most part, the hardware runs very well. The major exception is the wireless card; when I tried using it on an open access point, it worked fine. It struggled, and typically failed, to connect to my WPA2'd access point. I had a USB ral0 wireless adaptor lying around, and I just use that when I need wireless

@Paretzky
Paretzky / gist:4105017
Created November 18, 2012 12:36
Total the Number of Pages in All Pdf's in the Current Directory Recursively
find . -type f -iname "*pdf" | xargs -0 -d "\n" -n 1 pdfinfo 2> /dev/null | grep Pages | grep -Eo "[[:digit:]]+" | tr "\n" "+" | grep -Eo "[[:digit:]]+(\+[[:digit:]]+)+" | bc

Where people struggle learning Django

Over the last 3 years or so I've helped a bunch of companies, small and large, switch to Django. As part of that, I've done a lot of teaching Django (and Python) to people new to the platform (and language). I'd estimate I've trained something around 200-250 people so far. These aren't people new to programming — indeed, almost all of them are were currently employed as software developers — but they were new to Python, or to Django, or to web development, or all three.

In doing so, I've observed some patterns about what works and what doesn't. Many (most) of the failings have been my own pedagogical failings, but as I've honed my coursework and my skill I'm seeing, time and again, certain ways that Django makes itself difficult to certain groups of users.

This document is my attempt at organizing some notes around what ways different groups struggle. It's not particularly actionable — I'm not making any arguments about what Django should or shouldn't do (at least