Skip to content

Instantly share code, notes, and snippets.

View fernandotakai's full-sized avatar

Fernando Alves fernandotakai

View GitHub Profile
CmdUtils.CreateCommand({
name: "regexp",
takes: {
regexp: noun_arb_text
},
modifiers: {
with: noun_arb_text
},
execute: function(userRegexp, mods) {
CmdUtils.CreateCommand({
name: "regexp",
takes: {
regexp: noun_arb_text
},
modifiers: {
with: noun_arb_text
},
execute: function(userRegexp, mods) {
var text = mods.with.text || "";
--- a/ubiquity/chrome/content/builtincmds.js Sat Sep 13 23:44:07 2008 +0800
+++ b/ubiquity/chrome/content/builtincmds.js Sun Sep 14 01:24:51 2008 -0300
@@ -1299,13 +1299,15 @@
req.open('POST', currentCalendar, false);
req.setRequestHeader('Authorization', 'GoogleLogin auth=' + authKey);
req.setRequestHeader('Content-type', 'application/atom+xml');
- req.send(quickAddEntry);
+ req.send(quickAddEntry);
if (req.status == 401) {
displayMessage("Please make sure you are logged in to Google Calendar");
@fernandotakai
fernandotakai / gist:10705
Created September 14, 2008 04:50
nountime.diff
var noun_type_time = {
_name: "time",
default: function(){
var time = Date.parse("now");
var text = time.toString("hh:mm tt")
return CmdUtils.makeSugg(text, null, time)
},
suggest: function(text, html){
function addToGoogleCalendar(eventString) {
var quickAddEntry = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gCal='http://schemas.google.com/gCal/2005'>";
quickAddEntry += " <content type=\"html\">" + eventString + "</content>";
quickAddEntry += " <gCal:quickadd value=\"true\"/>";
quickAddEntry += "</entry>";
var authKey = Utils.getCookie(".www.google.com", "CAL");
if (authKey == "") {
displayMessage("Please make sure you are logged in to Google Calendar");
@fernandotakai
fernandotakai / gist:11270
Created September 17, 2008 18:01
Jaiku verb for Ubiquity
const JAIKU_MAXLEN = 140;
Jaiku = {
addKey:function(key){
if (!Application.prefs.has("jaiku_user_api_key")) {
Application.prefs.setValue("jaiku_user_api_key", key);
} else {
var new_key = Application.prefs.get("jaiku_user_api_key");
new_key.value = key;
return new_key.value;
CmdUtils.CreateCommand({
name:"trac",
icon: "http://labs.toolness.com/trac/chrome/common/trac.ico",
author: "Fernando 'fern' Takai",
takes: {'ticket number': noun_arb_text},
preview: function ( pblock, ticket ){
pblock.innerHTML = "Goes to ticket number #" + ticket.text
},
execute: function ( ticket ){
var url = "http://labs.toolness.com/trac/ticket/" + ticket.text;
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/web/api.py", line 339, in send_error
'text/html')
File "/usr/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/web/chrome.py", line 684, in render_template
data = self.populate_data(req, data)
File "/usr/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/web/chrome.py", line 592, in populate_data
d['chrome'].update(req.chrome)
File "/usr/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/web/api.py", line 168, in __getattr__
value = self.callbacks[name](self)
File "/usr/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/web/chrome.py", line 460, in prepare_request
var noun_type_trac_type = new CmdUtils.NounType( "Trac Type", ['defect', 'enhancement', 'task'])
CmdUtils.CreateCommand({
name:"tickets",
author: {name:"Fernando 'fern' Takai",email:"fernando.takai@gmail.com"},
license:"MPL",
icon:"http://labs.toolness.com/trac/chrome/common/trac.ico",
takes: {'summary':noun_arb_text},
modifiers: {'keywords':noun_arb_text, 'type':noun_type_trac_type},
description: 'Queries Ubiquity Trac for tickets - w/o parameters, get the last 8 open tickets.',
@fernandotakai
fernandotakai / gist:14823
Created October 4, 2008 23:37
view the last gmail's unread messages
function verifyUnreadEmails(url, callback){
jQuery.get(url, null, function(rss){
var entries = [];
var rssEntries = jQuery(rss).find("entry")
if(rssEntries.length > 0){
for each(entry in rssEntries){
entries.push(entry);
}
toslice = rssEntries.length + 1;