Skip to content

Instantly share code, notes, and snippets.

@dbellettini
dbellettini / resume.json
Last active July 16, 2020 13:06
Public JSON Resume
{
"meta": { "theme": "elegant" },
"basics": {
"name": "Davide Bellettini",
"profiles": [
{
"network": "LinkedIn",
"username": "dbellettini",
"url": "https://www.linkedin.com/in/dbellettini"
}
@dbellettini
dbellettini / NastyBugTest.php
Created July 25, 2018 17:01
Why PHP sucks, try to run this!
<?php
use PHPUnit\Framework\TestCase;
class NastyBugTest extends TestCase
{
public function testBug()
{
$data = [
'c' => [

Keybase proof

I hereby claim:

  • I am dbellettini on github.
  • I am dbellettini (https://keybase.io/dbellettini) on keybase.
  • I have a public key ASC3DujnSZix7mW2cPFxWq45njS8vHF15svEv_uZbhuEKgo

To claim this, I am signing this object:

Verifying that +sbiellone is my blockchain ID. https://onename.com/sbiellone
katalist(X, X, equal) :- !.
katalist(X, Y, sublist) :- sublist(X, Y), !.
katalist(X, Y, superlist) :- sublist(Y, X), !.
katalist(_, _, unequal) :- !.
prefix(X, L) :- append(X, _, L).
suffix(X, L) :- append(_, X, L).
sublist(X, L) :- suffix(S, L), prefix(X, S).
function makeDelayedFunction(oldFunction, delay) {
var obj = { timeout: false };
return function () {
if (obj.timeout) {
clearTimeout(obj.timeout);
}
obj.timeout = setTimeout(function () {
obj.timeout = false;
def decorated_function(*args, **kwargs):
return f(*args, **kwargs)
parser = argparse.ArgumentParser()
parser.add_argument("-ip", "--ip", help="IP to run the server on",
parser.add_argument("-p", "--port", help="Port to run the server on",
args = parser.parse_args()
if args.port: args.port = int(args.port)
if args.ip and args.port:
app.run(host=args.ip, port=args.port, debug=True)
elif args.ip:
@dbellettini
dbellettini / WeirdConditions.java
Created December 27, 2013 11:47
Weird conditions
List<Element> parameters = root.getChildren("parameter", ns);
int ip;
for(ip=0;ip<parameters.size();ip++)
{
if( parameters.get(ip).getAttributeValue("name").equalsIgnoreCase("new_results"))
{
break;
}
}
if(!(ip<parameters.size()))
@dbellettini
dbellettini / Configuration.php
Created December 12, 2013 14:44
CavejaToshBundle configuration
<?php
namespace Caveja\Bundle\ToshlBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
@dbellettini
dbellettini / gist:7889281
Created December 10, 2013 11:34
groups.py
from smart_m3.m3_kp_api import m3_kp_api
class GroupManager(object):
def __init__(self, kp:m3_kp_api):
self.kp = kp
def create(self, name):
pass
def delete(self, uri):
pass
def add_user(self, group_uri, user_uri):