Skip to content

Instantly share code, notes, and snippets.


Johan Hallstensson behe

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 / fizzbuzz.exs
Last active Aug 29, 2015
FizzBuzz in Elixir
View fizzbuzz.exs
defmodule FizzBuzz do
def up_to(n) do
|> Enum.to_list
|> Enum.join " "
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.