Skip to content

Instantly share code, notes, and snippets.

Diego Vinicius Diegow3b

Block or report user

Report or block Diegow3b

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Diegow3b
Diegow3b / express-passport-local.md
Created Mar 15, 2017 — forked from phalkunz/express-passport-local.md
Setup local (username/password) authentication in express.js (using passport.js)
View express-passport-local.md

Setup the project folder

    mkdir passport-local
    npm init
    # Use default values for npm init prompts

Install required packages

@Diegow3b
Diegow3b / filtro_dinamico.py
Created Dec 27, 2016
Filtros de Queryset com Colunas Dinamicas - Dinamic Column Filter
View filtro_dinamico.py
'''
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"
@Diegow3b
Diegow3b / views.py
Last active Sep 29, 2016
Turning arround m2m_changed bug in admin from Django 1.8
View views.py
'''
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)
View gist:43743af3f6a685870732a94d99450d55
#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
You can’t perform that action at this time.