Skip to content

Instantly share code, notes, and snippets.

View TheHiddenHaku's full-sized avatar

Alessio Bottiroli TheHiddenHaku

View GitHub Profile
@TheHiddenHaku
TheHiddenHaku / stati.sql
Created October 8, 2013 09:15
SQL ITA Stati
CREATE TABLE IF NOT EXISTS `stati` (
`id_stati` int(16) NOT NULL auto_increment,
`sigla_stati` varchar(5) default NULL,
`nome__stati` varchar(128) default NULL,
PRIMARY KEY (`id_stati`),
KEY `PRIMARY_KEY` (`id_stati`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO `stati` (`id_stati`, `sigla_stati`, `nome__stati`) VALUES
(1, 'AF', 'Afghanistan'),
@TheHiddenHaku
TheHiddenHaku / generatePassword.php
Last active December 25, 2015 07:19
Fuction for generating a random password
<?
function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength & 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .= "AEUY";
}
@TheHiddenHaku
TheHiddenHaku / isEmail.js
Last active December 25, 2015 09:09
Javascript email check function
function isEmail(email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(email) == false) {
return false;
}
else
{
return true;
}
}
@TheHiddenHaku
TheHiddenHaku / CodiceFiscale.js
Last active January 10, 2024 16:47
Javascript function to check Italian Codice Fiscale
function codiceFISCALE(cfins)
{
var cf = cfins.toUpperCase();
var cfReg = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/;
if (!cfReg.test(cf))
{
return false;
}
var set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
<?php
#Requires PHP 5.3.0
define("CONSUMER_KEY", "consumer_key");
define("CONSUMER_SECRET", "consumer_secret");
define("OAUTH_TOKEN", "access_token");
define("OAUTH_SECRET", "access_secret");
function oauth_gen($method, $url, $iparams, &$headers) {
@TheHiddenHaku
TheHiddenHaku / regioni.sql
Created October 22, 2013 16:08
SQL Creazione tabella regioni italiane
-- phpMyAdmin SQL Dump
-- version 2.6.0-pl3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: 18 Apr, 2007 at 04:00 PM
-- Versione MySQL: 3.23.58
-- Versione PHP: 4.3.11
--
-- Database: `test`
@TheHiddenHaku
TheHiddenHaku / province.sql
Created October 22, 2013 16:08
SQL crezione tabella provincie italiane
-- phpMyAdmin SQL Dump
-- version 2.6.0-pl3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: 18 Apr, 2007 at 04:00 PM
-- Versione MySQL: 3.23.58
-- Versione PHP: 4.3.11
--
-- Database: `test`
@TheHiddenHaku
TheHiddenHaku / comuni.sql
Created October 22, 2013 16:09
SQL creazione tabella comuni italiani
-- phpMyAdmin SQL Dump
-- version 2.6.0-pl3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: 18 Apr, 2007 at 04:00 PM
-- Versione MySQL: 3.23.58
-- Versione PHP: 4.3.11
--
-- Database: `test`
@TheHiddenHaku
TheHiddenHaku / jwd.sql
Created October 30, 2013 09:51
MYSQL - Jaro-Winkler-Distance function
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `jaro_winkler_similarity`(
in1 varchar(255),
in2 varchar(255)
) RETURNS float
DETERMINISTIC
BEGIN
#finestra:= search window, curString:= scanning cursor for the original string, curSub:= scanning cursor for the compared string
declare finestra, curString, curSub, maxSub, trasposizioni, prefixlen, maxPrefix int;
@TheHiddenHaku
TheHiddenHaku / mime.php
Created November 21, 2013 15:54
php array of mime types
<?php
$mime = array(
"323" => "text/h323",
"acx" => "application/internet-property-stream",
"ai" => "application/postscript",
"aif" => "audio/x-aiff",
"aifc" => "audio/x-aiff",
"aiff" => "audio/x-aiff",
"asf" => "video/x-ms-asf",
"asr" => "video/x-ms-asf",