I hereby claim:
- I am kamillelonek on github.
- I am squixy (https://keybase.io/squixy) on keybase.
- I have a public key ASB_XXberRTFg-l0C9iujwtDCYAjhfSMCQ5RjVkHVP6zmAo
To claim this, I am signing this object:
# Latest version of Erlang-based Elixir installation: https://hub.docker.com/_/elixir/ | |
FROM elixir:latest | |
# Create and set home directory | |
WORKDIR /opt/your_application_name | |
# Configure required environment | |
ENV MIX_ENV prod | |
# Install hex (Elixir package manager) |
import request from 'request-promise'; | |
exports.run = async() => { | |
const bloggers = await global.db.models.Blogger.findAll({ | |
where: { | |
instagramDemographics: { | |
$ne: null, | |
}, | |
}, | |
}); |
I hereby claim:
To claim this, I am signing this object:
# Html5Mode | |
middleman_sitemap = sitemap | |
use Rack::Rewrite do | |
rewrite %r{^[^.]*$}, -> (_, rack_env) do | |
base_url = rack_env['PATH_INFO'] | |
middleman_sitemap.find_resource_by_path(base_url) ? base_url : '/' | |
end | |
end |
class CommandHandler::CreateProduct | |
def call(command) | |
if command.invalid? | |
event_store.publish( | |
ProductValidationFailed.new(command.errors) | |
) | |
else | |
persist_product(command.product) | |
event_store.publish( | |
ProductCreated.new(product_id: command.id, name: command.name) |
#!/usr/bin/env bash | |
DAYS_TO_KEEP=6 | |
DB_USER=postgres | |
DUMP_DIR=/var/db_dumps | |
function create_dump_dir_unless_exist() { | |
if ! mkdir -p $DUMP_DIR | |
then | |
echo "Cannot create backup directory in $DUMP_DIR" 1>&2 |
class ValidateSumOfMilliliters | |
def call(form_object:) | |
find_juice_by_id.(form_object.juice_id) | |
.and_then { |juice| validate_sum_of_milliliters(juice: juice) } | |
.or_else { |error| fail_with_invalid_juice_id(error) } | |
end | |
private | |
def fail_with_invalid_juice_id(error) | |
interrupt( |
def div_check(x, y) | |
x / y | |
rescue ZeroDivisionError | |
raise Errors:UnsupportedMathematicOperation | |
end |
class SqlRepository | |
def entity_class | |
raise(NotImplementedError, "Subclesses must define an 'entity_class' method") | |
end | |
def load!(entity_id) | |
entity_class.find_by(id: entity_id) || raise(Errors::EntityNotFound, "Unknown : #{entity_id}") | |
end | |
end |
def create | |
create_product.(product_params) | |
head :created, location: product_path(product) | |
rescue UserNotAuthorized => error | |
render error.message, status: :unauthorized | |
rescue ProductAlreadyPublished => error | |
render error.message, status: :unprocessable_entity | |
end |