Skip to content

Instantly share code, notes, and snippets.

javascript:(function(){var%20body=document.getElementsByTagName('body')[0];body.style.margin="5%%2020%%205%%2020%";body.style.backgroundColor="#222222";body.style.color="#eeeeee";css='a{color:#0095dd}a:hover{color:#DD4800}';style=document.createElement('style');if(style.styleSheet){style.styleSheet.cssText=css;}else{style.appendChild(document.createTextNode(css));};document.getElementsByTagName('head')[0].appendChild(style);})();void(0);
@beane
beane / normal_margins
Last active September 5, 2016 02:23
Make reasonable margins for badly formatted text sites. Add this to your browser as a bookmarklet.
(function(){var body=document.getElementsByTagName('body')[0];body.style.margin="5% 20% 5% 20%";body.style.backgroundColor="#222222";body.style.color="#eeeeee";css='a{color:#0095dd}a:hover{color:#DD4800}';style=document.createElement('style');if(style.styleSheet){style.styleSheet.cssText=css;}else{style.appendChild(document.createTextNode(css));};document.getElementsByTagName('head')[0].appendChild(style);})();void(0);

Keybase proof

I hereby claim:

  • I am beane on github.
  • I am usedbooks (https://keybase.io/usedbooks) on keybase.
  • I have a public key whose fingerprint is 3FD0 8DA2 EFC9 2548 6FB1 7F2C 3128 AFCA 3A5E A531

To claim this, I am signing this object:

@beane
beane / isInViewVertically.js
Created April 23, 2014 05:22
Function to determine if a jQuery or window element is in view vertically
// rectangle.bottom shows the absolute position in pixels of the bottom of the rectangle from the top of the entire DOM.
// as you scroll down the page, this number gets smaller, and becomes negative when above the visible window rectangle.height
// shows the height in pixels of the rectangle.
// the difference between them should never exceed the height of the visible window
function isInViewVertically(element) {
if (element instanceof jQuery) element = element[0]
var rectangle = element.getBoundingClientRect();
var windowHeight = window.innerHeight;