Skip to content

Instantly share code, notes, and snippets.

View carboleda's full-sized avatar
👨‍💻

Carlos Fernando Arboleda carboleda

👨‍💻
View GitHub Profile
@carboleda
carboleda / package.json
Last active August 19, 2022 12:21
Test script with profiling for jest
{
"scripts": {
"test": "node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage",
}
}
@carboleda
carboleda / Jenkinsfile
Last active August 19, 2022 13:07
Improving the Jest tests performance in CI environments when using Typescript - Medium Story
pipeline {
agent { docker { image 'node:18.7-alpine' } }
stages {
stage('test') {
steps {
sh 'npm run test:ci'
}
}
}
}
@carboleda
carboleda / streamyard-comments.js
Created October 17, 2020 17:08
Extract comments by user in Streamyard
// Extract comments by user in Streamyard
var nickComments = {};
document
.querySelectorAll('.PlatformCommentList__List-dYPHyO.jgefvQ li span.lhUFXI')
.forEach(el => {
var nick = el.innerText;
if (!nickComments[nick]) nickComments[nick] = 0;
nickComments[nick] += 1;
});
@carboleda
carboleda / scrape-it.js
Created April 11, 2020 19:41
scraping-scrape-it
const scrapeIt = require("scrape-it");
async function scrapeItExample() {
const scrapeResult = await scrapeIt('https://slides.com/carboleda', {
presentations: {
listItem: 'li.deck.public',
data: {
title: 'span.deck-title-value',
description: 'span.deck-description-value',
link: {
@carboleda
carboleda / page.html
Created April 11, 2020 19:35
scraping-page
<section class="presentations">
<ul class="decks visible" data-tab-id="personal">
<li class="deck public">
<a class="deck-link" href="/carboleda/remote-work"></a>
<h2 class="deck-title">
<span class="deck-title-value ">Trabajo remoto</span>
</h2>
<p class="deck-description">
<span class="deck-description-value ">En esta presentación compartiré...</span>
</p>
@carboleda
carboleda / cheerio-test.js
Last active April 11, 2020 20:19
NodeJS scraping
const axios = require('axios');
const cheerio = require('cheerio');
async function cheerioExample() {
const pageContent = await axios.get('https://slides.com/carboleda');
const $ = cheerio.load(pageContent.data);
const presentations = $('li.deck.public').map((_, el) => {
el = $(el);
const title = el.find('span.deck-title-value').text();
const description = el.find('span.deck-description-value').text();
@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.
@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([
{
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 / 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;