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 / 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 / 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 / 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 / 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 / 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 / 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 components
Last active December 24, 2015 09:09
Example usage for Kickoff's components
Example usage for Kickoff's components
- child element
e.g. .form-controlGroup > .form-controlGroup-label
-- modifier element
e.g. .btn.btn--primary
.is- element state
e.g. .btn.btn--primary
aB camel-case descriptors
@mrmartineau
mrmartineau / bower.json
Created October 16, 2013 11:31
Kickoff bower example if not using jQuery
{
"name": "kickoff",
"version": "1.0.0",
"dependencies": {
"bean": "*",
"bonzo": "*",
"qwery": "*",
"lodash": "*",
"domready": "*"
},
@mrmartineau
mrmartineau / string.substitute.js
Last active December 31, 2015 03:19
String.substitute and example used on the uk.thebar.com
String.prototype.substitute = function (object) {
return this.replace(/\{(.+?)\}/g, function (match, name) {
return name in object ? object[name] : match;
});
};