Skip to content

Instantly share code, notes, and snippets.

@sazzer
sazzer / i18nextproblem.js
Created March 5, 2020 14:09
Catch missing message keys in tests using i18next
import LanguageDetector from "i18next-browser-languagedetector";
import defaultTranslations from "./messages.json";
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: {
@sazzer
sazzer / unstateful containers.js
Created March 16, 2018 17:16
Can Unstateful Containers see each other?
type LoginProvidersState = {
+loadedState: string,
+providers: {
[key: string]: string
}
};
export class LoginProvidersContainer extends Container<LoginProvidersState> {
state = {
loadedState: PENDING,
9 5 1
4 3 8
2 7 6
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Unicorns {
@Test
public void patUnicorns() {
@sazzer
sazzer / gist:3396114
Created August 19, 2012 16:41
Loading Groovy scripts as classes at runtime
public class GroovyClassloaderTest {
@Test
public void loadGroovyScript() throws Exception {
CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
compilerConfiguration.setClasspath("/base/directory/containing/groovy/files");
GroovyClassLoader gcl = new GroovyClassLoader(getClass().getClassLoader(), compilerConfiguration);
Class<?> cls = gcl.loadClass("SampleClass", true, true, true);
{
"title": "My Blog Post",
"author": {
"name": "Graham",
"link": "http://localhost:8080/authors/graham",
"id": "graham"
},
........
}
{
"title": "My Blog Post",
"author": {
"name": "Graham",
"id": "graham"
},
........
}