Skip to content

Instantly share code, notes, and snippets.

View willtonkin's full-sized avatar
💭
I may be slow to respond.

Will Tonkin willtonkin

💭
I may be slow to respond.
View GitHub Profile
@willtonkin
willtonkin / my haml override.
Created November 15, 2012 11:56 — forked from davesag/my haml override.
i18n aware haml and erb template loader for Sinatra
helpers do
def haml(template, options = {}, *)
# template will either be the name of a template or the body of a template.
# if it's the body then it will contain a "%" symbol and so we can skip any processing
template_name = template.to_s
do_not_localise = false
if template_name.include?('%')
@willtonkin
willtonkin / my haml override.
Created November 15, 2012 11:57 — forked from davesag/my haml override.
i18n aware haml and erb template loader for Sinatra
helpers do
def haml(template, options = {}, *)
# template will either be the name of a template or the body of a template.
# if it's the body then it will contain a "%" symbol and so we can skip any processing
template_name = template.to_s
do_not_localise = false
if template_name.include?('%')
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@willtonkin
willtonkin / vimeo_list.php
Created April 20, 2013 12:21
Generate list of Vimeo videos from array of Vimeo IDs. Uses Vimeo API to grab thumbnail and video title.
<div class="list">
<ul>
<?php
function drawVimeoPanel( $vimeo_id )
{
$request_url = "http://vimeo.com/api/v2/video/" . $vimeo_id . ".xml";
$video_info = simplexml_load_file( $request_url );
$v = '<li>';
$v .= '<a href="http://player.vimeo.com/video/' . $vimeo_id . '">';
@willtonkin
willtonkin / facebook-frame-test.html
Last active December 16, 2015 15:49
Really simple iframe test for Facebook App pages (810px x 800px). Gives you a change to test you work before throwing it into Facebook.
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Facebook frame test</title>
</head>
<body>
@willtonkin
willtonkin / check-url.sh
Last active December 16, 2015 16:29
Iterate through a list of URLs returning their HTTP response and showing their resultant redirect location. Been used for redirect testing.
#!/bin/bash
#BASE=example.com
while read LINE; do
echo -n "$BASE$LINE"
curl -o /dev/null --silent --head --write-out ' : %{http_code} -> ' "$BASE$LINE"
curl -IL -o /dev/null --silent --head --write-out '%{url_effective} : %{http_code}\n' "$BASE$LINE"
done < url-list.txt
@willtonkin
willtonkin / mail-and-rotate.sh
Created April 30, 2013 09:26
E-mail file, copy it with the current date appended to the filename and empty the file contents.
#!/bin/bash
FILE=targetfile.txt
echo "Email body text goes here" | mutt -a "$FILE" -s "Email subject goes here" -- willtonkin1@gmail.com
TIMESTAMP=`date +%Y%m%d`
NEW_FILE=$FILE.$TIMESTAMP
cp $FILE $NEW_FILE
/*
_______
These simple SCSS mixins for Foundation4 are made by me to deal with media-queries and have a clean code at the same time! ;)
****IMPORTANT****
Due to Foundation 4 uses mobile-first methodology, every $phone-"X" variable in these mixins defines the value for every screen size.
$desktop-"X" values overrides $phone-"X" values when window width is 768px and above.
So, to simplify this, we can think that way: ($phone-"X" < 768px => $desktop-"X")
@willtonkin
willtonkin / redirect.html
Last active December 22, 2015 21:48
Expression Engine redirect page template for use with Structure. Supports campaign tracking URLs.
{exp:channel:entries
limit="1"
channel="redirect_pages"
disable="{global:disable_default}"
require_entry="yes"
status="Open|Hidden"
entry_id="{structure:freebie:entry_id}"
}
{exp:ifelse}