Skip to content

Instantly share code, notes, and snippets.

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

Roberto Obando robertoandres24

🏠
Working from home
View GitHub Profile
@robertoandres24
robertoandres24 / for-of-loop.js
Last active October 17, 2021 21:34 — forked from anvk/promises_reduce.js
Sequential execution of Promises using reduce()
//recibe un array y una callback asyncrona
// y cada promesa se va ejecutando secuencialmente
// seria lo contrario a un Promise.all()
// me fue util para manejar los insert en la bd con typeorm y evitar conflictos de ids, duplicacion y fallos en las queries
export const runPromisesSequentally = async (
arr: any,
asyncFn: (item: any) => Promise<any>
): Promise<any[]> => {
const allContents = [];
@robertoandres24
robertoandres24 / schema.ts
Created December 7, 2020 04:15 — forked from mattmazzola/schema.ts
GraphQL Paginated Query Implementation
units: {
type: pagination.Page(Unit),
description: "Return the 'first' X number of items 'after' the specified cursor'",
args: {
first: {
type: graphql.GraphQLInt,
description: "Limits the number of results returned in the page. Defaults to 10."
},
after: {
type: graphql.GraphQLString,
@robertoandres24
robertoandres24 / ts-boilerplate.md
Created November 14, 2020 05:01 — forked from silver-xu/ts-boilerplate.md
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@robertoandres24
robertoandres24 / 2017_11_21_144804_create_regions_table.php
Created September 16, 2020 12:33 — forked from gdespirito/2017_11_21_144804_create_regions_table.php
Comunas y regiones de Chile - 2017 | Migraciones y Seeders para Laravel
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRegionsTable extends Migration
{
/**
* Run the migrations.
@robertoandres24
robertoandres24 / Confirm.vue
Created June 28, 2020 03:54 — forked from eolant/Confirm.vue
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@robertoandres24
robertoandres24 / README.md
Created March 4, 2020 18:46 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@robertoandres24
robertoandres24 / validarRUT.html
Created July 2, 2019 22:10 — forked from gaulatti/validarRUT.html
HTML5 Chilean RUT Validator
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Validador de RUT HTML5</title>
</head>
<body>
<form>
<input type="text" id="rut" name="rut" required oninput="checkRut(this)" placeholder="Ingrese RUT">
<button type="submit">Validar RUT y Enviar Form</button>
@robertoandres24
robertoandres24 / async-await.js
Created November 6, 2018 21:08 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@robertoandres24
robertoandres24 / php-pdo-mysql-crud.md
Created June 13, 2018 15:42 — forked from odan/php-pdo-mysql-crud.md
Basic CRUD operations with PDO and MySQL

Basic CRUD operations with PDO

CRUD = Create, Read, Update, Delete

Open a database connection

$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';