Skip to content

Instantly share code, notes, and snippets.

View sne11ius's full-sized avatar

Cornelius Wichering sne11ius

View GitHub Profile
@dataduke
dataduke / Maps.java
Last active October 11, 2023 19:41
Flatten a nested Map
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Maps {
public static Map<String, Object> asFlattendMap(Map<String, Object> map) {
return map.entrySet().stream()
.flatMap(Maps::flatten)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
@ajaegers
ajaegers / git-move-files-in-subfolder.md
Last active February 17, 2024 13:28
Git: move files in an subfolder keeping history

Change structure of project folder with Git

I have this structure:

 project-folder/
     .git
     wp-admin/
     wp-content/
     wp-includes/

.htaccess

@keki
keki / gist:9261886
Created February 27, 2014 23:25
Scala.xml vs. Jsoup example
//Scala xml -- this is supposed to return a collection of the elements to be modified
(e \ "_").find { child =>
(child \\ "_")
.filter { c =>
!isMedia(c.label)
}
.exists { c =>
c.child.exists { c =>
(singleParagraphs && isMedia(c.label)) || (c.label == "#PCDATA" && isEmpty(c.text))
}
@leon
leon / Grunt.scala
Last active September 3, 2016 02:23
Playframework 2.2 Grunt Runner
import sbt._
import Keys._
import java.net._
import java.io.File
import play.PlayRunHook
/*
Grunt runner should be in project directory to be picked up by sbt
*/
object Grunt {
@phortx
phortx / gist:4059848
Created November 12, 2012 15:02
Java Unicode German Umlaut Escape Sequences
Char Unicode
------------------------------
Ä, ä \u00c4, \u00e4
Ö, ö \u00d6, \u00f6
Ü, ü \u00dc, \u00fc
ß \u00df