Skip to content

Instantly share code, notes, and snippets.

/*
In Wordpress, using the "The SEO Framework" plugin, we want to break the inheritance
between the Meta Title and that of OpenGraph/Twitter Title (we also do this for Description but the approach is the same).
While the PHP code appears to work, the 'placeholder'
on the field INPUT and TEXTAREA elements still reflects the original behaviors.
This (hacky) code solves for that though a better approach is desired.
This would break if element IDs were to change in the future.
You also need to ensure you DO NOT run this code until the element exists.
<?php
/*
In Wordpress, using the "The SEO Framework" plugin, we want to break the inheritance
between the Meta Title and that of OpenGraph/Twitter Title
(we also do this for Description but the approach is the same)
Relates to: OpenGraph Title
We do not want the OG Title to inherit from the Meta Title (as is default behavior)
If no OG Title is given, it should default to the article headline.
Else use the custom OG Title.

Keybase proof

I hereby claim:

  • I am donohoe on github.
  • I am donohoe (https://keybase.io/donohoe) on keybase.
  • I have a public key whose fingerprint is EFE3 1791 85EC 0991 C730 AECA 9873 8128 4790 5AD5

To claim this, I am signing this object:

@donohoe
donohoe / genius-kill.js
Created June 7, 2016 00:21
Disable the Genius browser extension from working on a web page
(function(){
console.log("GK ftw");
function checkFlag() {
var checkPage = document.getElementsByTagName("genius-back-page");
if (checkPage.length) {
var checkPageEl = checkPage[0]
checkPageEl.parentNode.removeChild(checkPageEl);
}
var checkPrompt = document.getElementsByTagName("genius-pre-annotation-prompt");
if (checkPrompt.length) {
@donohoe
donohoe / index.html
Created April 15, 2014 22:39
Super simple basic hacky NYTimes API that hooks into their JSONP feeds
<html>
<head>
<title>Super Simple Sandbox</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<script src="nyt.js"></script>
</body>
</html>

Keybase proof

I hereby claim:

  • I am donohoe on github.
  • I am donohoe (https://keybase.io/donohoe) on keybase.
  • I have a public key whose fingerprint is E3DA EA47 D10B 05FF 2626 E451 B0B9 008F 3DBE 9F12

To claim this, I am signing this object:

@donohoe
donohoe / gist:3206690
Created July 30, 2012 12:51 — forked from madrobby/gist:3201472
Check if the browsers supports SVG
// A minor tweak the sake of changing
function supportsSVG(){
return !!('createElementNS' in (d = document) &&
d.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect)
}
@donohoe
donohoe / end-scroll.js
Created July 20, 2012 12:45
Determine when you have scrolled to the end of an element
document.getElementById('items').addEventListener('scroll', function() {
var seekEl = document.getElementById("items");
var contentHeight = seekEl.scrollHeight - seekEl.offsetHeight;
if (contentHeight <= seekEl.scrollTop) {
console.log("Scroll end");
}
}, false);
@donohoe
donohoe / is-in-view.js
Created July 20, 2012 12:37
Check if an element in DOM is in viewable area
/* Requires jQuery */
function isInView(el) {
var docViewTop = $(window).scrollTop();
var docViewBtm = docViewTop + $(window).height();
var elTop = $(el).offset().top;
var elBtm = elTop + $(el).height();
return ((elBtm <= docViewBtm) && (elTop >= docViewTop));
}
@donohoe
donohoe / LICENSE.txt
Created January 4, 2012 17:53 — forked from 140bytes/LICENSE.txt
Dynamic Anchor links in (exactly) 140 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE