mkdir passport-local
npm init
# Use default values for npm init prompts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tetris Move | |
Have the function TetrisMove(strArr) take strArr parameter being passed | |
which will be an array containing one letter followed by 12 numbers | |
representing a Tetris piece followed by the fill levels for the 12 columns | |
of the board. | |
Calculate the greatest number of horizontal lines that can be completed | |
when the piece arrives at the bottom assuming it is dropped immediately | |
after being rotated and moved horizontally from the top. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Answers: | |
1 - React is not being imported | |
2 - When calling setData at line 11 was overring the existing profile | |
3 - userEffect was watching at setData instead of data | |
4 - Suspense was being called without fallback with is required | |
Extras (Improviments): | |
1 - Considering that UserProfileList is the main component from the respective file | |
was added export default to be used externaly | |
2 - Calling SuspensefulUserProfile was changed from manually calling 3 to mapping a array with ids and interating them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, createContext, useContext } from 'react'; | |
import ReactDOM from 'react-dom'; | |
// useForm | |
const useForm = (callback) => { | |
const [formValues, setFormValues] = useState([]); | |
const [loading, setLoading] = useState(false); | |
const handleChange = (event) => { | |
const auxValues = { ...formValues }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Os campos filtrados dessa versão são do tipo inteiro ou decimal | |
Parametros: | |
1 - Queryset: Qual queryset deseja filtrar | |
2 - Coluna(String): Nome da coluna no qual deseja aplicar o filtro | |
3 - Filtro(String): String com o valor no qual deseja filtrar | |
- Menor ou Igual - "-<valor>" | Exemplo: "-250" | |
- Entre (Between) - "<valor>~<valor>" | Exemplo: "250~350" | |
- Maior ou igual - "+<valor>" | Exemplo: "+15" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Obs1: m2m_changed never trigger the remove signal (pre_remove, post_remove) when deleted, so this ways you can force he do it | |
obs2: Since the pre_clear data will be removed anyways to new valuei n post_add add it again and when you fully remove data | |
the add events wont be trigger, so this solution will simule the exacly action the m2m_changed should do | |
''' | |
class OtherModel(model.Models) | |
pass | |
class MyModel(model.Models): | |
m2m_attribute = models.ManyToManyField(OtherModel,related_name='other_model', blank=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Pequeno script para pegar 100 valores aleatorios entre as strings"HAS","Has","has","DM","Dm" | |
pool <- c("HAS","Has","has","DM","Dm") | |
index <- sample(1:5,100,replace=T) #Amostra de 100 valores entre 1 e 5 | |
comorb <- character(length=100) #Declara variavel comorb | |
#For loop para selecionar um item da lista conforme numero aleatorio sorteado | |
for (i in 1:100){ | |
comorb[i] <- pool[index[i]] | |
} | |
id <- seq(1:100) #Identificacao para cada caso |