Skip to content

Instantly share code, notes, and snippets.

View andreapavoni's full-sized avatar
🎧
❤️‍🔥🪩🕺🏻🚀

Andrea Pavoni andreapavoni

🎧
❤️‍🔥🪩🕺🏻🚀
View GitHub Profile
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
@andreapavoni
andreapavoni / README.md
Created November 23, 2016 12:05 — forked from felipegasparini/README.md
Ecto Postgres tsrange data type
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
@andreapavoni
andreapavoni / secure_random.ex
Last active September 4, 2015 08:18 — forked from Myuzu/secure_random.ex
Elixir ruby-like SecureRandom
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).