This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On PhpStorm, when ussing with laravel mix, for Alias path resolving in components you have to: | |
// - create a webpack.config.js file separately like: | |
const path = require('path') | |
const webpack = require('webpack') | |
module.exports = { | |
... | |
resolve: { | |
extensions: ['.js', '.json', '.vue'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class helpers { | |
public function uniqueCode($length = 10) { | |
$characters = '0123456789'; | |
$charactersLength = strlen($characters); | |
while (true) { | |
// uniqid gives 13 chars, but you could adjust it to your needs. | |
if (function_exists("random_bytes")) { | |
$bytes = random_bytes($length); | |
} elseif (function_exists("openssl_random_pseudo_bytes")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Recursively walks a Collection or Array that contains children of the same kind and flatten into an single dimesion Collection or Array. | |
// Example: | |
// We have: | |
// A | |
// |_B | |
// |_C | |
// |_D | |
// We want: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is question is old but I found you can do this based on information from a tutorial by Tejas Jasani: http://www.theappguruz.com/blog/upgrading-from-laravel-4-2-to-5-in-web | |
Here are the key steps: | |
1 - Add the app/Http/Controllers directory to the "autoload" classmap directive of your composer.json file. | |
"autoload": { | |
"classmap": [ | |
"database", | |
"app/Http/Controllers" | |
], | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function utf8_converter($array) { | |
array_walk_recursive($array, function(&$item, $key){ | |
if(!mb_detect_encoding($item, 'utf-8', true)){ | |
$item = utf8_encode($item); | |
} | |
}); | |
return $array; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Closure para el evitar conflicto de variables, se le pasa el obj jQuery | |
(function ( $ ) { | |
/** | |
* Elimina la clase que empieza con "startsWith" y añade la clase newClass (o no hace nada, si es vacia) | |
* @param {[string]} startsWith string con el que debe comenzar la clase a eliminar | |
* @param {[string]} newClass string con la nueva clase, o string vacio | |
* @return {[jQobj]} Objeto jQuery | |
*/ | |
$.fn.replaceClass = function( startsWith, newClass ) { | |
// A cada uno de los elementos de la selecion ( this ), le aplica la funcion.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Modal cargando | |
var dialogs = (function () { | |
var cargandoDiv = $('#cargandoDialog'); | |
var avisoDiv = $('#modalAviso'); | |
return { | |
showCargando: function() { | |
cargandoDiv.modal(); | |
}, | |
hideCargando: function () { | |
cargandoDiv.modal('hide'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
FUENTE: http://stackoverflow.com/questions/1985260/javascript-array-rotate | |
CREDITOS: http://stackoverflow.com/users/48015/christoph | |
*/ | |
Array.prototype.rotate = (function() { | |
var unshift = Array.prototype.unshift, | |
splice = Array.prototype.splice; | |
return function(count) { | |
var len = this.length >>> 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Number.prototype.toFixedDown = function(digits) { | |
var n = this - Math.pow(10, -digits)/2; | |
n += n / Math.pow(2, 53); // added 1360765523: 17.56.toFixedDown(2) === "17.56" | |
return n.toFixed(digits); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkEmail(email) { | |
email = email.toLowerCase(); | |
if(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/.test(email)==false ) { | |
return false; | |
} | |
return t |