Skip to content

Instantly share code, notes, and snippets.

@kemayo
kemayo / clicktest.py
Last active October 30, 2017 04:24
Test for click, of somewhat abusive dynamic subcommand creation and argument passing.
import re
import click
# This is obviously a placeholder for testing purposes, and would actually use Site.matches
sites = {}
for site in ('archiveofourown', 'fanfiction', 'spacebattles'):
@click.command()
@click.argument('url')
def cmd(url, *args, **kwargs):
@kemayo
kemayo / visualeditor-onboard.markdown
Last active May 20, 2017 13:49
Overview of Mediawiki VisualEditor concepts

VisualEditor: Getting Started With Development

VisualEditor is a WYSIWYG editor, developed primarily for use with Mediawiki. It is a general purpose editor and can be integrated anywhere. As such, it's maintained in two parts:

  • VisualEditor core
    • The basic editor component
  • Mediawiki-VisualEditor
    • Integration with Mediawiki, including wikitext support and various wiki-specific element types
    • Relies on Parsoid, a service that translates between HTML and wikitext
    • Other MW extensions include components that add support for their
@kemayo
kemayo / Default (OSX).sublime-keymap
Last active September 21, 2016 13:40
Tiny sublime plugin to wrap a selection in something.
[
{ "keys": ["alt+p"], "command": "wrap_text", "args": {"start":"<? ", "end":" ?>" }},
]
// ==UserScript==
// @name Gerrit: Remove size from searchbox
// @namespace http://davidlynch.org/
// @version 0.1
// @description Searchbox too wide; removing its size attribute helps there
// @author David Lynch <kemayo@gmail.com>
// @match https://gerrit.wikimedia.org/*
// @grant none
// ==/UserScript==
@kemayo
kemayo / eyewonder.js
Created October 20, 2011 21:20
Eyewonder XSS
document.write('<style type="text/css">body{padding); margin:0}</style>');
document.write('<iframe id="iwonder_hack" src="http://' + location.host + '/" width="100%" height="100%" style="border:0;padding:0;margin:0"></iframe>');
setTimeout(function(){
var frmdoc = document.getElementsByTagName('iframe')[0].contentWindow.document
,rotation = 0
,links = frmdoc.getElementsByTagName('a')
,images = frmdoc.getElementsByTagName('img')
,props = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform']
,transform = function(elem, trans) {
for (var i = 0; i < props.length; i++) {
local is_cloth = function(itemid, bag, slot) return select(7, GetItemInfo(itemid)) == "Cloth" end
SlashCmdList["MOVECLOTH"] = = BankStack.CommandDecorator(function(from, to)
BankStack.Stack(from, to, is_cloth)
BankStack.Fill(from, to, false, is_cloth)
end, "bags bank", 2)
SLASH_MOVECLOTH1 = "/movecloth"
-- DO NOT EDIT THIS FILE; run dataminer.lua to regenerate.
local core = LibStub("AceAddon-3.0"):GetAddon("SilverDragon")
local module = core:GetModule("Data")
function module:GetDefaults()
return {
[61] = {name="Thuros Lightfingers",["creature_type"]="Humanoid",level=9,locations={[30]={47207920,50008460},},},
[62] = {name="Gug Fatcandle",["creature_type"]="Humanoid",level=4,locations={[864]={31001840},},},
[79] = {name="Narg the Taskmaster",["creature_type"]="Humanoid",level=6,locations={[30]={36808340},},},
[99] = {name="Morgaine the Sly",["creature_type"]="Humanoid",level=9,locations={[30]={30606480},},},
[100] = {name="Gruff Swiftbite",["creature_type"]="Humanoid",level=9,locations={[30]={25209080},},},
@kemayo
kemayo / phptag.sublime-snippet
Created March 9, 2013 05:16
Make Sublime Text turn <? into <?php | ?> (where the | is your cursor), when you hit tab.
<snippet>
<content><![CDATA[
<?php ${1} ?>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>&lt;?</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
// ==UserScript==
// @name Xenforo invisitext
// @namespace http://davidlynch.org/
// @version 0.1
// @description Make some invisible text a little more visible
// @author David Lynch
// @match https://forums.sufficientvelocity.com/*
// @match https://forums.spacebattles.com/*
// @match https://forums.questionablequesting.com/*
// @match https://xenforo.com/community/*
@kemayo
kemayo / git-foreach
Last active November 26, 2015 21:16
A git utility for my own use, here so I don't forget about it
#!/bin/bash
for D in *; do
if [ -d "${D}/.git" ]; then
echo "${D}:" "${1:-pull}" "${@:2}"
git -C "${D}" "${1:-pull}" "${@:2}"
fi
done