Skip to content

Instantly share code, notes, and snippets.


Luca Grulla lucagrulla

View GitHub Profile
lucagrulla / gmail-auto-archive
Last active Mar 29, 2020
Automatically archive email threads with a given label after a certain number of days -
View gmail-auto-archive
function auto_archive_mails() {
var filter = "label:inbox and {label:blah label:foo} older_than:3d"
var threads =;
console.log("found:", threads.length, " threads");
threads.forEach(function(t) {
console.log("archived:", t.getFirstMessageSubject(), t.getLastMessageDate());
View cloudwatch_s3.rb
require 'aws-sdk-cloudwatch'
require 'aws-sdk-s3'
START_DATE =,1,21).utc
END_DATE =,1,22).utc
REGION = "eu-west-1"
View gist:34ba4f49518edec7945a
Verifying that +lucagrulla is my blockchain ID.

Keybase proof

I hereby claim:

  • I am lucagrulla on github.
  • I am lucagrulla ( on keybase.
  • I have a public key ASCbQRN_-ONzKQ6Gjkom4xyhKgI1vqIsVHtA-SMN2R-BtQo

To claim this, I am signing this object:

lucagrulla / gist:2035822
Created Mar 14, 2012
sanitize Windows file url for the web
View gist:2035822
image_path = "\images\foo\myimage.png"
image_path = image_path.dump.gsub(/\\\\/,"/").gsub("\"", "")
#total crazyness to cope with windows cut&paste url with backslashes instead of forward slashes:we convert to / just to avoid troubles...
#cover scenarios where Windows users find where a file is using windows explorer and copy the location from there(therefore with backslashes)
lucagrulla / breadcrumb
Created Feb 17, 2012
wordpress php breadcrumb
View breadcrumb
<?php function the_breadcrumb() {
echo "<nav>";
echo "<ul class=\"breadcrumb\">";
echo "<li>";
echo "<a href=\"\">Home</a>";
echo "</li>";
echo "<li>";
echo the_category("</li><li>");
echo "<li>";
echo the_title();
lucagrulla / gist:1716469
Created Feb 1, 2012
forcing clojureql to always print the sql in the standard output
View gist:1716469
(alter-var-root #'clojureql.core/*debug* (constantly true))
View getParamsFrom(url)
function getParamsFrom(url) {
var seq = url.split("?").pop().split("&")
var params = {};
$.each(seq, function(k, v) {
tmp = v.split("=");
params[tmp[0]] = tmp[1];
return params;
lucagrulla / gist:1605855
Created Jan 13, 2012
ClojureQL: select count with a where clause
View gist:1605855
(->(cql/table db :switches)
(cql/aggregate [[:count/id :as :cnt]])
(cql/select (cql/where (= :id 5))))
lucagrulla / gist:1240807
Created Sep 25, 2011
blog post: Javascript flow control
View gist:1240807
function fecthData() {
var people = ["Marc", "Liz", "Ken", "Duncan", "Uday", "Mark", "Charles"];
var grid = [];
$.each(people, function(index, person) {
$.getJSON('/git/pairs/' + person, function(data) {
// parse data and create somethingCool
if (grid.length === people.length) {
$(document).trigger("gridFilled", [grid]);
You can’t perform that action at this time.