Skip to content

Instantly share code, notes, and snippets.

@350d
350d / hosts
Created April 1, 2014 19:00
No More Youtube ADS
127.0.0.1 ads.youtube.com
127.0.0.1 s0.2mdn.net
127.0.0.1 s1.2mdn.net
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 static.doubleclick.net
@350d
350d / phpinfo.css
Created March 22, 2014 08:20
Styles for phpinfo();
html {
background: #fff;
margin:0;
padding:0;
}
body {
color: #233452;
height: 100%;
font-family: Verdana, Helvetica, sans-serif;
margin: 20px 0;
@350d
350d / domready.js
Created March 19, 2014 21:59
Minimal DOM ready, IE tested
function r(f) {
/in/.test(document.readyState) ? setTimeout('r('+f+')',9) : f()
}
@350d
350d / cookie.js
Last active February 1, 2016 17:50
Simple library for Cookie manage
<?xml version="1.0" ?><skin author="JW Player" name="Five" target="6.7" version="3.0">
<components>
<component name="controlbar">
<settings>
<setting name="margin" value="0"/>
<setting name="maxwidth" value="9999"/>
<setting name="fontsize" value="11"/>
<setting name="fontweight" value="normal"/>
"undefined"==typeof jwplayer&&(jwplayer=function(e){if(jwplayer.api)return jwplayer.api.selectPlayer(e)},jwplayer.version="6.8.4616",jwplayer.vid=document.createElement("video"),jwplayer.audio=document.createElement("audio"),jwplayer.source=document.createElement("source"),function(e){function a(h){return function(){return b(h)}}function l(h,b,a,k,j){return function(){var d,f;if(j)a(h);else{try{if(d=h.responseXML)if(f=d.firstChild,d.lastChild&&"parsererror"===d.lastChild.nodeName){k&&k("Invalid XML");
return}}catch(g){}if(d&&f)return a(h);(d=c.parseXML(h.responseText))&&d.firstChild?(h=c.extend({},h,{responseXML:d}),a(h)):k&&k(h.responseText?"Invalid XML":b)}}}var g=document,f=window,d=navigator,c=e.utils=function(){};c.exists=function(h){switch(typeof h){case "string":return 0<h.length;case "object":return null!==h;case "undefined":return!1}return!0};c.styleDimension=function(h){return h+(0<h.toString().indexOf("%")?"":"px")};c.getAbsolutePath=function(h,b){c.exists(b)||(b=g.location.href);if(c.exists(h)){va
@350d
350d / windowstatus.js
Created January 31, 2014 17:06
Window Active Status
function windowVisibility() {
var v = 'visible', hidden = h = 'hidden', map = {focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h};
if (hidden in D) D.addEventListener("visibilitychange", onchange);
else if ((hidden = "mozHidden") in D) D.addEventListener("mozvisibilitychange", onchange);
else if ((hidden = "webkitHidden") in D) D.addEventListener("webkitvisibilitychange", onchange);
else if ((hidden = "msHidden") in D) D.addEventListener("msvisibilitychange", onchange);
else if ('onfocusin' in D) D.onfocusin = D.onfocusout = onchange;
W.onpageshow = W.onpagehide = W.onfocus = W.onblur = onchange;
function onchange(e) {
e = e || W.event;
@350d
350d / functions.php
Created October 9, 2013 21:02
Disqus comment manager fix for Wordpress
function dsq_fix() {
echo '<style type="text/css">div.dsq-main {height:100%;min-height:100%;}</style>';
}
add_action('admin_head', 'dsq_fix');
@350d
350d / gaerror.js
Created September 20, 2013 20:36
Google Analytics Javascript errors tracking
$(window).error(function (error) {
if (error && error.originalEvent) {
error = error.originalEvent;
var message, url, line;
if (error && error.message) {
message = error.message;
url = getfilename(error.filename);
line = error.lineno;
} else {
message = "(message empty)";
@350d
350d / script.js
Created March 4, 2013 21:27
Photoshop Square Crop
var savedRuler= app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var w = app.activeDocument.width;
var h = app.activeDocument.height;
if(w>h) app.activeDocument.resizeCanvas (w, w, AnchorPosition.MIDDLECENTER);
if(w<h) app.activeDocument.resizeCanvas (h, h, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = savedRuler;