Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
@mrmartineau
mrmartineau / TMW.Supports.js
Created September 30, 2013 10:15
Simple detection for fullscreen media playback on touch devices
;(function (TMW, $) {
var theUserAgent = navigator.userAgent.toLowerCase();
TMW.Supports = {
userAgent : navigator.userAgent.toLowerCase(),
platform : {
iOS : theUserAgent.indexOf('iphone') != -1 || theUserAgent.indexOf('ipad') != -1 || theUserAgent.indexOf('ipod') != -1,
android : theUserAgent.indexOf('android') != -1,
@mrmartineau
mrmartineau / Kickoff forms
Last active December 23, 2015 23:49
Example usage for Kickoff's form markup
Example usage for Kickoff's form markup
@mrmartineau
mrmartineau / labels-above-inputs.html
Last active December 23, 2015 23:49
Kickoff forms
<form action="#" class="well">
<fieldset>
<legend>Your form</legend>
<ul>
<li class="form-controlGroup">
<label for="name" class="control-label">Name</label>
<div class="controls">
<input type="text" id="name" placeholder="Zander Martineau" class="input-xlarge" />
</div>
</li>
@mrmartineau
mrmartineau / extra-head-content.html
Last active December 22, 2015 02:29
Extra <head> content for websites
<!-- Mobile & Fav Icons -->
<link rel="shortcut icon" type="image/x-icon" href="{siteurl}/favicon.ico">
<!-- Apple iOS -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{siteurl}/favicons/144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="{siteurl}/favicons/114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="{siteurl}/favicons/72x72">
<link rel="apple-touch-icon-precomposed" href="{siteurl}/favicons/57x57.png">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="{page title}">
@mrmartineau
mrmartineau / styler.js
Created August 15, 2013 00:09
Simple shim to make getting and setting CSS values more easy
// Get/Set CSS styles with ease
function styler(el) {
return {
/* Get CSS style
* @prop : String - CSS property name e.g 'width', 'height'
* @int : Boolean
*/
get : function(prop, int) {
/* TODO:
* Get multiple CSS properties. prop could be comma separated list
@mrmartineau
mrmartineau / prompt.js
Last active December 20, 2015 12:19
Simple script to prompt user if they have not interacted with your page for a given amount of time. The check interval is 6 seconds and currently listens for the `mousemove` event but `scroll` or others can be used equally well.
var PROMPT = {
prompt : false,
interval : 6000,
now : new Date(),
init : function() {
// Do initial check
this.listener();
// console.log(this);
@mrmartineau
mrmartineau / jquery.data.code.block.js
Created July 13, 2013 18:08
Dave Rupert's data code block jQuery plugin
/* jshint jquery:true */
/* Author: Dave Rupert
* License: WTFPL
----------------------*/
(function($){
'use strict';
$.fn.dataCodeBlock = function(){
@mrmartineau
mrmartineau / jquery-fallback.html
Created June 9, 2013 22:25
Provide two versions of jQuery, one for old browsers and one for new. See more details at http://martineau.tv/blog/2013/06/two-versions-of-jquery/
<!--[if lte IE 8]>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/libs/jquery.min.js"><\/script>')</script>
<![endif]-->
<!--[if gt IE 8]><!-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/libs/jquery.2.min.js"><\/script>')</script>
<!--<![endif]-->
@mrmartineau
mrmartineau / inc-dec.json
Last active December 18, 2015 05:48
Out of date Sublime Text 2 settings
[
{ "keys": ["alt+up"], "command": "inc_dec_value", "args": { "action": "inc_min" } },
{ "keys": ["alt+down"], "command": "inc_dec_value", "args": { "action": "dec_min" } },
{ "keys": ["super+up"], "command": "inc_dec_value", "args": { "action": "inc_max" } },
{ "keys": ["super+down"], "command": "inc_dec_value", "args": { "action": "dec_max" } },
{ "keys": ["super+alt+up"], "command": "inc_dec_value", "args": { "action": "inc_all" } },
{ "keys": ["super+alt+down"], "command": "inc_dec_value", "args": { "action": "dec_all" } }
]
@mrmartineau
mrmartineau / grunt-watch-livereload-subtask.js
Last active December 18, 2015 05:39
Grunt watch task for compiling scss, js and trigerring a livereload
livereload: {
options: { livereload: true },
files: [
// When these files are changed, livereload is triggered
// Make sure this directory is the same as the one your site points to
'resources/css/styles.css'
]
}