Skip to content

Instantly share code, notes, and snippets.

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

Ariel Ivan Diaz arielivandiaz

🏠
Working from home
View GitHub Profile
@arielivandiaz
arielivandiaz / meta-tags.md
Created November 28, 2018 16:05 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@arielivandiaz
arielivandiaz / promise.js
Last active January 11, 2019 17:15
NodeJS Promise
const fs = require('fs');
let createFile = (filename) => {
return new Promise((resolve, reject) => {
if (fs.existsSync(file)) {
reject("File Exists");
} else {
fs.appendFile(file, 'Hello World', (error) => {
if (error) {
reject(error);
@arielivandiaz
arielivandiaz / app.js
Created December 1, 2018 14:33
Express NodeJS Simplest App Template
const express = require('express');
const app = express();
app.get('/', (request, respose) => {
respose.send('Hello World!');
});
app.listen(3000, () => {
@arielivandiaz
arielivandiaz / app.js
Created December 1, 2018 14:50
NodeJS MySQL connection and query with Promise
var mysql = require('mysql');
var connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
});
let run_mysql = (mysql_query) => {
@arielivandiaz
arielivandiaz / app.js
Created December 1, 2018 15:17
Resolving promises in a for loop - NodeJS / MySQL
let mysql = require('mysql');
let connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
});
connection.query('USE test_database');
@arielivandiaz
arielivandiaz / commit.sh
Created December 17, 2018 13:04
Git add, commit and push in a single line - bash command
#!/bin/sh
# Run: > sh commit.sh 'This is a commit description/message'
git status
git add -A
git commit -m '$1'
git push origin master
@arielivandiaz
arielivandiaz / git.sh
Created December 19, 2018 16:49
Guia rapida de como usar git bash
#Clonar un repositorio
git clone https://github.com/arielivandiaz/teaching-git-starter-pack.git
#Entrar en la carpeta del repositorio
cd teaching-git-starter-pack
#Modificamos el repositorio
### /*/*/*/*/
#Checkeamos los archivos modificados
@arielivandiaz
arielivandiaz / git_start.rm
Created December 19, 2018 17:09
Git start with HTTP & SSH
#SSH vs HTTP
Si usas HTTP por consola, te va a pedir usuario y contraseña o contraseña cada vez que realizas un pull/push
Si usas SSH, tus credenciales quedan guardadas en la PC y no necesitas loguearte para realziar acciones, pero para ello necesitas tener una key SSH en la PC/Servidor vinculada con la cuenta de github.
>En Windows Descargar git bash : [https://git-scm.com/](https://git-scm.com/)
## HTTP / SSH
Para usar git bash primero hay que configurar el usuario (probablemente si usaron github desktop esto no es necesario)
Ejecutar en el terminal:
@arielivandiaz
arielivandiaz / killNode.md
Created May 20, 2019 16:53
Release the port after father was killed

sudo kill -9 sudo lsof -t -i:3838

@arielivandiaz
arielivandiaz / async.js
Created November 2, 2019 18:34
Async function for SQL
let getUser = async (userId) => {
let promise = new Promise((resolve, reject) => {
sql.query("SELECT * FROM `users` WHERE `id`=" + userId).then((userInfo) => {
resolve(userInfo);
}).catch((reject) => { //Sql reject