Skip to content

Instantly share code, notes, and snippets.

View joemccann's full-sized avatar
💭
Thinking

Joe McCann joemccann

💭
Thinking
View GitHub Profile
@joemccann
joemccann / style.styl
Created July 19, 2011 08:23
Sample stylus file for Express apps.
@import 'normalize'
body, h1, h2, ul, li, p, img, a
margin 0
padding 0
outline 0
body
font 100% 'Helvetica Neue', Arial, sans-serif
color grey
@joemccann
joemccann / layout.ejs
Created July 19, 2011 08:19
layout.ejs for Express app
<!doctype html>
<html lang="en" manifest="">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><%= title %></title>
<meta name="description" content="">
<meta name="author" content="">
@joemccann
joemccann / app.js
Created July 19, 2011 08:06
Sample express app using smoosh config debug flag.
var express = require('express')
, cluster = require('cluster')
, fs = require('fs')
, debug
var smooshConfig = JSON.parse(fs.readFileSync('./smoosh.json', 'UTF-8'))
// set the debug flag
debug = smooshConfig.DEBUG
var app = module.exports = express.createServer();
@joemccann
joemccann / titanium_desktop_app_position.js
Created July 16, 2011 09:51
Save Titanium Desktop app location on screen
/*
* Calling this function while loading the app...
*/
function titaniumWindowSize() {
var window = Titanium.UI.getMainWindow();
var bounds = {};
try {
var arr = Titanium.App.Properties.getList('bounds');
bounds.x = +arr[0];
bounds.y = +arr[1];
@joemccann
joemccann / mobile_css_organization.md
Created July 15, 2011 17:21
Mobile CSS Organization of Files.

Keep the number of files down - reducing http requests is obviously an important part of site performance, but also I personally find it difficult to manage multiple files (base,mid,smartphone, etc) when authoring (What goes where? Is this being included or not?)

Enhance up and let the cascade work for you - starting declarations with the most universal properties and ending with smartphone flourishes (-webkit-border-radius et all) help keeps things in order for me. It can get a little confusing declaring 'background' 3-4 times but following that top-to-bottom, left-to-right model of enhancement allows the experience to scale quite nicely as browser support increases. It's important to manage client/team expectations and help them understand why every platform (WP7, Blackberry <6.0, etc) don't have all the rounded corners, gradients, etc and explain why the page speed > aesthetic consistency in the mobile web.

Reduce images where possible - you said you are using CSS gradients and other CSS techniques to

@joemccann
joemccann / node_app_start.sh
Created July 8, 2011 18:55
General init.d script on Debian for node apps.
#! /bin/sh
# /etc/init.d/myapp
#
# Don't forget to reload init.d:
# update-rc.d myapp defaults
APP='myapp'
@joemccann
joemccann / google_docs_in_ur_console_bro.js
Created June 11, 2011 14:44
Google Docs "Full Screen" Hack
var d = document;
var footerH = parseInt(d.getElementById('footer').style.height);
d.getElementById('slide_nav_fg').style.display = d.getElementById('footer').style.display = "none";
var presH = (parseInt(d.getElementById('main').style.height) + footerH) + 'px';
d.getElementById('primaryViewSlide').style.height = d.getElementById('primaryView').style.height = d.getElementById('main').style.height = presH;
d.getElementById('main').style.marginTop = footerH - 30 + 'px';
@joemccann
joemccann / exbp.sh
Created June 6, 2011 15:07
Another express boilerplate with normalize.css and jQuery
# /bin/bash
# run from Express project root directory
# Dependencies: wget, node.js, npm, express
# change these to the versions you want
JQ="1.6.1"
echo '\nGenerating Express app.\n'
express -t ejs -c stylus
@joemccann
joemccann / ex.sh
Created June 3, 2011 15:33
Another express boilerplate with yepnope, 1140.css, normalize, jQuery
# /bin/bash
# run from Express project root directory
# Dependencies: wget, node.js, npm, express
# change these to the versions you want
JQ="1.6.1"
YEP="yepnope.1.0.1-min.js"
express -t ejs -c stylus
npm install ejs
@joemccann
joemccann / exbp.sh
Created June 1, 2011 20:17
Express Boilerplate using EJS, Stylus, jQuery and Normalize.css
# /bin/bash
# run from Express project root directory
# Dependencies: wget, express, npm
express -t ejs -c stylus
npm install ejs
npm install stylus
mv public/stylesheets public/css
mv public/javascripts/ public/js
mv public/images/ public/img