Skip to content

Instantly share code, notes, and snippets.

View englishextra's full-sized avatar
💜
the beat goes on

englishextra englishextra

💜
the beat goes on
View GitHub Profile
@englishextra
englishextra / web-design-for-mobiles-and-tablets-viewport-sizes
Last active April 17, 2018 16:02 — forked from francoishill/gist:6483997
web-design-for-mobiles-and-tablets-viewport-sizes
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100
// 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'];
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@englishextra
englishextra / evento.js
Last active September 23, 2016 19:36 — forked from erikroyall/evento.js
modified Evento - v1.0.0
/*!
* modified Evento - v1.0.0
* by Erik Royall <erikroyalL@hotmail.com> (http://erikroyall.github.io)
* Dual licensed under MIT and GPL
* gist.github.com/erikroyall/6618740
* gist.github.com/englishextra/3a959e4da0fcc268b140
* removed Array.prototype.indexOf shim
* removed Helio stuff which seems to be added
* for some other library, and works without Helio
* jsbin.com/jilevi/edit?html,js,output
@englishextra
englishextra / ie8Events.js
Created March 20, 2016 09:24 — forked from chriswrightdesign/ie8Events.js
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;
};
@englishextra
englishextra / ajax.js
Created April 19, 2016 13:36 — forked from xeoncross/ajax.js
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
/**
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
*
* @param string url
* @param object callback
* @param mixed data
* @param null x
*/
function ajax(url, callback, data, x) {
try {
@englishextra
englishextra / querySelector.polyfill.js
Created May 6, 2016 18:53 — forked from chrisjlee/querySelector.polyfill.js
IE document.querySelector() polyfill
if (!document.querySelectorAll) {
document.querySelectorAll = function (selectors) {
var style = document.createElement('style'), elements = [], element;
document.documentElement.firstChild.appendChild(style);
document._qsa = [];
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}';
window.scrollBy(0, 0);
style.parentNode.removeChild(style);
@englishextra
englishextra / delegate.js
Created May 6, 2016 18:58 — forked from cvan/delegate.js
simple querySelectorAll wrapper + event delegation
function $(sel) {
if (!sel) {
return document.body;
}
var r = document.querySelectorAll(sel);
return r.length == 1 ? r[0] : Array.prototype.slice.call(r);
}
$.matches = function(el, sel) {
var matchesSelector = el.webkitMatchesSelector || el.mozMatchesSelector ||
@englishextra
englishextra / interval.js
Last active May 17, 2016 09:41 — forked from manast/interval.js
Accurate Javascript setInterval replacement
/*!
* Accurate Javascript setInterval replacement
* gist.github.com/manast/1185904
* gist.github.com/englishextra/f721a0c4d12aa30f74c2e089370e09eb
* minified with closure-compiler.appspot.com/home
* var timer = new interval(50, function(){ if(1===1){timer.stop(), timer = 0;}}); timer.run();
* The handle will be a number that isn't equal to 0; therefore, 0 makes a handy flag value for "no timer set".
* stackoverflow.com/questions/5978519/setinterval-and-how-to-use-clearinterval
*/
function interval(d,f){this.baseline=void 0;this.run=function(){void 0===this.baseline&&(this.baseline=(new Date).getTime());f();var c=(new Date).getTime();this.baseline+=d;var b=d-(c-this.baseline);0>b&&(b=0);(function(d){d.timer=setTimeout(function(){d.run(c)},b)}(this))};this.stop=function(){clearTimeout(this.timer)}};