Skip to content

Instantly share code, notes, and snippets.

View AEROGU's full-sized avatar

Arturo Rosas AEROGU

  • México
  • 04:25 (UTC -06:00)
View GitHub Profile
@AEROGU
AEROGU / frontendRoutes.go
Created February 6, 2023 06:53
GO & Gin: Use the same gin router to mount embedded frontend and your API routes
package main
/*
Uses the same gin router to mount embedded frontend.
Change the //go:embed .\frontend
Change the `root, _ := fs.Sub(embedFrontendFS, "frontend")`
*/
import (
@AEROGU
AEROGU / Change `public` folder name to `public_html` in Laravel 8 or 9.md
Created October 26, 2022 17:14
Change `public` folder name to `public_html` in Laravel 8 or 9

Change public folder name to public_html in Laravel 8 or 9

in the most shared servers the default public folder is named public_html or www, whats may present a problem since the server document root and Laravel public folder are not the same.

Let's fix it following this 3 steps:

1. Change the public folder name.

That´s it, just do it.

@AEROGU
AEROGU / README.md
Last active August 30, 2022 20:53
Create Laravel db:create artisan command for MySQL.

Create Laravel db:create artisan command for MySQL.

With this command, when your .env file is configured, you can create your project database with php artisan db:create when is the first time you clone your project.

To create this command, execute: php artisan make:command dbcreate, and then , a file named dbcreate.php will be generated in ./app/Console/Commands/dbcreate.php, then just copy and paste the code of dbcreate.php file.

@AEROGU
AEROGU / Ejemplo de uso de LINQ en base de datos.md
Last active January 10, 2020 04:41
Ejemplo de uso de LINQ en base de datos

Ejemplo de uso de LINQ en base de datos

Debes haber agregado un elemento "ADO.NET Entity Data Model" (Hay una opción para mapear una base de datos existente)

Yo estoy utilizando una base de datos MySQL (la integración con Visual Studio instala con "MySQL for visual studio"), pero es lo mismo para cualquier DBMS que hayas integrado con visual studio.

En este ejemplo los objetos del modelo que creó la plantilla están en "aguapotableEntities"

using(aguapotableEntities db = new aguapotableEntities() ) {
@AEROGU
AEROGU / Respaldo MySQL desde consola en Windows.md
Last active April 6, 2022 05:09
Respaldo MySQL desde consola en Windows

Hacer respaldo completo de base de datos MySQL desde consola en Windows

En ocaciones, si se tiene un MySQL Workbench en una versión superior a la base de datos, esto provocará errores al hacer respaldos, por lo que siempre es mejor hacerlo con el "mysqldump" que incluye el servidor, ya que este y la versión del servidor serán completamente compatibles.

Primero debes de tener la ruta a /bin de la instalación de MySQL en la variable de entorno PATH, y también el 7zip si se desea comprimir desde consola.

Usualmente están en la ruta "C:\Program Files\MySQL\MySQL Server 5.7\bin" y para 7zip en "C:\Program Files\7-Zip"

Ejemplo de respaldo de db_test:

@AEROGU
AEROGU / csv2matrix.php
Created November 21, 2019 23:03
Read CSV with PHP
<?php
/**
* Read character separated values file like CSV, TSV, etc.,
* If $a_asocciative==true returns asocciative matrix using
* the first row as column names.
*
* Example: print_r(csv2matrix("ocr_result.tsv", "\t"));
*
* @author Arturo E. Rosas Gutiérrez <https://github.com/AEROGU>
* @license MIT
@AEROGU
AEROGU / EjemploDapper.cs
Last active November 10, 2019 08:20
Ejemplo muy simple de uso de paquete NuGet "Dapper" para mapear automáticamente resultado de una consulta en un objeto en C# VS2019.
using Dapper;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;