Skip to content

Instantly share code, notes, and snippets.

@Dykam
Created May 9, 2009 09:18
Show Gist options
  • Select an option

  • Save Dykam/109196 to your computer and use it in GitHub Desktop.

Select an option

Save Dykam/109196 to your computer and use it in GitHub Desktop.
Dykam's best Ubiqs.
CmdUtils.CreateCommand({
name: "execute",
icon: "http://example.com/example.png",
homepage: "http://Dykam.nl",
author: {name: "Dykam", email: "[email protected]"},
license: "GPL",
description: "Execute javascript.",
help: "Enter a javascript snippet.",
takes: {"code": /.*/},
preview: function(pblock, code) {
pblock.innerHTML = "Result:\n" + eval(code.text);
},
execute: function(code) {
CmdUtils.setSelection(eval(code.text));
}
});
CmdUtils.CreateCommand({
name: "execute-ubiq",
icon: "http://example.com/example.png",
homepage: "http://Dykam.nl",
author: {name: "Dykam", email: "[email protected]"},
license: "GPL",
description: "Execute javascript.",
help: "Enter a javascript snippet.",
takes: {"code": /.*/},
preview: function(pblock, code) {
pblock.innerHTML = "Code to execute:\n" + code.text;
},
execute: function(input) {
eval(code.text);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment