Skip to content

Instantly share code, notes, and snippets.

var loopThroughSongsAnd = function(doThis, interval, runMax) {
console.time('Looping through songs');
var getIntOrDefault = function(variable, defaultValue) {
variable = parseInt(variable, 10);
if (isNaN(variable) || !variable) {
variable = getIntOrDefault(defaultValue, 0);
}
return variable;
}
@davidlwatsonjr
davidlwatsonjr / google-play-music-deduplicator.js
Created February 14, 2017 20:38
Google Play Music Deduplicator
var mainPanel = document.querySelector("#mainContainer");
var lastProcessedSong = '';
mainPanel.scrollTop = 0;
function processSong() {
var topSong = document.querySelector('.song-table tr.song-row');
console.log(topSong);
if (topSong.dataset.id !== lastProcessedSong) {
var nextSong = document.querySelector('.song-table tr.song-row:nth-child(3)');
var topSongTitle = topSong.querySelector('[data-col=title] .column-content').textContent;
var nextSongTitle = nextSong.querySelector('[data-col=title] .column-content').textContent;
@davidlwatsonjr
davidlwatsonjr / hide-google-keep-sidebar.user.js
Created January 5, 2017 06:29 — forked from qgustavor/hide-google-keep-sidebar.user.js
Hide by default Google Keep Sidebar
// ==UserScript==
// @name Hide by default Google Keep Sidebar
// @namespace üsersçrìpts@blio.tk
// @include https://keep.google.com/*
// @version 1
// @grant none
// @run-at document-idle
// ==/UserScript==
document.querySelector('[aria-label="Main Menu"]').click();
<link rel="import" href="//polygit.org/components/polymer/polymer.html" />
<dom-module id="parallax-parent">
<template>
<style>
:host {
position: relative;
overflow: hidden;
}
:host ::content [parallax-speed] {
@davidlwatsonjr
davidlwatsonjr / dumb-telephone-input.html
Last active April 24, 2016 17:54
A really dumb telephone input inspired by https://i.imgur.com/C0H0fIX.jpg
<link rel="import" href="//polygit.org/components/polymer/polymer.html" />
<dom-module id="dumb-telephone-input">
<template>
<select id="area"></select>
<select id="prefix"></select>
<select id="phone"></select>
</template>
</dom-module>
<script>
@davidlwatsonjr
davidlwatsonjr / hsl-clock.html
Last active March 28, 2016 20:54
HSL Clock web component
<script>
(function() {
var hslClock = Object.create(HTMLElement.prototype);
hslClock._hueTranslate = 0;
hslClock._saturationReverse = false;
hslClock._luminosityReverse= false;
hslClock._hideText = false;
Object.defineProperty(hslClock, 'hueTranslate', {
@davidlwatsonjr
davidlwatsonjr / TaskbarToggle.ahk
Created March 9, 2016 06:15
An AutoHotkey script that toggles auto-hide on the Windows taskbar.
WinWait, ahk_class Shell_TrayWnd,
IfWinNotActive, ahk_class Shell_TrayWnd, , WinActivate, ahk_class Shell_TrayWnd,
WinWaitActive, ahk_class Shell_TrayWnd,
Send, {APPSKEY}r
WinWait, Taskbar and Start Menu Properties,
IfWinNotActive, Taskbar and Start Menu Properties, , WinActivate, Taskbar and Start Menu Properties,
WinWaitActive, Taskbar and Start Menu Properties,
Send, {ALTDOWN}u{ALTUP}{ENTER}
{
"inputN": 41,
"values": [
{
"replaceWith": "my mom",
"replaceWithinWords": false,
"toReplace": "broki"
},
{
"replaceWith": "BPFC",
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');
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';