Skip to content

Instantly share code, notes, and snippets.

//function to define a class
// actual version is a rewrite by anieto2k: http://www.anieto2k.com
//params:
// @current : Object with the methods and attributes of the class
// @previous : Class from witch we wante to extend (optional)
JotaClass = function(current,previous){
previous = typeof previous == 'undefined' ? {} : previous.prototype;
for(p in previous){
if(typeof current[p] == 'undefined') current[p] = previous[p];
else if(typeof previous[p] == 'function'){
@mboersma
mboersma / yaml2json
Last active July 31, 2023 12:34
YAML to JSON one-liner
python3 -c 'import sys, yaml, json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))'
@sweenzor
sweenzor / gist:1502717
Created December 20, 2011 18:48
Adding users to rabbitmq server
sudo rabbitmqctl add_user tonyg changeit
sudo rabbitmqctl set_permissions tonyg ".*" ".*" ".*"
@3l3n01
3l3n01 / couch.php
Created November 20, 2012 00:06 — forked from timbuchwaldt/couch.php
Minimal PHP CouchDB Layer
<?
/*
* Usage:
* Instantiate class $c = couch::i();
* You can now use $c to make calls
*/
class couch
{
private static $instance = null;
private $curl_object = null;
@3l3n01
3l3n01 / UUID.php
Created November 20, 2012 00:26 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4211 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@cybertoast
cybertoast / gist:6499708
Last active September 25, 2024 16:35
Get a list of all flask routes, and their endpoint's docstrings as a helper resource for API documentation.
@admin_api.route('/help', methods=['GET'])
def routes_info():
"""Print all defined routes and their endpoint docstrings
This also handles flask-router, which uses a centralized scheme
to deal with routes, instead of defining them as a decorator
on the target function.
"""
routes = []
for rule in app.url_map.iter_rules():
@denji
denji / http-benchmark.md
Last active October 13, 2024 00:43
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@cescoffier
cescoffier / sonar.conf
Last active May 24, 2017 05:03
nginx server proxy for Sonar
server {
server_name sonar.dynamis-technologies.com;
location / {
proxy_pass http://localhost:12356;
proxy_set_header Host $host;
proxy_buffering off;
}
}
@juanPaclan
juanPaclan / gist:f618e49cffd17b21296bbefafbe6d100
Last active July 17, 2019 22:37
diferencia de fecha python
from datetime import datetime, date
formato_fecha = "%Y-%m-%d %H:%M:%S"
fecha = datetime.today()
fecha_actual= fecha.strftime(formato_fecha)
fecha_inicial = datetime.strptime("2017-10-10 03:12:50",formato_fecha)
fecha_final = datetime.strptime(fecha_actual, formato_fecha)
diferencia = fecha_final - fecha_inicial
@iodic
iodic / exclude-directory-from-git-diff.sh
Created March 28, 2018 09:41
Exclude a directory from git diff
git diff -- . ':!directory_name'