Skip to content

Instantly share code, notes, and snippets.

View eninja's full-sized avatar

Sebastian Żołnowski eninja

View GitHub Profile
package pl.app;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
@eninja
eninja / observerAttributeChange
Last active October 18, 2018 08:54
I had script which replace Edit Icon with custom image, but it didn't work in SharePoint until group is expanded (html of tbody is loaded after it), so I need to use MutationObserver and create it's weaker version for this browsers which didnt support it.
var siteUrl = "http://www.example.com/";
function SetEditFieldIcon() {
var imageUrl = siteUrl + 'styles/img/edit.png';
$("img[src*='edititem.gif'][alt='edit']").attr('src', imageUrl);
}
function createObserverForBrowser() {
if (IsBrowserSupportMutationObserver()) {
ObserverEditFieldIconForModernBrowsers();
} else {
@eninja
eninja / getUniqueEmailsUsingFor.java
Last active June 12, 2018 12:10
From List<Person> (when Person has String fields: name, surname, email) return emails with only one occurence
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class UtilEmail {
public Set<String> getEmailsWithOneOccurence(List<Person> people) {
List<String> emails = people.stream().map(Person::getEmail).collect(Collectors.toList());
Set<String> emailsUnique = new HashSet<>();