Skip to content

Instantly share code, notes, and snippets.

View dodadoa's full-sized avatar
🧠
brain

Wasawat Somno dodadoa

🧠
brain
View GitHub Profile
d1
$ degradeBy (0.25)
$ plyWith 4 (|* speed 1.2)
$ s "~ hh*2"
# sustain 0.2
# room 0.5 # size 0.7
# pan rand
# gain 1.15
d5
import Data.List
hangman :: [Char] -> [Char] -> Bool
hangman sw lc = sw == (sw `intersect` lc)
defmodule ElixirChallenge do
def transform(data) do
data
|> Map.to_list()
|> Enum.reverse()
|> Enum.reduce(
[],
fn {_, listOfElement}, accumulator ->
if accumulator == [] do
accumulator ++ listOfElement
module Shape
( area
, perimeter
, maxArea
, maxPerimeter
, max
, Shape (Circle, Rectangle, Square)
) where
data Shape = Circle Float | Rectangle Float Float | Square Float deriving(Show)
module MarsRovers
( Direction (North, East, West, South)
, Rotation (CounterClockWise, ClockWise)
, Position
, Rover
, Plateau
, Command
, Commands
, move
, turn
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.function.Function;
class Teddy {
private final String name;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
class Box<T> {
List<T> l;
Box(List<T> l){
class Box<T> {
List<T> l;
Box(List<T> l){
this.l = l;
}
public <E> Box<E> map(Function<? super T, ? extends E> f){
List<E> result = new ArrayList<>();
for(int i = 0; i < this.l.size(); i++){
(defn build-new-ds [result ds]
(if (empty? ds)
result
(let [province (get (first ds) :province)
amphoe (get (first ds) :amphoe)
district (get (first ds) :district)]
(if (contains? result province)
(recur
(assoc result province
(assoc (province result) amphoe
@dodadoa
dodadoa / clojure-cipher-katas.clj
Last active October 14, 2017 20:05
code katas - Clojure Cipher
(def init-key (vec (map str "abcdefghijklmnopqrstuvwxyz")))
(defn fill-up-keyword [keyword message]
(apply str
(take (count message) (apply str
(repeat (count message) keyword)))))
(defn get-char-encode [a b]
(nth init-key
(mod (+