Skip to content

Instantly share code, notes, and snippets.

View MSch's full-sized avatar

Martin Schürrer MSch

View GitHub Profile
@MSch
MSch / dup_bench.exs
Last active August 29, 2015 14:04 — forked from alco/dup_bench.exs
Benchfella.start duration: 1.0#, format: :machine
defmodule StringDuplicateBench do
use Benchfella
@iterations [100, 1000, 10000, 100000]
Enum.each(@iterations, fn n ->
@str "1234567890"
@n n
@MSch
MSch / stem.ex
Last active August 29, 2015 14:02 — forked from avgerin0s/stem.ex
defmodule Stemmer do
def stem(word) do
IO.puts "stemming #{word}"
case Regex.run(~r/^(.+?)(ASD|QWE)$/u, word) do
[pattern_matching, like, "ASD"] -> IO.inspect like
[pattern_matching, like, "QWE"] -> IO.puts "whatever"
end
end
end
defmodule Mix.TasksServer do
@moduledoc false
use GenServer.Behaviour
def start_link() do
:gen_server.start_link({ :local, __MODULE__ }, __MODULE__, :ok, [])
end
def clear_tasks() do
call :clear_tasks