Skip to content

Instantly share code, notes, and snippets.

View malteo's full-sized avatar
🏠
Working from home

Matteo Giordano malteo

🏠
Working from home
View GitHub Profile
@malteo
malteo / .editorconfig
Created November 15, 2019 11:19
root editorconfig
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4

Keybase proof

I hereby claim:

  • I am malteo on github.
  • I am malteo (https://keybase.io/malteo) on keybase.
  • I have a public key ASB2zXxcD8vv4jRg-_7DNB9z_URxPBRb3yyW-gZfGZCT9go

To claim this, I am signing this object:

@malteo
malteo / gist:d7bb8eb835be9b734fc2
Created October 20, 2014 11:19
HTML select per le province italiane raggruppate per regione
<select>
<optgroup label="Piemonte">
<option value="TO">Torino</option>
<option value="VC">Vercelli</option>
<option value="NO">Novara</option>
<option value="CN">Cuneo</option>
<option value="AT">Asti</option>
<option value="AL">Alessandria</option>
<option value="BI">Biella</option>
<option value="VB">Verbano-Cusio-Ossola</option>
@malteo
malteo / index.html
Last active December 29, 2015 23:59
URLbot
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>URLbot</title>
<?php
/**
* This is what happens when you don't catch a case in your switches, Larry.
*/
class ShouldntHappenException extends \RuntimeException
{
const COMBO_BREAKER = 'C-C-C-COMBO BREAKER!';
/**
@malteo
malteo / uptime.conf
Created April 10, 2013 14:06
Upstart script
# /etc/init/uptime.conf
description "uptime"
author "malte"
start on runlevel [2345]
stop on runlevel [^2345]
# Restart when job dies
respawn
@malteo
malteo / gist:5310697
Created April 4, 2013 14:14
anche PHP ha i suoi momenti
$app->get('/admin/print/{course_id}/{generated}', function ($course_id, $generated) use ($app) {
$query = $app['idiorm']->getTable('keys')
->select('code')
->where('course_id', $course_id)
->where('generated', $generated);
$stream = function () use ($query) {
$out = fopen('php://output', 'w');
foreach ($query->find_array() as $key) {
fputcsv($out, $key);
#!/bin/bash
while read -r line
do
echo "$line$(pwgen -s 16 1)"
done < $1 >temp
mv temp $1
from fabric.api import cd, env, local, prefix, run, sudo
env.hosts = ['cs01.actalis.vpn']
env.project_root = '/home/libersoft/visalaid'
env.user = 'libersoft'
def push():
local('git push')
@malteo
malteo / LocalStorageProvider.js
Created December 12, 2011 17:04
localStorage state provider for ExtJS 3
Ext.ns('Ext.ux.state');
/**
* @class Ext.ux.state.LocalStorageProvider
* @extends Ext.state.Provider
* A Provider implementation which saves and retrieves state via the HTML5 localStorage object.
* If the browser does not support local storage, an exception will be thrown upon instantiating
* this class.
* <br />Usage:
<pre><code>