Skip to content

Instantly share code, notes, and snippets.

package pl.matisoft.soy.example;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@matiwinnetou
matiwinnetou / HttpRequest.java
Last active February 12, 2016 02:25
Dedupe service requests from various pagelets
public class HttpRequest {
private String requestId;
private HttpRequestsCache httpRequestsCache;
public HttpRequest(final HttpRequestsCache httpRequestsCache, final String prefix, final WSRequestHolder holder) {
this.requestId = prefix.concat(":").concat(UUID.randomUUID().toString());
this.httpRequestsCache = httpRequestsCache.addRequest(requestId, holder);
}
@matiwinnetou
matiwinnetou / maven-metadata.xml
Created June 2, 2014 10:58
maven-metadata.xml
<metadata modelVersion="1.1.0">
<groupId>de.mobile.translations</groupId>
<artifactId>mobile-pregenerated-resourcebundles</artifactId>
<version>LATEST-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20140528.150131</timestamp>
<buildNumber>4465</buildNumber>
</snapshot>
<lastUpdated>20140528150131</lastUpdated>
@matiwinnetou
matiwinnetou / MakeModelRefDataClient
Last active July 12, 2016 02:21
Observable to F.Promise adapter
package play;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import play.libs.F;
import play.libs.ws.WS;
import play.libs.ws.WSResponse;
import play.mvc.Http;
import java.util.List;
@matiwinnetou
matiwinnetou / gist:013aa076d99830b7a17d
Created August 17, 2014 10:44
plain old play java promises
public static F.Promise<Result> index6() {
String makesUrl = "http://m.mobile.de/svc/r/makes/Car";
String modelsUrl = "http://m.mobile.de/svc/r/models/375";
F.Promise<SvcApi.Makes> makesP = WS
.url(makesUrl).get()
.map(response -> gson.fromJson(response.getBody(), SvcApi.Makes.class));
F.Promise<SvcApi.Models> modelsP = WS
.url(modelsUrl).get()
### Keybase proof
I hereby claim:
* I am matiwinnetou on github.
* I am matiwinnetou (https://keybase.io/matiwinnetou) on keybase.
* I have a public key whose fingerprint is 83E6 E53B A395 17EB 068B DF91 FF31 7FD1 233E 22C9
To claim this, I am signing this object:
@matiwinnetou
matiwinnetou / advent1.scala
Last active February 25, 2016 20:58
The simplest NON persisted event sourcing on planet earth
//http://adventofcode.com/day/1
object DayOne extends App {
val floorData: String = "(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(()
import org.apache.lucene.analysis.de.GermanAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.search.spell.LuceneDictionary;
import org.apache.lucene.search.spell.SpellChecker;
import org.apache.lucene.search.suggest.Lookup;
import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester;
@matiwinnetou
matiwinnetou / pet-snippet.toml
Last active November 15, 2019 09:35
description
[[snippets]]
description = "ssh inet kokosz"
command = "ssh -A [email protected]"
output = ""
[[snippets]]
description = "git fetch all"
command = "git fetch --all"
output = ""
@matiwinnetou
matiwinnetou / time_lock.ak
Created January 4, 2023 14:34
Aiken's vesting contract
use aiken/hash.{Blake2b_224, Hash}
use aiken/interval.{Finite, Interval, IntervalBound}
use aiken/list
use aiken/transaction.{ScriptContext, Spend, ValidityRange}
use aiken/transaction/credential.{VerificationKey}
type POSIXTime =
Int
type PubKeyHash =