Skip to content

Instantly share code, notes, and snippets.

@patrickdanger
patrickdanger / server.coffee
Created April 23, 2011 04:00
Basic FileServer in node.js
http = require 'http'
url = require 'url'
fs = require 'fs'
path = require 'path'
server = http.createServer (req, resp) ->
uri = url.parse req.url, yes
query = uri.queryString
filepath = path.normalize uri.pathname
@patrickdanger
patrickdanger / File.coffee
Created April 23, 2011 03:51
file objects and accompanying factory
class FileFactory
constructor: (webroot = "webroot") ->
@webroot = webroot
file: (filepath) ->
type = path.extname(filepath).substr 1, path.extname(filepath).length
switch type
when 'html' then new HtmlFile path.join(@webroot, filepath), 'text/html'
else new File path.join(@webroot, filepath), null
@patrickdanger
patrickdanger / example.html
Created April 22, 2011 20:27
semantic intermediary example (grid_stylus)
<!DOCTYPE html>
<html>
<head>
<title>Semantic Markup</title>
</head>
<body>
<section>
<article>...</article>
<sidebar>...</sidebar>
</section>
/* -- variables -- */
var_grid_width = 960px
var_grid_gutter = 20px
var_grid_columns = 12
/* -- mixins -- */
container()
width var_grid_width
margin-left auto
margin-right auto
@patrickdanger
patrickdanger / gist:937482
Created April 22, 2011 20:06
stylus 960 grid variables
/* -- variables -- */
var_grid_width = 960px
var_grid_gutter = 20px
var_grid_columns = 12
@patrickdanger
patrickdanger / gist:937463
Created April 22, 2011 19:58
960.css map to Stylus
.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6,
.grid_7,
.grid_8,
.grid_9,
.grid_10,