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
/*!
* load CSS with requestAnimationFrame
* stackoverflow.com/questions/28394097/async-loading-css-stylesheet-using-requestanimationframe
* gist.github.com/englishextra/10712436aa14df45d7031fd739bf9dfc
*/
function loadCSSwithRaf(h, c, m, b) {
function l() {
var t = window.document.createElement("link"),
a = b || window.document.getElementsByTagName("script")[0],
s = window.document.styleSheets;
@englishextra
englishextra / setTimeout setInterval.js
Last active October 13, 2017 15:41 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
/*! 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 Moller. fixes from Paul Irish and Tino Zijdel
* MIT license
*/
(function(){var lastTime=0;var vendors=["ms","moz","webkit","o"];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[vendors[x]+"CancelAnimationFrame"]||window[vendors[x]+"CancelRequestAnimationFrame"];}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return id;};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id);};}());
/*!
* requestAnimationFrame() shim by
@englishextra
englishextra / Responsive-card-ui-grid.markdown
Created October 12, 2017 10:07
Responsive card ui grid
@englishextra
englishextra / web-servers.md
Created October 5, 2017 23:55 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@englishextra
englishextra / useragentswitcher.xml
Created September 13, 2017 23:33
Massive list of user agents for User Agent Switcher by Chris Pederik http://forums.chrispederick.com/categories/user-agent-switcher
<useragentswitcher>
<folder description="Browsers - Windows">
<folder description="Legacy Browsers">
<useragent description="Arora 0.6.0 - (Vista)" useragent="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.6 (Change: )" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Avant Browser 1.2" useragent="Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Chrome 4.0.249.0 (Win 7)" useragent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Chrome 5.0.310.0 (Server 2003)" useragent="Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9" appcodename="" appname=""
@englishextra
englishextra / css-media-queries-cheat-sheet.css
Created September 12, 2017 09:19 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@englishextra
englishextra / loadExt.js
Created July 4, 2017 22:25 — forked from Aymkdn/loadExt.js
To load JS and CSS files with vanilla JavaScript
// long version
function loadExt(files, after) {
var _this=this;
_this.files = files;
_this.js = [];
_this.head = document.getElementsByTagName("head")[0];
_this.after = after || function(){};
_this.loadStyle = function(file) {
var link = document.createElement("link");
link.rel = "stylesheet";
@englishextra
englishextra / .eslintrc
Created June 13, 2017 21:30 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@englishextra
englishextra / openDeviceBrowser.js
Last active May 12, 2017 20:15
Open external links in default browser out of Electron / nwjs
/*!
* Open external links in default browser out of Electron / nwjs
* gist.github.com/englishextra/b9a8140e1c1b8aa01772375aeacbf49b
* stackoverflow.com/questions/32402327/how-can-i-force-external-links-from-browser-window-to-open-in-a-default-browser
* github.com/nwjs/nw.js/wiki/shell
* electron - file: | nwjs - chrome-extension: | http: Intel XDK
* wont do in electron and nw,
* so manageExternalLinks will set target blank to links
* var win = w.open(url, "_blank");
* win.focus();
@englishextra
englishextra / function-bind.js
Last active May 1, 2017 22:11 — forked from Daniel-Hug/function-bind.js
Polyfill for Function.prototype.bind
/*!
* Polyfill for Function.prototype.bind
* @see {@link https://gist.github.com/Daniel-Hug/5682738}
* @see {@link https://gist.github.com/englishextra/db0f22a60e59de86c19f174938c09529}
*/
if (!Function.prototype.bind) {
Function.prototype.bind = (function () {}).bind || function (b) {
if (typeof this !== "function") {
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}