Skip to content

Instantly share code, notes, and snippets.

from django.core.cache import cache
from django.conf import settings
from django.contrib.auth.models import User
ONLINE_THRESHOLD = getattr(settings, 'ONLINE_THRESHOLD', 60 * 15)
ONLINE_MAX = getattr(settings, 'ONLINE_MAX', 50)
def get_online_now(self):
return User.objects.filter(id__in=self.online_now_ids or [])
from uuid import uuid1
from simplejson import dumps, loads
from urlparse import urlparse
from httplib import HTTPConnection
class Client(object):
def __init__(self, server):
self.server = server
url_parts = urlparse(server)
self.port = url_parts.port
(when (load "flymake" t)
(load "flymake-cursor" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "/PATH/TO/YOUR/pyflakes" (list local-file))))
"""
Copyright (c) 2008-2009, Nathan Borror, and modified heavily by Eric Florenzano
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
(app-ticket6904)bash-3.2$ curl http://github.com/api/v1/json/nicksieger | python -msimplejson.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5635 100 5635 0 0 25522 0 --:--:-- --:--:-- --:--:-- 143k
{
"user": {
"blog": "http://blog.nicksieger.com/",
"email": "nick@nicksieger.com",
"login": "nicksieger",
"name": "Nick Sieger",