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
| add_subscription(user, subscription) | |
| def add_subscription(%User{subscription: nil} = user, subscription) do | |
| #Add subscription here using user | |
| end | |
| def add_subscription(_user, _subscription) do | |
| raise "This user already has a subscription" | |
| 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
| add_subscription(user, subscription) | |
| def add_subscription(%User{subscription: nil}, subscription) do | |
| #Add subscription here | |
| end | |
| def add_subscription(_user, _subscription) do | |
| raise "This user already has a subscription" | |
| 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
| defmodule Fib do | |
| def fib(0), do: 0 | |
| def fib(1), do: 1 | |
| def fib(n), do: fib(n-1) + fib(n-2) | |
| 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
| def fib(num) | |
| return 0 if num == 0 | |
| return 1 if num == 1 | |
| return fib(num - 1) + fib(num - 2) | |
| 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
| alias Rebirth.Subscription | |
| alias Ecto.Query | |
| Subscription |> Query.where([s], not is_nil(s.user_id)) |
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
| alias Rebirth.Subscription | |
| alias Ecto.Query | |
| Subscription |> Query.where([s], s.user_id != nil) |
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
| select * from subscriptions where user_id is not null; |
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
| alias Rebirth.Repo | |
| query = from o in Rebirth.Order, [] | |
| orders = Repo.all query |
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
| alias Ecto.Repo | |
| query = from o in Rebirth.Order, [] | |
| orders = Repo.all query |
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
| try{Typekit.load({ async: false });}catch(e){} | |
| var sheet = (function() { | |
| var style = document.createElement("style"); | |
| style.appendChild(document.createTextNode("")); | |
| document.head.appendChild(style); | |
| return style.sheet; | |
| })(); |