Skip to content

Instantly share code, notes, and snippets.

View themorgantown's full-sized avatar

Daniel themorgantown

View GitHub Profile
<style type="text/css">
body {
background-color: #FFFFFF;
margin: 0px;
}
@media screen and (orientation:portrait)
{
#portrait_hype_container {
display: block;}
#landscape_hype_container {
@themorgantown
themorgantown / normaldocument.html
Created March 16, 2012 19:51
This document redirects retina displays to a different page. It looks for the pixel density of the device and triggers a redirect if the density is 2 or greater.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>For regular devices.</title>
<script type="text/javascript">
if( window.devicePixelRatio >= 2 ){
window.location.replace("http://tumultco.com/blog/wp-content/uploads/2012/03/retinatestdocument/forretina.html");
}
</script>
@themorgantown
themorgantown / dfpdemo.html
Last active October 3, 2015 17:18
This is part of a tutorial for adding Hype animations to Double Click for Publishers
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=9" />
<meta name="viewport" content="user-scalable=yes, width=300" />
<script type="text/javascript">
window.DFP_CLICK_PREFIX = "%%CLICK_URL_UNESC%%";
</script>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
// if(navigator.platform == "iPad")
if (navigator && navigator.platform && navigator.platform.match(/^(iPad|iPod|iPhone)$/)) {
$("a").each(function() { // have to use an `each` here - either a jQuery `each` or a `for(...)` loop
var onClick; // this will be a function
var firstClick = function() {
onClick = secondClick;
return false;
@themorgantown
themorgantown / scrollfix.html
Created August 9, 2012 20:17
Enable scrolling on iframes in iOS
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
if (/iPhone|iPod|iPad/.test(navigator.userAgent))
$('iframe').wrap(function(){
var $this = $(this);
return $('<div />').css({
width: $this.attr('width'),
height: $this.attr('height'),
overflow: 'auto',
<!-- Try HTML 5 playback first. -->
<audio width="400" controls="controls">
<source src="http://tumultco.com/misc/static/audio/04Shakedownst.steves.ogg" type="audio/ogg"> <!-- Firefox and Chrome -->
<source src="http://tumultco.com/misc/static/audio/04Shakedownst.steves_vbr.mp3" type="audio/mpeg"> <!-- Safari and iPhone -->
<!-- Windows Media Player class id to enable native streaming on IE 7 and above. IE 6 and below will go straight to flash player -->
<!--[if gt IE 6]>
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="320" height="45"><!
[endif]-->
@themorgantown
themorgantown / video.html
Created August 27, 2012 19:21
video element code
<video controls="controls" poster="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg" width="640" height="360">
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4" />
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm" />
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg" />
</video>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=9" />
<meta name="viewport" content="user-scalable=yes, width=1024" />
<title>test</title>
<style>
body {
background-color: #FFFFFF;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=9" />
<meta name="viewport" content="user-scalable=yes, width=300" />
<title>spinnerdemo</title>
<style>
body {
@themorgantown
themorgantown / audiosprite.js
Created December 6, 2012 01:11 — forked from remy/audiosprite.js
An example of how an audio sprite can be used (includes fixes for iOS)
function Track(src, spriteLength, audioLead) {
var track = this,
audio = document.createElement('audio');
audio.src = src;
audio.autobuffer = true;
audio.load();
audio.muted = true; // makes no difference on iOS :(
/* This is the magic. Since we can't preload, and loading requires a user's
input. So we bind a touch event to the body, and fingers crossed, the