Skip to content

Instantly share code, notes, and snippets.

View sneeu's full-sized avatar
🦀
Hi

John Sutherland sneeu

🦀
Hi
View GitHub Profile
@sneeu
sneeu / gist:47948
Created January 16, 2009 15:00
List all files in a directory and create links to each of them.
ls -1 *.html | awk '{print "<li><a href=\"" $1 "\">" $1 "</a></li>"}' > index.html
@sneeu
sneeu / html5.js
Created January 16, 2009 15:03
Enable styles of new HTML5 elements in IE6 & 7.
(function(){var e=['section','article','aside','header','footer','nav','dialog','figure'];for(var i=0;i<e.length;i++)document.createElement(e[i])})();
@sneeu
sneeu / ligature.py
Created February 12, 2009 22:45
Replace several characters with ligatures.
# -*- coding: utf-8 -*-
import re
_REPLACEMENTS = (
('ffi\B', 'ffi', ),
('ff\B', 'ff', ),
('fi\B', 'fi', ),
('fl\B', 'fl', ),
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>flat</title>
<style type="text/css" media="screen">
*{margin:0;padding:0}
body{color:#000;font:600 400%/1.4em "Avenir";padding:1em}
@sneeu
sneeu / gist:79423
Created March 15, 2009 14:01
Add all untracked files to an SVN commit.
svn st | grep "^?" | awk '{ print $2 }' | xargs svn add
@sneeu
sneeu / css_colour_convert.py
Created April 17, 2009 09:33
A TextMate command that converts rgb(x, y, z) to #pqr
#!/usr/bin/env python
# See a demo: <http://www.vimeo.com/4195472>
# Here are the settings: <http://www.quicksnapper.com/sneeu/image/css-colour-convert-settings>
import os
import re
import sys
class John(threading.Thread):
def __run__(self):
while True:
work = all_work.read()
if inverse(work) in self.complete_work:
self.grump()
work()
self.complete_work.append(work)
@sneeu
sneeu / gist:190175
Created September 21, 2009 10:14
100 Lines or so of Python
# Hello world:
print "Hello, World!"
# Print the numbers 1 to 10:
for i in range(1, 11):
print i
# Print the numbers less than 100, which are divisable by 3:
#
# Configuration File for JavaScript Lint 0.2.6
# Developed by Matthias Miller (http://www.JavaScriptLint.com)
#
# This configuration file can be used to lint a collection of scripts, or to enable
# or disable warnings for scripts that are linted via the command line.
#
#### NOTE TO TEXTMATE BUNDLE USERS:
#### Feel free to experiment with enabling/disabling individual warnings to
<?php
abstract class Model {
static abstract function getFields();
static function getFieldsForSQL() {
return implode(', ', self::getFields());
}
static function getAll() {