Skip to content

Instantly share code, notes, and snippets.

@bastos
Created November 18, 2008 05:43
Show Gist options
  • Save bastos/26061 to your computer and use it in GitHub Desktop.
Save bastos/26061 to your computer and use it in GitHub Desktop.
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132
CmdUtils.CreateCommand(
{
name: "code",
takes: {"function": noun_arb_text},
icon: "http://github.com/fluidicon.png",
homepage: "http://tiago.zusee.com",
author: {name: "Tiago Bastos", email: "[email protected]"},
license: "MPL,GPL",
description: "Search on Github Code Search",
help: "Search on Github Code Search",
execute: function(directObject)
{
var url = "http://github.com/codesearch?q={QUERY}"
var urlString = url.replace("{QUERY}", directObject.text);
Utils.openUrlInBrowser(urlString);
},
preview: function(pblock, directObject)
{
searchText = jQuery.trim(directObject.text);
if(searchText.length <= 0)
{
pblock.innerHTML = "Search on github codesearch";
return;
}
var previewTemplate = "Search on Github: ${query}";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment