Skip to content

Instantly share code, notes, and snippets.

View chriswrightdesign's full-sized avatar

Chris Wright chriswrightdesign

View GitHub Profile
@chriswrightdesign
chriswrightdesign / rAF.js
Last active August 29, 2015 14:27 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];

Tiny Content Framework

About the Project

This is a tiny content strategy framework focused on goals, messages, and branding. This is not a checklist. Use what you need and scrap the rest. Rewrite it or add to it. These topics should help you get to the bottom of things with clients and other people you work with.

Contribute

There’s more to come, and I’d love to hear what you think. Give me feedback on Twitter (@nicoleslaw) or by email ([email protected]). We all benefit from sharing our ideas and creating standards. Onward.

Script to build URLs
https://github.com/cgiffard/node-simplecrawler
Script to build CSS selector file
https://github.com/caplin/SuperSelector
http://selectorgadget.com/
Script to convert :hover, :focus, etc to .hover, .focus etc
https://github.com/jacobrask/styledocco/blob/master/share/previews.js
Apply for any selectors that match
@chriswrightdesign
chriswrightdesign / ios8nozoom
Created March 4, 2015 11:35
Disable form field auto zoom on ios8 devices
select:focus,
textarea:focus,
input:focus,
select:hover,
input:hover,
option:hover,
option:focus,
select:focus option,
select:hover option {
font-size: 1em;
<!doctype html>
<html>
<head>
<title>Number Test</title>
<style>
tr {
background: #ddd;
}
tr:nth-child(odd) {
@chriswrightdesign
chriswrightdesign / ajax.js
Created January 18, 2014 03:50
Ajax sans jQuery (i think the last time I did this was 2006 or 2007) source: www.aaron-powell.com/posts/2013-08-02-ajax-without-jquery.html
//instance
var xhr = new XMLHttpRequest();
//open the request with method
xhr.open('get', '/foo');
//dom events- load, progress, error
//progress listen for and inform user of status if it takes a long time
xhr.addEventListener('load', function(e) {
//handle success
}, false);
xhr.send(); // sends the request
@chriswrightdesign
chriswrightdesign / 3rdpartyasync
Created January 8, 2014 02:51
Loading 3rd party content asynchronously (from http://browserdiet.com/)
var script = document.createElement('script'),
scripts = document.getElementsByTagName('script')[0];
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@chriswrightdesign
chriswrightdesign / arrayJS
Created January 7, 2014 21:45
Cached array length javascript for better performance
for (i = 0, len = arr.length; i < len; i++) {
//Calculated once
}
@chriswrightdesign
chriswrightdesign / mobilecheck.js
Created December 14, 2013 03:48
Mobile check returns boolean Feature detection is better, but sometimes this is useful
// http://coveroverflow.com/a/11381730/989439
function mobilecheck() {
var check = false;
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|i
@chriswrightdesign
chriswrightdesign / ie8Events.js
Created November 20, 2013 23:47
Polyfill for IE8 Javascript Event Listeners
(function() {
if (!Event.prototype.preventDefault) {
Event.prototype.preventDefault=function() {
this.returnValue=false;
};
}
if (!Event.prototype.stopPropagation) {
Event.prototype.stopPropagation=function() {
this.cancelBubble=true;
};