Skip to content

Instantly share code, notes, and snippets.

View gregnewman's full-sized avatar

Greg Newman gregnewman

View GitHub Profile
(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))
; 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)))))))
@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'''
@gregnewman
gregnewman / gist:182280
Created September 7, 2009 10:33 — forked from idan/gist:182267
(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 / 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()
We couldn’t find that file to show.
# -*- coding: utf-8 -*-
"""
Example Usage
=============
>>> import datetime
>>> start = datetime.date(2009, 6, 21)
>>> g1 = daterange(start)
bgImageTotal=5;
randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
imgPath=('/static/images/headers/'+randomNumber+'.png');
$('.header').css('background-image', ('url("'+imgPath+'")'));
For the Birds - http://nycbirdlist.org/
Code monkeys - http://djapp.org/
Freelancer - http://tnycnt.com/
Sword of Truth - http://leafychat.com/
wwswd - http://wwswd.com/
East meets West - http://whohasmy.net/
crunkd - http://getcrunkd.com:88/
Ra - http://www.ntrie.com/
arctangent - http://rudestword.com/
Slugs - http://flicasa.com/