Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍

Kenneth Reitz kennethreitz

🐍
View GitHub Profile
@kennethreitz
kennethreitz / standard.css
Created March 7, 2010 16:15
CSS I use on almost all projects.
.block { display: block; }
.inline { display: inline; }
.clrfix { display:inline-block; }
.hide { display: none; }
.fleft { float: left; }
.fright { float: right; }
.fclear { clear: both; }
.hi { background-color: rgb(255, 255, 204); }
.sub { vertical-align: sub; }
.super { vertical-align: super; }
@kennethreitz
kennethreitz / gist:324961
Created March 8, 2010 07:21 — forked from leah/gist:216443
Great collection of advanced emoticons.
:⌉
=⌉
¦-) as opposed to |
⍥ om nom nom
@kennethreitz
kennethreitz / alt-svnscrub.sh
Created March 8, 2010 20:16
Recursively delete all .svn folders from a working directory.
find . -name .svn -exec rm -rf {} \;
@kennethreitz
kennethreitz / send-via-gmail.py
Created March 9, 2010 16:18
Send a message via Gmail's SMTP servers
import smtplib
to = 'xxxxxx@xxxxxx.com'
gmail_user = 'xxxxxx@gmail.com'
gmail_pwd = 'xxxxxx'
subject = 'xxxxxx'
message = '''
xxxxxx
'''
@kennethreitz
kennethreitz / helpers.py
Created March 9, 2010 22:12
Random Python helper functions
# encoding: utf-8
""" Python General Helpers
Copyright (c) 2010 Kenneth Reitz. Creative Commons Attribution 3.0 Lisense.
"""
import urllib, re, time
import paramiko
def enc(str):
@kennethreitz
kennethreitz / github-wikistyle.css
Created March 9, 2010 23:30
CSS from GitHub's doc views. Added html wrapper. Great for embedding in HTML documentation.
html{width: 85%; min-width: 600px;margin: 0 auto; font-family: sans-serif;}
h1,h2,h3,h4,h5,h6{border:0!important;}
h1{font-size:170%!important;border-top:4px solid #aaa!important;padding-top:.5em!important;margin-top:1.5em!important;}
h1:first-child{margin-top:0!important;padding-top:.25em!important;border-top:none!important;}
h2{font-size:150%!important;margin-top:1.5em!important;border-top:4px solid #e0e0e0!important;padding-top:.5em!important;}
h3{margin-top:1em!important;}
p{margin:1em 0!important;line-height:1.5em!important;}
ul{margin:1em 0 1em 2em!important;}
ol{margin:1em 0 1em 2em!important;}
ul ul, ul ol, ol ol, ol ul{margin-top:0!important;margin-bottom:0!important;}
@kennethreitz
kennethreitz / attrib.regex
Created March 11, 2010 20:46
Regex to match any html attribute, and its value.
attrib="[^"\r\n]*"
@kennethreitz
kennethreitz / current.jquery.js
Created March 23, 2010 14:17
jQuery: Find current path, and wrap in em's
$.fn.markCurrentLocation = function() {
var path = window.location.href
return this.each(function(){
var self = $(this);
var href = self.attr('href');
if(RegExp(href).test(path)){
self
.wrap('<em></em>')
}
})
@kennethreitz
kennethreitz / sups.jquery.js
Created March 23, 2010 14:17
jQuery script for sup-ing ordinals.
$.fn.orderedFigure = function() {
return this.each(function(){
var self = $(this);
var cont = self.html();
var cont2 = cont.replace(/(\d)(st|nd|rd|th)/g,'$1<sup>$2</sup>')
self.html(cont2);
})
};
@kennethreitz
kennethreitz / .htaccess
Created March 29, 2010 04:03
Apache htaccess for gzip compression
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# file-types indicated will not be compressed
SetEnvIfNoCase Request_URI
\.(?:gif|jpe?g|png|rar|zip|pdf)$ no-gzip dont-vary
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>