Skip to content

Instantly share code, notes, and snippets.

@brunolemos
brunolemos / App.tsx
Last active January 14, 2021 05:07
react-native-safe-area-context
import React from 'react'
import { StatusBar, Text, View } from 'react-native'
import { useSafeArea } from 'react-native-safe-area-context'
export function App() {
const safeAreaInsets = useSafeArea()
return (
<View
style={{
@brunolemos
brunolemos / v1.tsx
Created December 17, 2019 15:40
useWhyDidYouUpdate
import { useEffect, useRef } from 'react'
export function useWhyDidYouUpdate(name: string, props: Record<string, any>) {
const latestProps = useRef(props)
useEffect(() => {
const allKeys = Object.keys({ ...latestProps.current, ...props })
const changesObj: Record<string, { from: any; to: any }> = {}
allKeys.forEach(key => {
@brunolemos
brunolemos / aws_console_cloud_shell.sh
Last active December 7, 2022 02:17
Delete all AWS Lambdas (old versions) except $LATEST
lambda_functions=$(aws lambda list-functions | jq -r '.Functions' | jq -c '.[]')
for function in $lambda_functions
do
function_name=$(echo $function | jq -r '.FunctionName')
current_version=$(echo $function | jq -r '.Version')
lambda_versions=$(aws lambda list-versions-by-function --function-name $function_name | jq -r '.Versions' | jq -c '.[]')
for version in $lambda_versions
do
@brunolemos
brunolemos / Xcode Build Phases
Created November 22, 2017 08:23
React Native with Source Maps
# Xcode > Build Phases > Bundle React Native code and images
export NODE_BINARY=node
./react-native-xcode.sh
@brunolemos
brunolemos / linkedin-unfollow-everyone.js
Last active February 3, 2024 05:47
Unfollow everyone on Linkedin
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();