Skip to content

Instantly share code, notes, and snippets.

View gubi's full-sized avatar

Alessandro Gubitosi gubi

View GitHub Profile
@gubi
gubi / README.md
Last active August 29, 2015 14:24
[IT] Quando un cliente non paga...

Mai successo che un cliente "sparisca" e faccia il furbetto non pagandovi? Con questo script, da sostituire al file index.php del sito, ad ogni caricamento di pagina da parte dei suoi utenti verrà mostrato un messaggio di errore e a lui arriverà una mail che lo incentiverà a chiamarvi e a chiedervi di risolvere.

L'incentivo sta nel fatto che si ritroverà la posta intasata di messaggi inviati inconsapevolmente dai suoi stessi utenti...

Quanto è efficace
Se i rapporti non sono pessimi è molto facile che vi chiamino per sapere cosa è successo, diversamente verrà chiamato un altro sviluppatore (che quasi sicuramente verrà sfruttato come hanno fatto con voi).

@gubi
gubi / netjsongraph.js
Created September 3, 2015 08:22
A temp copy of my last developing version
// version 0.1
(function () {
/**
* vanilla JS implementation of jQuery.extend()
*/
d3._extend = function(defaults, options) {
var extended = {},
prop;
for(prop in defaults) {
if(Object.prototype.hasOwnProperty.call(defaults, prop)) {
@gubi
gubi / image-selector.js
Created November 8, 2015 01:50
image-selector
(function($) {
$.fn.imageSelector = function() {
$(this).each(function() {
var $el = $(this);
$el.hide();
var $imageWrapper = $('<a href="javascript:void(0);" class="image-wrapper" />').insertAfter($el);
var $remove = $('<a href="javascript:void(0);" class="remove-image" >Remove image</a>').insertAfter($imageWrapper);
$el.change(function() {
if($el.val() == '') {
$remove.hide();
@gubi
gubi / README.md
Last active December 23, 2018 15:50
Mysql version from .frm file

From your terminal launch this command:

$>: hexdump -s 0x33 -n 2 -v -d <FILE_NAME>.frm  | awk '{ print "Mysql version " $2; exit }'

Example output: Mysql version 50530, which means version 5.5.30

<?php
abstract class Physics {
/**
* The Planck's law
* @param integer $J An integer that represent an energy measure
* @param integer $s An integer that represent a time measure
*/
public static function Planck($J, $s) {
$h = 6.62607004 * pow(10, -34) * ($J * $s);
return $h;
<?php
interface PhilosophicalContexts {
/**
* The concept of Property
* @see http://www.iep.utm.edu/prop-con/
*/
public function Property();
}
interface PhilosophicalTheories extends PhilosophicalContexts {
/**
<?php
print PhysicsTheories::BohmTheory();
?>
<?php
$e = new Economics();
print_r($e->Property());
print_r($e->LabourTheory());
print_r($e->InvisibleHand());
?>
@gubi
gubi / bootstrap-3_responsiveness.css
Created May 16, 2016 08:36
Bootstrap 3 Media Queries
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Less than mobile (col-xs) */
@media only screen and (min-width: 0px){
}
@gubi
gubi / README.md
Last active February 9, 2017 00:34

Node ARGV