Skip to content

Instantly share code, notes, and snippets.

View mvelebit's full-sized avatar
🌊
Look upon my works, ye mighty, and despair

Milan Velebit mvelebit

🌊
Look upon my works, ye mighty, and despair
  • Belgrade, Serbia
View GitHub Profile
@mvelebit
mvelebit / fizzbuzz.ex
Last active September 11, 2019 17:49
A (somewhat) ugly but flexible solution to the fizzbuzz problem in Elixir
defmodule FizzBuzz do
@default_map %{3 => "Fizz", 5 => "Buzz"}
@default_range_size 100
def go() do
go(@default_map, @default_range_size)
end
def go(map, range_size)
when is_map(map)
@mvelebit
mvelebit / ChickenCase.scala
Created October 17, 2019 15:06
Convert normal text into that succulent SpongeBob chicken meme format
def toChickenCase(text: Seq[Char], soFar: List[Char] = List.empty, wasLastUpper: Boolean = false): String = text.toList match {
case h :: t =>
val shouldUpper = !wasLastUpper
val newList = if (shouldUpper) soFar :+ Character.toUpperCase(h) else soFar :+ h
toChickenCase(t, newList, shouldUpper)
case _ => soFar.mkString
}
toChickenCase("Our engineers have reviewed your code and they deemed it unworthy.")