Skip to content

Instantly share code, notes, and snippets.

@sbarrat
sbarrat / .htaccess
Created June 16, 2013 19:19
Acceso restringido de usuarios con Apache
AuthType Basic
AuthName "Mi Sitio Seguro"
AuthBasicProvider file
AuthUserFile /ruta/completa/ficheroUsuarios
Require valid-user
@sbarrat
sbarrat / vbaColorToWeb.php
Last active December 19, 2015 05:59
Function to change vba color to hex or rgb
/**
* vbaColorToWeb.php Class to convert VBA color to web Color
*
*
* PHP Version 5.3
*
* @author Ruben Lacasa Mas <ruben@rubenlacasa.es>
* @copyright 2013 Ruben Lacasa Mas http://rubenlacasa.es
* @license http://creativecommons.org/licenses/by-nc-nd/3.0
* CC-BY-NC-ND-3.0
@sbarrat
sbarrat / DBConnection.php
Created February 8, 2012 18:26
Singleton PDO DB Connection PHP
final class DBConnection {
private static $_handle = null;
private static $_dsn = "mysql:dbname=mydb;host=my.host.com;port=3306";
private static $_user = "myUserName";
private static $_password = "myPassword";
private static $_options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); // SET UTF-8
/**
* Deny Construct
*/
@sbarrat
sbarrat / generoPersona.php
Last active September 12, 2022 17:04
Detección de genero de Persona España
function generoPersona($nombre, $provider = 'genderAPI')
{
$providers = array(
'genderAPI' => array(
'url' => 'https://gender-api.com/get?name=',
'pais' => '&country=ES'
),
'genderize' => array(
'url' => 'https://api.genderize.io/?name=',
'pais' => '&country_id=es'