Skip to content

Instantly share code, notes, and snippets.

View imetallica's full-sized avatar

Iuri L. Machado imetallica

View GitHub Profile
iex(1)> [97,98,99]
'abc'
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/"
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:
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
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")
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
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
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
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 }
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