This file contains 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
Mix.install([ | |
{:phoenix_playground, git: "https://github.com/phoenix-playground/phoenix_playground"}, | |
{:ecto, "~> 3.11"}, | |
{:phoenix_ecto, "~> 4.6"} | |
]) | |
defmodule CoreComponents do | |
use Phoenix.Component | |
attr(:id, :any) |
This file contains 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
// Courtesy of @chrismccord | |
let pageLoadingDone = new Promise(resolve => { | |
window.addEventListener("phx:page-loading-stop", _info => { | |
topbar.hide() | |
resolve() | |
}, {once: true}) | |
}) | |
window.addEventListener("phx:page-loading-start", _info => { | |
if(navigation.navigate){ |
This file contains 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
defimpl Phoenix.HTML.Safe, for: Version do | |
# Based on `to_string` implementation | |
# https://github.com/elixir-lang/elixir/blob/v1.13.4/lib/elixir/lib/version.ex#L629 | |
def to_iodata(%Version{} = version) do | |
[ | |
Integer.to_string(version.major), | |
Integer.to_string(version.minor), | |
[Integer.to_string(version.patch), pre(version.pre), build(version.build)] | |
] | |
|> Enum.intersperse(".") |
This file contains 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 NestedWeb.FormLive do | |
use NestedWeb, :live_view | |
require Logger | |
defmodule Form do | |
use Ecto.Schema | |
import Ecto.Changeset | |
embedded_schema do | |
field :name, :string |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
This file contains 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 TestEctoReplace.ContextTest do | |
use TestEctoReplace.DataCase | |
alias TestEctoReplace.Context.{Country, Restaurant} | |
test "assoc" do | |
################## | |
# Arrange | |
country = Repo.insert!(%Country{name: "Germany"}) | |
[_, _, kfc, burger_king, _] = |
This file contains 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 ConnectWeb.PhoenixInstrument do | |
@moduledoc """ | |
Phoenix instrumentation to assert on the query count of controllers/views in | |
Phoenix.ConnCase tests. | |
## Installing | |
Before using the module there are some things to setup: | |
* Add `{:ok, _} = ConnectWeb.PhoenixInstrument.start_link()` to `test/test_helper.exs`. |
This file contains 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.Swoosh.TestAdapter do | |
@moduledoc """ | |
Integration Testable Adapter for Swoosh | |
## Usage | |
Add `{:ok, _} = MyApp.Swoosh.TestAdapter.start_link` into your | |
`test_helper.exs` file. | |
Merge with ecto metadata in the case templates, which need it. |
NewerOlder