Skip to content

Instantly share code, notes, and snippets.

View alvieirajr's full-sized avatar

Antônio Vieira alvieirajr

  • Brazil, Recife
View GitHub Profile
@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() {
//
// ContentView.swift
// AnimationTimingCurve
//
// Created by Chris Eidhof on 25.09.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
@StephanHoyer
StephanHoyer / gist:bddccd9e159828867d2a
Last active March 29, 2022 11:46
Isomorphic applications with mithril

Attention

This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.

The example is updated with the current version of mithril, though.

Isomorphic applications with mithril

@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```
@andypols
andypols / ntlm.js
Created May 3, 2013 19:37
Javascript to create the type1, type3 messages you need to communicate with an ntlm server. I used this to talk to a NTLM enabled windows server from a node.js application.
var url = require('url');
var crypto = require('crypto');
/*
NTLM PROCESS FOR GET REQUESTS:
==============================
STEP 1: The Client requests a protected resource from the server
STEP 2: The Server responds with a 401 status, with a header indicating that the client must authenticate
STEP 3: The Client resubmits the request with an Authorization header containing a Base-64 encoded Type 1 message. From this point forward, the connection is kept open; closing the connection requires reauthentication of subsequent requests.