Skip to content

Instantly share code, notes, and snippets.

Johan Hallstensson behe

Block or report user

Report or block behe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gc_count.exs
defmodule ATGCCount do
def count(sequence), do: cnt(String.to_char_list(sequence),0,0)
def cnt([65|t],at,gc), do: cnt(t,at+1,gc)
def cnt([84|t],at,gc), do: cnt(t,at+1,gc)
def cnt([71|t],at,gc), do: cnt(t,at,gc+1)
def cnt([67|t],at,gc), do: cnt(t,at,gc+1)
def cnt([62|_],at,gc), do: {at,gc}
def cnt([],at,gc), do: {at,gc}
# def cnt(_,0,0), do: {0,0}
def cnt([_|t], at, gc), do: cnt(t,at,gc)
@behe
behe / fizzbuzz.exs
Last active Aug 29, 2015
FizzBuzz in Elixir
View fizzbuzz.exs
"""
http://elixirquiz.github.io/2014-08-11-fizzbuzz.html
"""
defmodule FizzBuzz do
def up_to(n) do
1..n
|> Enum.to_list
|> Enum.map(&transform/1)
|> Enum.join " "
end
@behe
behe / gist:2145979
Created Mar 21, 2012
Reload .rvmrc after git checkout
View gist:2145979
# Put this is your .profile, .bashrc or similar to automatically reload your .rvmrc after git checkouts
git() { command git "$@" ; if [[ "$@" == *checkout* ]]; then [[ -s .rvmrc ]] && . .rvmrc; fi }
You can’t perform that action at this time.