Skip to content

Instantly share code, notes, and snippets.

View rpl's full-sized avatar

Luca Greco rpl

  • Mozilla
  • Lecce, Italy
View GitHub Profile
@rpl
rpl / tomboy_ubiquity.js
Created October 11, 2008 12:56
Tomboy Ubiquity Commands (require mozjs_dbus extension)
Components.utils.import("resource://mozjs_dbus/DBUS.jsm");
const bus = DBUS.sessionBus;
const tb = bus.getObject("org.gnome.Tomboy",
"/org/gnome/Tomboy/RemoteControl",
"org.gnome.Tomboy.RemoteControl");
CmdUtils.CreateCommand({
name: "tomboy-list",
homepage: "http://rplcodeline.blogspot.com",
function reloadChrome() {
try {
Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIXULChromeRegistry).reloadChrome();
} catch(e) { alert(e); }
}
reloadChrome.doc = "Reload all chrome packages";
function debugPrefs(enabled) {
var notifyBox = window.getNotificationBox(content);
notifyBox.appendNotification( "XULit say: NotificationBox is cool, isn't it?",
"notify-01",
"chrome://xulnotificationbox/content/xulit.ico",
notifyBox.PRIORITY_INFO_LOW, null);
%% yate_decode: yate message decoding experimental erlang module.
%%
%% Copyright (C) 2009 - Alca Società Cooperativa <info@alcacoop.it>
%%
%% Author: Luca Greco <luca.greco@alcacoop.it>
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU Lesser General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at your option) any later version.
const Ci = Components.interfaces;
const Cr = Components.results;
const STATE_START = Ci.nsIWebProgressListener.STATE_START;
const STATE_STOP = Ci.nsIWebProgressListener.STATE_STOP;
var myScreenshotListener =
{
QueryInterface: function(aIID) {
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
// recovery
var httpReadOrRetry = function (url, timeout, times) {
return http.read(url).then(function (content) {
return content;
}, function (error) {
if (times == 0)
return error;
return delay(timeout).then(function () {
return httpReadOrRetry(url, timeout, times - 1);
});
(require 'iimage)
(autoload 'iimage-mode "iimage" "Support Inline image minor mode." t)
(autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t)
(add-to-list 'iimage-mode-image-regex-alist '("@startuml\s+\\(.+\\)" . 1))
;; Rendering plantuml
(defun plantuml-render-buffer ()
(interactive)
(message "PLANTUML Start rendering")
(shell-command (concat "java -jar ~/Downloads/plantuml.jar "
@rpl
rpl / .gitignore
Created October 11, 2011 17:55
Go Websocket implementation, hybi and Firefox
_obj
*~
bin
*.6
@rpl
rpl / chrono.css
Created November 6, 2012 00:06
code fragments
...
/* NOTE: set fixed size on empty visible elements
[role="chrono"] > p span {
width: -moz-calc(100% / 3);
height: 100%;
...
}
...
/* NOTE: move real offscreen DOM elements
[role="chrono"] > div {
@rpl
rpl / find-non-frozen-cookbooks.rb
Created June 28, 2013 16:27
simple ruby script to find "non-frozen" cookbooks on a chef-server
require 'rubygems'
require 'chef/config'
require 'chef/log'
require 'chef/rest'
require 'chef/cookbook_version'
chef_server_url = ARGV[0]
client_name = ARGV[1]
signing_key_filename=ARGV[2]