This file contains hidden or 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
import java.util.function.Supplier; | |
public class NullSafeUtils { | |
public static <T> T nullSafeGet(Supplier<T> supplier){ | |
try{ | |
return supplier.get(); | |
}catch (NullPointerException npe){ | |
return null; |
This file contains hidden or 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
import org.axonframework.commandhandling.CommandCallback; | |
import org.axonframework.commandhandling.gateway.CommandGateway; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import rx.Observable; | |
import rx.Single; | |
import rx.Subscriber; | |
public class DefaultObservableCommandGateway implements ObservableCommandGateway { |
This file contains hidden or 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
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; | |
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity; | |
import org.springframework.data.elasticsearch.core.query.DeleteQuery; | |
import org.springframework.test.context.TestContext; | |
import org.springframework.test.context.support.AbstractTestExecutionListener; | |
import java.util.Collection; | |
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; |
This file contains hidden or 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
module Main where | |
allEvenWithRecursion :: [Integer] -> [Integer] | |
allEvenWithRecursion [] = [] | |
allEvenWithRecursion (h:t) = if even h then h:allEvenWithRecursion t else allEvenWithRecursion t | |
allEvenWithListComprehension :: [Integer] -> [Integer] | |
allEvenWithListComprehension (numbers) = [x | x <- numbers , even x ] | |
allEvenWithFilter:: [Integer] -> [Integer] | |
allEvenWithFilter = filter even |
This file contains hidden or 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
import com.thoughtworks.qdox.JavaDocBuilder | |
import com.thoughtworks.qdox.model.JavaClass | |
import com.thoughtworks.qdox.model.Type | |
import com.thoughtworks.qdox.model.JavaField | |
import com.thoughtworks.qdox.model.JavaMethod | |
import com.thoughtworks.qdox.model.JavaSource | |
import groovy.text.SimpleTemplateEngine | |
import org.apache.commons.io.FileUtils | |
JavaDocBuilder builder = new JavaDocBuilder(); |
This file contains hidden or 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
(defn ceasarEncodeChar [char, shift] (nth infAlphabetSeq (+ shift (indexInAlphabet char) ))) | |
(defrecord CeasarCipher [shift] Cipher | |
(encode [c, message] (reduce str (map #(ceasarEncodeChar %1 shift) message ))) | |
) | |
(def ceasar1 (CeasarCipher. 3)) |
This file contains hidden or 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
(def accounts (ref [])) | |
(defn openaccount [] (dosync (alter accounts conj 0))) | |
(defn debit [ accountnr debitammount] (dosync (alter accounts #(assoc %1 accountnr (- (get %1 accountnr) debitammount))))) | |
(defn credit [ accountnr creditammount] (dosync (alter accounts #(assoc %1 accountnr (+ creditammount (get %1 accountnr) ))))) | |
(openaccount) | |
(println @accounts) | |
(credit 0 100) | |
(println @accounts) |
This file contains hidden or 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
(defn ceasarEncodeChar [char, shift] (nth infAlphabetSeq (+ shift (indexInAlphabet char) ))) | |
(defrecord CeasarCipher [shift] Cipher | |
(encode [c, message] (reduce str (map #(ceasarEncodeChar %1 shift) message ))) | |
) | |
(def ceasar1 (CeasarCipher. 3)) |
This file contains hidden or 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
(defn big [str,n] (> (count str) n)) |
This file contains hidden or 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
-module(doctor). | |
-behaviour(supervisor). | |
-export([start/0]). | |
-export([init/1]). | |
start() -> | |
supervisor:start_link({local, doctor}, doctor, []). | |
init(_Args) -> |
NewerOlder