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
| iex(1)> [97,98,99] | |
| 'abc' |
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 Merchant.Gateways.PayPal do | |
| @moduledoc """ | |
| The PayPal api. It connects with the PayPal's REST API. | |
| """ | |
| use HTTPoison.Base | |
| use Merchant.Gateway | |
| alias Merchant.Gateways.PayPal | |
| @sandbox_api "https://api.sandbox.paypal.com/" | |
| @live_api "https://api.paypal.com/" |
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 PayPal.Transaction do | |
| @moduledoc """ | |
| A Transaction structure. All *fields* are required: | |
| - description: String. (Give a description to the transaction.) | |
| - *ammount*: | |
| - *currency*: String. (A 3-letter currency code. All supported | |
| currencies are listed below.) | |
| - *total*: String. (Total to be charged. 10 characters max with | |
| support for 2 decimal places.) | |
| - details: |
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 set_tokens(conn, user_from_db) do | |
| case user_from_db.account_level do | |
| 99 -> # Admin level | |
| Guardian.Plug.sign_in(conn, user_from_db, perms: %{admin: [:all]}) | |
| redirect(conn, to: page_path(conn, :index)) | |
| _ -> # Not yet implemented | |
| redirect(conn, to: page_path(conn, :index)) | |
| 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
| config :tasksrc, Tasksrc.Endpoint, | |
| http: [port: {:system, "PORT"}], | |
| url: [scheme: "https", host: "tasksrc-dev.herokuapp.com", port: 443], | |
| force_ssl: [rewrite_on: [:x_forwarded_proto]], | |
| cache_static_manifest: "priv/static/manifest.json", | |
| secret_key_base: System.get_env("SECRET_KEY_BASE") |
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
| open System | |
| type Car = {size: int; name: string} | |
| type Cars = Car list | |
| let bigCar cars = | |
| let zeroCar = {Car.name = ""; Car.size = 0} | |
| List.fold (fun car acc -> | |
| if car.size > acc.size then car | |
| elif car.size < acc.size then acc |
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
| module MetroUi.Css exposing (class, classes, Styles(..)) | |
| import List | |
| import MetroUi.Css.SimpleGrid as SimpleGrid | |
| import Html.Attributes as Attr | |
| import Debug | |
| type Styles a = SimpleGrid.Classes a | Others a |
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
| module MetroUi.Widgets.Accordion exposing ( Model | |
| , defaultAccordion | |
| , update | |
| , view ) | |
| import Html | |
| import Html.App | |
| import Html.Attributes as Attr | |
| import MetroUi.Widgets.Frame as Frame |
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
| module MetroUi exposing (..) | |
| import Html exposing (Html, text, div, h1) | |
| import Html.App as App | |
| import MetroUi.Widgets.Accordion as Accordion | |
| import MetroUi.Widgets.Frame as Frame | |
| type alias MetroUiModel = | |
| { accordion : Accordion.Model | |
| , bigAccordion : Accordion.Model } |
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 is_empty(state) do | |
| result = :queue.is_empty(state.queue) | |
| Logger.debug "#{inspect __MODULE__}: Empty? #{inspect result}." | |
| {result, state} | |
| end | |
| def delete(state) do | |
| Logger.debug "#{inspect __MODULE__}: Deleting #{inspect state}." | |
| {:ok, state} | |
| end |