// See https://runkit.com/snekse/yup-tests-string-defined/1.0.0
// and https://runkit.com/snekse/yup-tests-string-defined/2.0.0
yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]);
// If we want to allow nulls, just add `.nullable(true)`
const schema = yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]);
console.log(schema.isValidSync(""));
This file contains hidden or 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
[alias] | |
######################################## | |
# Config commands | |
######################################## | |
editConfig = "!code ~/.gitconfig" | |
# setAuthor "Firstname Lastname" "[email protected]" | |
setAuthor = "!f(){ git config user.name $1 && git config user.email $2; }; f" |
This file contains hidden or 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
# It's better to unpack these files and commit the raw source because | |
# git has its own built in compression methods. | |
*.7z | |
*.jar | |
*.rar | |
*.zip | |
*.gz | |
*.bzip | |
*.bz2 | |
*.xz |
This file contains hidden or 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
package com.snekse.java.utils | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.function.Function; | |
import java.util.stream.Collectors; | |
public class CollectionStreamUtil { | |
public static <T, R> List<R> mapToList(Collection<T> i, Function<T, R> f) { | |
return i.stream().map(f).collect(Collectors.toList()); |
This file contains hidden or 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
const convertDataAttributes = dataAttributes => | |
Object.entries(dataAttributes) | |
.filter(([k, v]) => k.startsWith("data-")) | |
.reduce((acc, [k, v]) => { | |
const newKey = k.slice(5); //`data-` length | |
acc[newKey] = v; | |
return acc; | |
}, {}); |
This file contains hidden or 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
// See https://runkit.com/snekse/yup-tests-string-defined | |
yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]); | |
// If we want to allow nulls, just add `.nullable(true)` | |
const schema = yup.string().min(0).strict(true).nullable(true).notOneOf([undefined]); | |
console.log(schema.isValidSync("")); |
This file contains hidden or 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
/* eslint-disable no-console */ | |
const CHECK = "CHECK"; | |
const WHEN = "WHEN"; | |
const THEN = "THEN"; | |
const DEFAULT_INDENT = " "; | |
const DEFAULT_STEP_PAUSE = 50; | |
const DEFAULT_LOG_VALUE_MSG_FORMATTER_FN = (selector, result) => | |
`${DEFAULT_INDENT}${selector} value is "${result.value}" |
This file contains hidden or 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
//All of the fancy annotations are mostly here if you want to generate the DDL via Hibernate | |
@Size(min = 10) // If you want to limit the max size of the array | |
@ElementCollection(fetch = FetchType.EAGER) | |
@CollectionTable(name = 'IssueRequestor', joinColumns = [@JoinColumn(name = 'IssueID')], | |
uniqueConstraints = [ @UniqueConstraint(name = 'IssueRequestor_uc_issueId_requestor', | |
columnNames = ['IssueID', 'requestor'])]) | |
@Column(name = 'requestor', length = 150) | |
Set<String> requestors = [] |
In Hibernate 5+ a change was made that requires an alternative naming strategy otherwise the name attribute on the Column annotation is ignored.
See
spring-projects/spring-boot#6264 (comment) https://stackoverflow.com/a/38875123/378151
This file contains hidden or 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
@TestConfiguration | |
class IntegrationTestMockingConfig { | |
private DetachedMockFactory factory = new DetachedMockFactory() | |
@Bean | |
ExternalRankingService externalRankingService() { | |
factory.Mock(ExternalRankingService) | |
} | |
} |
NewerOlder