brian wickman - @wickman
[TOC]
Pants makes the manipulation and distribution of hermetically sealed Python environments
# Based on http://blogs.fluidinfo.com/terry/2009/06/24/python-code-for-retrieving-all-your-tweets/ | |
# Patched to retry upon failure until *all* tweets are downloaded. | |
import sys, twitter, operator | |
from dateutil.parser import parse | |
import time | |
twitterURL = 'http://twitter.com' | |
def fetch(user): | |
data = {} | |
api = twitter.Api() |
import logging | |
l = logging.getLogger('django.db.backends') | |
l.setLevel(logging.DEBUG) | |
l.addHandler(logging.StreamHandler()) |
if (phantom.state.length === 0) { | |
if (phantom.args.length !== 1) { | |
console.log('Usage: run-jasmine.js URL'); | |
phantom.exit(); | |
} else { | |
phantom.state = 'run-jasmine'; | |
phantom.open(phantom.args[0]); | |
} | |
} else { | |
window.setInterval(function () { |
CompilerSet makeprg=jshint\ \"%\" | |
CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m | |
" vim: set sts=4 sw=4 expandtab ff=unix fdm=syntax : |
$ git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
grep -v 'pr/' | | |
xargs -L1 | | |
sed 's|origin/||' | | |
xargs git push origin --delete |
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
/** | |
* Interpret any valid css string as an r, g, b, (a) object. | |
* If nothing found then it returns an object that is black with | |
* no alpha. | |
* | |
* Usage: interpret('red'); // { r: 1, g: 0, b: 0 }; | |
* interpret('#f00'); // { r: 1, g: 0, b: 0 }; | |
* interpret('#ff000'); // { r: 1, g: 0, b: 0 }; | |
* interpret('rgb(255, 0, 0)'); // { r: 1, g: 0, b: 0 }; | |
* interpret('rgba(255, 0, 0, 1)'); // { r: 1, g: 0, b: 0, a: 1 }; |
val des = scala.concurrent.ExecutionContext.global | |
import scala.concurrent._ | |
import duration._ | |
def ct = Thread.currentThread.getName | |
val n = Runtime.getRuntime.availableProcessors | |
def hogThread(sec:Int) = future { |
object Currying { | |
def sum(f: Int => Int) : (Int, Int) => Int = { | |
def sumF(a: Int, b: Int) : Int = { | |
if(a > b) 0 | |
else f(a) + sumF(a + 1, b) | |
} | |
sumF | |
} |