Skip to content

Instantly share code, notes, and snippets.

View JorgeMadson's full-sized avatar

Jorge Madson JorgeMadson

View GitHub Profile
@JorgeMadson
JorgeMadson / data_loading_utils.py
Last active March 27, 2025 14:05 — forked from iyvinjose/data_loading_utils.py
Read large files line by line without loading entire file to memory. Supports files of GB size
def read_lines_from_file_as_data_chunks(file_name, chunk_size, callback, return_whole_chunk=False):
"""
read file line by line regardless of its size
:param file_name: absolute path of file to read
:param chunk_size: size of data to be read at at time
:param callback: callback method, prototype ----> def callback(data, eof, file_name)
:param return_whole_chunk: if True, returns whole chunks instead of line by line
:return: None
"""
@JorgeMadson
JorgeMadson / clean_code.md
Created December 10, 2024 15:23 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Receitas do(a) (seu nome)</title>
<style>
body {
margin: 0;
@JorgeMadson
JorgeMadson / Ice&FireOfReact19.md
Last active August 5, 2024 18:51
What’s New in React 19: A Game of Thrones Saga

What’s New in React 19: A Game of Thrones Saga

Winter is coming, and so is React 19, with a flurry of new features that would make even the most stoic Starks crack a smile. Gather 'round the fire, dear developers, as we recount the tales of transitions, hooks, and the dreaded Server Components, all through the lens of Westeros.

The Battle of Actions

In the land of React, handling data mutations and updating state was once as cumbersome as defending the Wall from a horde of White Walkers. With React 18, developers had to juggle pending states, errors, and sequential requests like Jon Snow balancing his duty and love life.

// Before Actions
@JorgeMadson
JorgeMadson / rotate-image.js
Created July 14, 2021 18:24
How to rotate images in browser console
document.getElementsByTagName("img")[0].style.transform = "rotate(270deg)"
@JorgeMadson
JorgeMadson / READ.md
Last active January 31, 2023 22:49
Meu setup pra linux recem instalado

Dev Setup

  1. Run command: chmod +x dev-setup.sh
  2. Run command: ./dev-setup.sh to start the install script

Technical challenge

Here is the description of what you'll need to implement on this technical challenge.

Challenges

1. Cache function

Implement a function, class or module (it can be on the same file - request.py) to cache requests made with the existing code, preventing unecessary calls. You MUST use this Redis module as a cache service. Feel free to change the code within the existing functions, but do not alter their behaviour.

Context: Caching requests can be useful to avoid unecessary HTTP calls for the same resources, however, the resources can change during time, so it is important to keep in mind that cache needs to be invalidated at some point.

@JorgeMadson
JorgeMadson / brasil-sp-timezone.js
Created August 8, 2019 21:40
Data e hora em português com fuso horário de são paulo
new Date().toLocaleString('pt-BR', { timeZone: 'America/Sao_Paulo' });
@JorgeMadson
JorgeMadson / CuidadosMasculinos.md
Last active July 7, 2019 22:35
melhorando a autoestima masculina

Ajeitar a cara

Tem o canal do youtube do cara que foi por onde achei ele, mas tem um blog também é maneiro e organizado, ele ensina como cuidar da pele, cabelo e até o tal da harmonização facial que é o que faz o pessoal de hollywood tem aquele maxilar/mandibula bonita https://www.youtube.com/watch?v=JJXe0_3DJWA https://homensquesecuidam.com/

Ajeitar os dentes

Esse vídeo é bem vlog, mas mostra direitinho o processo pra ficar com os dentes lindos, o canal dessa cara não recomendo tanto pq ele divaga um pouco, mas dá algumas dicas https://www.youtube.com/watch?v=5uF_8CHb2bM

Moda

@JorgeMadson
JorgeMadson / hoursAgo.js
Last active June 26, 2019 14:13
Devolve uma data e hora menos algumas horas atrás
/*
O 19 é a quantidade de horas atrás, só subistituir por outro valor.
*/
new Date(new Date().setHours(new Date().getHours() - 19)).toLocaleString("pt-BR")