Skip to content

Instantly share code, notes, and snippets.

var flag;
function reset(){ flag = 'off' }
function ubiquityLoad_resetFlag(U){
U.msgPanel.addEventListener('popuphidden', reset, false);
}
CmdUtils.CreateCommand({
name: 'test flag reset',
argument: noun_arb_text,
preview: function pv(pb){
pb.innerHTML = flag;
@satyr
satyr / hit@hint_preview.ubiq.js
Created July 13, 2009 00:45
Hit-a-Hint-like navigation within preview
var gKey = '@', root = this;
const HHO = {
keys: 'hjkluiopnm',
bind: {
click: 'return',
click1: '@ comma space',
click2: 'C_return',
focus: 'f period',
undo: 'back_space delete',
},
content conhis chrome/content/
overlay chrome://browser/content/browser.xul chrome://conhis/content/conhis.xul
@satyr
satyr / _codeURIComponent.ubiq.js
Created July 6, 2009 17:01
(en|de)codeURIComponent()
(function cmd_codeURIComponent(_){
var name = _ + 'codeURIComponent', fn = this[name];
CmdUtils.CreateCommand({
name: name,
icon: 'chrome://ubiquity/skin/icons/convert.png',
argument: noun_arb_text,
execute: function({object: {text}}){
if (!text) return;
try { var r = fn(text) }
catch(e){ displayMessage(_ +'code error', this); return }
# -*- encoding: utf-8 -*-
import wsgiref.handlers
from google.appengine.ext import webapp
#from google.appengine.api import urlfetch
class Form(webapp.RequestHandler):
def get(self):
self.response.out.write("""\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
// ==UserScript==
// @name JGate Hacks
// @namespace http://d.hatena.ne.jp/murky-satyr
// @include http://apps.jgate.de/platform/edit?*
// ==/UserScript==
setTimeout(function(){
var {$, editor} = unsafeWindow;
var name = location.search.slice(1);
var form = document.forms[0].wrappedJSObject;
$(form.code).remove();
// http://search.cpan.org/~dankogai/Regexp-Trie-0.02/lib/Regexp/Trie.pm
function RegexpTrie(strs, prefixes) {
var me = {$: {}, __proto__: arguments.callee.fn};
if (strs) {
let add = prefixes ? "addPrefixes" : "add";
for each (let str in strs) me[add](str);
}
return me;
}
RegexpTrie.fn = {
/* This is a template command. */
CmdUtils.CreateCommand({
name: "example",
description: "(A short description of your command)",
help: "(How to use your command)",
icon: "http://www.mozilla.com/favicon.ico",
author: {name: "Your Name", email: "[email protected]"},
license: "GPL",
homepage: "http://www.mozilla.com/",
arguments: {object: noun_arb_text},
CmdUtils.CreateCommand({
name: "test-bin",
arguments: noun_arb_text,
execute: function({object: {text, html}}){
Bin.text(text || null);
Bin.html(html || null);
},
preview: function(pbl){
pbl.innerHTML = <p>{Bin.text()}</p>.toXMLString() + Bin.html();
},
#!ruby
$> << (<<"."
_ = {_: ''};
#{ (1..9).map{|i| "#{i} = ++0;" }.join }
// 'constructor' => Function
_.______ = _[_.______ =
(c = (_.___ = ''+ {})[5]) + // '[object Object]'
_.___[1] +
(_.____ = ''+ _[_])[6] + // 'undefined'
(''+ !_)[3] +