This file contains 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
Random random = new Random(System.currentTimeMillis()); | |
random.doubles().limit(10).forEach(x -> { | |
// hogehoge | |
}); |
This file contains 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
public static Map<LocalDate, Integer> summarizePeriodsOld(final List<Bike> bikes, final Predicate<Map.Entry<LocalDate, Integer>> entryFilter) { | |
return bikes.stream() | |
.filter(Bike::hasMilages) | |
.flatMap(bike -> bike.getPeriods().entrySet().stream()) | |
.filter(Optional.ofNullable(entryFilter).orElse(entry -> true)) | |
.collect( | |
HashMap::new, | |
(map, period) -> { | |
map.merge(period.getKey(), period.getValue(), (val1, val2) -> val1 + val2); | |
}, |
This file contains 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
public static Map<LocalDate, Integer> summarizePeriods(final List<Bike> bikes, final Predicate<Map.Entry<LocalDate, Integer>> entryFilter) { | |
return bikes.stream() | |
.filter(Bike::hasMilages) | |
.flatMap(bike -> bike.getPeriods().entrySet().stream()) | |
.filter(Optional.ofNullable(entryFilter).orElse(entry -> true)) | |
.collect( | |
Collectors.groupingBy( | |
Map.Entry::getKey, | |
Collectors.reducing(0, Map.Entry::getValue, Integer::sum) | |
) |
This file contains 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
List<String> converted = Files.lines(file, StandardCharsets.UTF_8) | |
.map(line -> line.replace("<credentialsId>oldID</credentialsId>", "<credentialsId>newID</credentialsId>")) | |
.collect(Collectors.toList()); |
This file contains 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 ac.simons.utils; | |
import java.util.Comparator; | |
/** | |
* @author michael.simons, 2011-02-15 | |
*/ | |
public class ExtendedAntPathMatcher implements PathMatcher { | |
private final AntPathMatcher delegate = new AntPathMatcher(); |
This file contains 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
<?php | |
/* | |
Plugin Name: Enable dailyfratze.de oEmbed | |
Description: Enables automatic embedding of pictures from dailyfratze.de through oEmbed | |
Author: Michael Simons | |
Version: 1.0 | |
Author URI: http://michael-simons.eu | |
*/ | |
// Profile | |
wp_oembed_add_provider('#https?://dailyfratze\.(?:de|com)/([a-z]+\w*)#i', 'https://dailyfratze.de/app/oembed.json', true); |
This file contains 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
<?php | |
/* | |
Plugin Name: Enable Twitter oEmbed | |
Description: Enables automatic embedding of twitter updates through oembed | |
Author: Michael Simons | |
Version: 1.0 | |
Author URI: http://michael-simons.eu | |
*/ | |
wp_oembed_add_provider('#https?://twitter.com/\#!/[a-z0-9_]{1,20}/status/\d+#i', 'https://api.twitter.com/1/statuses/oembed.json', true); | |
?> |
This file contains 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 de.enerko.ensupply.config; | |
import org.jooq.ConnectionProvider; | |
import org.jooq.ExecuteListenerProvider; | |
import org.jooq.SQLDialect; | |
import org.jooq.TransactionProvider; | |
import org.jooq.impl.DefaultConfiguration; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.jooq.RecordMapperProvider; |
This file contains 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
mysqldump -uroot -pblah --opt --routines --add-drop-database --default-character-set=utf8 --create-options --databases db1 db2 usw | bzip2 > backup.sql.bz2 |
This file contains 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
/* | |
* FancyBox - jQuery Plugin | |
* Simple and fancy lightbox alternative | |
* | |
* Examples and documentation at: http://fancybox.net | |
* | |
* Copyright (c) 2008 - 2010 Janis Skarnelis | |
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. | |
* | |
* Version: 1.3.4 (11/11/2010) |
OlderNewer