Skip to content

Instantly share code, notes, and snippets.

View gregnewman's full-sized avatar

Greg Newman gregnewman

View GitHub Profile
We couldn’t find that file to show.
@gregnewman
gregnewman / djpydoc
Created June 25, 2009 12:23 — 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()
(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))))
@gregnewman
gregnewman / gist:182280
Created September 7, 2009 10:33 — forked from idan/gist:182267
@gregnewman
gregnewman / gist:182282
Created September 7, 2009 10:33 — forked from idan/gist:182264
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'''
; 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)))))))
(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))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 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 ()
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))
(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/" "")