Skip to content

Instantly share code, notes, and snippets.

View danielcaldas's full-sized avatar
👋

Daniel Caldas danielcaldas

👋
View GitHub Profile
@danielcaldas
danielcaldas / rss.xml
Last active March 14, 2026 07:15
RSS feed for daily news digest
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<atom:link href="https://gist.githubusercontent.com/danielcaldas/78a6fb22b38eff458c26543c794050ea/raw/rss.xml?v=1773472510" rel="self" type="application/rss+xml" />
<title>Global News Digest</title>
<link>https://gist.github.com/danielcaldas/54c220a12ec051a812983aee87a19c42</link>
<description>Curated news digest with AI-powered clustering and filtering</description>
<language>en</language>
<pubDate>Sat, 14 Mar 2026 08:15:10 +0000</pubDate>
<lastBuildDate>Sat, 14 Mar 2026 08:15:10 +0000</lastBuildDate>
@danielcaldas
danielcaldas / decorateAddEventListener.js
Last active September 16, 2019 21:57
decorateAddEventListener.js
/**
* This is a DOM utility function that allows you to decorate a specific event handler
* for a specific event type of a DOM element with some additional behavior
* (e.g. for each click on a given button I want to log something before the actual click handler is executed).
* @param {Object} targetElement the target dom element whose addEventListener we want to decorate.
* @param {string} targetEventType the target event type whose event handler we want to decorate.
* @param {Function} decorator a function that returns the new event handler for the targetEventType.
* This returned function will most likely contain additional behavior.
* NOTE: make sure that your decorator function calls the actual event handler
* at the end, otherwise you will override the original behavior designed for that event
@danielcaldas
danielcaldas / cloudSettings
Last active April 12, 2021 03:30
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-04-12T03:30:34.496Z","extensionVersion":"v3.4.3"}
/**
* Drops array elements while specified condition is met
* @param {Array.<T>} array
* @param {Function} cb condition to drop elements
* @returns {Array.<T>} returns array tail of resulting operation
*/
function dropWhile(array, cb) {
const n = array.length;
let i = 0;