When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}| def create_batch(conn, %{"people" => people_params}) do | |
| changesets = Enum.map(people_params, fn class -> | |
| Person.changeset(%Person{}, person) | |
| end) | |
| result = changesets | |
| |> Enum.with_index() | |
| |> Enum.reduce(Ecto.Multi.new(), fn ({changeset, index}, multi) -> | |
| Ecto.Multi.insert(multi, Integer.to_string(index), changeset) | |
| end) |
| # two different ways to implement a find_or_create for Ecto | |
| find_or_create_user = fn user -> | |
| case Repo.all(from u in users, where: u.id == ^user.id and u.email == ^user.email) do | |
| [] -> | |
| %User{} | |
| |> User.changeset(user) | |
| |> Repo.insert!() | |
| _ -> | |
| IO.puts "Already inserted" |
By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.
| import java.io.IOException; | |
| import java.net.URLClassLoader; | |
| import java.nio.file.Files; | |
| import java.nio.file.Paths; | |
| import java.nio.file.Path; | |
| /** | |
| * Example demonstrating a ClassLoader leak. | |
| * | |
| * <p>To see it in action, copy this file to a temp directory somewhere, |
| /** | |
| * ``` | |
| * Does JDK8's Optional class satisfy the Monad laws? | |
| * ================================================= | |
| * 1. Left identity: true | |
| * 2. Right identity: true | |
| * 3. Associativity: true | |
| * | |
| * Yes, it does. | |
| * ``` |
| /* | |
| Before running, install express by running | |
| npm install express | |
| and run with: | |
| node absurd_rest_service.js | |
| in this script's directory. |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| package com.pandemic.recommendation_core.web | |
| import akka.actor._ | |
| import akka.actor.Actor.actorOf | |
| import akka.http._ | |
| import org.eclipse.jetty.server.Server | |
| import org.eclipse.jetty.servlet.ServletHolder | |
| import org.eclipse.jetty.servlet.ServletContextHandler | |
| import org.eclipse.jetty.http.security.Constraint; | |
| import org.eclipse.jetty.http.security.Credential; |
| #!/bin/bash | |
| # TODO | |
| # - Automatically fix the "Unknown display" problem by editing grub defaults | |
| # like described here: http://askubuntu.com/questions/398903/unknown-display-besides-laptop-built-in-display-old-question-but-with-no-answer | |
| ## | |
| ## Essential stuff | |
| ## | |
| sudo apt-get install -y build-essential aria2 git mercurial subversion \ |