A simple Ecto custom type for the Postgres tsrange type.
Based on: http://pedroassumpcao.ghost.io/using-postgres-range-data-type-in-ecto/ and elixir-ecto/postgrex#27
module Geometry do | |
@moduledoc """ | |
Calculates area of different shapes | |
""" | |
@doc """ | |
Some other comment | |
""" | |
def area({:rectangle, width, height}) do: width * height | |
def area({:square, side}) do: side * side |
A simple Ecto custom type for the Postgres tsrange type.
Based on: http://pedroassumpcao.ghost.io/using-postgres-range-data-type-in-ecto/ and elixir-ecto/postgrex#27
exports.config = { | |
optimize: false, | |
sourceMaps: true, | |
files: { | |
javascripts: { | |
joinTo: "js/app.dev.js" | |
}, | |
stylesheets: { | |
joinTo: "css/app.dev.css", |
config.generators do |generate| | |
generate.helper false | |
generate.javascript_engine false | |
generate.request_specs false | |
generate.routing_specs false | |
generate.stylesheets false | |
generate.test_framework :rspec | |
generate.view_specs false | |
end |
RSpec.configure do |config| | |
config.include FactoryGirl::Syntax::Methods | |
end |
# Create a product | |
product_params = %{ | |
description: "some content", | |
name: "some content", | |
price: 120.5, | |
sku: "ABC-123" | |
} | |
{:ok, product} = Nova.ProductCommands.create(product_params) | |
# Create a variant |
defmodule SecureRandom do | |
@moduledoc """ | |
Ruby-like SecureRandom module. | |
## Examples | |
iex> SecureRandom.base64 | |
"xhTcitKZI8YiLGzUNLD+HQ==" | |
iex> SecureRandom.urlsafe_base64(4) |
package main | |
import ( | |
"bytes" | |
"exec" | |
"log" | |
"os" | |
) | |
// Pipeline strings together the given exec.Cmd commands in a similar fashion |
require "virtus" | |
module Commands | |
module Base | |
def self.included(base) | |
base.extend ClassMethods | |
base.include Virtus.model | |
base.include ActiveModel::Validations | |
base.prepend InstanceMethods |
class CreateEmailTest | |
include Lotus::Interactor | |
def initialize(params) | |
@params = params | |
@email_test = EmailTest.new(@params[:email_test]) | |
end | |
def call | |
Operation.new(self, email_test: @email_test). |