This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Name = 'check-twitter', | |
Twitter = 'http://twitter.com/', | |
Icon = Twitter +'favicon.ico', | |
Base = <div class={Name}><style><![CDATA[ | |
${position:relative} | |
$ol {list-style:none; margin:0} | |
$li {font-size:92%; line-height:1.2em} | |
$ol, $li {padding:0.2em 0} | |
$a img {border:none} | |
$button {font:bold 100% "Consolas",monospace; padding:0; border-width:1px} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Should also work for <img>, <form>, <link>, etc. | |
// 2. Should also work for html string, DOM, and XML. | |
// 3. Should return the same (type of) object it received. | |
function absolutifyUrls(data, baseUrl) { | |
switch(typeof data){ | |
case "string": | |
return data.replace( | |
/\b(href|src|action)=([\"\']?)(?!https?:\/\/)(\S+)\2/ig, | |
function au_repl(_, a, q, path)( | |
a + "=" + q + Utils.url({uri: path, base: baseUrl}).spec + q)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: 'selector-selector', | |
description: ( | |
<ul style="list-style-image:none"> | |
<li>Lets you type a CSS selector and highlights matched elements.</li> | |
<li>Hovering on an element creates a matching selector.</li> | |
</ul>+''), | |
help: [ | |
[<b>Left-click / Enter</b>, | |
'Copy and Quit'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name gist diff | |
// @namespace http://github.com/satyr | |
// @description Shows diffs on Gist with google-diff-match-patch. | |
// @include https://gist.github.com/* | |
// @require https://raw.github.com/gist/105908 | |
// @require https://google-diff-match-patch.googlecode.com/svn/trunk/javascript/diff_match_patch.js | |
// @fork_of http://gist.github.com/105913 | |
// @check_also http://gist.github.com/107780 | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> | |
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ --> | |
<title>isObjectLiteral</title> | |
<style> | |
li { background: green; } li.FAIL { background: red; } | |
iframe { display: none; } | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function casecmd(fn) CmdUtils.CreateCommand({ | |
name: fn.name +' case', | |
description: 'Makes text '+ fn.name +' case.', | |
icon: icon(fn('Aa')), | |
argument: noun_arb_text, | |
execute: function case_execute({object: {text, html}}){ | |
if(!text) return; | |
var t = fn(text); | |
CmdUtils.setSelection(fn(html), {text: t}) || CmdUtils.copyToClipboard(t); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
names: ['open links', 'linkopen'], | |
description: 'Opens links from among the current page.', | |
icon: 'chrome://ubiquity/skin/icons/tab_go.png', | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function preview(pblock, {object: {text}}) { | |
var me = this, links = me._links(text); | |
if(!links.length) return void this.previewDefault(pblock); | |
CmdUtils.previewList( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gQuery; | |
CmdUtils.makeSearchCommand({ | |
name: "Directory", | |
url: "http://www10.go.com.mt/edirnew_dev/modules/edir_checkquery.asp", | |
arguments: {suggest: function (txt) { | |
gQuery = txt; | |
return noun_arb_text.suggest(txt); | |
}}, | |
get postData() { | |
if(!gQuery) return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function run(fn, arg){ | |
var start = new Date; | |
for(var i = 1e4; i--;) fn(arg); | |
return new Date - start; | |
} | |
var tests = [function(src){ | |
return src.slice(0, src.lastIndexOf("/") + 1); | |
}, function(src){ | |
var a = src.split("/"); |