Skip to content

Instantly share code, notes, and snippets.

@Dither
Dither / cssify.js
Created February 25, 2012 17:38
Convert XPath to CSS selector
// JavaScript function for converting simple XPath to CSS selector.
// Ported by Dither from [cssify](https://github.com/santiycr/cssify)
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')`
var sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)",
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)",
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*"
};
@Dither
Dither / chroma_hash.js
Created March 4, 2012 08:18
Password field coloring to avoid mistyping
// ==UserScript==
// @name chroma-hash
// @author Parashuram (mod by Dither)
// @namespace https://gist.github.com/gists/1971243
// @include http://*
// @include https://*
// ==/UserScript==
document.addEventListener('DOMContentLoaded', function(){
@Dither
Dither / autopatchwork_googlevideos.js
Last active September 14, 2016 07:26
AutoPatchWork Mod support script for google video search
// ==UserScript==
// @include http://www.google.*/search*&tbm=vid*
// @include https://www.google.*/search*&tbm=vid*
// @include https://encrypted.google.com/search*&tbm=vid*
// @description AutoPatchWork Mod 1.9.6+ support script for google video search
// ==/UserScript==
var index = 1, scripts = '';
function handleNewPageLoad(event) {
@Dither
Dither / autopatchwork_youtube.js
Last active August 30, 2016 16:22
AutoPatchWorkOpera support script for YouTube video search
// ==UserScript==
// @include https://www.youtube.com/results*
// @description AutoPatchWork Mod 1.9.6+ support script for youtube video search
// ==/UserScript==
(function() {
function handleNewPage () {
var clip = document.querySelectorAll('img[data-thumb][alt="Thumbnail"]');
[].forEach.call(clip, function (img) {
@Dither
Dither / ImageCaching.php
Last active December 31, 2015 05:49
ImageCaching PHP class for creating dataURI out of images in FullTextRSS project
<?php
class ImageCaching {
const UPPER_LIMIT = 256000;
const UPPER_MAX = 3145728;
const LOWER_LIMIT = 512;
const LOWER_MIN = 48;
public $lower_limit_setting = null;
public $upper_limit_setting = null;
@Dither
Dither / dif2bin.py
Last active July 3, 2016 15:08
Python binary patcher for .dif files
#!/usr/bin/env python
# Small .dif patcher for Python 3+
# File format of .dif file (description and filename should be on the 1st and 3rd lines exactly):
# File description
#
# filename.ext
# 0000000a: 00 01
# 0000000b: 00 02
@Dither
Dither / fc2bin.ps1
Last active April 23, 2017 23:35
PowerShell script for applying fc /b or .dif kind of binary diffs to files
# Script for applying fc /b or .dif kind of binary diffs to files.
# Run using this command:
# powershell -executionpolicy bypass -File "fc2bin.ps1"
# Difference file should have the following format:
# Description line
#
# myold.fil
# 0000100A: 00 10
# 0000100B: 00 30
@Dither
Dither / utility_link_alert.js
Created August 18, 2014 00:28
Link type alerter (onhover)
@Dither
Dither / autopatchwork_batoto.js
Last active November 29, 2017 23:56
Batoto reader service script for AutoPatchWork mod
// ==UserScript==
// @description Batoto reader service script for AutoPatchWork mod.
// @include http://bato.to/*
// @include https://bato.to/*
// ==/UserScript==
(function(){
var on, off, trigger;
function getURL(id, page) {
@Dither
Dither / autopatchwork_egscans.js
Last active September 3, 2017 10:56
EgScans reader service script for AutoPatchWork mod
// ==UserScript==
// @description read.egscans.com reader service script for AutoPatchWork mod.
// @include http://read.egscans.com/*
// ==/UserScript==
(function(){
var on, off, trigger;
var base_url = 'http://read.egscans.com/',
current_index = 0,
current_chapter = null,