Skip to content

Instantly share code, notes, and snippets.

View ramasilveyra's full-sized avatar
๐Ÿ•

Ramiro Silveyra d'Avila ramasilveyra

๐Ÿ•
View GitHub Profile
@dcatanzaro
dcatanzaro / scrapper.js
Created February 18, 2024 21:18
Browser comments scrapper
let comments = [];
let lastScrollHeight = 0;
let interval = setInterval(() => {
// Scroll down to load more comments
window.scrollTo(0, document.body.scrollHeight);
// Wait for new comments to load
setTimeout(() => {
// Select all comments
let commentElements = document.querySelectorAll('[data-testid="tweetText"] span.css-1qaijid.r-bcqeeo.r-qvutc0.r-poiln3');
@nymous
nymous / README.md
Last active June 2, 2025 09:26
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@straker
straker / README.md
Last active June 10, 2025 06:39
Basic Tetris HTML and JavaScript Game

Basic Tetris HTML and JavaScript Game

This is a basic implementation of the game Tetris, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@kosamari
kosamari / how_i_got_into_google.md
Last active November 1, 2023 02:16
Google ใซๅ…ฅใ‚‹ใพใงใฎ่ฉฑ

Googleใซๅ…ฅใ‚‹ใพใงใฎ่ฉฑ (Developer Relations)

ใ‚ณใƒณใƒ†ใ‚ญใ‚นใƒˆ: https://togetter.com/li/1331865

ๅ‰ๆๆกไปถ

้ƒจ็ฝฒ

ใ‚ฐใƒผใ‚ฐใƒซใ‚ธใƒฃใƒ‘ใƒณใงใฏใชใใฆUSใฎๆœฌ็คพใงใฎๆŽก็”จใฎ่ฉฑใ€‚็งใŒๅ—ใ‘ใŸใฎใฏSoftware EngineerใงใฏใชใใฆDeveloper Advocateใ€‚Engineering็ต„็น”ใฎไธ‹ใซใคใ„ใฆใ„ใ‚‹ใฎใงใ‚ณใƒผใƒ‡ใ‚ฃใƒณใ‚ฐ้ขๆŽฅๆœ‰ใ‚Šใ€‚ใŸใ ใ—่ฉ•ไพก้ …็›ฎใŒSWEใจใฏ็•ฐใชใ‚‹ใ€‚

่‹ฑ่ชž

Getting Started With Plug'n'Play

If you use create-react-app, #5136 (released with the 2.0) implements a --use-pnp option that allows you to easily create a new project using PnP! In this case, just use create-react-app --use-pnp together with Yarn 1.12, and you're good to go! ๐Ÿ‘

Plug'n'Play is a new initiative from Yarn that aims to remove the need for node_modules. It's already available, and has proved being effective even on large-scale infrastructures. This document describes in a few steps how to quickly get started with it. Spoiler alert: it's quite easy ๐Ÿ™‚

First, download a package manager that supports it. Yarn 1.12 already does, so that's what we're going to use! To install it, just follow the instructions on our website: https://yarnpkg.com/en/docs/install

If everything is ok, running yarn --version should give you v1.12.1 or higher. If you don't get this result maybe a

@gaearon
gaearon / prepack-gentle-intro-1.md
Last active March 22, 2025 07:22
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@adactio
adactio / minimal-serviceworker.js
Last active August 18, 2023 09:15
An attempt at a minimal viable service worker.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
// HTML files: try the network first, then the cache.
// Other files: try the cache first, then the network.
// Both: cache a fresh version if possible.
// (beware: the cache will grow and grow; there's no cleanup)
const cacheName = 'files';
@james2doyle
james2doyle / ios-chrome-devtools.md
Last active July 20, 2024 16:11
Enable remote debugging on the iOS simulator using Chrome Dev Tools

Install the tools:

brew install ios-webkit-debug-proxy

Run the simulator. And choose an iOS 10 device. The chrome remote debugging doesn't work with iOS 11 yet.

Enable the inspector

@acdlite
acdlite / coordinating-async-react.md
Last active June 17, 2024 11:56
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

Avoid live "then()-ables"

Like a Promise, await will call any .then() function on its operand. This can be used to create values that change every time they are awaited.

let lastId = 1;
const id = {
  then(fn, errfn) {
    fn(lastId++);
 }