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 SupportChat do | |
import Phoenix.Component | |
alias Phoenix.LiveView.JS | |
@doc """ | |
Chat bubble at the bottom right corner. | |
""" | |
def bubble(assigns) do | |
~H""" | |
<div> |
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 Hello.Admin.CopyLink do | |
use Phoenix.Component | |
@doc """ | |
Render a button (styled as a link) that copies a value to clipboard when clicked. | |
Storybook: Basic | |
<.copy_link value="https://example.com" text="copy link" /> | |
""" | |
def copy_link(assigns) do |
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
######################################## | |
# 1. Build nodejs frontend | |
######################################## | |
FROM node:10.9-alpine as build-node | |
# prepare build dir | |
RUN mkdir -p /app/assets | |
WORKDIR /app | |
# set build ENV |
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 Twin do | |
@moduledoc """ | |
See http://teamon.eu/2017/different-approach-to-elixir-mocks-doubles/ | |
""" | |
## PROXY | |
defmodule Proxy do | |
def unquote(:"$handle_undefined_function")(fun, args) do | |
[{__MODULE__, mod} | rest] = Enum.reverse(args) |
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 Test do | |
def run(x) do | |
with :error <- try_one(x), | |
:error <- try_two(x), | |
:error <- try_three(x) do | |
:error | |
end | |
end | |
defp try_one(1), do: {:ok, "one"} |
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
⌘ ~/code/tesla (master) λ mix xref graph | |
lib/tesla.ex | |
├── lib/tesla/adapter/hackney.ex (compile) | |
│ ├── lib/tesla/multipart.ex (compile) | |
│ └── lib/tesla.ex | |
├── lib/tesla/adapter/httpc.ex (compile) | |
│ ├── lib/tesla/adapter/shared.ex (compile) | |
│ ├── lib/tesla/multipart.ex (compile) | |
│ └── lib/tesla.ex | |
├── lib/tesla/adapter/ibrowse.ex (compile) |
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
#!/usr/bin/env escript | |
%% Original author - Steve Vinoski <[email protected]> | |
%% Modifications by - Tymon Tobolski <[email protected]> | |
%% This is a modified version of https://gist.github.com/vinoski/4996859 | |
%% with support for keeping TCP connection open. | |
%% Useful for testing HTTP clients and their Connection: keep-alive support | |
%% Usage: ./httpd.erl [PORT] |
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
#!/usr/bin/env escript | |
% -*- mode: erlang -*- | |
main([BeamFile]) -> | |
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
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 A do | |
use Mockery | |
@b Mockery.of(B) | |
@c C | |
@d Mockery.of("D") | |
def run do | |
@b.fun() | |
@c.fun() |
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 Box do | |
defmacro __using__(_env) do | |
quote do | |
import Box | |
end | |
end | |
@doc """ | |
Define module with struct and typespec, in single line |
NewerOlder