Skip to content

Instantly share code, notes, and snippets.

Avatar
🤦‍♂️
Coding

Zander Martineau mrmartineau

🤦‍♂️
Coding
View GitHub Profile
@mrmartineau
mrmartineau / prompt.js
Last active Dec 20, 2015
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.
View prompt.js
var PROMPT = {
prompt : false,
interval : 6000,
now : new Date(),
init : function() {
// Do initial check
this.listener();
// console.log(this);
@mrmartineau
mrmartineau / styler.js
Created Aug 15, 2013
Simple shim to make getting and setting CSS values more easy
View styler.js
// 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 Dec 22, 2015
Extra <head> content for websites
View extra-head-content.html
<!-- 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}">
View labels-above-inputs.html
<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 Dec 23, 2015
Example usage for Kickoff's form markup
View Kickoff forms
Example usage for Kickoff's form markup
@mrmartineau
mrmartineau / TMW.Supports.js
Created Sep 30, 2013
Simple detection for fullscreen media playback on touch devices
View TMW.Supports.js
;(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 Dec 24, 2015
Example usage for Kickoff's components
View Kickoff components
Example usage for Kickoff's components
View Kickoff CSS class naming scheme.css
- 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 Oct 16, 2013
Kickoff bower example if not using jQuery
View bower.json
{
"name": "kickoff",
"version": "1.0.0",
"dependencies": {
"bean": "*",
"bonzo": "*",
"qwery": "*",
"lodash": "*",
"domready": "*"
},
@mrmartineau
mrmartineau / string.substitute.js
Last active Dec 31, 2015
String.substitute and example used on the uk.thebar.com
View string.substitute.js
String.prototype.substitute = function (object) {
return this.replace(/\{(.+?)\}/g, function (match, name) {
return name in object ? object[name] : match;
});
};