{"id":18078465,"url":"https://github.com/techgaun/elixir-tips-tricks","last_synced_at":"2025-04-05T20:40:53.358Z","repository":{"id":147047972,"uuid":"57055151","full_name":"techgaun/elixir-tips-tricks","owner":"techgaun","description":"Just random tips and tricks while working with elixir [\u0026 phoenix and other libs/frameworks]","archived":false,"fork":false,"pushed_at":"2016-09-04T01:01:45.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T21:52:29.418Z","etag":null,"topics":["elixir","elixir-tips","erlang","phoenix"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techgaun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-25T15:51:38.000Z","updated_at":"2017-08-10T19:02:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"11caa0af-b0a1-43ea-8a1c-878ba2deb090","html_url":"https://github.com/techgaun/elixir-tips-tricks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techgaun%2Felixir-tips-tricks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techgaun%2Felixir-tips-tricks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techgaun%2Felixir-tips-tricks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techgaun%2Felixir-tips-tricks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techgaun","download_url":"https://codeload.github.com/techgaun/elixir-tips-tricks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399898,"owners_count":20932876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","elixir-tips","erlang","phoenix"],"created_at":"2024-10-31T12:14:10.473Z","updated_at":"2025-04-05T20:40:53.328Z","avatar_url":"https://github.com/techgaun.png","language":null,"readme":"# elixir-tips-tricks\nJust random tips and tricks while working with elixir [\u0026amp; phoenix and other libs/frameworks]\n\n\n### Disable compiling of dependency in mix\n```\n{:my_dep, …, compile: false}\n```\n\n### Run only particular tests\n\nUse `@tag :wip` in the test you want to run\n```\ndefmodule MyTest do\n  use ExUnit.Case\n  \n  test \"first test\" do\n    assert 1 == 1\n  end\n  \n  @tag :wip\n  test \"second test\" do\n    assert 3 != 5\n  end\nend\n```\n\n```\nmix test --only wip\n```\n\n### Build composable queries with Inquisitor\nCheck the [Inquisitor](https://github.com/DockYard/inquisitor) repository if you're looking for building composable queries for Ecto.\n\n### iex shortcuts\n- c \"somefile.exs\" - compile the file\n- r SomeModule - reload the module\n- h some_func - get help for the function\n- v [n] - access session history\n\n### Get query and post params excluding others in params (phoenix)\n\n```\nconn.body_params # gives params from POST\nconn.query_params # query string parameters\n```\n\n### Run multiple mix tasks\n\n```\nMIX_ENV=test mix do deps.get, test\n```\n\n### Update particular dependency\n\n```\nmix deps.update \u003cdep_name\u003e\n```\n\n### Turn off layout on Phoenix.Controller.render/3\n\n```\nrender conn, \"index.html\", %{layout: false}\n# with plug\nplug :put_layout, false\n\n# pipe it\nconn |\u003e put_layout(false) |\u003e render(...)\n```\n\n### Increase stacktrace\n\n```\n:erlang.system_flag(:backtrace_depth, 20)\n\n# with phoenix\n# config/env.exs\nconfig :phoenix, :stacktrace_depth, 20\n```\n\n### Observer on remote erlang node\n\n```\n$ iex --name phoenix@127.0.0.1 --cookie iam_not_so_awesome -S mix phoenix.server  # in api server\n\n# on separate shell\n$ iex --name test@127.0.0.1 --remsh phoenix@127.0.0.1 --cookie iam_not_so_awesome\niex(phoenix@127.0.0.1)1\u003e :observer.start\n```\n\nYou can pass args down to erlang via `erl` flag.\nExample: `--erl \"-kernel inet_dist_listen_min 9001 inet_dist_listen_m 9001\"`\n\n### Change default compile output directory\n\nBased on [this](https://github.com/elixir-lang/elixir/blob/4e648199f18ee3be8addab82c951b9e2dd82f885/lib/mix/lib/mix/tasks/new.ex#L286), you can specify a keyword list arg `build_path` to override the default `_build` directory.\n\nExample:\n\n    def project do\n        [app: :my_app,\n        version: \"0.0.1\",\n        elixir: \"~\u003e 1.2\",\n        build_embedded: Mix.env == :prod,\n        start_permanent: Mix.env == :prod,\n        build_path: \"custom_build_dir\",\n        deps: deps]\n    end\n\n### Emmet tab support for eex in Atom\n\nOpen your preferences and select keymaps. It should open keymaps.cson. Add the following in that file:\n\n```coffeescript\n'atom-text-editor[data-grammar=\"text html elixir\"]:not([mini])':\n    'tab': 'emmet:expand-abbreviation-with-tab'\n```\n\nThe grammar can be obtained for any files by opening console (ctrl+shift+i) and type the following with the appropriate file open in your editor:\n\n```javascript\ndocument.getElementsByTagName('atom-text-editor')\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechgaun%2Felixir-tips-tricks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechgaun%2Felixir-tips-tricks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechgaun%2Felixir-tips-tricks/lists"}