Skip to content

Instantly share code, notes, and snippets.

@tomdavies
tomdavies / flexboxtest.html
Created August 16, 2011 11:44 — forked from adactio/flexboxtest.html
Content-first flexbox test
<!DOCTYPE html>
<html>
<head>
<title>Flexbox test</title>
<style>
@media screen and (min-width: 30em) {
body {
width:100%;
display: -webkit-box;
display: -moz-box;
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
@tomdavies
tomdavies / RSS Feed
Created January 24, 2012 08:44 — forked from ryanbattles/RSS Feed
RSS Feed
{!--
1. THE CHANNEL AND FIELD NAMES NEED TO BE CHECKED FOR ACCURACY
2. THE DYNAMIC LINK PATHS NEED TO BE CHECKED FOR ACCURACY
--}
{exp:rss:feed channel="news"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
@tomdavies
tomdavies / script.js
Created October 6, 2012 11:12
Yepnope / user scripting
function betaApp(){
var app = this;
this.init = function(){
app.injectYepnope('https://raw.github.com/cnkt/eksi-beta/master/ui/js/yepnope.js');
};
this.injectYepnope = function(url) {
var gp = document.createElement( 'script' );
gp.type = 'text/javascript';
gp.async = true;
gp.src = url;
@tomdavies
tomdavies / deploy-production.rb
Created November 27, 2012 12:16
Deploying ExpressionEngine 2 with Capistrano
set :deploy_to, "/var/www/default"
set :branch, 'master'
#Remote DB info
set :dbuser, ""
set :dbname, ""
set :dbhost, ""
set :dbpass, ""
@tomdavies
tomdavies / QUERY_PARAM.md
Created November 28, 2012 11:16 — forked from airways/QUERY_PARAM.md
ExpressionEngine: new QUERY_PARAM protocol that always works

QUERY_PARAM Protocol

This is a simple technique which should work on ALL hosts to allow ExpressionEngine to handle URLs without index.php in them. Hopefully EllisLab will add this as a built-in option soon.

IJR

@tomdavies
tomdavies / HowTo.md
Created November 29, 2012 00:35
ExpressionEngine Google Analytics Site Search

Google Analytics Site Search

New GA.js script allows to track EE searches

Google updated their Analytics code from their former Urchin script (urchin.js) to their own Google Analytics (gs.js) that now allows to track:

  • Site Search (e.g EE site search)
  • Events (e.g file downloads) (still in closed beta Jan.11.2008)

Preparation

@tomdavies
tomdavies / config.php
Created November 30, 2012 11:45 — forked from 1stevengrant/config.php
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;
@tomdavies
tomdavies / gist:5721867
Created June 6, 2013 14:20
Last Git commit SHA to Mac clipboard
git log -n1 | cut -c6-12 | pbcopy
@tomdavies
tomdavies / Directory Structure
Created October 3, 2013 15:45
Mobile first media queries with IE8 fallback, using Breakpoint
sass/
|- _config.scss
|- site.scss
|- site--ie8.scss
\- modules/
\- _widget.scss