This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))) |
- http://groups.google.com/group/twitter-development-talk/msg/293e23a5213f9a50
- screen name: varchar(20)
- name: varchar(20)
- location: varchar(30)
- description: varchar(160)
- time zone: you should store this in a native time format
- source: varchar(256)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
from django.template.defaultfilters import stringfilter | |
from django.utils.html import conditional_escape | |
from django.utils.safestring import mark_safe | |
import re | |
register = template.Library() | |
# (?:\A|[\s\.,:;'"])(@(\w{1,20}))(?!\.?\w) | |
twitterize_pattern = r''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Display CSS Hexadecimal color values | |
; as background to that value. | |
(defvar hexcolour-keywords | |
'(("#[abcdef[:digit:]]\\{6\\}" | |
(0 (put-text-property | |
(match-beginning 0) | |
(match-end 0) | |
'face (list :background | |
(match-string-no-properties 0))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode)) | |
(autoload 'css-mode "css-mode" "Mode for editing Cascading Style Sheets") | |
;; make css colors their actual colors | |
(require 'cl) | |
(defun hexcolour-luminance (color) | |
"Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\"). | |
This is 0.3 red + 0.59 green + 0.11 blue and always between 0 and 255." | |
(let* ((values (x-color-values color)) | |
(r (car values)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Syntax Check using flymake and PyFlakes EMACS 23.x | |
;;; GUI Emacs 23.x on Mac OS X has problems respecting | |
;;; system paths so we have to add it manually with setq | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(setq pyflakes "/usr/local/bin/pyflakes") | |
(when (load "flymake" t) | |
(defun flymake-pyflakes-init () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def random_date(start, end): | |
""" | |
Returns a random datetime between two datetime objects. | |
""" | |
delta = end - start | |
int_delta = (delta.days * 24 * 60 * 60) + delta.seconds | |
random_second = randrange(int_delta) | |
return (start + timedelta(seconds=random_second)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load-library "iso-transl") | |
(add-to-list 'load-path "~/.emacs.d/vendor/org-mode/lisp") | |
(add-to-list 'load-path "~/.emacs.d/vendor/org-mode/contrib/lisp") | |
(add-to-list 'load-path "~/.emacs.d/vendor") | |
(progn (cd "~/.emacs.d/vendor") | |
(normal-top-level-add-subdirs-to-load-path)) | |
(defconst emacs-config-dir "~/.emacs.d/configs/" "") |