Skip to content

Instantly share code, notes, and snippets.

@sazzer
sazzer / i18nextproblem.js
Created Mar 5, 2020
Catch missing message keys in tests using i18next
View i18nextproblem.js
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 Mar 16, 2018
Can Unstateful Containers see each other?
View unstateful containers.js
type LoginProvidersState = {
+loadedState: string,
+providers: {
[key: string]: string
}
};
export class LoginProvidersContainer extends Container<LoginProvidersState> {
state = {
loadedState: PENDING,
View unicorns.java
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 Aug 19, 2012
Loading Groovy scripts as classes at runtime
View gist:3396114
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);
View gist:3316979
{
"title": "My Blog Post",
"author": {
"name": "Graham",
"link": "http://localhost:8080/authors/graham",
"id": "graham"
},
........
}
View badrestblog.json
{
"title": "My Blog Post",
"author": {
"name": "Graham",
"id": "graham"
},
........
}
You can’t perform that action at this time.