Skip to content

Instantly share code, notes, and snippets.

View calevano's full-sized avatar
🍕
eating pizza and being happy making code.

Carlos Levano calevano

🍕
eating pizza and being happy making code.
View GitHub Profile
[user]
name = Carlos Levano
email = calevano@gmail.com
[core]
editor = vim
excludesfile = ~/.gitignore_global
autocrlf = false
[alias]
a = add
br = branch
@calevano
calevano / change-email.sh
Last active May 8, 2017 16:38
Git - Change email
git filter-branch --env-filter '
WRONG_EMAIL="dude@gmail.com"
NEW_NAME="Dude Name"
NEW_EMAIL="dude@company.com"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
@calevano
calevano / regiones.sql
Created July 20, 2017 05:21
Tabla de regiones
INSERT INTO `regiones` (`id`, `region`) VALUES
(1, 'AMAZONAS'),
(2, 'ANCASH'),
(3, 'APURIMAC'),
(4, 'AREQUIPA'),
(5, 'AYACUCHO'),
(6, 'CAJAMARCA'),
(7, 'CALLAO'),
(8, 'CUSCO'),
(9, 'HUANCAVELICA'),
@calevano
calevano / provincias.sql
Created July 20, 2017 05:23
Tabla de Provincias asociados a una region
INSERT INTO `provincias` (`id`, `provincia`, `region_id`) VALUES
(1, 'CHACHAPOYAS ', 1),
(2, 'BAGUA', 1),
(3, 'BONGARA', 1),
(4, 'CONDORCANQUI', 1),
(5, 'LUYA', 1),
(6, 'RODRIGUEZ DE MENDOZA', 1),
(7, 'UTCUBAMBA', 1),
(8, 'HUARAZ', 2),
(9, 'AIJA', 2),
@calevano
calevano / distritos.sql
Created July 20, 2017 05:26
Tabla de Distrito asociado a una provincia
INSERT INTO `distritos` (`id`, `distrito`, `provincia_id`) VALUES
(1, 'CHACHAPOYAS', 1),
(2, 'ASUNCION', 1),
(3, 'BALSAS', 1),
(4, 'CHETO', 1),
(5, 'CHILIQUIN', 1),
(6, 'CHUQUIBAMBA', 1),
(7, 'GRANADA', 1),
(8, 'HUANCAS', 1),
(9, 'LA JALCA', 1),
<?hp
function url_amigable($url) {
//$urlMinuscula = strtolower($url);
$buscarLetra = array('Á', 'É', 'Í', 'Ó', 'Ú', 'Ñ', 'á', 'é', 'í', 'ó', 'ú', 'ñ');
$reemplazar = array('A', 'E', 'i', 'O', 'U', 'N', 'a', 'e', 'i', 'o', 'u', 'n');
$urlNueva = str_replace($buscarLetra, $reemplazar, $url);
$buscarCaracteres = array(' ', '&', '\r\n', '\n', '+');
$urlAceptable = str_replace($buscarCaracteres, ' ', $urlNueva);
//$find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');
//$repl = array('', '-', '');
@calevano
calevano / ChangeColumnLength
Created December 26, 2017 19:59
Laravel 5.2 Console Comand, Alter table with arguments, options... php artisan change-column-table [argument] [--options]
public function handle()
{
$tableName = $this->argument('table');
if ($tableName != null) {
$table = Schema::hasTable($tableName);
if ($table) {
$columnName = $this->option('column');
if ($columnName != null) {
$column = Schema::hasColumn($tableName, $columnName);
if ($column) {
@calevano
calevano / openModal.js
Last active January 30, 2018 16:08
Create simple openModal
#In view
<a href="[_route_]"
class="btn btn btn-success btn-circle btn-xs zmdi zmdi-edit"
data-toggle='modal'
data-target="#openModal"
data-tamanio='lg'>
</a>
#OpenModal
@calevano
calevano / execute_search_key_list_store_procedure.sql
Created February 21, 2018 00:03
Search definition in Store Procedure in sqlServer
SELECT
ROUTINE_NAME ,ROUTINE_DEFINITION
FROM
INFORMATION_SCHEMA.ROUTINES
WHERE
ROUTINE_DEFINITION LIKE '%Letter%'
AND ROUTINE_TYPE = 'PROCEDURE'
ORDER BY ROUTINE_NAME
@calevano
calevano / removeIndexArray.js
Created May 16, 2018 16:44
function to remove index in array
function remove(array, element) {
const index = array.indexOf(element);
if (index !== -1) {
array.splice(index, 1);
}
}