Skip to content

Instantly share code, notes, and snippets.

@werand
werand / HexDump.java
Created September 21, 2018 12:07
HexDump Java-Class
import java.util.AbstractList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class HexDump
{
private static final int _16 = 16;
private static class ByteList extends AbstractList<Integer>
(ns hex.core)
;;
;; Decode hex numbers - kata
;;
(defn decimal-value [n]
(or
(get {\0 0 \1 1 \2 2 \3 3 \4 4 \5 5 \6 6 \7 7 \8 8 \9 9 \a 10 \b 11 \c 12 \d 13 \e 14 \f 15} n)
(throw (Exception. (str "Invalid number: " n)))))
(ns diamond.core)
;;
;; Diamond kata
;;
(def alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
(def blanks-d (iterate #(str %1 "-") ""))
(defn blanks [n] (nth blanks-d n))
/**
* Solution for the java puzzle from http://zeroturnaround.com/fun/magical-java-puzzle-pat-the-unicorns/
*/
public class Unicorn {
private static int currentLine = 0;
public static boolean pat() {
int line = getExecutionLineFromMagicalLand();
@werand
werand / birthday.clj
Created April 14, 2012 19:27
Date calculations concerning my bday and easter
;; The content for the project.clj
#_(defproject datetest "1.0.0-SNAPSHOT"
:description "Some date calculations"
:dependencies [[clj-time "0.3.5"]
[org.clojure/clojure "1.3.0"]
[org.clojure/math.numeric-tower "0.0.1"]])
(ns test.date
(:use clojure.math.numeric-tower)
(:refer-clojure :exclude (extend))
@werand
werand / REPL_Beispiele.clj
Created February 8, 2011 08:07
Beispiele
;; Beispiele für die REPL
(+ 2 2)
; Listen
'(1 2 3 4 5 "ksdjksdfjkjsdf")
; Vektoren
[1 2 3 4 5]
@werand
werand / abc.csv
Created February 7, 2011 20:03
Learning Clojure
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Dies ist ein aTest;;2;3;4;5;6;7;2
Dies ist ein bTest;1;2;3;4;5;6;7;2
Dies ist ein cTest;1;2;3;4;5;6;7;2
Dies ist ein dTest;1;2;3;4;5;6;7;2
Dies ist ein eTest;1;2;3;4;5;6;7;2
Dies ist ein fTest;1;2;3;4;5;6;7;2
Dies ist ein gTest;1;2;3;4;5;6;7;2
Dies ist ein hTest;1;2;3;4;5;6;7;2
Dies ist ein iTest;1;2;3;4;5;6;7;2
Dies ist ein jTest;;2;3;4;5;6;7;2