Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
View GitHub Profile
View ToUpperCaseInTurkeyLocaleTests.java
package de.tutorials.training.testing;
import static org.junit.Assert.*;
import java.util.Locale;
import org.junit.Test;
public class ToUpperCaseInTurkeyLocaleTests {
View PartTree.java
//In org.springframework.data.repository.query.parser.
private static final Pattern PREFIX_TEMPLATE = Pattern
.compile("^(find|read|get|count)((\\p{Lu}|\\P{M}\\p{M}*+).*?)??By");
private static final String KEYWORD_TEMPLATE = "(%s)(?=(\\p{Lu}|\\P{M}\\p{M}*+))";
@thomasdarimont
thomasdarimont / AnnotationMixin.java
Created Oct 29, 2013
Prototype of @AnnotationMixing Feature for ProjectLombok
View AnnotationMixin.java
package lombok.experimental;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface AnnotationMixin {
@thomasdarimont
thomasdarimont / LambdaPi.java
Last active Dec 27, 2015
Approximate PI in almost one line with Lambdas in Java 8 :) - Theory here: http://www.stealthcopter.com/blog/2009/09/python-calculating-pi-using-random-numbers/
View LambdaPi.java
package de.tutorials.training.java8.lambda;
import java.util.stream.IntStream;
import static java.lang.Math.*;
import static java.util.concurrent.ThreadLocalRandom.*;
/**
* Author: Thomas Darimont
*/
View MongoDbJavaDriverAuthTests.java
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View CustomMongoRepository.java
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@thomasdarimont
thomasdarimont / QueryMapperUnitTests.java
Last active Jan 4, 2016
Prototypic test case for the race condition in DATAMONGO-686
View QueryMapperUnitTests.java
/**
* @see DATAMONGO-686
*/
@SuppressWarnings("serial")
@Test
public void thereShouldBeNoRaceConditionWhenReusingQueryFromMultipleThreads() throws Exception {
Query query = new Query().addCriteria(where("_id").in("42"));
final CountDownLatch latch = new CountDownLatch(1);
View 1_SpringJunit4RunnerRuleTests.java
package de.jugsaar.meeting8.testing.junit.poc;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
@thomasdarimont
thomasdarimont / gist:10669696
Last active Mar 29, 2020 — forked from debasishg/gist:8172796
Sketching Data Structures
View gist:10669696
  1. General Background and Overview
@thomasdarimont
thomasdarimont / FalseSharingDemo.cs
Last active Aug 29, 2015
C# FalseSharingEffects
View FalseSharingDemo.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConcurrencyExamples
{
You can’t perform that action at this time.