Skip to content

Instantly share code, notes, and snippets.

View AndreiCalazans's full-sized avatar
🏠
Working from home

Andrei Xavier de Oliveira Calazans AndreiCalazans

🏠
Working from home
View GitHub Profile
@chanan
chanan / auth.server.js
Created December 21, 2021 21:55
Cognito authentication method for Remix
import { redirect, createCookie } from "remix";
const sessionSecret = process.env.SESSION_SECRET;
const cognitoDomain = process.env.COGNITO_DOMAIN;
const clientId = process.env.CLIENT_ID;
if (!sessionSecret) {
throw new Error("SESSION_SECRET must be set");
}
if (!cognitoDomain) {
throw new Error("COGNITO_DOMAIN must be set");
@sibelius
sibelius / learning-path-web3.md
Last active January 8, 2024 19:16
Learning Path Web3
  • learn blockchain concepts
  • learn ethereum
  • learn how to use metamask
  • learn how to use hardhat (https://hardhat.org/)
  • learn how to deploy and interact with a smart contract
  • learn common smart contract standards like ERC20 (token), ERC721 (nft), ERC1155 (opensea)
  • learn ipfs
  • learn how to read blockchain explorers like https://etherscan.io/
  • learn how to use web3 and etherjs
  • learn solidity
@karlhorky
karlhorky / try-catch.ts
Last active October 19, 2022 23:43
Try-catch helper for promises and async/await
export default async function tryCatch<Data>(
promise: Promise<Data>,
): Promise<{ error: Error } | { data: Data }> {
try {
return { data: await promise };
} catch (error) {
return { error };
}
}
@tobi
tobi / kindle.rb
Last active September 25, 2022 02:37
Download your Kindle Highlights to local markdown files. Great for Obsidian.md.
#!/usr/bin/env ruby
# gem install active_support
require 'active_support/inflector'
require 'active_support/core_ext/string'
# gem install webrick (only ruby3)
require 'webrick'
# gem install mechanize
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@felippepuhle
felippepuhle / Player.tsx
Created November 13, 2020 13:22
ant media web player
import React, { useRef, useState, useCallback, useEffect, memo } from 'react'
import styled from 'styled-components'
import { MEDIA } from 'src/styles'
import {
AntMediaCommands,
AntMediaTakeConfigurationType,
AntMediaTakeConfigurationSignal,
AntMediaTakeCandidateSignal,
@jgcmarins
jgcmarins / RazzleStack.ts
Last active January 20, 2021 19:21
Deploy Razzle Apps to AWS Lambda using AWS CDK (https://aws.amazon.com/cdk/)
import * as CDK from '@aws-cdk/core';
import * as S3 from '@aws-cdk/aws-s3';
import * as S3Deployment from '@aws-cdk/aws-s3-deployment';
import * as Lambda from '@aws-cdk/aws-lambda';
import * as APIGateway from '@aws-cdk/aws-apigateway';
import * as SSM from '@aws-cdk/aws-ssm';
import * as SecretsManager from '@aws-cdk/aws-secretsmanager';
import { ConfigProps, getParam, ModeStack } from './helpers';
@jgcmarins
jgcmarins / babel.config.js
Created April 24, 2020 23:37
Webpack configs for Node.js backends to run both locally and on AWS Lambda
module.exports = {
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},

[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

@tcodes0
tcodes0 / react-native-0.62-upgrade-tips.txt
Last active March 31, 2020 12:17
react-native 0.62 upgrade tips
BLOCKERS:
If you use react-native-fbads, it doesn't build on android 0.62.
Either wait fix or remove.
I've openned an issue already: https://github.com/callstack/react-native-fbads/issues/244
Some libs are also giving the Error "Super expression must either be null or a function"
You should open an issue and look for a PR that fixes it, or fix it yourself.
Example of a PR fixing this issue: https://github.com/expo/react-native-action-sheet/pull/162
To install a dep from a github PR, add to package.json: