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 Sample do | |
| def test do | |
| # acquire your Firebase URL (https://xxx.firebaseio.com/) | |
| # from the environment variable. | |
| url = String.from_char_list!(:os.getenv("FIREBASE_URL")) | |
| # setup url for ExFirebase module | |
| ExFirebase.set_url(url) | |
| # put data in /test path" |
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 Sequence do | |
| def fib(0), do: 1 | |
| def fib(1), do: 1 | |
| def fib(n), do: fib(n - 1) + fib(n - 2) | |
| end | |
| IO.puts Sequence.fib(10) # -> 89 |
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 ApplicationRouter do | |
| use Dynamo.Router | |
| filter DynamoScaffold.Filters.MethodOverride | |
| prepare do | |
| conn = conn.fetch([:cookies, :params]) | |
| conn.assign :layout, "main" | |
| end | |
| @doc "index" |
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 ApplicationRouter do | |
| use Dynamo.Router | |
| filter Dynamo.Filters.MethodOverride | |
| prepare do | |
| conn = conn.fetch([:cookies, :params]) | |
| conn.assign :layout, "main" | |
| end | |
| @doc "index" |
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 ExVCR.MockTest do | |
| use ExUnit.Case | |
| import ExVCR.Mock | |
| setup_all do | |
| ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes", | |
| "fixture/custom_cassettes") | |
| :ok | |
| end |
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 QuickSort do | |
| def sort([]), do: [] | |
| def sort([head|tail]) do | |
| {lesser, greater} = Enum.partition(tail, &(&1 < head)) | |
| sort(lesser) ++ [head] ++ sort(greater) | |
| end | |
| end | |
| IO.inspect QuickSort.sort([1,6,3,4,2,5]) |
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 SampleFuture do | |
| require Future | |
| def fib(0), do: 0 | |
| def fib(1), do: 1 | |
| def fib(n), do: fib(n - 1) + fib(n - 2) | |
| defmacro benchmark([do: content]) do | |
| quote do | |
| s = :erlang.now |
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 ExFuture.HelperTest do | |
| use ExUnit.Case | |
| use ExFuture | |
| test "future block" do | |
| f = future do | |
| 3 * 3 | |
| end | |
| assert 9 == value(f) | |
| end |
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
| dependencies: | |
| pre: | |
| - bash ./install-otp_src_17.0.sh | |
| - bash ./install-elixir.sh | |
| cache_directories: | |
| - otp_src_17.0 | |
| - elixir | |
| test: | |
| pre: | |
| - ln -s ~/circle_sample/otp_src_17.0/bin/erl ~/bin/erl |
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
| Git clone https://github.com/parroty/exfirebase | |
| cd exfirebase | |
| mix deps.get | |
| iex -S mix |
OlderNewer