This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prod.ex | |
config :mobil, Mobil.Endpoint, | |
secret_key_base: System.get_env("PHOENIX_SECRET") | |
# Finally import the config/prod.secret.exs | |
# which should be versioned separately. | |
config :mobil, Mobil.Repo, | |
adapter: Ecto.Adapters.Postgres, | |
host: "db", | |
username: "postgres", #System.get_env("DB_ENV_user"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web_1 | ** (EXIT from #PID<0.49.0>) an exception was raised: | |
web_1 | ** (FunctionClauseError) no function clause matching in Regex.match?/2 | |
web_1 | (elixir) lib/regex.ex:157: Regex.match?(~r/^\/([^\/])+$/, nil) | |
web_1 | (ecto) lib/ecto/repo/supervisor.ex:85: Ecto.Repo.Supervisor.parse_url/1 | |
web_1 | (ecto) lib/ecto/repo/supervisor.ex:21: Ecto.Repo.Supervisor.config/3 | |
web_1 | (ecto) lib/ecto/repo/supervisor.ex:107: Ecto.Repo.Supervisor.init/1 | |
web_1 | (stdlib) supervisor.erl:272: :supervisor.init/1 | |
web_1 | (stdlib) gen_server.erl:328: :gen_server.init_it/6 | |
web_1 | (stdlib) proc_lib.erl:239: :proc_lib.init_p_do_apply/3 | |
web_1 | 10:22:24.968 [info] Running Mobil.Endpoint with Cowboy on http://example.com:4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"249,0" |> String.replace ~r/,(\d)$/, ",\\1" | |
# -> "249,0" | |
"249,0" |> String.replace ~r/,(\d)$/, ",\\10" | |
# -> "249," | |
# The closest i can get. | |
"249,0" |> String.replace ~r/,(\d)$/, ",\\1 0" | |
# -> "249,0 0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Mobil.Session do | |
alias Mobil.Admin | |
def current_user(conn) do | |
id = Plug.get_session(conn, :current_user) | |
if id, do: Repo.get(Admin, id) | |
end | |
end | |
defmodule Mobil.Web do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for @changeset, @action, [multipart: true], fn f -> %> | |
<%= if @changeset.action do %> | |
<div class="alert alert-danger"> | |
<p>Oops, something went wrong! Please check the errors below:</p> | |
<ul> | |
<%= for {attr, message} <- f.errors do %> | |
<li><%= humanize(attr) %> <%= message %></li> | |
<% end %> | |
</ul> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Mobil.Admin.CompanyController do | |
use Mobil.Web, :controller | |
alias Mobil.Company | |
plug :scrub_params, "company" when action in [:create, :update] | |
def index(conn, _params) do | |
companies = Repo.all(Company) | |
render(conn, "index.html", companies: companies) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.FTP do | |
def open_connection(host, user, password) do | |
:inets.start | |
{host_success, pid} = :inets.start(:ftpc, [{:host, host |> to_char_list}]) | |
login_success = :ftp.user(pid, user |> to_char_list, password |> to_char_list) | |
if host_success && login_success do | |
{:ok, pid} | |
else | |
{:error, "Could not connect to host"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"params":{ | |
"facets":{ | |
"category":{ | |
"data_type":"taxonomy_term", | |
"machine_name":"category", | |
"taxonomy_tree":true, | |
"field_name":"sm_vid_Category", | |
"field_type":"string", | |
"facet_type":"field", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"github.com/gorilla/mux" | |
_ "github.com/lib/pq" | |
"log" | |
"net/http" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.User = DS.Model.extend({ | |
name: DS.attr('string'), | |
email: DS.attr('string'), | |
createdDate: DS.attr(), | |
location: DS.attr('string') | |
}); | |
App.User.FIXTURES = [{ | |
id: 1, | |
name: "Johan", |