Skip to content

Instantly share code, notes, and snippets.

Bryon Vandiver asterick

View GitHub Profile
@asterick
asterick / grid.scss
Last active Jun 12, 2018
Variable column grid system with ratios ala PURE in very little SCSS
View grid.scss
// Globals
$screen-width: 1280px;
// Grid
$column-granularity: 12;
$column-gutter: 20px;
// Dimensions (responsive)
$screen-xs-max: 567px;
$screen-sm-min: 568px;
@asterick
asterick / esi.js
Created May 1, 2014
Replace all unrealized ESI's on a page (good for bookmarklets)
View esi.js
Array.prototype.forEach.call(document.getElementsByTagName("esi:include"),function(e){function r(e){n.after(e);console.log(t,"loaded");sessionStorage[t]=JSON.stringify({ts:+(new Date)+1e3*60*30,value:e})}var t=e.getAttribute("src"),n=$(e);if(sessionStorage[t]){var i=JSON.parse(sessionStorage[t]);if(i.ts>+(new Date)){r(i.value);return}}if(e.getAttribute("processed")){return}e.setAttribute("processed",true);var s=new XMLHttpRequest;s.open("GET",t,true);s.send();console.log("Loading",t);s.onreadystatechange=function(){if(s.readyState!==4){return}r(s.responseText)}})
View chicken.js
(function(word) {
var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false), el;
word=word.split("");
while(el=walk.nextNode()) {
el.nodeValue = el.nodeValue.replace(/\w+/g, function (o) {
return word.map(function (v, i) {
return (o[i] < "a") ? v.toUpperCase() : v;
}).join("");
});
}
View gist:5041436
functon onReturn(resp) {
if (resp.status === 200) {
// SUCCESS!
} else {
// BOOO
}
}
$http(...).then(onReturn, onReturn);
You can’t perform that action at this time.