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
| version: "3.8" | |
| services: | |
| app: | |
| image: papereira/devcontainer-elixir-phoenix:1.5.6-alpine | |
| volumes: | |
| - ../:/workspace | |
| - ~/.ssh:/home/vscode/.ssh:ro | |
| - ~/.ssh:/root/.ssh:ro | |
| - /var/run/docker.sock:/var/run/docker.sock |
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
| # pubsub request | |
| http://localhost:4567/api/v1/pubsub/twitter | |
| json: {"search":"myelixirstatus", "number": 20} | |
| # response | |
| { | |
| uuid: "1bab11d8-f4f9-45c3-ace5-cffc907135b2" | |
| search_string: "myelixirstatus" | |
| number_of_tweets: 20 | |
| requested_at: "2015-11-18 17:48:22 +0000" |
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
| Rails as it has never been before :) | |
| Rails 3 AntiPatterns, Useful snippets and Recommended Refactoring. Note: Some of them are collected from different online resources/posts/blogs with some tweaks. |
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 ConnectionTable do | |
| @table_id __MODULE__ | |
| def init do | |
| :ets.new(@table_id, [:public, :named_table]) | |
| end | |
| def insert(key, value) do | |
| :ets.insert(@table_id, {key, value}) |
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
| * Getting cowboy (git://github.com/extend/cowboy.git) | |
| Cloning into '/Users/paulopereira/Devel/TheLab/00.Research/pknoa/dev/pknoa_phoenix/deps/cowboy'... | |
| remote: Reusing existing pack: 6124, done. | |
| remote: Total 6124 (delta 0), reused 0 (delta 0) | |
| Receiving objects: 100% (6124/6124), 3.68 MiB | 560.00 KiB/s, done. | |
| Resolving deltas: 100% (3602/3602), done. | |
| Checking connectivity... done. | |
| * Getting cowlib (git://github.com/extend/cowlib.git) | |
| Cloning into '/Users/paulopereira/Devel/TheLab/00.Research/pknoa/dev/pknoa_phoenix/deps/cowlib'... | |
| remote: Reusing existing pack: 185, done. |
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
| # The ruby kata was: | |
| # Given an array of numbers, which are perfect squares? | |
| # get_squares(1..16) # => [1, 4, 9, 16] | |
| # get_squares(1..100) # => [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
| # | |
| # This version accepts lists an ranges | |
| defmodule ElixirKatas do | |
| def get_squares(numbers) 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
| defmodule TestApp.Utils do | |
| @doc """ | |
| Returns `true`if `:app` is running; otherwise returns `false` | |
| """ | |
| @spec is_app_running?(atom) :: boolean | |
| def is_app_running?(appname) do | |
| (:application.which_applications |> | |
| Enum.filter(fn(x)->Enum.member? tuple_to_list(x), appname end) |> | |
| Enum.count) > 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
| =ERROR REPORT==== 14-Oct-2013::20:24:51 === | |
| Error in process <0.370.0> with exit value: {[{reason,{'Elixir.CompileError','__exception__',<<6 bytes>>,8,<<26 bytes>>}},{mfa,{'Elixir.Handler.WeberReqHandler',handle,2}},{stacktrace,[{elixir_translator,translate_arg,2,[{file,"src/elixir_translator.erl"},{line,573}]},{lists,mapfoldl,3,[{file... | |
| =ERROR REPORT==== 14-Oct-2013::20:24:51 === | |
| Ranch listener http had connection process <0.370.0> exit with reason: {[{reason,{'Elixir.CompileError','__exception__',<<"nofile">>,8,<<"function style/1 undefined">>}},{mfa,{'Elixir.Handler.WeberReqHandler',handle,2}},{stacktrace,[{elixir_translator,translate_arg,2,[{file,"src/elixir_translator.erl"},{line,573}]},{lists,mapfoldl,3,[{file,"lists.erl"},{line,1339}]},{elixir_translator,translate_args,2,[{file,"src/elixir_translator.erl"},{line,580}]},{elixir_translator,translate_apply,7,[{file,"src/elixir_translator.erl"},{line,609}]},{elixir_compiler,'__FILE__',2,[{file,<<"nofile">>},{line,1}]},{elixir_compiler,'__FILE__',2,[{fi |