Skip to content

Instantly share code, notes, and snippets.

@davidlwatsonjr
davidlwatsonjr / autoRefreshNewTweets.js
Created October 9, 2012 05:05
This script clicks the "Show New Tweets" button on Twitter whenever it available, allowing you watch your stream without interaction.
var autoRefreshNewTweets = function () {
var newTweetsBar = document.getElementsByClassName('new-tweets-bar');
if ('undefined' !== typeof newTweetsBar[0]) {
newTweetsBar[0].click();
}
setTimeout(autoRefreshNewTweets, 1000);
}
autoRefreshNewTweets();
// Reload the entire page every hour, basically flushing the page so it doesn't become too "heavy"
@davidlwatsonjr
davidlwatsonjr / drunken-scroller.js
Created December 14, 2012 04:40
The beginnings of the drunken-scroller stellar.js plugin.
$.stellar.positionProperty.stagger = {
setTop: function ($element, newTop, originalTop) {
var $elementCoords = $element.position();
var stellarScrollRatio = parseFloat($element.data('stellar-ratio'));
var direction = 'top';
var originalPosition = originalTop;
var currentPosition = $elementCoords.top;
var magnitude = newTop - originalTop;
if ($element.data('stellar-swap-horizontal-and-vertical') == true) {
if ($element.data('stellar-scroll-horizontal') == false) {
@davidlwatsonjr
davidlwatsonjr / Remove Analytics Query Variables
Last active April 15, 2016 02:27
Remove analytics variables from the current page's query string. This allows for cleaner bookmarking, sharing, saving in Readability, etc. More analytics variables will added as they are found. This is minified as I use it as a bookmarklet.
(function() {
var r = ['utm_source', 'utm_campaign', 'utm_medium', 'utm_content', 'utm_hp_ref', 'wpisrc', 'xrs', 'fb_action_ids', 'fb_action_types', 'fb_source', 'action_object_map', 'mcid', 'rmid', 'rrid', 'CIMID'],
e = window.location.search.slice(1),
t = e.split('&'),
n = '?',
i = '';
e: for (p in t) {
for (var s = 0; s < r.length; s++) {
if (t[p].indexOf(r[s] + '=') === 0) {
break e
var rerouteRandomEvent = function () {
var pickRandomEvent = function () {
var events = [
'click',
'keyup',
'mousedown'
];
return events[Math.floor(Math.random()*events.length)];
};
@davidlwatsonjr
davidlwatsonjr / feedlySubscribe.js
Last active December 19, 2015 23:29
Feedly Subscribe Bookmarklet
javascript: (function() {
function getProperHref(href) {
if (!href.match(/^http/)) {
var path = (href.match(/^\//)) ? '/' : location.pathname;
href = 'http://' + location.hostname + path + href;
}
return href;
}
var links = document.querySelectorAll('link[rel="alternate"][type^="application/"][type$="+xml"');
var feedlyURL = 'https://feedly.com/i/subscription/feed/';
@davidlwatsonjr
davidlwatsonjr / github.css
Last active August 29, 2015 14:23
GitHub CSS
/**
* This section makes it much easier to switch branches/forks when creating a pull request.
* Instead of hiding the dropdowns after each selection, they're left visible, ready to be changed at a moment's notice.
* I use StyleBot to persist these styles (https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha?hl=en)
*/
.range-editor .range .cross-repo-text {
display: none;
}
.range-editor .range .select-menu.fork-suggester {
@davidlwatsonjr
davidlwatsonjr / jira.css
Last active August 29, 2015 14:23
JIRA CSS
/**
* This section fixes the height of the content editor in JIRA, so that, instead of having two scrollbars, the editor takes the full page and I can click Save at the bottom without having to scroll down.
* Stylebot persists these changes: https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha
*/
.contenteditor #content {
height: calc(100% - 41px);
}
@davidlwatsonjr
davidlwatsonjr / hipchat.css
Last active August 29, 2015 14:23
HipChat CSS
/**
* You people annoy me with your constant cat pictures in HipChat.
* So this section hides them.
* Stylebot: https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha
*/
.chatBlock .messageBlock .image {
display: none;
}
javascript: (function() {
var url = encodeURIComponent(location.href);
var w = 47;
var h = 86;
var ifr = document.createElement('iframe');
ifr.style.position = 'fixed';
ifr.style.top = '10px';
ifr.style.left = '10px';
ifr.style.width = w + 'px';
ifr.style.height = h + 'px';
javascript: (function() {
var plusOneWrapper = document.createElement('div');
plusOneWrapper.style.left = '67px';
plusOneWrapper.style.top = '10px';
plusOneWrapper.style.position = 'fixed';
plusOneWrapper.style.zIndex = 2147483647;
document.body.appendChild(plusOneWrapper);
var plusOne = document.createElement('div');
plusOne.setAttribute('class', 'g-plusone');
plusOne.setAttribute('data-size', 'tall');