Skip to content

Instantly share code, notes, and snippets.

View LucasPLopes's full-sized avatar

Lucas Lopes Pereira LucasPLopes

View GitHub Profile
@gbzarelli
gbzarelli / mongo-docker-compose.yml
Last active February 29, 2024 17:24
Initializing mongo db in docker-compose with init script
version: '3.8'
services:
# Database - Mongo DB
mongo:
image: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: helpdev
MONGO_INITDB_ROOT_PASSWORD: 123456
@rponte
rponte / BeanValidationConfig.java
Last active December 27, 2021 20:33
Spring Boot: integrating Bean Validation between Spring and Hibernate (supporting DI on custom validations with Hibernate)
@Configuration
public class BeanValidationConfig {
/**
* The idea here is to configure Hibernate to use the same ValidatorFactory used by Spring,
* so that Hibernate will be able to handle custom validations that need to use dependency injection (DI)
*/
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer(final Validator validator) {
return new HibernatePropertiesCustomizer() {

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@lienista
lienista / practice-precendence-rule.js
Created October 23, 2018 02:11
(Algorithms in Javascript) Practice. A precedence rule is given as "P>E", which means that letter "P" is followed by letter "E". Write a function, given an array of precedence rules, that finds the word represented by the given rules. Note: Each represented word contains a set of unique characters, i.e. the word does not contain duplicate letters.
/*
we create 2 separate arrays of letters and count
the number of characters resulting from the
original precedence array.
we look up the index of each letter from first letter
array and follow the index of the next letter.
*/
function findWord(a){
console.log(a);