Skip to content

Instantly share code, notes, and snippets.

View brunolemos's full-sized avatar

Bruno Lemos brunolemos

View GitHub Profile
@lucassshanks
lucassshanks / ReactWindowPerformanceExample.ts
Created November 14, 2024 08:59
Use react-window to limit the amount of items rendered in the dom in TS. The onHover will lag due to how react-select computes whether an element should be highlighted or not so a CSS solution is needed to solve this. Also included some example of data fetching. Designed for https://github.com/JedWatson/react-select/issues/3128
import React, { useEffect, useState } from 'react'
import ReactSelect, { createFilter, MenuListProps, OptionProps } from 'react-select'
import { FixedSizeList as List, ListChildComponentProps } from 'react-window'
type OptionType = {
label: string
value: string
}
export const ReactWindowSelectExample = () => {
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@brunolemos
brunolemos / linkedin-unfollow-everyone.js
Last active December 23, 2024 12:51
Unfollow everyone on Linkedin
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();

[WIP]Juliana Dias Rules

Algumas frases com pensamentos que me guiam no desenvolvimento de software

1 - Se está difícil, provavelmente tem algo errado, o código deveria ser mais fácil de codificado e lido.
2 - Você é seu melhor termômetro, se algo não te agrada é provável que precise refatorar, tal qual o item 1.
3 - Se o erro não faz sentido, provavelmente é algum typo, refaça todos os passos com bastante atenção.
4 - Tenha preferência em fazer funcionar com um código com a maior qualidade possível dentro do prazo dado, tendo feito um código que funcione, refatore (siga o TDD e o Make it works, Make it Beauty).
5 - É tudo sobre responsabilidades, clareza e objetividade, isso é orientação a objetos, isso é SOLID.
6 - Testes foram feitos para quebrar, isso é que te dá segurança sobre o que você está desenvolvendo. Se o teste não falha com a sua alteração no código, pode ser que o teste não esteja testando o que deve.
7 - O código é apenas um sintoma, um reflexo de você e ou ambiente em que

###### CONSISTENCY BETWEEN MACOS AND IOS #####
#
# In order to use the same PodFile with MacOS, we need to unlink the libraries that do not support Catalyst, filter
# files in native targets build phases, filter dependencies and make sure the unsupported frameworks along with their
# their bundle resources are not included in the final archive. For that, we use `platform_filter` to specify 'ios' and
# 'OTHER_LDFLAGS[sdk=iphone*]' to link those libraries for iPhone and iPad. Besides, we modify "*frameworks.sh" and
# "*resrouces.sh" to skip installation for architecture x86_64.
#
# *Notice*: 'sdk=iphone*' excludes macOS, even though Catalyst is compiled with iOS SDK.
#
const bypass = [
// function names to avoid logging
];
const collapsed = [
// function names to groupCollapsed
];
module.exports = function(babel) {
const { types: t } = babel;
const wrapFunctionBody = babel.template(`{
import {
Dimensions,
LayoutChangeEvent,
Platform,
ScrollEvent,
ScrollView,
StyleSheet,
View,
} from "react-native";
import {Font, Space} from "../atoms";
@erquhart
erquhart / selection-command.js
Last active December 11, 2024 03:28
Text selection commands for Cypress.io
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@ryanpcmcquen
ryanpcmcquen / darkify_slack.sh
Last active February 23, 2023 16:08
Darkify your Slack.
#!/bin/sh
# Darkify Slack on Mac OS or Linux.
# curl https://gist.githubusercontent.com/ryanpcmcquen/8a7ddc72460eca0dc1f2dc389674dde1/raw/darkify_slack.sh | sh
if [ "`uname -s`" = "Darwin" ]; then
SLACK_INTEROP_JS="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
else
SLACK_INTEROP_JS="/usr/lib/slack/resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
fi