Skip to content

Instantly share code, notes, and snippets.

View mattosborn's full-sized avatar

Matt Osborn mattosborn

View GitHub Profile
@mattosborn
mattosborn / gist:b87ec6231071c959e8bf
Created May 9, 2014 10:15
gu/head.css bookmarklet
javascript:(function(){
function reloadCss(url){
$("link[href='"+url+"']").remove();
$('head').append('<link rel="stylesheet" type="text/css" href="'+url+'">');
}
reloadCss('/assets/stylesheets/head.default.css');
})();
@mattosborn
mattosborn / gist:1235e11f897e3cf6fa58
Created May 9, 2014 10:16
gu/global.css bookmarklet
javascript:(function(){
function reloadCss(url){
$("link[href='"+url+"']").remove();
$('head').append('<link rel="stylesheet" type="text/css" href="'+url+'">');
}
reloadCss('/assets/stylesheets/global.css');
})();
@mattosborn
mattosborn / gist:6eb44db53789b485ab4a
Created May 9, 2014 10:17
jQuery and lodash bookmarklet
javascript:(function() {
var el = document.createElement('pre'),
b = document.getElementsByTagName('body')[0],
otherjQuery = false,
msg = '',
libs = [
function loadjQuery() {
if (typeof jQuery != 'undefined') {
showMsg('This page already using jQuery v' + jQuery.fn.jquery);
} else {
@mattosborn
mattosborn / gist:4cdffa1dd9e729ec66d6
Last active August 29, 2015 14:07
gu bookmarket - expose libs
javascript: (function(){require([
'qwery',
'bonzo',
'bean',
'common/utils/$',
'common/utils/_',
'common/utils/ajax'
],function(
qwery,
bonzo,
@mattosborn
mattosborn / gist:02bb80dbf7efac6e5759
Created October 17, 2014 10:41
gu bookmarket - skip ads
javascript:(function() {
require(['qwery'],
function(qwery){
qwery('.js-gu-media').forEach(function(el) {
var vjs = videojs(el);
vjs.currentTime(vjs.duration() - 1);
});
});})();
@mattosborn
mattosborn / gist:e80fb368ec0ff6ffce83
Created November 3, 2014 14:54
log cutting n counting
cat logfile.log | awk -F'" "' '{print $6}' | sort | uniq -c | sort -rbg | less
@mattosborn
mattosborn / spacefinder-debug.js
Last active August 29, 2015 14:11
spacefinder-debug.js
(function() {
require([
'common/utils/$',
'common/utils/detect',
'common/modules/article/spacefinder',
'common/modules/commercial/article-body-adverts'
], function(
$,
detect,
@mattosborn
mattosborn / spacefinder-debug-bookmarklet.js
Created December 10, 2014 14:01
spacefinder-debug-bookmarklet
javascript: (function() {
var script = document.createElement('script');
script.src = "https://s3-eu-west-1.amazonaws.com/aws-frontend-store/MATT/spacefinder-debug.js";
document.getElementsByTagName('head')[0].appendChild(script);
})();
javascript: (function() {
var scripts = [
'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.6.0/lodash.js'
];
function drop(url) {
var s=document.createElement('script');
s.setAttribute('src', url);
document.getElementsByTagName('body')[0].appendChild(s);
console.log('loaded', url);
function throttle(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
if (!options) options = {};
var later = function() {
previous = options.leading === false ? 0 : Date.now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;