See the Official Guides.
Start a REPL: iex
See the Official Guides.
Start a REPL: iex
class AttachedValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
record.errors.add(attribute, :attached, options) unless value.attached? | |
end | |
end |
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found
/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
require 'hexapdf' | |
doc = HexaPDF::Document.open("/home/xxxx/Downloads/OoPdfFormExample.pdf") | |
page = doc.pages[0] | |
canvas = page.canvas(type: :overlay) | |
canvas.translate(0, 20) do | |
canvas.fill_color(0.3, 0.7, 0.7) | |
canvas.rectangle(50, 0, 80, 80, radius: 80) |
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
Just some assorted notes I've made while digging into Phoenix, Elixir and friends. I'm coming from a strong Rails background, so many of these will refer to features from that framework.
Unlike Rails, where rendering is almost always performed by a template file, the responsibility of rendering a response in Phoenix lies with a view module (that typically corresponds to the current controller module.) This view module will typically offer a whole bunch of render
functions (matching different parameters, first and foremost the template name.) Templates (found in web/templates/
) will directly compile into such functions.
#!/usr/bin/env bash | |
# install docker | |
# https://docs.docker.com/engine/installation/linux/ubuntulinux/ | |
# install docker-compose | |
# https://docs.docker.com/compose/install/ | |
# install letsencrypt | |
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 |