Skip to content

Instantly share code, notes, and snippets.

@source-data
source-data / word-cloud
Created September 29, 2008 22:13
generates a word cloud on the fly
/************************************************
*WordCloud methods below are modifications of wordcloud by yoah.bardavid@gmail.com and razbarvaz@gmail.com
*wordcloud is part of the following project: http://visapi-gadgets.googlecode.com
*The visapi-gadgets project is licensed under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*Modifications include:
* inclusion of a some sort of a log scale
* exclusion of single letter words
* exclusion of excludedTerms
* exclusion of numbers
* attempt to merge plural and singular
@source-data
source-data / search-pubmed
Created September 29, 2008 22:23
Ubiquity pubmed search command
makeSearchCommand({
//to subscribe to the command ,go to: <http://gist.github.com/13700>
//project: <http://code.google.com/p/tl-ubiquity-commands/>
author: {name: "Thomas Lemberger", email: "thomas.lemberger@gmail.com"},
license: "GPL",
name: "pubmed",
help: "Search selected terms or directly typed in the input line. The number of records to be displayed can be specified by adding '#number' somewhere in the query (eg. #3 will show only 3 records, default is 5, maximum is 15).",
url: "http://www.ncbi.nlm.nih.gov/pubmed?term={QUERY}",
icon: "http://www.ncbi.nlm.nih.gov/favicon.ico",
description: "Searches <a href='http://www.ncbi.nlm.nih.gov/pubmed'>PubMed</a>.",
CmdUtils.CreateCommand({
names: ["rewrap"],
arguments: [{role: "object",
nountype: noun_arb_text,
label: "input"}],
help: "removes unnecessary carriage returns and strings of spaces",
execute: function(arguments) {
var selectedText=arguments.text;
selectedText=selectedText.replace(/[\r\n]{2}/g,"§#!");
selectedText=selectedText.replace(/[\r\n]+/g," ");
function HTMLescape(string) {
var LT = new RegExp("<", "g");
var GT = new RegExp(">", "g");
var AMP = new RegExp("&", "g");
var TAB = new RegExp("\t", "g");
return string.replace(AMP,"&amp;").replace(LT, "&lt;").replace(GT, "&gt;").replace(TAB, "...");
}
CmdUtils.CreateCommand({
name: "whatizit",
@source-data
source-data / more-like-this
Created October 8, 2008 15:49
Ubiquity command more-like-this
CmdUtils.CreateCommand({
//to subscribe to the command, go to http://gist.github.com/15544
//code maintained at http://code.google.com/p/tl-ubiquity-commands/
author: {name: "thomas lemberger", email: "thomas.lemberger@embo.org"},
license: "GPL",
name: "more-like-this",
takes: {"selected text": noun_arb_text},
help: "The command is based on Jane (http://www.biosemantics.org/jane/, Schuemie & Kors (2008) Bioinformatics.24:727). It lists PubMed records related to the selected text (typically an abstract).",
execute: function(directObj) {
var selectedText=directObj.text;
@source-data
source-data / Ubiquity command open-doi
Created November 3, 2008 12:32
Ubiquity command open-doi
CmdUtils.CreateCommand({
//to install this command, visit http://gist.github.com/21865
//code is part of http://code.google.com/p/tl-ubiquity-commands/
name: "open-doi",
takes: {"selected text": noun_arb_text},
preview: function(pblock, directObject){
if (directObject.text){
var m = directObject.text.match(/(doi:)?.*?\b(10\.\d{4}\/\S+)/i);
if (!m){pblock.innerHTML="The selection <pre>"+directObject.text+"</pre> does not include a recognized doi !";}
else {pblock.innerHTML="press Return to go to the document associated with <i>"+m[2]+"</i>.";}