Skip to content

Instantly share code, notes, and snippets.

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

Alexis Montilla alexlatam

🏠
Working from home
View GitHub Profile
@alexlatam
alexlatam / async-await-api-query.js
Created August 28, 2022 14:44
Script para consultar con JavaScript nativo a una api, usando async await
// Hago el llamado al endpoint, y obtengo al respuesta
const response = await fetch(API_URL);
// Paso la informacion de string, a formato JSON
const data = response.json();
// Ahora con la data que retorna el endopoint, puedo procesarlo.
@alexlatam
alexlatam / query_db.php
Last active November 15, 2022 16:53
PHP Query with MySqli and PDO and Transactions using PDO
<?php
/*------------------------- \Mysqli -------------------------*/
/*------------------------- \Mysqli -------------------------*/
// Conexion con DB, usando la clase global(propia del lenguaje) mysqli
$mysqli_conection = new \mysqli($this->server, $this->username, $this->password, $this->database);
// Comprobar conexión genero error
if ($mysqli->connect_errno)
die("Falló la conexión: {$mysqli->connect_error}");
@alexlatam
alexlatam / filterTwoDecimalsInInputTextJS.html
Created April 21, 2021 21:42 — forked from Javlopez/filter.html
Solo numeros con 1 punto y maximo dos decimales
<script type="text/javascript">
<!--
function filterFloat(evt,input){
// Backspace = 8, Enter = 13, ‘0′ = 48, ‘9′ = 57, ‘.’ = 46, ‘-’ = 43
var key = window.Event ? evt.which : evt.keyCode;
var chark = String.fromCharCode(key);
var tempValue = input.value+chark;
if(key >= 48 && key <= 57){
if(filter(tempValue)=== false){
return false;