This is a short summary of my experience while writing a simple HackerNews scraper.
As a pure exercise or kata if you want, I tried to apply Clean code, Refactoring and Testing priciples for this small npm module.
The task is simple:
Get the posts on the front page of https://news.ycombinator.com and parse them.
This happened to me recently, and I couldn't understand the cause.
"Suddenly", after updating some npm packages, my npm install was "not working".
It exited abrubtly with status code 137, with the error message "Killed".
This is a short summary of what I learned while playing around with my Bangle.js Watch.
I managed to
Recently I got myself a treat: a Bangle.js Watch! ⌚️
It's a pretty awesome, open-source watch based on Espruino and Node.js, and much more! 🤓
Read about my experiments here especially for creating a mouse-watch app with Node.js and Bluetooth Low Energy!
You're seeing a blank page saying "HTTP_ERROR 431"?
And you're running a Node.js HTTP server, like express or fastify?
The Nullish coalescing operator in useful to handle default values, without short-circuiting on values that result as
Falsy values are
devblog is yet another lightweight static site generator.
Although there are widely used SSG like 11ty (which this blog was previously based on), Jekyll (also previously used), GatsbyJS and many others, I wanted to get my hands dirty and understand how to make the process of building a static blog even simpler, if possible.
Even simpler in the sense of "it does just what I need and nothing more".
npm i -g devblog or create a blog with a one-liner
npx devblog init my-new-blog,
cd my-new-blog and serve with
npx http-server _site 8080. It's that easy.
Rebuild the blog by running
npx devblog (or
npm i -g devblog and then just run
devblog in the main directory)
Continue reading my story of building
Browser automation built for enterprises, loved by developers.
I was amazed when I found out about it 🤯!
Find the whole source code on Github christian-fei/browserless-example!
Lately I found myself dealing with Twitter and Google OAuth (1.0a and 2.0) to authorize a user to act on their behalf, namely reading profile information, reading and posting content on their behalf or other common permissions.
Personally I use
dotenv to handle different environments in my Node.js applications.
It gives you the ability to specify a
.env file (generally provisioned on each environment with the corresponding environment variables), along these lines:
Lately, I was having issues with
lerna while trying to publish packages from a mono-repo.
The problem was that
lerna, sometimes, failed while publishing the changed packages (with the command
lerna publish --conventional-commits)!
Rate limiting API calls to an HTTP service doesn't have to cumbersome and too complicated.
A simple way to achieve this (and that I use all the time) is to combine
Promise.all with an npm package called
p-limit is used to run multiple promise-returning & async functions with limited concurrency.
Let's say you want to filter odd numbers from a list of numbers, like
[1,2,3,4,5,6] should become
One way to solve this problem in a functional fashion is to provide an
odd filter function, that is internally composed by a negation of an
even filter on those numbers.
Let's say you made a jQuery plugin and want to have an output (like a list of search results), whose aspect and format can be defined by the user.
The theory is very simple:
With a JSON file/object and the template the user provided you can create a basic templating system.