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 / 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 / rebuild_masonry_after_disqus_ready.js
Last active April 24, 2016 19:03
Rebuild Masonry / Packery after Disqus is ready
evento.add(window, "load", function () {
var w = window,
d = document,
disqus_thread = d.getElementById("disqus_thread") || "",
disqus_shortname = disqus_thread ? (disqus_thread.dataset.shortname || "") : "",
embed_js_src = ("https:" == w.location.protocol ? "https" : "http") + "://" + disqus_shortname + ".disqus.com/embed.js",
g = ".grid",
h = ".grid-item",
k = ".grid-sizer",
grid = d.querySelector(g) || "",
/*!
* load JS with requestAnimationFrame
* stackoverflow.com/questions/28394097/async-loading-css-stylesheet-using-requestanimationframe
*/
function loadJSwithRaf(s, c) {
function l() {
var a = document.getElementsByTagName("script")[0],
t = document.createElement("script");
t.src = s;
t.async = !0;
/*!
* 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;
<?xml version="1.0" encoding="Windows-1252" ?>
<!--// HelpingHand Notepad++ XML Theme
Copyright (c) 2016 Seguei Shimansky <http://shimansky.biz/>
gist.github.com/englishextra/1132a0a940768984cd4735837a22aba2
//-->
<NotepadPlus>
<LexerStyles>
<LexerType name="xml" desc="XML" ext="">
<WordsStyle name="XMLSTART" styleID="12" fgColor="000000" bgColor="F1F1F1" fontName="" fontStyle="0" fontSize="10" />
<WordsStyle name="XMLEND" styleID="13" fgColor="000000" bgColor="F1F1F1" fontName="" fontStyle="0" fontSize="10" />
@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 / AJAXLoadTriggerJs.js
Last active February 3, 2017 13:13
Load and execute JS via AJAX
/*!
* Load and execute JS via AJAX
* gist.github.com/englishextra/8dc9fe7b6ff8bdf5f9b483bf772b9e1c
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
* gist.github.com/Xeoncross/7663273
* modified callback(x.responseText,x); to callback(eval(x.responseText),x);
* stackoverflow.com/questions/3728798/running-javascript-downloaded-with-xmlhttprequest
* @param {String} u path string
* @param {Object} [f] callback function
* @param {Object} [e] on error callback function
@englishextra
englishextra / externalcounters.js
Last active December 12, 2016 09:04
track visitors
/*!
* externalcounters.js
* track visitors
* gist.github.com/englishextra/12dec2c7a796ab9ec5e9ed84b134c055
*/
if (!/localhost/.test(self.location.host)) {
(function (b, a, c, d) {
if (c && d) {
var e = encodeURIComponent(a.referrer || "");
b = encodeURIComponent(b.location.href || "");
@englishextra
englishextra / externalcounters-clicks.js
Last active May 3, 2016 09:27
track clicks on external links
/*!
* externalcounters-clicks.js
* track clicks on external links
* gist.github.com/englishextra/b1e2dec7ab9b5d5af28a02c7257b17e6
*/
"undefined" !== typeof window.jQuery && $(function () {
$(document).on("click", ".superbox-current-desc a", function (e) {
e.preventDefault();
e.stopPropagation();
var w = window,
@englishextra
englishextra / hyphenator.js
Created May 3, 2016 16:58
modified github.com/ykyuen/hyphenator.js/blob/master/Hyphenator.js
/*!
* modified github.com/ykyuen/hyphenator.js/blob/master/Hyphenator.js
* only English and Russian support
* some functions and checks are cut off
* usage <p class="hyphenate text" lang="ru"> <p class="hyphenate text" lang="en">
* dont minify with JSMin
* minify with closure-compiler.appspot.com/home and then remove new lines
*/
var Hyphenator = function (e) {
var p = {