Skip to content

Instantly share code, notes, and snippets.

View albertomario's full-sized avatar
🏠
Working from home

Alberto Burlacu albertomario

🏠
Working from home
View GitHub Profile
SublimeLinter-php:
-----------------
SublimeLinter-php
-------------------------------
This linter plugin for SublimeLinter provides an interface to php -l.
** IMPORTANT! **
Before this plugin will activate, you *must*
@albertomario
albertomario / Router.php
Created September 16, 2016 18:28
router example
class Router {
private static $routes = array();
private function __construct() {}
private function __clone() {}
public static function addRoute($routePattern, $callback)
@albertomario
albertomario / Router.php
Created September 16, 2016 18:29
router example
<?php
namespace Phasic\Core;
class Router {
private static $routes = array();
private function __construct() {}
private function __clone() {}
@albertomario
albertomario / Router.php
Created September 16, 2016 18:29
router example
<?php
namespace Phasic\Core;
class Router {
private static $routes = array();
private function __construct() {}
private function __clone() {}

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

<?php
/**
* Clasa face transpunerea numerelor in cuvinte
* E dezvoltata doar pentru limba ROMANA
**/
class NConv {
/**
* Methoda de separare a grupurilor de 3 cifre, si conversie (functie de nivel)
* Va returna [NaN] daca parametrul de intrare $num nu e numeric
@albertomario
albertomario / mysql-levenshtein.sql
Created October 27, 2017 11:24 — forked from Kovah/mysql-levenshtein.sql
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@albertomario
albertomario / template_loader.php
Created January 16, 2018 20:45
codeigniter template helper
<?php
class MY_Loader extends CI_Loader {
public function template($template_name, $vars = array(), $return = FALSE)
{
if($return):
$content = $this->view('templates/header', $vars, $return);
$content .= $this->view($template_name, $vars, $return);
$content .= $this->view('templates/footer', $vars, $return);
return $content;
validator.addRule(
'customer-type-validation',
function (value) {
console.log(value);
var customerTypeSelector = $('[name=custom_attributes\\[customer_type\\]] option:selected').text();
console.log(customerTypeSelector);
if(value === 'hello') {
return true;
} else {
return false;
var array_data = [["Romania","Alba","Urban","Aiud"],["Romania","Alba","Urban","Alba iulia"],["Romania","Alba","Urban","Baia de aries"],["Romania","Alba","Urban","Blaj"],["Romania","Alba","Urban","Campeni"],["Romania","Alba","Urban","Cugir"],["Romania","Alba","Urban","Ocna mures"],["Romania","Alba","Urban","Sebes"],["Romania","Alba","Urban","Teius"],["Romania","Alba","Urban","Zlatna"],["Romania","Alba","Rural","Albac"],["Romania","Alba","Rural","Almasu mare"],["Romania","Alba","Rural","Arieseni"],["Romania","Alba","Rural","Avram iancu"],["Romania","Alba","Rural","Berghin"],["Romania","Alba","Rural","Bistra"],["Romania","Alba","Rural","Blandiana"],["Romania","Alba","Rural","Bucerdea granoasa"],["Romania","Alba","Rural","Bucium"],["Romania","Alba","Rural","Calnic"],["Romania","Alba","Rural","Cenade"],["Romania","Alba","Rural","Cergau"],["Romania","Alba","Rural","Ceru-bacainti"],["Romania","Alba","Rural","Cetatea de balta"],["Romania","Alba","Rural","Ciugud"],["Romania","Alba","Rural","Ciuruleasa"],["Romania","Al