sudo apt-get update
sudo apt-get install git-core python-software-properties software-properties-common
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
/* Requirements install git and curl */ | |
/* installing rbenv */ | |
curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash | |
/* add this instead of generated stuff "PREPEND" the echo wordings to ~/.profile */ | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile | |
echo 'eval "$(rbenv init -)"' >> ~/.profile |
In the controller action
change_img_params(params[:background_image])
def change_img_params(img)
begin
Base64.decode64(params[:user][img])
if params[:user][img]
params[:user][img] = file_decode(params[:user][img].split(',')[1],
params[:user][:screen_name] )
#= Bouncers.Bouncer.check_entry(conn, %MyApp.User{}) | |
#=> true | |
defmodule Bouncers.Bouncer do | |
alias Bouncers.Areas | |
def check_entry(conn, resource) do | |
verify(resource, conn.path_info) | |
end |
defmodule Parser do | |
require Record | |
Record.defrecord :xmlElement, Record.extract(:xmlElement, from_lib: "xmerl/include/xmerl.hrl") | |
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl") | |
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl") | |
def run(xml) do | |
run(xml, '//response') | |
end |
defmodule Runlength do | |
def encode(<< first :: binary-size(1) , rest :: binary>>) do | |
encode({first, 1}, rest, "") | |
end | |
def encode({letter, count}, << letter :: binary-size(1) , rest :: binary>>, result) do | |
encode({letter, count + 1}, rest, result) | |
end | |
def encode({letter, count}, << diff :: binary-size(1) , rest :: binary>>, result) do | |
result = result <> to_string(count) <> letter |
defmodule Palindrome do | |
def check(<< first :: binary-size(1), rest :: binary >> = actual) do | |
check(first, rest, actual) | |
end | |
def check(newstr, << next_letter :: binary-size(1), rest :: binary >>, actual) do | |
check(next_letter <> newstr, rest, actual) | |
end | |
def check(reverse, <<>>, actual), do: reverse === actual |
defmodule Any do | |
def remove(str, char) do | |
remove("", str, char) | |
end | |
def remove(newstr, << char :: binary-size(1), rest :: binary >>, char) do | |
remove(newstr, rest, char) | |
end | |
def remove(newstr, << first :: binary-size(1), rest :: binary >>, char) do | |
remove(newstr <> first, rest, char) | |
end |