Skip to content

Instantly share code, notes, and snippets.

View carboleda's full-sized avatar
👨‍💻

Carlos Fernando Arboleda carboleda

👨‍💻
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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",
}
}