Skip to content

Instantly share code, notes, and snippets.

@liamcurry
liamcurry / Testing.html
Created November 2, 2009 23:07
chapter1.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Coddee</title>
<link rel="stylesheet" href="stylesheets/master.css" />
</head>
<body id="tutorial">
<div id="layout-header">
<h1>coddee</h1>
@liamcurry
liamcurry / gist:441595
Created June 17, 2010 02:25
Introduction to HTML
We couldn’t find that file to show.
@liamcurry
liamcurry / models.py
Created May 5, 2011 14:58
Django Snippets
from django.db import models
class TimeAwareModel(models.Model):
created_on = models.DateTimeField(editable=False, auto_now_add=True)
updated_at = models.DateTimeField(editable=False, auto_now=True)
class Meta:
abstract = True
@liamcurry
liamcurry / index.html
Created June 10, 2011 16:13
HTML Boilerplate
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<title></title>
<meta name='description' content=''>
<meta name='author' content=''>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link rel='stylesheet' type='text/css' href='css/master.css' />
@liamcurry
liamcurry / gist:1019779
Created June 10, 2011 21:06
Add embedded document helpers to Mongoose.js
mongoose.Types.DocumentArray.prototype.sortByDir = function(direction, path) {
this.sort(function(a, b) {
var aVal = a.get(path),
bVal = b.get(path);
if (!aVal && !bVal) return 0;
if (!aVal) return 1;
if (!bVal) return -1;
if (direction > 0) return !(aVal < bVal);
return (aVal < bVal);
});
@liamcurry
liamcurry / FFMpeg - FLAC to Ogg
Created September 18, 2011 17:22
Converting FLAC to various formats
ffmpeg -i hlah_3.flac -strict experimental -acodec vorbis -aq 100 hlah.ogg
@liamcurry
liamcurry / develop.py
Created September 18, 2011 19:53
Start coffee, compass, and a simple HTTP server with one script
#!/usr/bin/python
import os
import subprocess
import signal
import sys
STATICGEN_ROOT = (os.path.join(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))),
'staticgen'))
staticgen_path = lambda *a: os.path.abspath(os.path.join(STATICGEN_ROOT, *a))
@liamcurry
liamcurry / convert.py
Created November 7, 2011 21:52
Converting fonts with fontforge and python
import fontforge
import os.path
filename = 'the-filename'
basename, ext = os.path.splitext(filename)
desired_formats = ['otf', 'eot']
font = fontforge.open(filename)
for desired_format in desired_formats:
font.generate('%s.%s' % (basename, desired_format))
@liamcurry
liamcurry / Coercion.js
Created May 4, 2012 16:58
HTMl/CSS/JS quickies
/* String to Number */
var hello = '1234'
parseInt(hello) // Use this when speed is a concern (see http://jsperf.com/parseint-vs-unary)
// 1234
+hello // unary operator -- use this when file size is a concern
// 1234
+hello++ // Converts `hello` to a number and adds 1 to it
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})