Skip to content

Instantly share code, notes, and snippets.

View carboleda's full-sized avatar
👨‍💻

Carlos Fernando Arboleda carboleda

👨‍💻
View GitHub Profile
@carboleda
carboleda / events-keyboard.js
Last active February 9, 2019 17:20
nodejs-tictactoe-client
const readline = require('readline');
const Constants = require('../helpers/constants');
module.exports = function(GameBoardScreen) {
function initKeypressEvents() {
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);
process.stdin.on('keypress', (str, key) => {
console.log('key', key);
if(key.ctrl && key.name === 'c') {
docker pull mysql/mysql-server
docker images
docker run --name=mysql1 -p 3306:3306 -d mysql/mysql-server
docker start mysql1
docker logs mysql1
@carboleda
carboleda / db.js
Last active February 8, 2019 14:09
Conexión a base de datos usando mysql2
const mysql = require('mysql2');
let pool;
module.exports = {
getPoolConnection
}
function getPoolConnection() {
if(!pool) {
pool = mysql.createPool({
@carboleda
carboleda / db.js
Last active February 8, 2019 14:15
Conexión a MySQL utilizando knex
const knex = require('knex');
let pool;
module.exports = {
getPoolConnection
}
function getPoolConnection() {
if(!pool) {
pool = knex({
@carboleda
carboleda / db.js
Last active February 9, 2019 15:43
Bookshelf
const bookshelf = require('bookshelf');
const db = require('../knex/db');
module.exports = bookshelf(db.getPoolConnection());
@carboleda
carboleda / constants.js
Last active February 9, 2019 17:07
nodejs-tictactoe-server
module.exports = {
//Tamaño del tablero, este caso es de 3x3
GAME_SIZE: 3,
//Una posición sin marcar
UNSELECTED_POSITION: ' ',
//Identificador del jugador 1
PLAYER_INDEX_1: 1,
//Identificador del jugador 2
PLAYER_INDEX_2: 2,
//Caracteres de los jugadores:
@carboleda
carboleda / style.css
Created February 13, 2019 02:06
Movie scraping
body {
font-family: sans-serif;
}
.movies {
display: flex;
flex-direction: row;
flex-wrap: wrap;
flex-flow: wrap;
justify-content: flex-start;
const jsonwebtoken = require('jsonwebtoken');
const secretOrPrivateKey = 'devhack.com';
function verifyToken(token) {
console.log('verifyToken.token', token);
if (token && token.length > 7 && token.substring(0, 7).toLowerCase() === 'bearer ') {
token = token.slice(7);
}
const data = jsonwebtoken.verify(token, secretOrPrivateKey);
console.log('verifyToken.data', data);
@carboleda
carboleda / uploadFileHandler.js
Last active March 16, 2019 15:31
Subir archivos a servidor usando Node.js y Hapi.js v18.1.10
const fs = require('fs');
const path = require('path');
//EL DIRECTORIO uploads/ DEBE SER CREADO MANUALMENTE
const uploadsDir = path.join(__dirname, '..', '..', 'uploads');
const plugin = {
name: 'uploadFileHandler',
version: '1.0.0',
register: (server, options) => {
server.route([
{
@carboleda
carboleda / 1. README.md
Last active November 6, 2019 02:00
Prueba técnica Android/Backend La Manicurista - Link de la oferta: https://torre.co/en/talent/ZWXDpDW7

A continuación encontrarás una prueba conceptual y otra técnica. Todo el contenido génerado como respuesta de las pruebas debe ser subido a un repositorio en GitHub.

  • La prueba debe ser entregada a más tardar el próximo martes 5 de noviembre a las 9am.
  • Una vez hayas terminado por completo las respuestas, debes invitar el usuario carboleda tu repositorio.
  • Si tienes alguna inquetud puedes contactarme al correo carlos@lamanicurista.com o por el chat de torre.co.