This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defp deps do | |
[... | |
{:ueberauth, "~> 0.4"}, | |
{:ueberauth_identity, "~> 0.2"}, | |
...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixUeberauthComeonin.Repo.Migrations.CreateUsers do | |
use Ecto.Migration | |
def change do | |
create table(:users) do | |
add :name, :string | |
add :email, :string | |
add :password, :string | |
timestamps() | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shameless copy from http://learnyousomeerlang.com/buckets-of-sockets | |
defmodule SimpleTcp do | |
def start_server(port) do | |
pid = spawn fn -> | |
{:ok, listen} = :gen_tcp.listen(port, [:binary, {:active, false}]) | |
spawn fn -> acceptor(listen) end | |
:timer.sleep(:infinity) | |
end | |
{:ok, pid} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "foo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule CouchQuery do | |
use GenServer.Behaviour | |
def start_link() do | |
:gen_server.start_link(__MODULE__, [], []) | |
end | |
def set_timeout(pid, timeout) do | |
:gen_server.call(pid, {:set_timeout, timeout}) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Document design: {"_id": "namespace/edf42", ...} | |
fun({Doc}) -> | |
Id = proplists:get_value(<<"_id">>, Doc, null), | |
NameSpace = binary:bin_to_list(Id), | |
case re:split(NameSpace, "[/]") of | |
[_] -> null; | |
[Type, BaseId] -> Emit(Type, BaseId) | |
end | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FortuneTellerMachine | |
WELCOME = "Hola ¿Quiéres saber tu fortuna?" | |
REQUEST = "Fortuna por monedas, yo quiero yo quiero monedas (2): " | |
CHANGE_BACK = "Here is your change" | |
COST = 2 | |
def initialize | |
clear | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FortuneTellerMachine | |
def initialize | |
@coins = 0 | |
end | |
def start | |
puts "Hola ¿Quiéres saber tu fortuna?" | |
@coins += 1 | |
if @coins == 1 | |
puts "necesito otra moneda, yo quiero moneda." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mysqld_safe] | |
socket = /tmp/mysql.sock | |
[server] | |
character_set_server=utf8 | |
collation_server=utf8_unicode_ci | |
skip_character_set_client_handshake | |
default_table_type=innodb | |
transaction-isolation=READ-COMMITTED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by iptables-save v1.4.10 on Sun Apr 22 03:00:29 2012 | |
*filter | |
:INPUT DROP [59:1664] | |
:FORWARD DROP [0:0] | |
:OUTPUT ACCEPT [49:5928] | |
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | |
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT | |
-A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT | |
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT | |
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT |