Skip to content

Instantly share code, notes, and snippets.

View intelguasoft's full-sized avatar
🏬
Working from at wharehouse of PROFAR...

Henry Díaz intelguasoft

🏬
Working from at wharehouse of PROFAR...
View GitHub Profile
We couldn’t find that file to show.
@intelguasoft
intelguasoft / snippet_java_android.md
Created June 10, 2020 04:56
Apuntes para trabajar comodamente con desarrollo android 2020

Listado de trozos de código (Java/Android)

  1. Si necesita hacer uso de un string de las traducciones automaticamente se hace de la siguiente forma:
btnRequestPickup.setText(getApplicationContext().getResources().getString(R.string.call_driver));
@intelguasoft
intelguasoft / deno_api_rest_usando_jwt.md
Last active July 13, 2020 01:58
Desde su v1.0, Deno se ha convertido en una palabra de moda para los desarrolladores de Javascript/Typecript/Node.js. Entremos en esta tecnología creando una Rest API segura usando JWT.

Deno: Crear una API Rest usando JWT

Desde su v1.0, Deno se ha convertido en una palabra de moda para los desarrolladores de Javascript/Typecript/Node.js. Entremos en esta tecnología creando una Rest API segura usando JWT.

https://deno.land/v1

⚠️ Es preferible tener algunos conceptos básicos en Node y su ecosistema (Express, Nodemon, Sequelize, etc.) para seguir este tutorial.

🦕 ¿Qué es Deno?

@intelguasoft
intelguasoft / limit_one_session_per_user_in_laravel_5.md
Last active May 19, 2020 07:41
Limit one session per user in Laravel 5

Limit one session per user in Laravel 5

Laravel 5 does not limit the number of sessions a user may have open, so the web application may be open in several browsers of several computers.

In a project in which I am participating we need that the user can only have an active session, so if it is authenticated in a browser, the rest of sessions have to disappear, so the user can not use the web application in the other browsers, except in the last one. The example is developed with Laravel 5.4.

The first thing I will do is add a new migration to add a text field to the «users» table, where I will store the id of the active session.

$ php artisan make:migration add_session_id_to_users_table --table=users
@intelguasoft
intelguasoft / composer.json
Last active May 12, 2020 16:44
Archivo de configuración para un paquete de composer...
{
"name": "intelguasoft/generators",
"description": "Generate numbers in a specific way according to the needs of the user.",
"keywords": [
"generators",
"lotto",
"lottery",
"generate",
"random",
"aleatorio"
@intelguasoft
intelguasoft / Generate.php
Created May 12, 2020 16:42
Clase para generar numero aleatorios
<?php
/**
* Clase para la generación de números aleatorios de manera
* personalizada por medio de argumentos.
*
* @package IntelGUA
* @subpackage Generators
* @author Henry Díaz <[email protected]>
*/
@intelguasoft
intelguasoft / gist:f4bf26dceac9def9373b94046c93df06
Created May 4, 2020 01:44
What is the right way of production deployment of nestjs application
# What is the right way of production deployment of nestjs application
Own server
1) Checkout your project's repository on your server and run npm install.
2) Run npm run build which compiles your project to javascript:
rimraf dist && tsc -p tsconfig.build.json
3) Start your application with:
@intelguasoft
intelguasoft / push_notifications_with_nodejs.md
Created April 30, 2020 02:15
Notificaciones Push de Firebase a Android con NodeJS

Notificaciones Push de Firebase a Android con NodeJS

Entonces, está desarrollando una aplicación móvil y se da cuenta de que necesita una forma de comunicarse con sus usuarios de una manera rápida y rentable. En este punto, estoy seguro de que has pensado en las notificaciones push. Ahí es donde entra Firebase Cloud Messaging (FCM).

Firebase Cloud Messaging (FCM) proporciona una conexión confiable y eficiente de la batería entre su servidor y dispositivos que le permite entregar y recibir mensajes y notificaciones en iOS, Android y la web sin costo alguno. Puedes leer más sobre esto aquí.

Ahora que hemos terminado con la introducción, vamos a sumergirnos en todo este vergueo.

Primero, debe iniciar sesión con su cuenta de Google en firebase. Luego haga clic en el enlace "Ir a la consola" que se encuentra junto al avatar de su cuenta y será redirigido a la consola del tablero de instrumentos, donde

@intelguasoft
intelguasoft / git_pull_remote_branch.md
Created April 24, 2020 00:29
How do I force “git pull” to overwrite local files?

Important: If you have any local changes, they will be lost. With or without --hard option, any local commits that haven't been pushed will be lost.[*] If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected.

I think this is the right way:

git fetch --all Then, you have two options:

git reset --hard origin/master OR If you are on some other branch:

                    -------------

/\\\\\\_/\\/\\/\\\\_ _/\/////////\_/\\\/\\\/\///////\_ /\_/\_/\//\_/\//\_/////\_ _/\\\\\\//\\///\/\//\_/\/ /\//////////\_///\//\_/\//_____ /\_/\_////\_____/\//_____ /\_/\_/\_/\/__________