Skip to content

Instantly share code, notes, and snippets.

View nevali's full-sized avatar
🏳️‍🌈
Always, always busy

Mo McRoberts nevali

🏳️‍🌈
Always, always busy
View GitHub Profile
We couldn’t find that file to show.
@nevali
nevali / relative-urls.php
Created November 5, 2010 10:56
This is the biggest hack in the world. Okay, not the biggest. Another plugin I saw accomplished this by output-buffering every page and regexp-replacing.
<?php
/*
Plugin Name: Relative URLs
Author: Mo McRoberts
*/
function init_relative_urls()
{
$admin = defined('WP_ADMIN_PATH') ? WP_ADMIN_PATH : 'wp-admin';
Scenario A, in which content publishers attempt to convince people not to run adblockers:
A: "If you install this adblocker, you never need to see those annoying ads again!"
B: "Oh wow! Why didn't I know about this sooner? This is such a godsend."
Y: "You know, by doing that, you're depriving content publishers of revenues. You'll just be ripping them off."
B: "I don't ever look at the ads anyway/You've had over ten years of revenues out of me, and the industry hasn't changed its ways yet, time's up/Time's-a-changin', you need to evolve/Various random spurious arguments"
Y: "Respect the web economy -- you're basically stealing content, you'll put me and others like me out of business!"
A: "Too late. Adapt or die."
Y: [site folds]
// ==UserScript==
// @name iPlayer
// @namespace http://www.bbc.co.uk/iplayer/*
// @include http://www.bbc.co.uk/iplayer/*
// ==/UserScript==
var i = window.setInterval(function () {
if ((e = document.getElementById('bbc_emp_embed_emp'))) {
clearInterval(i);
window.addEventListener('resize', function() { doResizePlayer(e); });
doResizePlayer(e);
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=540, minimum-scale=1.0, maximum-scale=1.0">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="https://isetup.o2.co.uk/resources/styles/styles.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script type="text/javascript" charset="utf-8" src="https://isetup.o2.co.uk/resources/scripts/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="https://isetup.o2.co.uk/resources/scripts/jquery.tools.js"></script>
<script type="text/javascript" charset="utf-8" src="https://isetup.o2.co.uk/resources/scripts/scripts.js"></script>
#! /bin/sh
emacsdir=/Local/Applications/Emacs.app
PATH=${emacsdir}/Contents/MacOS/bin:$PATH
export PATH
sock="$TMPDIR/emacs$UID/server"
if test x"$TERM_PROGRAM" = x"Apple_Terminal" ; then
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:po="http://purl.org/ontology/po/" xmlns:mo="http://purl.org/ontology/mo/" xmlns:skos="http://www.w3.org/2008/05/skos#" xmlns:time="http://www.w3.org/2006/time#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:wgs84_pos="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:timeline="http://purl.org/NET/c4dm/timeline.owl#" xmlns:event="http://purl.org/NET/c4dm/event.owl#">
<rdf:Description rdf:about="/13ff142e-fad3-4b3f-aca5-ce7f0b20ebaa.rdf">
<rdfs:label>Description of the episode Hubblecast 01</rdfs:label>
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2010-09-05T12:22:08Z</dcterms:created>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2010-09-11T19:34:59Z</dcterms:modified>
{"episodeNumber":"1",
"seriesNumber":"1",
"curie":"spacetelescope.org:heic0705a",
"title":"Hubblecast 01",
"description":"The NASA\/ESA Hubble Space Telescope, in collaboration with several other ground- and space-based telescopes, has captured a galaxy being ripped apart by a galaxy cluster's gravitational field and harsh environment.\n\nThe finding sheds light on the mysterious process by which gas-rich spiral-shaped galaxies might evolve into gas-poor irregular- or elliptical-shaped galaxies over billions of years.",
"publisher":{"key":"spacetelescope.org","name":"ESA\/Hubble","country":"ALL"},
"uri":"http:\/\/www.spacetelescope.org\/videos\/heic0705a\/",
"shortDescription":"Hubble sees 'Comet Galaxy' being ripped apart by galaxy cluster",
"mediumDescription":"The NASA\/ESA Hubble Space Telescope, in collaboration with several other ground- and space-based telescopes, has captured a galaxy being ripped apart by a galaxy cluster's gravitational field and harsh environment.",
"kind":"episode",
<?php
/* This is rather naïve - suck it up. It'll probably break XMLRPC. That's left as an
* exercise to the reader. You should probably also make sure fuel_home_url() return the
* actual root, rather than assuming it's '/'. Also, this will all fail horribly with URLs
* to _other_ servers which get unexpectedly passed through the filters. A smarter
* implementation would strip off the real siteurl where it occurs at the start of the URL,
* rather than blindly stripping the host.
*/
<?php
define('DB_USER', 'tv');
define('DB_PASS', null);
define('DB_HOST', null);
define('DB_NAME', 'mythtv');
error_reporting(E_ALL);
ini_set('display_errors', 'On');