Skip to content

Instantly share code, notes, and snippets.

View sheodox's full-sized avatar

sheodox

View GitHub Profile
@sheodox
sheodox / gist:a2c7f8c7021964842827
Last active February 17, 2018 02:38
Mutation Observer - filtered node inserted callback
function filteredNewNodeCallback(root, selector, callback) {
var obs, i;
if (!root || !selector || !callback) {
return;
}
function filterAndCallback(node) {
var matches = [], childMatches;
if (node.matches(selector)){
@sheodox
sheodox / gist:4959b372c56745c1f5de
Created September 19, 2014 20:48
Time formatter
function formatTime(seconds) {
var fTime = [];
fTime[0] = Math.floor(seconds / 86400);
seconds %= 86400;
fTime[1] = Math.floor(seconds / 3600);
seconds %= 3600;
fTime[2] = Math.floor(seconds / 60);
seconds %= 60;
fTime[3] = seconds;
for (var i = 0; i < 4; i++) {
@sheodox
sheodox / gist:e6afe09e243df6566160
Last active August 29, 2015 14:06
Twitter auto-show mode
javascript: (function () {
var newTweets = 0,
modes = [];
function addMode(modeName) {
var title = 'Tweets [';
modes.push(modeName);
title += modes.join(', ') + ']';
$('#content-main-heading').text(title);
}
@sheodox
sheodox / gist:27cfeff96c7d0a1fa566
Created September 22, 2014 04:47
Twitter JP tweets in Meiryo font
javascript:(function(){
var jpReg = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g, modes = [];
function addMode(modeName) {
var title = 'Tweets [';
modes.push(modeName);
title += modes.join(', ') + ']';
$('#content-main-heading').text(title);
}
if (!window.addMode) {
window.addMode = addMode;
@sheodox
sheodox / BatchStyler.js
Last active August 29, 2015 14:06
BatchStyler
;(function(){
'use strict';
if (!window.createBatchStyler) {
window.createBatchStyler = createBatchStyler;
}
function createBatchStyler() {
var styles = {};
function createStyleText(styles) {
@sheodox
sheodox / automeiryo
Last active August 29, 2015 14:07
Automatically changes the font to Meiryo for the chosen domains.
// ==UserScript==
// @name Auto-Meiryo
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @copyright 2012+, You
// ==/UserScript==
(function() {
var always = 'alwaysHost';
@sheodox
sheodox / shadowDialog.js
Created October 30, 2014 14:09
Shadow DOM dialog. Putting this here to use later as a dialog for my specific dialog needs for a dialog that won't be effected by site styling.
(function() {
var dialog = document.createElement('div'),
shadow = dialog.createShadowRoot(),
style = document.createElement('style'),
paragraph = document.createElement('p');
dialog.style.width = '500px';
dialog.style.height = '500px';
dialog.style.border = '3px solid gray';
dialog.style.position = 'fixed';
@sheodox
sheodox / wkoverride.user.js
Created February 7, 2015 20:26
WaniKani override, fixed for Greasemonkey
// ==UserScript==
// @name Wanikani Override
// @namespace wkoverride
// @description Adds an "Ignore Answer" button during reviews that makes WaniKani ignore the current answer (useful if, for example, you made a stupid typo)
// @include http://www.wanikani.com/review/session*
// @include https://www.wanikani.com/review/session*
// @version 1.1.3
// @author Rui Pinheiro
// @grant GM_addStyle
// @grant unsafeWindow
@sheodox
sheodox / wkrealnumbers.user.js
Last active August 29, 2015 14:15
WK Real Numbers (Fixed for Greasemonkey)
// ==UserScript==
// @name WaniKani Real Numbers
// @namespace penx.scripts
// @description Replaces 42+ with the real number using WaniKani API v1.0
// @include https://www.wanikani.com/*
// @version 2.8
// @run-at document-end
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @grant GM_getValue
@sheodox
sheodox / betterhangouts.user.js
Created February 13, 2015 14:32
Better Hangouts
// ==UserScript==
// @name Better Hangouts
// @namespace Jake Harrington
// @description Makes Hangouts better
// @include https://plus.google.com/*/hangouts
// @version 1.0
// @run-at document-end
// @require https://code.jquery.com/jquery-1.11.2.min.js
// @require https://code.jquery.com/ui/1.11.3/jquery-ui.min.js
// @downloadURL https://gist.github.com/dbs727/e4def722691762c4c910/raw/2bf1936175459f6b6c0fefbe222f34d298234b82/betterhangouts.user.js