commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 4.24k | new_contents stringlengths 1 5.44k | subject stringlengths 14 778 | message stringlengths 15 9.92k | lang stringclasses 277
values | license stringclasses 13
values | repos stringlengths 5 127k |
|---|---|---|---|---|---|---|---|---|---|
a38449b7e48c40a55b5adf6784a42bb207dbc87e | web/controllers/polls_controller.ex | web/controllers/polls_controller.ex | defmodule WildPoll.PollsController do
use WildPoll.Web, :controller
plug :action
def index(conn, _params) do
render conn, "index.html"
end
def create(conn, params) do
#HTTPoison.post("https://1cb66526.ngrok.com/poll", Poison.encode!(params["polls"]), [{"Content-Type", "application/json"}])
dict ... | defmodule WildPoll.PollsController do
use WildPoll.Web, :controller
plug :action
def index(conn, _params) do
render conn, "index.html"
end
def create(conn, params) do
dict = params["polls"]
answers = params["polls"]
|> Enum.filter(fn({key, _value}) -> String.starts_with?(key, "answer") en... | Use application vars for the poll creation endpoint | Use application vars for the poll creation endpoint
| Elixir | mpl-2.0 | trywildcard/wildpoll |
277e43c8dd289dd3702ee0cd3416fe551751071a | test/koans/protocols_koans_test.exs | test/koans/protocols_koans_test.exs | defmodule ProtocolsTests do
use ExUnit.Case
import TestHarness
test "Protocols" do
answers = [
{:multiple, ["Andre signed up for violin", "Darcy enrolled for ballet"]},
"Pupil enrolled at school",
Protocol.UndefinedError
]
test_all(Protocols, answers)
end
end
| defmodule ProtocolsTests do
use ExUnit.Case
import TestHarness
test "Protocols" do
answers = [
{:multiple, ["Andre played violin", "Darcy performed ballet"]},
"Artist showed performance",
Protocol.UndefinedError
]
test_all(Protocols, answers)
end
end
| Fix up test answer values that diverged from example | Fix up test answer values that diverged from example
| Elixir | mit | elixirkoans/elixir-koans |
b40a682a88b1cb58fc83af42d7246b5f0fd15718 | lib/whistler_news_reader/feed_worker_supervisor.ex | lib/whistler_news_reader/feed_worker_supervisor.ex | defmodule WhistlerNewsReader.FeedWorkerSupervisor do
use Supervisor
@pool_size 1
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
pool_size = Application.get_env(:whistler_news_reader, :pool_size) || @pool_size
pool_options = [
name: {:local, :feed_worker_pool},... | defmodule WhistlerNewsReader.FeedWorkerSupervisor do
use Supervisor
@pool_size 10
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
pool_size = Application.get_env(:whistler_news_reader, :pool_size) || @pool_size
pool_options = [
name: {:local, :feed_worker_pool}... | Revert "set worker num to 1" | Revert "set worker num to 1"
This reverts commit 41509609daddbf38200bef650d147466319b3c43.
| Elixir | mit | fdietz/whistler_news_reader,fdietz/whistler_news_reader |
59064f8b58131c4949de5dfc3abcf978548452df | lib/mix/lib/mix/tasks/cmd.ex | lib/mix/lib/mix/tasks/cmd.ex | defmodule Mix.Tasks.Cmd do
use Mix.Task
@shortdoc "Executes the given command"
@recursive true
@moduledoc """
Executes the given command.
Useful in umbrella applications to execute a command
on each child app:
mix cmd echo pwd
You can limit which apps the cmd runs in by passing the app names
... | defmodule Mix.Tasks.Cmd do
use Mix.Task
@shortdoc "Executes the given command"
@recursive true
@moduledoc """
Executes the given command.
Useful in umbrella applications to execute a command
on each child app:
mix cmd echo pwd
You can limit which apps the cmd runs in by passing the app names
... | Rename varialbe s -> status in Mix.Tasks.Cmd | Rename varialbe s -> status in Mix.Tasks.Cmd
Hard to say for sure, without knowing cmd/1 return, what this `s` represents there.
| Elixir | apache-2.0 | antipax/elixir,michalmuskala/elixir,lexmag/elixir,pedrosnk/elixir,kimshrier/elixir,ggcampinho/elixir,elixir-lang/elixir,beedub/elixir,kelvinst/elixir,gfvcastro/elixir,gfvcastro/elixir,pedrosnk/elixir,beedub/elixir,antipax/elixir,lexmag/elixir,kelvinst/elixir,kimshrier/elixir,joshprice/elixir,ggcampinho/elixir |
7b354febcaae4aed66aef6fda18f6f5d1cb170b7 | lib/marc_cx/markdown.ex | lib/marc_cx/markdown.ex | defmodule MarcCx.Markdown do
def parse(markdown) when markdown |> is_list do
{metadata, markdown} = parse_metadata(markdown)
html = Earmark.to_html(markdown, %Earmark.Options{
renderer: MarcCx.HtmlRenderer,
footnotes: true
})
{metadata, html}
end
def get_metadata(markdown) when mar... | defmodule MarcCx.Markdown do
def parse(markdown) when markdown |> is_list do
{metadata, markdown} = parse_metadata(markdown)
html = Earmark.to_html(markdown, %Earmark.Options{
renderer: MarcCx.HtmlRenderer,
footnotes: true
})
{metadata, html}
end
def get_metadata(markdown) when mar... | Update guard clause for consistency | Update guard clause for consistency
| Elixir | mit | marcaddeo/marc.cx,marcaddeo/marc.cx,marcaddeo/marc.cx |
747e81d87db003ff2236f9c5dad0d4482f897fdd | lib/ex_twilio/resources/available_phone_number.ex | lib/ex_twilio/resources/available_phone_number.ex | defmodule ExTwilio.AvailablePhoneNumber do
@moduledoc """
Represents an AvailablePhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/available-phone-numbers)
"""
defstruct friendly_name: nil,
phone_number: nil,
lata: nil,
rate_cent... | defmodule ExTwilio.AvailablePhoneNumber do
@moduledoc """
Represents an AvailablePhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource)
"""
defstruct friendly_name: nil,
phone_number: nil,
lata: nil,
... | Update redirect link to AvailablePhoneNumber API | Update redirect link to AvailablePhoneNumber API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
51117b147ce91074d47e4eb80d658aef6f2cc666 | test/battle_snake/game_server/supervisor_test.exs | test/battle_snake/game_server/supervisor_test.exs | defmodule BattleSnake.GameServer.SupervisorTest do
alias BattleSnake.{
GameServer,
}
use BattleSnake.Case, async: false
@sup_name GameServer.Supervisor
describe "GameServer.Supervisor.start_game_server/1" do
import GameServer.Supervisor, only: [start_game_server: 1]
test "does not link the Gam... | defmodule BattleSnake.GameServer.SupervisorTest do
alias BattleSnake.GameServer.Supervisor
use BattleSnake.Case, async: false
describe "Supervisor.start_game_server/1" do
test "starts a game server process" do
{:ok, game_server} = Supervisor.start_game_server([build(:state)])
assert is_pid game_... | Remove bad tests from supervisor | Remove bad tests from supervisor
These tests suck. They don't add value to the project.
They test the behavior of OTP.
The only thing that needs to be tested here is that a pid is returned.
| Elixir | agpl-3.0 | Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake |
c862dcc2da5e6ad9fef0c9b1e7df0877b9779b13 | config/prod.exs | config/prod.exs | use Mix.Config
config :slack_coder, SlackCoder.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE")
config :slack_coder, SlackCoder.Repo,
adapter: Ecto.Adapters.Postgres,
# url: "postgres://postgres:postgres@localhost/slack_coder",
url: System.get_env("DATABASE_URL"),
size: 20
if File.exists? "conf... | use Mix.Config
config :slack_coder, SlackCoder.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE")
http: [port: {:system, "PORT"}],
url: [host: "slack-coder.herokuapp.com", port: 80],
cache_static_manifest: "priv/static/manifest.json"
# Do not print debug messages in production
config :logger, level:... | Add system port config that was accidentally removed. | Add system port config that was accidentally removed.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
fed0777ee28732fbae8492b8a01f8282def3d1eb | lib/credo/sources.ex | lib/credo/sources.ex | defmodule Credo.Sources do
@default_sources_glob ~w(** *.{ex,exs})
def find(%Credo.Config{files: files}) do
files.included
|> Enum.flat_map(&find/1)
|> exclude(files.excluded)
|> to_source_files
end
def find(path) do
path
|> to_glob
|> Path.wildcard
end
def exclude(files, patt... | defmodule Credo.Sources do
@default_sources_glob ~w(** *.{ex,exs})
def find(%Credo.Config{files: files}) do
files.included
|> Enum.flat_map(&find/1)
|> exclude(files.excluded)
|> to_source_files
end
def find(path) do
path
|> to_glob
|> Path.wildcard
end
def exclude(files, patt... | Fix files' exclude pattern in .credo.exs | Fix files' exclude pattern in .credo.exs
Fixes #11
| Elixir | mit | rrrene/credo,rrrene/credo |
a092d14f5c71698d45e84879e0f9c0e4e99978b5 | test/appsignal/error/backend_test.exs | test/appsignal/error/backend_test.exs | defmodule Appsignal.Error.BackendTest do
use ExUnit.Case, async: true
import AppsignalTest.Utils
import ExUnit.CaptureIO
alias Appsignal.{Error.Backend, Span, Test, WrappedNif}
setup do
WrappedNif.start_link()
Test.Tracer.start_link()
Test.Span.start_link()
:ok
end
test "is added as a L... | defmodule Appsignal.Error.BackendTest do
use ExUnit.Case, async: true
import AppsignalTest.Utils
import ExUnit.CaptureIO
alias Appsignal.{Error.Backend, Span, Test, WrappedNif}
setup do
WrappedNif.start_link()
Test.Tracer.start_link()
Test.Span.start_link()
:ok
end
test "is added as a L... | Update describe block in Error.BackendTest | Update describe block in Error.BackendTest
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir |
575b26d0abeddf3a0f5442db261becd9beb16a7e | lib/mix/tasks/dogma.ex | lib/mix/tasks/dogma.ex | defmodule Mix.Tasks.Dogma do
use Mix.Task
@shortdoc "Check Elixir source files for style violations"
@moduledoc @shortdoc
alias Dogma.Config
alias Dogma.Formatter
def run(argv) do
{dir, formatter} = argv |> parse_args
config = Config.build
dir
|> Dogma.run(config, formatter)
|> any_... | defmodule Mix.Tasks.Dogma do
use Mix.Task
@shortdoc "Check Elixir source files for style violations"
@moduledoc @shortdoc
alias Dogma.Config
alias Dogma.Formatter
def run(argv) do
{dir, formatter, noerrors} = argv |> parse_args
config = Config.build
dir
|> Dogma.run(config, formatter)
... | Allow disabling the unix exit code via `--noerrors` | Allow disabling the unix exit code via `--noerrors`
This is useful when using linting as part of a CI pipeline which would
otherwise stop when an exit code other than `0` is returned, while one
is only interested in the text results of the linter.
| Elixir | mit | rrrene/dogma |
28ec0b33ba63fb6463a3731c69a7bbe18e6d7c04 | lib/addict/helper.ex | lib/addict/helper.ex | defmodule Addict.Helper do
@moduledoc """
Addict Helper functions
"""
@doc """
Returns the current user in session in a Hash
"""
def current_user(conn) do
conn |> Plug.Conn.fetch_session |> Plug.Conn.get_session(:current_user)
end
@doc """
Verifies if user is logged in
Returns a boolean
"""
d... | defmodule Addict.Helper do
@moduledoc """
Addict Helper functions
"""
@doc """
Returns the current user in session in a Hash
"""
def current_user(conn) do
conn |> Plug.Conn.fetch_session |> Plug.Conn.get_session(:current_user)
end
@doc """
Verifies if user is logged in
Returns a boolean
"""
d... | Validate against `nil` instead of `"null" | Validate against `nil` instead of `"null"
Doh...
Closes #90
| Elixir | mit | trenpixster/addict,trenpixster/addict |
feab3d8a32e1e75223dc99a89c29066b4b279540 | mix.exs | mix.exs | defmodule ExDocEPUB.Mixfile do
use Mix.Project
def project do
[app: :ex_doc_epub,
version: "0.0.2",
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` fo... | defmodule ExDocEPUB.Mixfile do
use Mix.Project
@version "0.0.2"
def project do
[app: :ex_doc_epub,
version: @version,
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
# Hex.pm
description: description,
package: packag... | Add metadata for hex.pm and ExDoc | Add metadata for hex.pm and ExDoc
| Elixir | mit | milmazz/ex_doc_epub |
51264b70372e14dc171962ad60a373d9c57942d3 | test/channel_test.exs | test/channel_test.exs | defmodule Poxa.ChannelTest do
use ExUnit.Case
import SpawnHelper
import Poxa.Channel
doctest Poxa.Channel
test "occupied? returns false for empty channel" do
refute occupied?("a channel")
end
test "occupied? returns true for populated channel" do
register_to_channel("a channel")
assert occu... | defmodule Poxa.ChannelTest do
use ExUnit.Case
import SpawnHelper
import Poxa.Channel
doctest Poxa.Channel
test "occupied? returns false for empty channel" do
refute occupied?("a channel")
end
test "occupied? returns true for populated channel" do
register_to_channel("a channel")
assert occu... | Refactor channel test on all/0 | Refactor channel test on all/0
| Elixir | mit | joshk/poxa,edgurgel/poxa,edgurgel/poxa,waffleio/poxa,edgurgel/poxa,joshk/poxa,RobertoSchneiders/poxa,waffleio/poxa,RobertoSchneiders/poxa |
6e9e4956029b97a0232f7f6a42c9fd56773c1340 | apps/hard_hat/mix.exs | apps/hard_hat/mix.exs | defmodule HardHat.Mixfile do
use Mix.Project
def project() do
[
app: :hard_hat,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.3",
build_embedded: Mix.env ==... | defmodule HardHat.Mixfile do
use Mix.Project
def project() do
[
app: :hard_hat,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.3",
build_embedded: Mix.env ==... | Add httpoison and poison as deps for Hard Hat | Add httpoison and poison as deps for Hard Hat
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni |
cdc91ad877f4f92898ac4b406487611624185652 | exercises/queen-attack/queen_attack.exs | exercises/queen-attack/queen_attack.exs | defmodule Queens do
@type t :: %Queens{black: {integer, integer}, white: {integer, integer}}
defstruct black: nil, white: nil
@doc """
Creates a new set of Queens
"""
@spec new({integer, integer}, {integer, integer}) :: Queens.t()
def new(white, black) do
end
@doc """
Gives a string representation... | defmodule Queens do
@type t :: %Queens{black: {integer, integer}, white: {integer, integer}}
defstruct black: nil, white: nil
@doc """
Creates a new set of Queens
"""
@spec new() :: Queens.t()
@spec new({integer, integer}, {integer, integer}) :: Queens.t()
def new(white \\ nil, black \\ nil) do
end
... | Add default values to queen-attack `Queens.new/2` | Add default values to queen-attack `Queens.new/2`
They are however, invalid in the context of this exercise. We are adding
them so that we can bring back the spec for `Queens.new/0` which was
removed wrongly, the spec is supposed to be there to show students this
style of writing specs. However, for the code to compil... | Elixir | mit | exercism/xelixir |
7022215fe74ac581564cdf50a626d4c390eb4668 | config/config.exs | config/config.exs | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :jumubase,
ecto_repos: [Jumubase.Repo]
... | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :jumubase,
ecto_repos: [Jumubase.Repo]
... | Use German locale by default | Use German locale by default
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
0359c0191eced6a91f70378b67509033737526b4 | test/tesla/middleware/telemetry_test.exs | test/tesla/middleware/telemetry_test.exs | defmodule Tesla.Middleware.TelemetryTest do
use ExUnit.Case, async: true
defmodule Client do
use Tesla
plug Tesla.Middleware.Telemetry
adapter fn env ->
case env.url do
"/telemetry" -> {:ok, env}
"/telemetry_error" -> {:error, :econnrefused}
end
end
end
setup do
... | defmodule Tesla.Middleware.TelemetryTest do
use ExUnit.Case, async: true
defmodule Client do
use Tesla
plug Tesla.Middleware.Telemetry
adapter fn env ->
case env.url do
"/telemetry" -> {:ok, env}
"/telemetry_error" -> {:error, :econnrefused}
end
end
end
setup do
... | Use Application.ensure_all_started for starting telemetry in unit test | Use Application.ensure_all_started for starting telemetry in unit test
| Elixir | mit | monterail/tesla,teamon/tesla |
615afe41ebe26e5915050bbdb42286f52b96574b | web/views/job_view.ex | web/views/job_view.ex | defmodule GetAJobEx.JobView do
use GetAJobEx.Web, :view
def render("api.json", _) do
%{job: %{number_one: nil,
number_two: nil,
status: nil,
links: [
%{href: "/api/jobs",
rel: "index"}
],
}
}
end
def ren... | defmodule GetAJobEx.JobView do
import GetAJobEx.Router.Helpers
use GetAJobEx.Web, :view
def render("api.json", %{conn: conn}) do
job(conn)
end
def render("index.json", %{jobs: jobs}) do
%{data: jobs}
end
def render("show.json", %{job: job}) do
%{job: job}
end
defp job(conn) do
%{n... | Use path helper to render responses. | Use path helper to render responses.
| Elixir | mit | smoynes/get_a_job_ex,smoynes/get_a_job_ex |
119d48e093a34df24436aed1488ef76be712b5f4 | lib/elixir/test/elixir/io/ansi_test.exs | lib/elixir/test/elixir/io/ansi_test.exs | Code.require_file "../../test_helper.exs", __FILE__
defmodule IO.ANSITest do
use ExUnit.Case, async: true
test :escape_single do
assert IO.ANSI.escape("Hello, #[red]world!#[reset]") ==
"Hello, #{IO.ANSI.red}world!#{IO.ANSI.reset}"
assert IO.ANSI.escape("Hello, #[ red ]world!#[reset]") ==
... | Code.require_file "../../test_helper.exs", __FILE__
defmodule IO.ANSITest do
use ExUnit.Case, async: true
test :escape_single do
assert IO.ANSI.escape("Hello, #[red]world!#[reset]", true) ==
"Hello, #{IO.ANSI.red}world!#{IO.ANSI.reset}"
assert IO.ANSI.escape("Hello, #[ red ]world!#[reset]", tru... | Improve IO.ANSI test case so it can be run on non-terminals correctly | Improve IO.ANSI test case so it can be run on non-terminals correctly
| Elixir | apache-2.0 | ggcampinho/elixir,kelvinst/elixir,kelvinst/elixir,michalmuskala/elixir,ggcampinho/elixir,antipax/elixir,elixir-lang/elixir,beedub/elixir,joshprice/elixir,antipax/elixir,beedub/elixir,gfvcastro/elixir,pedrosnk/elixir,lexmag/elixir,pedrosnk/elixir,gfvcastro/elixir,lexmag/elixir,kimshrier/elixir,kimshrier/elixir |
b62ab9d541c26e162de82384ed05e4dbc7413d8d | test/elixir/range_test.exs | test/elixir/range_test.exs | Code.require_file "../test_helper", __FILE__
defmodule RangeTest do
use ExUnit.Case
test :first do
assert Range.new(1, 3).first == 1
end
test :last do
assert Range.new(1, 3).last == 3
end
test :op do
assert (1..3).first == 1
assert (1..3).last == 3
end
end | Code.require_file "../test_helper", __FILE__
defmodule RangeTest do
use ExUnit.Case
test :first do
assert Range.new(1, 3).first == 1
end
test :last do
assert Range.new(1, 3).last == 3
end
test :op do
assert (1..3).first == 1
assert (1..3).last == 3
end
test :in do
refute 0 in 1... | Add some in range assertions | Add some in range assertions
| Elixir | apache-2.0 | pedrosnk/elixir,gfvcastro/elixir,beedub/elixir,elixir-lang/elixir,gfvcastro/elixir,joshprice/elixir,antipax/elixir,lexmag/elixir,kimshrier/elixir,kimshrier/elixir,lexmag/elixir,kelvinst/elixir,beedub/elixir,kelvinst/elixir,antipax/elixir,michalmuskala/elixir,ggcampinho/elixir,pedrosnk/elixir,ggcampinho/elixir |
da713311ce85f09b74d3ce9acde16ef2e547c543 | lib/choicest_web/router.ex | lib/choicest_web/router.ex | defmodule ChoicestWeb.Router do
use ChoicestWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", ChoicestWeb do
pi... | defmodule ChoicestWeb.Router do
use ChoicestWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
pipeline :auth do
plug :acce... | Reorganize routes to authenticated and public | Reorganize routes to authenticated and public
| Elixir | mit | Cadiac/choicest,Cadiac/choicest,Cadiac/choicest |
b949af3b6882c88c43f44297d7d2e6cdf3a9e9b3 | web/models/students.ex | web/models/students.ex | defmodule CoursePlanner.Students do
alias CoursePlanner.Repo
alias CoursePlanner.User
import Ecto.Query
@students from u in User, where: u.role == "Student" and is_nil(u.deleted_at)
def all() do
Repo.all(@students)
end
def update(id, params) do
case Repo.get(User, id) do
student ->
... | defmodule CoursePlanner.Students do
alias CoursePlanner.Repo
alias CoursePlanner.User
import Ecto.Query
alias Ecto.{Changeset, DateTime}
@students from u in User, where: u.role == "Student" and is_nil(u.deleted_at)
def all() do
Repo.all(@students)
end
def update(id, params) do
case Repo.get(U... | Set timestamp when changing status. | Set timestamp when changing status.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
7ca2304c88f760e608d6fbb4dd64e7ecf2442657 | test/controllers/page_controller_test.exs | test/controllers/page_controller_test.exs | defmodule Stranger.PageControllerTest do
use Stranger.ConnCase
test "GET /", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Hello Stranger"
end
get "GET /agreement", %{conn: conn} do
conn = get conn, "/agreement"
assert html_response(conn, 200) =~ "User Agreement"
... | defmodule Stranger.PageControllerTest do
use Stranger.ConnCase
test "GET /", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Hello Stranger"
end
test "GET /agreement", %{conn: conn} do
conn = get conn, "/agreement"
assert html_response(conn, 200) =~ "User Agreement"
... | Fix test by using correct test method | Fix test by using correct test method
| Elixir | mit | cazrin/stranger,cazrin/stranger |
62bcefeb38a806ae78f99810936d44d3ecd9669c | elixir/nucleotide-count/nucleotide_count.exs | elixir/nucleotide-count/nucleotide_count.exs | defmodule NucleotideCount do
@nucleotides [?A, ?C, ?G, ?T]
def count(strand, nucleotide) do
strand |> Enum.count(fn char -> char == nucleotide end)
end
def histogram(strand) do
@nucleotides |> Map.new(fn char -> { char, count(strand, char) } end)
end
end
| defmodule NucleotideCount do
@nucleotides [?A, ?C, ?G, ?T]
def count(strand, nucleotide) do
strand |> Enum.count(&(&1 == nucleotide))
end
def histogram(strand) do
@nucleotides |> Map.new(&({ &1, count(strand, &1)}))
end
end
| Refactor Nucleotide Count in Elixir | Refactor Nucleotide Count in Elixir
| Elixir | mit | parkertm/exercism |
3c8601897a43fbe68d1ebaffbe25ae3d7249669b | platform/target/network/wait_for_time.ex | platform/target/network/wait_for_time.ex | defmodule Farmbot.Target.Network.WaitForTime do
use Farmbot.Logger
nerves_time = case Nerves.Time.FileTime.time() do
{:error, _} -> NaiveDateTime.utc_now()
ndt -> ndt
end
@nerves_time nerves_time
def start_link(_, _) do
:ok = wait_for_time()
Logger.success 3, "Time seems to be set. Moving on.... | defmodule Farmbot.Target.Network.WaitForTime do
use Farmbot.Logger
nerves_time = case Nerves.Time.FileTime.time() do
{:error, _} -> NaiveDateTime.utc_now()
ndt -> ndt
end
@nerves_time nerves_time
def start_link(_, _) do
:ok = wait_for_time()
Logger.success 3, "Time seems to be set. Moving on.... | Fix race condition in getting time. | Fix race condition in getting time.
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
84ce6b75d277a5764207472a5ad14d8bd785edcf | lib/logger/test/test_helper.exs | lib/logger/test/test_helper.exs | Logger.configure_backend(:console, colors: [enabled: false])
ExUnit.start()
defmodule Logger.Case do
use ExUnit.CaseTemplate
import ExUnit.CaptureIO
using _ do
quote do
import Logger.Case
end
end
def msg(msg) do
~r/\d\d\:\d\d\:\d\d\.\d\d\d #{Regex.escape(msg)}/
end
def wait_for_handl... | Logger.configure_backend(:console, colors: [enabled: false])
ExUnit.start()
defmodule Logger.Case do
use ExUnit.CaseTemplate
import ExUnit.CaptureIO
using _ do
quote do
import Logger.Case
end
end
def msg(msg) do
~r/\d\d\:\d\d\:\d\d\.\d\d\d #{Regex.escape(msg)}/
end
def wait_for_handl... | Fix keyword ordering on try | Fix keyword ordering on try
| Elixir | apache-2.0 | beedub/elixir,antipax/elixir,pedrosnk/elixir,michalmuskala/elixir,ggcampinho/elixir,gfvcastro/elixir,kimshrier/elixir,beedub/elixir,kelvinst/elixir,pedrosnk/elixir,lexmag/elixir,antipax/elixir,lexmag/elixir,kelvinst/elixir,joshprice/elixir,elixir-lang/elixir,kimshrier/elixir,gfvcastro/elixir,ggcampinho/elixir |
5915a300917def548e518db95d93cb7b2530d38a | verify/geolix/mix.exs | verify/geolix/mix.exs | defmodule Geolix.Verification.Mixfile do
use Mix.Project
def project do
[
app: :geolix_verification,
version: "0.0.1",
elixir: "~> 1.5",
deps: [{:geolix_adapter_mmdb2, path: "../../"}],
deps_path: "../../deps",
lockfile: "../../mix.lock"
]
end
end
| defmodule Geolix.Verification.Mixfile do
use Mix.Project
def project do
[
app: :geolix_verification,
version: "0.0.1",
elixir: "~> 1.7",
deps: [{:geolix_adapter_mmdb2, path: "../../"}],
deps_path: "../../deps",
lockfile: "../../mix.lock"
]
end
end
| Update verification elixir requirement to library value | Update verification elixir requirement to library value
| Elixir | apache-2.0 | elixir-geolix/adapter_mmdb2,elixir-geolix/adapter_mmdb2 |
659359f62d1604adf465ca359f019d0cf514b1fb | lib/serum/template.ex | lib/serum/template.ex | defmodule Serum.Template do
@moduledoc "Defines a struct which stores a template and its information."
@type t() :: %__MODULE__{
type: type(),
file: binary(),
ast: Macro.t()
}
@type collection() :: %{optional(binary()) => t()}
@type type() :: :template | :include
defst... | defmodule Serum.Template do
@moduledoc "Defines a struct which stores a template and its information."
@type t() :: %__MODULE__{
type: type(),
file: binary(),
ast: Macro.t(),
include_resolved?: boolean()
}
@type collection() :: %{optional(binary()) => t()}
@type... | Add `:include_resolved?` key to Template struct | Add `:include_resolved?` key to Template struct
| Elixir | mit | Dalgona/Serum |
56709eb2fcec23ae1f59ff3083349679ea19e9ad | web/forms/admin/portfolio/image_series_form.ex | web/forms/admin/portfolio/image_series_form.ex | defmodule Brando.Portfolio.Admin.ImageSeriesForm do
@moduledoc """
A form for the ImageCategory model. See the `Brando.Form` module for more
documentation
"""
use Brando.Form
alias Brando.Portfolio.ImageCategory
alias Brando.Portfolio.ImageSeries
@doc false
def get_categories() do
categories =
... | defmodule Brando.Portfolio.Admin.ImageSeriesForm do
@moduledoc """
A form for the ImageCategory model. See the `Brando.Form` module for more
documentation
"""
use Brando.Form
alias Brando.Portfolio.ImageCategory
alias Brando.Portfolio.ImageSeries
@doc false
def get_categories() do
categories =
... | Call function at module level | Call function at module level
| Elixir | mit | twined/brando_portfolio,twined/brando_portfolio |
145b110fa7b4938e2e1976957b4ca806a1d0db48 | mix.exs | mix.exs | defmodule ExMagic.Mixfile do
use Mix.Project
def project do
[app: :exmagic,
version: "0.0.1",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
compilers: [:make, :elixir, :app],
aliases: aliases(),
deps: deps()]
end
defp aliases do
... | defmodule ExMagic.Mixfile do
use Mix.Project
def project do
[app: :exmagic,
version: "0.0.1",
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
compilers: [:make, :elixir, :app],
aliases: aliases(),
deps: deps()]
end
defp aliases do
... | Declare we only need Elixir 1.0 or greater | Declare we only need Elixir 1.0 or greater
| Elixir | mit | andrew-d/exmagic,andrew-d/exmagic |
05a1bdc1e1d67105f50b2041b39f3fad851bb653 | lib/elixir/test/elixir/hash_dict_test.exs | lib/elixir/test/elixir/hash_dict_test.exs | Code.require_file "../test_helper.exs", __FILE__
defmodule HashDictTest do
use ExUnit.Case, async: true
defp smoke_test(range) do
dict = Enum.reduce 1..range, HashDict.new, fn(x, acc) ->
acc = HashDict.put(acc, x, x)
assert HashDict.size(acc) == x
acc
end
Enum.each 1..range, fn(x) -... | Code.require_file "../test_helper.exs", __FILE__
defmodule HashDictTest do
use ExUnit.Case, async: true
defp smoke_test(range) do
dict = Enum.reduce 1..range, HashDict.new, fn(x, acc) ->
acc = HashDict.put(acc, x, x)
assert HashDict.size(acc) == x
acc
end
Enum.each 1..range, fn(x) -... | Increase large hash dict tests range | Increase large hash dict tests range
| Elixir | apache-2.0 | gfvcastro/elixir,ggcampinho/elixir,kelvinst/elixir,antipax/elixir,kelvinst/elixir,joshprice/elixir,pedrosnk/elixir,kimshrier/elixir,gfvcastro/elixir,ggcampinho/elixir,kimshrier/elixir,michalmuskala/elixir,beedub/elixir,pedrosnk/elixir,beedub/elixir,lexmag/elixir,lexmag/elixir,antipax/elixir,elixir-lang/elixir |
a5c46b6fe3cb6fff69df35bbdca9eaca579fbb17 | lib/pullhub/fetchers/repo_fetcher.ex | lib/pullhub/fetchers/repo_fetcher.ex | defmodule Pullhub.RepoFetcher do
require Logger
use GenServer
alias Pullhub.Repo
alias Pullhub.User
alias Pullhub.GithubApi
alias Pullhub.Repository
alias Pullhub.RepositoriesService
def start_link(opts \\ []) do
{:ok, pid} = GenServer.start_link(__MODULE__, [], opts)
end
def fetch(fetch_par... | defmodule Pullhub.RepoFetcher do
use GenServer
alias Pullhub.GithubApi
alias Pullhub.Repository
def fetch(fetch_params) do
GenServer.cast(:repo_fetcher, {:fetch_user_github_repositories, fetch_params})
end
def handle_cast({:fetch_user_github_repositories, fetch_params}, state) do
%{user: user} = ... | Make RepoFetcher broadcast downloaded repositories | Make RepoFetcher broadcast downloaded repositories
Each user can now request to download repositories individually. The
fetcher broadcasts a list of rendered repository-rows for the client to
insert when finish fetching.
| Elixir | mit | substancelab/pullhub,substancelab/pullhub,substancelab/pullhub |
6b7b80a3b0451ec5ffc6193d4eed2037ce6b07d8 | farmbot_core/lib/farmbot_core/config_storage/network_interface.ex | farmbot_core/lib/farmbot_core/config_storage/network_interface.ex | defmodule FarmbotCore.Config.NetworkInterface do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
schema "network_interfaces" do
field(:name, :string, null: false)
field(:type, :string, null: false)
## For wireless interfaces
field(:ssid, :string)
field(:psk, :string)
field(:sec... | defmodule FarmbotCore.Config.NetworkInterface do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
schema "network_interfaces" do
field(:name, :string, null: false)
field(:type, :string, null: false)
## For wireless interfaces
field(:ssid, :string)
field(:psk, :string)
field(:sec... | Fix Regulatory Domain setting not being casted | Fix Regulatory Domain setting not being casted
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
7259247efad534704809dd7a809077e9a5408dbf | lib/algae/free.ex | lib/algae/free.ex | defmodule Algae.Free do
use Quark.Partial
@type t :: Algae.Free.Pure.t | Algae.Free.Wrap.t
defmodule Pure do
@type t :: %Algae.Free.Pure{pure: any}
defstruct [:pure]
end
defmodule Wrap do
@type t :: %Algae.Free.Wrap{wrap: any}
@moduledoc ~S"""
`wrap` must be some functor wrapping anoth... | defmodule Algae.Free do
use Quark.Partial
@type t :: Algae.Free.Pure.t | Algae.Free.Deep.t
defmodule Shallow do
@type t :: %Algae.Free.Shallow{shallow: any}
defstruct [:shallow]
end
defmodule Deep do
@moduledoc ~S"""
Deep holds two values: a value (often a functor) in `deep`, and another
... | Rework %Free with more explicit structure | Rework %Free with more explicit structure
| Elixir | mit | robot-overlord/algae |
db2a49f8026841141cc9455eb28cc15160a958d8 | lib/gn_server/router/biodalliance/snp.ex | lib/gn_server/router/biodalliance/snp.ex | defmodule GnServer.Router.Biodalliance.SNP do
alias GnServer.Biodalliance.SNPDensity, as: SNPDensity
use Maru.Router
plug CORSPlug, headers: ["Range", "If-None-Match", "Accept-Ranges"], expose: ["Content-Range"]
namespace :snp do
namespace :features do
route_param :chr, type: String do
para... | defmodule GnServer.Router.Biodalliance.SNP do
alias GnServer.Biodalliance.SNPDensity
use Maru.Router
plug CORSPlug, headers: ["Range", "If-None-Match", "Accept-Ranges"], expose: ["Content-Range"]
namespace :snp do
namespace :features do
route_param :chr, type: String do
params do
... | Increase SNP density bin size | Increase SNP density bin size
| Elixir | agpl-3.0 | genenetwork/gn_server |
70323f5b27811f0f9484fc2743b87409d5a755d4 | web/controllers/tp_rating_plan_controller.ex | web/controllers/tp_rating_plan_controller.ex | defmodule CgratesWebJsonapi.TpRatingPlanController do
use CgratesWebJsonapi.Web, :controller
use CgratesWebJsonapi.Web, :controller
use JaResource
use CgratesWebJsonapi.TpSubresource
use CgratesWebJsonapi.DefaultSorting
alias CgratesWebJsonapi.TpRatingPlan
plug JaResource
def handle_show(conn, id), ... | defmodule CgratesWebJsonapi.TpRatingPlanController do
use CgratesWebJsonapi.Web, :controller
use CgratesWebJsonapi.Web, :controller
use JaResource
use CgratesWebJsonapi.TpSubresource
use CgratesWebJsonapi.DefaultSorting
alias CgratesWebJsonapi.TpRatingPlan
plug JaResource
def handle_show(conn, id), ... | Fix filter by weight for TpRatingPlan | Fix filter by weight for TpRatingPlan | Elixir | mit | cgrates-web/cgrates_web_jsonapi |
e78cef9dd057d567b52ed273e902b51f5f42aafb | web/models/skill.ex | web/models/skill.ex | defmodule CodeCorps.Skill do
use CodeCorps.Web, :model
import CodeCorps.Validators.SlugValidator
alias Inflex
schema "skills" do
field :title, :string
field :description, :string
field :original_row, :integer
field :slug, :string
timestamps()
end
@doc """
Builds a changeset based on... | defmodule CodeCorps.Skill do
use CodeCorps.Web, :model
import CodeCorps.Validators.SlugValidator
import CodeCorps.ModelHelpers
schema "skills" do
field :title, :string
field :description, :string
field :original_row, :integer
field :slug, :string
timestamps()
end
@doc """
Builds a c... | Update slug generation to use model helper | Update slug generation to use model helper
| Elixir | mit | code-corps/code-corps-api,crodriguez1a/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api |
5d4f97a8549c19e61d5633d1166e53a5d856b3d7 | lib/watcher.ex | lib/watcher.ex | defmodule Watcher do
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, dirs: ["lib/koans"])
end
def init(args) do
{:ok, watcher_pid} = FileSystem.start_link(args)
FileSystem.subscribe(watcher_pid)
{:ok, %{watcher_pid: watcher_pid}}
end
def handle_info({:file_event, watche... | defmodule Watcher do
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, dirs: ["lib/koans"])
end
def init(args) do
{:ok, watcher_pid} = FileSystem.start_link(args)
FileSystem.subscribe(watcher_pid)
{:ok, %{watcher_pid: watcher_pid}}
end
def handle_info({:file_event, watche... | Make code loading compatible and deprecation free on old and new elixirs | Make code loading compatible and deprecation free on old and new elixirs
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans |
917667096daa8aab5197dc362314f166e738bf2f | lib/credo/cli/output/ui.ex | lib/credo/cli/output/ui.ex | defmodule Credo.CLI.Output.UI do
@edge "┃"
def edge(color, indent \\ 2) when is_integer(indent) do
[:reset, color, @edge |> String.ljust(indent)]
end
defdelegate puts, to: Bunt
defdelegate puts(v), to: Bunt
def puts(v, color), do: Bunt.puts([color, v])
def wrap_at(text, number, acc \\ []) do
... | defmodule Credo.CLI.Output.UI do
@edge "┃"
def edge(color, indent \\ 2) when is_integer(indent) do
[:reset, color, @edge |> String.ljust(indent)]
end
defdelegate puts, to: Bunt
defdelegate puts(v), to: Bunt
def puts(v, color), do: Bunt.puts([color, v])
def wrap_at(text, number) do
Regex.compi... | Remove unused variable for UI.wrap_at | Remove unused variable for UI.wrap_at
| Elixir | mit | rrrene/credo,rrrene/credo |
321a0096e0fb42038ff3e45151c52030e47548a5 | backend/lib/emoji_map/tweet_consumer.ex | backend/lib/emoji_map/tweet_consumer.ex | defmodule EmojiMap.TweetConsumer do
@moduledoc """
The consumer side. Subscribes to the producer once it is started so when
it crashes and the supervisor restarts it, it automatically re-subscribes
"""
use GenStage
@doc """
Starts the consumer.
"""
def start_link() do
GenStage.start_link(__MODUL... | defmodule EmojiMap.TweetConsumer do
@moduledoc """
The consumer side. Subscribes to the producer once it is started so when
it crashes and the supervisor restarts it, it automatically re-subscribes
"""
use GenStage
@doc """
Starts the consumer.
"""
def start_link() do
GenStage.start_link(__MODUL... | Change format of data sent via channel | Change format of data sent via channel
| Elixir | mit | ospaarmann/ex-emoji-map,ospaarmann/ex-emoji-map,ospaarmann/ex-emoji-map |
ad372e8f6588e104ceb23e083ca3f8af6eb5b672 | api/web/views/product_view.ex | api/web/views/product_view.ex | defmodule Api.ProductView do
use Api.Web, :view
def render("index.json", %{products: products}) do
%{data: render_many(products, Api.ProductView, "product.json")}
end
def render("show.json", %{product: product}) do
%{data: render_one(product, Api.ProductView, "product.json")}
end
def render("prod... | defmodule Api.ProductView do
use Api.Web, :view
def render("index.json", %{products: products}) do
%{products: render_many(products, Api.ProductView, "product.json")}
end
def render("show.json", %{product: product}) do
%{product: render_one(product, Api.ProductView, "product.json")}
end
def rende... | Change data to product in JSON attribute | Change data to product in JSON attribute
| Elixir | mit | acoustep/ember-phoenix-slug-example,acoustep/ember-phoenix-slug-example |
91ec77e63262efa372a701afff0915ddf99dcaa6 | mix.exs | mix.exs | defmodule Redix.Mixfile do
use Mix.Project
@description """
Superfast, pipelined, resilient Redis driver for Elixir.
"""
@repo_url "https://github.com/whatyouhide/redix"
@version "0.5.1"
def project() do
[app: :redix,
version: @version,
elixir: "~> 1.2",
build_embedded: Mix.env == :... | defmodule Redix.Mixfile do
use Mix.Project
@description "Superfast, pipelined, resilient Redis driver for Elixir."
@repo_url "https://github.com/whatyouhide/redix"
@version "0.5.1"
def project() do
[app: :redix,
version: @version,
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
... | Remove the trailing newline out of the Mix package description | Remove the trailing newline out of the Mix package description
This newline carries over the application description, which tends to look off
then.
| Elixir | mit | whatyouhide/redix |
8293133878e91b64f503476008958e58219b823c | lib/aelita2/models/patch.ex | lib/aelita2/models/patch.ex | defmodule Aelita2.Patch do
use Aelita2.Web, :model
alias Aelita2.Patch
schema "patches" do
belongs_to :project, Aelita2.Project
belongs_to :batch, Aelita2.Batch
field :pr_xref, :integer
field :title, :string
field :body, :string
field :commit, :string
belongs_to :author, Aelita2.User... | defmodule Aelita2.Patch do
use Aelita2.Web, :model
alias Aelita2.Patch
schema "patches" do
belongs_to :project, Aelita2.Project
belongs_to :batch, Aelita2.Batch
field :pr_xref, :integer
field :title, :string
field :body, :string
field :commit, :string
belongs_to :author, Aelita2.User... | Use a more reasonable setup for Patch changesets | Use a more reasonable setup for Patch changesets
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
085af145578d0e771eaf9817f067898aa9ff791b | lib/phoenix/code_reloader/change_detector.ex | lib/phoenix/code_reloader/change_detector.ex | defmodule Phoenix.CodeReloader.ChangeDetector do
use GenServer
@moduledoc """
Watches paths for ctime changes and calls MFA
"""
def start_link(paths, mfa, poll_every_ms \\ 300) do
GenServer.start_link(__MODULE__, [paths, mfa, poll_every_ms])
end
def init([paths, mfa, poll_every_ms]) do
paths = ... | defmodule Phoenix.CodeReloader.ChangeDetector do
use GenServer
@moduledoc """
Watches paths for ctime changes and calls MFA
"""
def start_link(paths, mfa, poll_every_ms \\ 300) do
GenServer.start_link(__MODULE__, [paths, mfa, poll_every_ms])
end
def init([paths, mfa, poll_every_ms]) do
paths = ... | Use max for ctime/mtime change detection | Use max for ctime/mtime change detection
| Elixir | mit | VictorZeng/phoenix,ugisozols/phoenix,kyledecot/phoenix,phoenixframework/phoenix,paulcsmith/phoenix,henrik/phoenix,romul/phoenix,rafbgarcia/phoenix,evax/phoenix,rafbgarcia/phoenix,phoenixframework/phoenix,ephe-meral/phoenix,hsavit1/phoenix,michalmuskala/phoenix,SmartCasual/phoenix,sdnorm/phoenix,nshafer/phoenix,lono-dev... |
fd7184198ce456c0bf35b9f73d01c1c343b0541f | test/ontag_core/accounts_test.exs | test/ontag_core/accounts_test.exs | defmodule OntagCore.AccountsTest do
use OntagCore.DataCase
alias OntagCore.Accounts
@moduledoc """
Test for `OntagCore.Accounts`
"""
test "Create a user without credentials successfully" do
params = %{
username: "john_example",
name: "John example"
}
assert {:ok, user} = Accounts.c... | defmodule OntagCore.AccountsTest do
use OntagCore.DataCase
alias OntagCore.Accounts
@moduledoc """
Test for `OntagCore.Accounts`
"""
test "Create a user without credentials successfully" do
params = %{
username: "john_example",
name: "John example"
}
assert {:ok, user} = Accounts.c... | Add new test in OntagCore.Accounts | Add new test in OntagCore.Accounts
| Elixir | mit | CommonActionForum/ontag_core,CommonActionForum/ontag_core |
21c41f3a74ecc4126cbb3d58afec21293cc1ad6c | test/elixir/elixir/partial_application_test.exs | test/elixir/elixir/partial_application_test.exs | defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_w... | defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_w... | Add test for partially applying an internal macro. | Add test for partially applying an internal macro.
| Elixir | apache-2.0 | beedub/elixir,beedub/elixir,lexmag/elixir,joshprice/elixir,antipax/elixir,lexmag/elixir,gfvcastro/elixir,ggcampinho/elixir,elixir-lang/elixir,gfvcastro/elixir,kimshrier/elixir,kimshrier/elixir,kelvinst/elixir,pedrosnk/elixir,kelvinst/elixir,pedrosnk/elixir,ggcampinho/elixir,michalmuskala/elixir,antipax/elixir |
cd6d79f8ec4e98bc83f61c3b8126959c4ab41ce3 | lib/httparrot/deny_handler.ex | lib/httparrot/deny_handler.ex | defmodule HTTParrot.DenyHandler do
@moduledoc """
Returns a simple HTML page.
"""
alias HTTParrot.GeneralRequestInfo
def init(_transport, _req, _opts) do
{:upgrade, :protocol, :cowboy_rest}
end
def allowed_methods(req, state) do
{["GET", "HEAD", "OPTIONS"], req, state}
end
def content_types... | defmodule HTTParrot.DenyHandler do
@moduledoc """
Returns a simple HTML page.
"""
def init(_transport, _req, _opts) do
{:upgrade, :protocol, :cowboy_rest}
end
def allowed_methods(req, state) do
{["GET", "HEAD", "OPTIONS"], req, state}
end
def content_types_provided(req, state) do
{[{{"tex... | Remove unused alias on DenyHandler | Remove unused alias on DenyHandler
| Elixir | mit | edgurgel/httparrot,edgurgel/httparrot,jordan0day/httparrot |
ef2e06db6f6d103fd0cf7a20dd5b3a159a284e7a | apps/lexibomb_server/lib/word_list/word_list.ex | apps/lexibomb_server/lib/word_list/word_list.ex | defmodule LexibombServer.WordList do
@moduledoc """
Manages access to the list of valid words based on Mendel Leo Cooper's
_[Yet Another Word List](https://github.com/elasticdog/yawl)_ (YAWL).
"""
@doc """
Starts an agent linked to the current process to store the word list after
reading it from disk.
... | defmodule LexibombServer.WordList do
@moduledoc """
Manages access to the list of valid words based on Mendel Leo Cooper's
_[Yet Another Word List](https://github.com/elasticdog/yawl)_ (YAWL).
"""
@doc """
Starts an agent linked to the current process to store the word list after
reading it from disk.
... | Normalize the word lookup to lowercase letters | Normalize the word lookup to lowercase letters
| Elixir | isc | elasticdog/lexibomb |
192466ee3d0d53b69d6919e2d0b1071a77eca7ec | lib/phoenix.ex | lib/phoenix.ex | defmodule Phoenix do
use Application
# See http://elixir-lang.org/docs/stable/Application.Behaviour.html
# for more information on OTP Applications
def start(_type, _args) do
Phoenix.Supervisor.start_link
end
end
| defmodule Phoenix do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
Phoenix.Supervisor.start_link
end
end
| Fix broken link in generated comments. | Fix broken link in generated comments. | Elixir | mit | michalmuskala/phoenix,javimolla/phoenix,Rumel/phoenix,stevedomin/phoenix,manukall/phoenix,seejee/phoenix,bsmr-erlang/phoenix,arthurcolle/phoenix,CultivateHQ/phoenix,mobileoverlord/phoenix,jamilabreu/phoenix,nicrioux/phoenix,thegrubbsian/phoenix,gjaldon/phoenix,korobkov/phoenix,eksperimental/phoenix,ugisozols/phoenix,dm... |
e344c8c402734417f9e065f8568f62b3149fd84c | lib/credo/main_process.ex | lib/credo/main_process.ex | defmodule Credo.MainProcess do
@moduledoc """
This module defines all Tasks which make up the execution of Credo.
Each task receives an Execution struct and returns an Execution struct upon completion.
Any Task can mark the Execution as "halted" to stop Credo's execution.
Subsequent Tasks won't be run.
Ta... | defmodule Credo.MainProcess do
@moduledoc """
This module defines all Tasks which make up the execution of Credo.
Each task receives an Execution struct and returns an Execution struct upon completion.
Any Task can mark the Execution as "halted" to stop Credo's execution.
Subsequent Tasks won't be run.
Ta... | Fix custom tasks by resolving config before validating it | Fix custom tasks by resolving config before validating it
| Elixir | mit | rrrene/credo,rrrene/credo |
a74d0a9fcfb12e09f962b58dbbd8e6eeed287d13 | lib/ten_thousand_feet.ex | lib/ten_thousand_feet.ex | defmodule TenThousandFeet do
@api_url Application.get_env(:slax, :ten_thousand_feet)[:api_endpoint]
@auth_token Application.get_env(:slax, :ten_thousand_feet)[:auth_token]
def create_project(name) do
{:ok, request} = Poison.encode(%{ name: name })
response = HTTPotion.post "#{@api_url}/projects", [
... | defmodule TenThousandFeet do
@api_url Application.get_env(:slax, :ten_thousand_feet)[:api_endpoint]
@auth_token Application.get_env(:slax, :ten_thousand_feet)[:auth_token]
def create_project(name) do
if is_nil(@api_url) or is_nil(@auth_token) do
{:error, "10000ft not configured"}
else
handle_... | Update 10000ft module to ignore request if 10000ft is not setup | Update 10000ft module to ignore request if 10000ft is not setup
| Elixir | mit | revelrylabs/slax,revelrylabs/slax,revelrylabs/slax |
54ece4b21486b5474465915e03562bfde9f994fd | lib/mix/tasks/firmware.ex | lib/mix/tasks/firmware.ex | defmodule Mix.Tasks.Firmware do
use Mix.Task
import Mix.Nerves.Utils
@switches [verbosity: :string]
def run(args) do
{opts, _, _} = OptionParser.parse(args)
Mix.shell.info "Nerves Firmware Assembler"
config = Mix.Project.config
otp_app = config[:app]
target = config[:target]
verbosity... | defmodule Mix.Tasks.Firmware do
use Mix.Task
import Mix.Nerves.Utils
@switches [verbosity: :string]
def run(args) do
{opts, _, _} = OptionParser.parse(args)
Mix.shell.info "Nerves Firmware Assembler"
config = Mix.Project.config
otp_app = config[:app]
target = config[:target]
verbosity... | Check for rootfs-additions before calling rel2fw | Check for rootfs-additions before calling rel2fw
| Elixir | apache-2.0 | nerves-project/nerves,nerves-project/nerves |
829bc9fece811bcecbf740485a7d2b5fa1c3a22a | lib/credo/execution/task/validate_config.ex | lib/credo/execution/task/validate_config.ex | defmodule Credo.Execution.Task.ValidateConfig do
use Credo.Execution.Task
alias Credo.CLI.Output.UI
def call(exec, _opts) do
exec
|> validate_checks()
|> remove_missing_checks()
end
defp validate_checks(%Execution{checks: checks} = exec) do
Enum.each(checks, &warn_if_check_missing/1)
e... | defmodule Credo.Execution.Task.ValidateConfig do
use Credo.Execution.Task
alias Credo.CLI.Output.UI
def call(exec, _opts) do
exec
|> validate_checks()
|> remove_missing_checks()
|> inspect_config_if_debug()
end
defp validate_checks(%Execution{checks: checks} = exec) do
Enum.each(checks,... | Print exec struct after validating config in debug mode | Print exec struct after validating config in debug mode
| Elixir | mit | rrrene/credo,rrrene/credo |
dc88ba45a08cd1ce4f55fe0298eece6334169451 | lib/oauth2_example.ex | lib/oauth2_example.ex | defmodule OAuth2Example do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
# Define workers and child supervisors to be supervised
# worke... | defmodule OAuth2Example do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
worker(OAuth2Example.Endpoint, [])
]
# See http://elixir-lan... | Add Endpoint as a worker | Add Endpoint as a worker
| Elixir | mit | cdegroot/clueless,cdegroot/clueless,scrogson/oauth2_example,scrogson/oauth2_example,wsmoak/phoenix_oauth2_example,phoenix-examples/oauth2_example,cdegroot/clueless |
79c4890becb8c9368d92fe7b0dc6d36477d444f2 | test/interaction_test.exs | test/interaction_test.exs | defmodule PactElixir.InteractionTest do
use ExUnit.Case
import PactElixir.Dsl
test "Interactions to json" do
expected_interactions_json =
Poison.decode!("""
[
{
"providerState": "foo is present",
"description": "interaction-description",
"request": ... | defmodule PactElixir.InteractionTest do
use ExUnit.Case
import PactElixir.Dsl
test "Interactions to json" do
expected_interactions_json =
Poison.decode!("""
[
{
"providerState": "foo is present",
"description": "interaction-description",
"request": ... | Include a query into the request path | Include a query into the request path
| Elixir | mit | elitau/pact_elixir |
351da030c3ea6c6815d4fe21be1639a1a1601f60 | test/support/conn_case.ex | test/support/conn_case.ex | defmodule BorsNG.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build and query models.
Finally, if the test case interacts with the data... | defmodule BorsNG.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build and query models.
Finally, if the test case interacts with the data... | Stop using deprecated macro-mode Phoenix.ConnTest, instead import | Stop using deprecated macro-mode Phoenix.ConnTest, instead import
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
07e65d2636b678975a6e11ad61e351149f926502 | config/prod.secret.exs | config/prod.secret.exs | use Mix.Config
config :aelita2, Aelita2,
activation_phrase: "bors r+"
config :aelita2, Aelita2.Batcher,
run: true
config :aelita2, Aelita2.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: "sheltered-savannah-39730.herokuapp.com", port: 80],
cache_static_manifest: "priv/static/manifest.json",
secret... | use Mix.Config
config :aelita2, Aelita2,
activation_phrase: "bors r+"
config :aelita2, Aelita2.Batcher,
run: true
config :aelita2, Aelita2.Endpoint,
http: [port: {:system, "PORT"}],
url: System.get_env("PUBLIC_URL"),
cache_static_manifest: "priv/static/manifest.json",
secret_key_base: System.get_env("SEC... | Make the public URL configurable as a env | Make the public URL configurable as a env
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
8fe0d22d65342d1d651350343b786e303d2bb314 | apps/lexibomb_server/lib/word_list/word_list.ex | apps/lexibomb_server/lib/word_list/word_list.ex | defmodule LexibombServer.WordList do
@moduledoc """
Manages access to the list of valid words based on Mendel Leo Cooper's
_[Yet Another Word List](https://github.com/elasticdog/yawl)_ (YAWL).
"""
@doc """
Starts an agent linked to the current process to store the word list after
reading it from disk.
... | defmodule LexibombServer.WordList do
@moduledoc """
Manages access to the list of valid gameplay words.
The default word list is based on Mendel Leo Cooper's
_[Yet Another Word List](https://github.com/elasticdog/yawl)_ (YAWL) project.
"""
@doc """
Starts an agent linked to the current process to store ... | Split out word normalization and YAWL loading functions | Split out word normalization and YAWL loading functions
| Elixir | isc | elasticdog/lexibomb |
c1b40593e49501fc07f785a607bb935610c4c691 | test/jsox/parser_test/map_test.exs | test/jsox/parser_test/map_test.exs | defmodule Jsox.ParserTest.MapTest do
use ExUnit.Case, async: true
import Jsox.Parser
test "parsing empty map" do
assert parse(~s({})) === {:ok, %{}}
end
test "parsiing map with one item" do
assert parse(~s({"a":1})) === {:ok, %{"a" => 1}}
end
test "parsiing map with two items" do
assert p... | defmodule Jsox.ParserTest.MapTest do
use ExUnit.Case, async: true
import Jsox.Parser
test "parsing empty map" do
assert parse(~s({})) === {:ok, %{}}
end
test "parsiing map with one item" do
assert parse(~s({"a":1})) === {:ok, %{"a" => 1}}
end
test "parsiing map with two items" do
assert p... | Add test for parsing deep nested map | Add test for parsing deep nested map
| Elixir | mit | hrzndhrn/jsox |
d59d93e32cdc97873d60e7518404879b967682a5 | mix.exs | mix.exs | defmodule Funnel.Mixfile do
use Mix.Project
def project do
[ app: :funnel,
version: "0.0.1",
dynamos: [Funnel.Dynamo],
compilers: [:elixir, :dynamo, :app],
compile_path: "tmp/#{Mix.env}/funnel/ebin",
elixir: "~> 0.13.3",
deps: deps ]
end
# Configuration for the OTP appl... | defmodule Funnel.Mixfile do
use Mix.Project
def project do
[ app: :funnel,
version: "0.0.1",
dynamos: [Funnel.Dynamo],
compilers: [:elixir, :dynamo, :app],
compile_path: "tmp/#{Mix.env}/funnel/ebin",
elixir: "~> 0.13.3",
deps: deps ]
end
# Configuration for the OTP appl... | Remove `ex_doc` for prod env | Remove `ex_doc` for prod env
Signed-off-by: chatgris <f9469d12bf3d131e7aae80be27ccfe58aa9db1f1@af83.com>
| Elixir | mit | chatgris/funnel |
166af23675bcd0453b0da0b1d93d6bb3bb6028d8 | apps/account/lib/account/service.ex | apps/account/lib/account/service.ex | defmodule HELM.Account.Service do
use GenServer
alias HELM.Account
alias HELF.Broker
alias HELF.Router
def start_link(state \\ []) do
Router.register("account.create", "account:create")
Router.register("account.login", "account:login")
Router.register("account.get", "account:get")
GenServe... | defmodule HELM.Account.Service do
use GenServer
alias HELM.Account
alias HELF.Broker
alias HELF.Router
def start_link(state \\ []) do
Router.register("account.create", "account:create")
Router.register("account.login", "account:login")
Router.register("account.get", "account:get")
GenServe... | Remove wrong todo from `Account.Service`. | Remove wrong todo from `Account.Service`.
| Elixir | agpl-3.0 | renatomassaro/Helix,HackerExperience/Helix,renatomassaro/Helix,mememori/Helix,HackerExperience/Helix |
5fb6858350712dac57194092e6db358bc7af95a2 | installer/templates/phx_web/views/error_helpers.ex | installer/templates/phx_web/views/error_helpers.ex | defmodule <%= web_namespace %>.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
<%= if html do %>
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn ... | defmodule <%= web_namespace %>.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
<%= if html do %>
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn ... | Improve description of the gettext usage | Improve description of the gettext usage | Elixir | mit | rafbgarcia/phoenix,Joe-noh/phoenix,dmarkow/phoenix,nshafer/phoenix,pap/phoenix,mobileoverlord/phoenix,gjaldon/phoenix,rafbgarcia/phoenix,korobkov/phoenix,dmarkow/phoenix,0x00evil/phoenix,evax/phoenix,Gazler/phoenix,Kosmas/phoenix,Gazler/phoenix,gjaldon/phoenix,pap/phoenix,optikfluffel/phoenix,rafbgarcia/phoenix,evax/ph... |
1bd76a378cb6d84ec0d3bfa71cba8d5ee1a897f8 | mix.exs | mix.exs | defmodule Mix.Tasks.Compile.WpaSupplicant do
@shortdoc "Compiles the wpa_ex port binary"
def run(_) do
0=Mix.Shell.IO.cmd("make priv/wpa_ex")
end
end
defmodule WpaSupplicant.Mixfile do
use Mix.Project
def project do
[app: :wpa_supplicant,
version: "0.1.0",
elixir: "~> 0.14.0",
compile... | defmodule Mix.Tasks.Compile.WpaSupplicant do
@shortdoc "Compiles the wpa_ex port binary"
def run(_) do
0=Mix.Shell.IO.cmd("make priv/wpa_ex")
end
end
defmodule WpaSupplicant.Mixfile do
use Mix.Project
def project do
[app: :wpa_supplicant,
version: "0.1.0",
elixir: "~> 0.14.0",
compile... | Fix files attribute to not include object files | Fix files attribute to not include object files
| Elixir | apache-2.0 | fhunleth/wpa_supplicant.ex |
ce126782bde89ae590cac25ce81c267439c54439 | lib/addict/mailers/mailgun.ex | lib/addict/mailers/mailgun.ex | defmodule Addict.Mailers.Mailgun do
@moduledoc """
Wrapper for Mailgun client that handles eventual errors.
"""
require Logger
use Mailgun.Client, domain: Application.get_env(:addict, :mailgun_domain),
key: Application.get_env(:addict, :mailgun_key)
@doc """
Sends an e-mail to a use... | defmodule Addict.Mailers.Mailgun do
@moduledoc """
Wrapper for Mailgun client that handles eventual errors.
"""
require Logger
use Mailgun.Client, domain: Application.get_env(:addict, :mailgun_domain),
key: Application.get_env(:addict, :mailgun_key)
@doc """
Sends an e-mail to a use... | Fix issues creating users with no E-mail provider configured | Fix issues creating users with no E-mail provider configured
| Elixir | mit | esbullington/addict,altenwald/addict,suranyami/addict,pap/addict,trenpixster/addict,trenpixster/addict |
47064424f9d65ad66d74120e7c5e1b365d8d7cc6 | lib/phoenix/endpoint/server.ex | lib/phoenix/endpoint/server.ex | defmodule Phoenix.Endpoint.Server do
# The supervisor for the underlying handlers.
@moduledoc false
use Supervisor
require Logger
def start_link(otp_app, endpoint, opts \\ []) do
Supervisor.start_link(__MODULE__, {otp_app, endpoint}, opts)
end
def init({otp_app, endpoint}) do
handler = endpoin... | defmodule Phoenix.Endpoint.Server do
# The supervisor for the underlying handlers.
@moduledoc false
use Supervisor
require Logger
def start_link(otp_app, endpoint, opts \\ []) do
Supervisor.start_link(__MODULE__, {otp_app, endpoint}, opts)
end
def init({otp_app, endpoint}) do
handler = endpoin... | Raise so we get proper error report | Raise so we get proper error report | Elixir | mit | Kosmas/phoenix,mschae/phoenix,0x00evil/phoenix,stevedomin/phoenix,jamilabreu/phoenix,ybur-yug/phoenix,dmarkow/phoenix,optikfluffel/phoenix,evax/phoenix,optikfluffel/phoenix,keathley/phoenix,trarbr/phoenix,nshafer/phoenix,bsmr-erlang/phoenix,phoenixframework/phoenix,mitchellhenke/phoenix,wsmoak/phoenix,keathley/phoenix,... |
e785f6fa7bf1669a330d89198b547c93ad3f9d0a | test/support/factory.ex | test/support/factory.ex | defmodule AtomStyleTweaks.Factory do
use ExMachina.Ecto, repo: AtomStyleTweaks.Repo
alias FakerElixir, as: Faker
alias AtomStyleTweaks.Tweak
alias AtomStyleTweaks.User
def user_factory do
%User{
name: Faker.Internet.user_name(),
site_admin: false,
github_id: Faker.Helper.pick(1..100),... | defmodule AtomStyleTweaks.Factory do
use ExMachina.Ecto, repo: AtomStyleTweaks.Repo
alias FakerElixir, as: Faker
alias AtomStyleTweaks.Tweak
alias AtomStyleTweaks.User
def user_factory do
%User{
name: Faker.Internet.user_name(),
site_admin: false,
github_id: Faker.Helper.pick(1..10_00... | Use bigger range for less chance of collision | Use bigger range for less chance of collision
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
b66d0cd47e1fadfcf004ff48dee242b30d796a5f | priv/repo/migrations/20161012151240_create_location.exs | priv/repo/migrations/20161012151240_create_location.exs | defmodule Classlab.Repo.Migrations.CreateLocation do
use Ecto.Migration
def change do
create table(:locations) do
add :name, :string
add :address_line_1, :string
add :address_line_2, :string
add :zipcode, :string
add :city, :string
add :country, :string
add :external_u... | defmodule Classlab.Repo.Migrations.CreateLocation do
use Ecto.Migration
def change do
create table(:locations) do
add :name, :string, null: false
add :address_line_1, :string, null: false
add :address_line_2, :string
add :zipcode, :string, null: false
add :city, :string, null: fal... | Add location model required restrictions | Add location model required restrictions
| Elixir | mit | classlab/classlab,classlab/classlab |
63f97eb326d8e7f2ed8ee6fd6da6e18caae278e6 | test/credo/check/readability/large_numbers_test.exs | test/credo/check/readability/large_numbers_test.exs | defmodule Credo.Check.Readability.LargeNumbersTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.LargeNumbers
@moduletag :to_be_implemented
test "it should NOT report expected code" do
"""
def numbers do
1024 + 1_000_000 + 43_534
end
""" |> to_source_file
|> refute_issues(@described_... | defmodule Credo.Check.Readability.LargeNumbersTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.LargeNumbers
@moduletag :to_be_implemented
test "it should NOT report expected code" do
"""
def numbers do
1024 + 1_000_000 + 43_534
end
""" |> to_source_file
|> refute_issues(@described_... | Add additional large numbers test | Add additional large numbers test
| Elixir | mit | rrrene/credo,rrrene/credo |
f7f24f8aedb4d9a633893132c85604df02f19154 | lib/hound/session_server.ex | lib/hound/session_server.ex | defmodule Hound.SessionServer do
use GenServer.Behaviour
def start_link(options // []) do
state = [
sessions: [],
options: [
connection: options[:connection] || [],
driver: options[:driver] || Hound.JsonDriver
]
]
:gen_server.start_link({ :local, :hound }, __MODULE__,... | defmodule Hound.SessionServer do
use GenServer.Behaviour
def start_link(options // []) do
state = [
driver_options: options[:driver_options] || [],
driver: options[:driver] || Hound.JsonDriver
]
:gen_server.start_link({ :local, :hound }, __MODULE__, state, [])
end
def init(state), do: ... | Simplify hound session server to handle only driver info mgmt | Simplify hound session server to handle only driver info mgmt
| Elixir | mit | manukall/hound,manukall/hound,knewter/hound,esbullington/hound,HashNuke/hound,oivoodoo/hound,esbullington/hound,oivoodoo/hound,lowks/hound,HashNuke/hound,jontonsoup/hound,jontonsoup/hound,lowks/hound |
b67f0ffaf42d77cea3b2447429ae9b6a059bb377 | test/phoenix/router/options_test.exs | test/phoenix/router/options_test.exs | defmodule Phoenix.Router.OptionsTest do
use ExUnit.Case, async: false
alias Phoenix.Adapters.Cowboy
alias Phoenix.Router.Options
alias Phoenix.Router.OptionsTest.PhoenixOptionsTest
setup_all do
Mix.Config.persist(phoenix: [
{Router, port: 71107},
{Router2, port: "4000", proxy_port: "80"},
... | defmodule Phoenix.Router.OptionsTest do
use ExUnit.Case, async: false
alias Phoenix.Adapters.Cowboy
alias Phoenix.Router.Options
setup_all do
Mix.Config.persist(phoenix: [
{Router, port: 71107},
{Router2, port: "4000", proxy_port: "80"},
])
defmodule Router do
use Phoenix.Router
... | Remove unused PhoenixOptionsTest alias that was causing error on test suite run | Remove unused PhoenixOptionsTest alias that was causing error on test suite run
| Elixir | mit | CultivateHQ/phoenix,greyhwndz/phoenix,korobkov/phoenix,wsmoak/phoenix,elliotcm/phoenix,ephe-meral/phoenix,kevinold/phoenix,daytonn/phoenix,lancehalvorsen/phoenix,ericmj/phoenix,eksperimental/phoenix,phoenixframework/phoenix,seejee/phoenix,safi/phoenix,gjaldon/phoenix,ACPK/phoenix,switchflip/phoenix,ybur-yug/phoenix,CD1... |
04cff5bc507b60032600ad6a5ab2962efb93dbb0 | installer/templates/new/web/views/error_helpers.ex | installer/templates/new/web/views/error_helpers.ex | defmodule <%= application_module %>.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
<%= if html do %>
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
if error = form.errors[field] do
conten... | defmodule <%= application_module %>.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
<%= if html do %>
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
if error = form.errors[field] do
content_... | Remove trailing whitespace in generated file | Remove trailing whitespace in generated file | Elixir | mit | seejee/phoenix,mobileoverlord/phoenix,pap/phoenix,ericmj/phoenix,pap/phoenix,dmarkow/phoenix,phoenixframework/phoenix,gjaldon/phoenix,cas27/phoenix,CultivateHQ/phoenix,Gazler/phoenix,michalmuskala/phoenix,mschae/phoenix,Kosmas/phoenix,mschae/phoenix,optikfluffel/phoenix,vic/phoenix,Ben-Evolently/phoenix,Rumel/phoenix,s... |
e7d76a6c7475dfc1658bd12f33293e727afe715b | lib/tesla/middleware/timeout.ex | lib/tesla/middleware/timeout.ex | defmodule Tesla.Middleware.Timeout do
@moduledoc """
Timeout http request after X seconds.
## Example
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Timeout, timeout: 2_000
end
```
## Options
- `:timeout` - number of milliseconds a request is allowed to take (defaults to 1000)
... | defmodule Tesla.Middleware.Timeout do
@moduledoc """
Timeout http request after X seconds.
## Example
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Timeout, timeout: 2_000
end
```
## Options
- `:timeout` - number of milliseconds a request is allowed to take (defaults to 1000)
... | Use System.stacktrace for older Elixir versions | Use System.stacktrace for older Elixir versions
| Elixir | mit | teamon/tesla,monterail/tesla |
6b7cada80a89515f078809b0f01ce3dda5871e99 | installer/templates/new/test/support/conn_case.ex | installer/templates/new/test/support/conn_case.ex | defmodule <%= application_module %>.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
imports other functionalities to make it easier
to build and query models.
Finally, if the test case i... | defmodule <%= application_module %>.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
imports other functionality to make it easier
to build and query models.
Finally, if the test case int... | Fix word usage in `ConnCase` docs. | Fix word usage in `ConnCase` docs.
Functionality is already plural. | Elixir | mit | gjaldon/phoenix,0x00evil/phoenix,evax/phoenix,Joe-noh/phoenix,mobileoverlord/phoenix,bsmr-erlang/phoenix,nshafer/phoenix,lono-devices/phoenix,bsodmike/phoenix,Rumel/phoenix,kyledecot/phoenix,milafrerichs/phoenix,phoenixframework/phoenix,JHKennedy4/phoenix,manukall/phoenix,michalmuskala/phoenix,ephe-meral/phoenix,trarbr... |
750e32ccf9d1143d772b51f13ad035448c5a419b | apps/ello_grandstand/lib/ello_grandstand/client/http.ex | apps/ello_grandstand/lib/ello_grandstand/client/http.ex | defmodule Ello.Grandstand.Client.HTTP do
alias Ello.Grandstand.{Impression, Client}
@behaviour Client
use HTTPoison.Base
@doc """
Get %Impressions{} from grandstand api.
"""
def fetch_impressions(path, params) do
params = Enum.map(params, fn({k, v}) -> {Atom.to_string(k), v} end)
opts = [
p... | defmodule Ello.Grandstand.Client.HTTP do
alias Ello.Grandstand.{Impression, Client}
@behaviour Client
use HTTPoison.Base
@doc """
Get %Impressions{} from grandstand api.
"""
def fetch_impressions(path, params) do
params = Enum.map(params, fn({k, v}) -> {Atom.to_string(k), v} end)
opts = [
p... | Tweak handling of 204 responses | Tweak handling of 204 responses | Elixir | mit | ello/apex,ello/apex,ello/apex |
f81a412fd5a3864e7a9ac511a1599cc39ac0bb56 | lib/erlef_web/controllers/working_group_controller.ex | lib/erlef_web/controllers/working_group_controller.ex | defmodule ErlefWeb.WorkingGroupController do
use ErlefWeb, :controller
alias Erlef.{Blogs, Groups}
action_fallback ErlefWeb.FallbackController
def index(conn, _params) do
render(conn, working_groups: all_groups())
end
def show(conn, %{"id" => slug}) do
case Groups.get_working_group_by_slug(slug)... | defmodule ErlefWeb.WorkingGroupController do
use ErlefWeb, :controller
alias Erlef.{Blogs, Groups}
action_fallback ErlefWeb.FallbackController
def index(conn, _params) do
render(conn, working_groups: all_groups())
end
def show(conn, %{"id" => slug}) do
case Groups.get_working_group_by_slug(slug)... | Remove catch all from show/2 | Remove catch all from show/2
- The catch all in the show/2 makes dialyzer unhappy as the type is
covered by the two previous clauses.
| Elixir | apache-2.0 | simplabs/website,simplabs/website |
09053a51919b0a6168e3cb8d1eed48f52c31018c | web/controllers/job_controller.ex | web/controllers/job_controller.ex | defmodule GetAJobEx.JobController do
use GetAJobEx.Web, :controller
alias GetAJobEx.Repo
alias GetAJobEx.Job
plug :action
def index(conn, _params) do
jobs = Repo.all(Job)
render conn, jobs: jobs
end
def create(conn, %{"job" => job_params}) do
changeset = Job.changeset(%Job{}, job_params)
... | defmodule GetAJobEx.JobController do
use GetAJobEx.Web, :controller
alias GetAJobEx.Repo
alias GetAJobEx.Job
plug :action
def index(conn, _params) do
jobs = Repo.all(Job)
render conn, jobs: jobs
end
def create(conn, %{"job" => job_params}) do
changeset = Job.changeset(%Job{}, job_params)
... | Use symbolic status code for clarity. | Use symbolic status code for clarity.
| Elixir | mit | smoynes/get_a_job_ex,smoynes/get_a_job_ex |
bb912e236127101892b1d519433ef3e72e926f92 | test/encoding/escaped_fields_test.exs | test/encoding/escaped_fields_test.exs | defmodule EncodingTests.EscapedFieldsTest do
use ExUnit.Case
alias CSV.Encoding.Encoder
test "encodes streams to csv strings and escapes them" do
result = Encoder.encode([["a,", "b\re"], ["c,f\"", "dg"]]) |> Enum.to_list
assert result == ["\"a,\",\"b\\re\"\r\n", "\"c,f\"\"\",dg\r\n"]
end
test "encod... | defmodule EncodingTests.EscapedFieldsTest do
use ExUnit.Case
alias CSV.Encoding.Encoder
test "encodes streams to csv strings and escapes them" do
result = Encoder.encode([["a,", "b\re"], ["c,f\"", "dg"]]) |> Enum.to_list
assert result == ["\"a,\",\"b\\re\"\r\n", "\"c,f\"\"\",dg\r\n"]
end
test "encod... | Add tests for escaped fields and force_quote | Add tests for escaped fields and force_quote
| Elixir | mit | beatrichartz/csv,beatrichartz/csv |
37f1eb4694dd097e74e0a5562c0c5b22d2696073 | web/views/question_view.ex | web/views/question_view.ex | defmodule Core.QuestionView do
use Core.Web, :view
def render("index.json", %{questions: questions}) do
render_many(questions, Core.QuestionView, "summary.json")
end
def render("show.json", %{question: question}) do
render_one(question, Core.QuestionView, "question.json")
end
def render("summary.... | defmodule Core.QuestionView do
use Core.Web, :view
def render("index.json", %{questions: questions}) do
render_many(questions, Core.QuestionView, "summary.json")
end
def render("show.json", %{question: question}) do
render_one(question, Core.QuestionView, "question.json")
end
def render("summary.... | Fix QuestionView. Add "answer" field | Fix QuestionView. Add "answer" field
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
2770758966a754ffd290f624857098b698e16755 | lib/code_corps_web/plugs/data_to_attributes.ex | lib/code_corps_web/plugs/data_to_attributes.ex | defmodule CodeCorpsWeb.Plug.DataToAttributes do
@moduledoc """
Puts authenticated Guardian user into conn.assigns[:current_user]
"""
alias Plug.Conn
@spec init(Keyword.t) :: Keyword.t
def init(opts), do: opts
@spec call(Conn.t, Keyword.t) :: Plug.Conn.t
def call(%Conn{params: %{"data" => data} = para... | defmodule CodeCorpsWeb.Plug.DataToAttributes do
@moduledoc ~S"""
Converts params in the JSON api "data" format into flat params convient for
changeset casting.
This is done using `JaSerializer.Params.to_attributes/1`
"""
alias Plug.Conn
@spec init(Keyword.t) :: Keyword.t
def init(opts), do: opts
@... | Correct bad moduledoc in CodeCorps.Plug.DataToAttributes | Correct bad moduledoc in CodeCorps.Plug.DataToAttributes
| Elixir | mit | crodriguez1a/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api,code-corps/code-corps-api |
38c6a24c91962f813373d088428d4b8132292b2d | mix.exs | mix.exs | defmodule Bottler.Mixfile do
use Mix.Project
def project do
[app: :bottler,
version: "0.5.0",
elixir: ">= 1.0.0",
package: package(),
description: "Help you bottle, ship and serve your Elixir apps.",
deps: deps()]
end
def application do
[ applications: [:logger, :crypto],
... | defmodule Bottler.Mixfile do
use Mix.Project
def project do
[app: :bottler,
version: "0.5.0",
elixir: ">= 1.0.0",
package: package(),
description: "Help you bottle, ship and serve your Elixir apps.",
deps: deps()]
end
def application do
[ applications: [:logger, :crypto],
... | Allow any Poison version greater than 2.0 for backwards compatibility | Allow any Poison version greater than 2.0 for backwards compatibility
| Elixir | mit | rubencaro/bottler |
6953bf61587c413eed760dba89ac2a83843f3f4e | web/controllers/helpers.ex | web/controllers/helpers.ex | defmodule Krihelinator.Controllers.Helpers do
@moduledoc """
Common helpers for the controllers.
"""
alias Krihelinator.{GithubRepo, Repo, Scraper}
require Logger
import Ecto.Query, only: [from: 2]
def get_from_db_or_scrape(name) do
query = from(r in GithubRepo,
where: ilike(r.name,... | defmodule Krihelinator.Controllers.Helpers do
@moduledoc """
Common helpers for the controllers.
"""
alias Krihelinator.{GithubRepo, Repo, Scraper}
require Logger
import Ecto.Query, only: [from: 2]
def get_from_db_or_scrape(name) do
query = from(r in GithubRepo,
where: ilike(r.name,... | Fix 'get_from_db_or_scrape' after Periodic refactoring | Fix 'get_from_db_or_scrape' after Periodic refactoring
| Elixir | mit | Nagasaki45/krihelinator,Nagasaki45/krihelinator,Nagasaki45/krihelinator,Nagasaki45/krihelinator |
62efedd6445a97eb205946dafcc535f8a62aabff | web/channels/user_socket.ex | web/channels/user_socket.ex | defmodule EvercamMedia.UserSocket do
use Phoenix.Socket
## Channels
channel "cameras:*", EvercamMedia.SnapshotChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and can
# be used to ver... | defmodule EvercamMedia.UserSocket do
use Phoenix.Socket
## Channels
channel "cameras:*", EvercamMedia.SnapshotChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket, check_origin: false
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and c... | Disable checking origin for websockets transport | Disable checking origin for websockets transport
| Elixir | agpl-3.0 | shankardevy/evercam-media,shankardevy/evercam-media,shankardevy/evercam-media |
b6369e2b5fc487f25ca49c47f7d7b2d80e01efd8 | apps/hell/lib/credo/refuse_trailing_blank_line.ex | apps/hell/lib/credo/refuse_trailing_blank_line.ex | if Code.ensure_loaded?(Credo) do
defmodule Credo.Check.Readability.RefuseTrailingBlankLine do
@moduledoc """
Files should NOT end in a trailing blank line.
"""
@explanation [check: @moduledoc]
use Credo.Check, base_priority: :low
def run(%SourceFile{lines: lines} = source_file, params \\ []... | if Code.ensure_loaded?(Credo) do
defmodule Credo.Check.Readability.RefuseTrailingBlankLine do
@moduledoc """
Files should NOT end in a trailing blank line.
"""
@explanation [check: @moduledoc]
use Credo.Check, base_priority: :low
def run(source_file = %SourceFile{lines: lines}, params \\ []... | Fix order of bind on function clause on credo custom check | Fix order of bind on function clause on credo custom check
| Elixir | agpl-3.0 | renatomassaro/Helix,HackerExperience/Helix,renatomassaro/Helix,mememori/Helix,HackerExperience/Helix |
d3e30bffc9b0c5f374d262969c1baab4956dd5cd | lib/mailman/eex_composer.ex | lib/mailman/eex_composer.ex | defmodule Mailman.EexComposer do
@moduledoc "Provides functions for rendering from Eex template files"
def compile_part(config, :html, %{html: template, data: data}) do
if config.html_file do
EEx.eval_file config.html_file_path <> template, data
else
case data do
%{} -> template
... | defmodule Mailman.EexComposer do
@moduledoc "Provides functions for rendering from Eex template files"
def compile_part(config, :html, %{html: template, data: data}) do
if config.html_file do
EEx.eval_file config.html_file_path <> template, data
else
case data do
%{} -> template
... | Change data to catch all case | Change data to catch all case
| Elixir | mit | datanoise/mailman,kamilc/mailman,dejanstrbac/mailman |
aa454007a47d856eafbfae4801da7ecbf49a4235 | web/channels/user_channel.ex | web/channels/user_channel.ex | defmodule Kairos.UserChannel do
use Kairos.Web, :channel
require Logger
alias Kairos.{Repo, User}
def join("users:" <> user_id, _params, socket) do
Logger.info "Joined to UserChannel"
current_user = socket.assigns.current_user
if String.to_integer(user_id) == current_user.id do
{:ok, socke... | defmodule Kairos.UserChannel do
use Kairos.Web, :channel
require Logger
alias Kairos.{Repo, User}
def join("users:" <> user_id, _params, socket) do
Logger.info "Joined to UserChannel"
current_user = socket.assigns.current_user
if String.to_integer(user_id) == current_user.id do
{:ok, socke... | Use changeset instead of old update one | Use changeset instead of old update one
| Elixir | mit | diacode/kairos,diacode/kairos |
bd46e23e6589bd4736315464c98707e554638bba | farmbot_os/platform/target/configurator/vintage_network_layer.ex | farmbot_os/platform/target/configurator/vintage_network_layer.ex | defmodule FarmbotOS.Platform.Target.Configurator.VintageNetworkLayer do
@behaviour FarmbotOS.Configurator.NetworkLayer
@impl FarmbotOS.Configurator.NetworkLayer
def list_interfaces() do
VintageNet.all_interfaces()
|> Kernel.--(["usb0", "lo"])
|> Enum.map(fn ifname ->
{ifname, %{mac_address: "fi... | defmodule FarmbotOS.Platform.Target.Configurator.VintageNetworkLayer do
@behaviour FarmbotOS.Configurator.NetworkLayer
@impl FarmbotOS.Configurator.NetworkLayer
def list_interfaces() do
VintageNet.all_interfaces()
|> Kernel.--(["usb0", "lo"])
|> Enum.map(fn ifname ->
{ifname, %{mac_address: "fi... | Sort networks in configurator by signal strength | Sort networks in configurator by signal strength
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
1ca8392c1ae13809751e1791d36383cf3e72bf1c | test/concurrency_test.exs | test/concurrency_test.exs | defmodule ConcurrencyTest do
use ExUnit.Case, async: true
defmodule Computator do
def double do
receive do
{sender, msg} ->
send sender, { :ok, 2 * msg }
end
end
end
# @tag :focus
test "spawns a process that passes back a message" do
# run it in a separate proce... | defmodule ConcurrencyTest do
use ExUnit.Case, async: true
defmodule Computator do
def double do
receive do
{sender, msg} ->
send sender, { :ok, 2 * msg }
end
end
end
# @tag :focus
test "spawns a process that passes back a message" do
# run it in a separate proce... | Use after to timeout on message reception | Use after to timeout on message reception
| Elixir | mit | thbar/elixir-playground |
bd9e2336842009d515a33227f2c26340a1faa39f | apps/baumeister_web/lib/baumeister_web.ex | apps/baumeister_web/lib/baumeister_web.ex | defmodule BaumeisterWeb do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec
# Define workers and child supervisors to be supervised
children = [
# Start the Ecto repos... | defmodule BaumeisterWeb do
use Application
require Logger
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(type, args) do
import Supervisor.Spec
Logger.info("BaumeisterWeb.start(type=#{inspect type}, args=#{inspect args})")
#... | Use startup phases for starting and setting up mnesia first. | Use startup phases for starting and setting up mnesia first.
| Elixir | apache-2.0 | alfert/baumeister,alfert/baumeister,alfert/baumeister |
ebab7baff9882537254e7c73bf4ccb3c8be761fb | time_tracker_backend/lib/time_tracker_backend/endpoint.ex | time_tracker_backend/lib/time_tracker_backend/endpoint.ex | defmodule TimeTrackerBackend.Endpoint do
use Phoenix.Endpoint, otp_app: :time_tracker_backend
socket "/socket", TimeTrackerBackend.UserSocket
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files i... | defmodule TimeTrackerBackend.Endpoint do
use Phoenix.Endpoint, otp_app: :time_tracker_backend
socket "/socket", TimeTrackerBackend.UserSocket
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files i... | Add a few more headers for pagination metadata | Add a few more headers for pagination metadata
We weren't allowing the CORS clients to see total pages or page number;
this fixes that.
| Elixir | mit | knewter/time-tracker,knewter/time-tracker |
c459d3128757f8cc66fb109547082fdb78e823ab | lib/elixir/test/elixir/gen_server/behaviour_test.exs | lib/elixir/test/elixir/gen_server/behaviour_test.exs | Code.require_file "../../test_helper.exs", __FILE__
defmodule GenServer.BehaviourTest do
use ExUnit.Case, async: true
defmodule Sample do
use GenServer.Behaviour
# Callbacks
def handle_call(:pop, _from, [h|t]) do
{ :reply, h, t }
end
def handle_call(:terminate, _from, config) do
... | Code.require_file "../../test_helper.exs", __FILE__
defmodule GenServer.BehaviourTest do
use ExUnit.Case, async: true
defmodule Sample do
use GenServer.Behaviour
# Callbacks
def handle_call(:pop, _from, [h|t]) do
{ :reply, h, t }
end
def handle_call(:terminate, _from, config) do
... | Use System.services_timeout/0 for kernel tests. | Use System.services_timeout/0 for kernel tests.
| Elixir | apache-2.0 | antipax/elixir,lexmag/elixir,antipax/elixir,kimshrier/elixir,ggcampinho/elixir,elixir-lang/elixir,lexmag/elixir,kimshrier/elixir,beedub/elixir,joshprice/elixir,pedrosnk/elixir,gfvcastro/elixir,ggcampinho/elixir,beedub/elixir,kelvinst/elixir,kelvinst/elixir,gfvcastro/elixir,pedrosnk/elixir,michalmuskala/elixir |
968a3bb0c579bcfc5c5eac11a86dd535cba77a7d | web/controllers/page_controller.ex | web/controllers/page_controller.ex | defmodule WebSpa.PageController do
use WebSpa.Web, :controller
def index(conn, _params) do
render conn, "index.html"
end
end
| defmodule WebSpa.PageController do
use WebSpa.Web, :controller
def index(conn, _params) do
conn
|> render "index.html"
end
end
| Use |> operator for serving response | Use |> operator for serving response
| Elixir | mit | korczis/the-scratch,korczis/the-scratch,korczis/the-scratch |
ad6c71044b911f2b615a18dd8aaea3c39805606c | config/dev.exs | config/dev.exs | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :elixre, Elixre.Endpoint,
root: Path.expand(".... | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :elixre, Elixre.Endpoint,
root: Path.expand(".... | Clean up config a touch | Clean up config a touch
| Elixir | agpl-3.0 | linearregression/elixre,linearregression/elixre,lpil/elixre |
855bedb81c2210ad348aae56e984ef68f133138f | config/dev.exs | config/dev.exs | use Mix.Config
config :bottler, :params, [servers: [server1: [ip: "1.1.1.1"],
server2: [ip: "1.1.1.2"]],
remote_user: "devuser",
cookie: "abc" ]
| use Mix.Config
config :bottler, :params, [servers: [server1: [ip: "1.1.1.1"],
server2: [ip: "1.1.1.2"]],
remote_user: "devuser",
# rsa_pass_phrase: "bogus",
cookie: "abc" ]
| Add rsa pass phrase support | Add rsa pass phrase support
| Elixir | mit | rubencaro/bottler |
f859ed59be18020965b5f3d9e7f7f06f514d1088 | web/models/question.ex | web/models/question.ex | defmodule Core.Question do
use Core.Web, :model
schema "questions" do
field :title, :string
many_to_many :question_tags, Core.Tag, join_through: Core.QuestionTag
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
"""
def changeset(struct, params \\ %{}) do
... | defmodule Core.Question do
use Core.Web, :model
schema "questions" do
field :title, :string
many_to_many :question_tags, Core.Tag, join_through: Core.QuestionTag
field :answer, {:array, :map}, virtual: true
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
... | Add field "answer" to QuestionTag model | Add field "answer" to QuestionTag model
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
c5a3d5c2369c8cf62e9696f0bdabad6cafa37478 | lib/mix/tasks/credo.ex | lib/mix/tasks/credo.ex | defmodule Mix.Tasks.Credo do
use Mix.Task
@shortdoc "Run code analysis (use `--help` for options)"
@moduledoc @shortdoc
@doc false
def run(argv) do
Credo.CLI.main(argv)
end
end
| defmodule Mix.Tasks.Credo do
use Mix.Task
@shortdoc "Run code analysis (use `--help` for options)"
@moduledoc @shortdoc
@doc false
def run(argv) do
Credo.start nil, nil
Credo.CLI.run(argv)
end
end
| Use `Credo.Cli.run/1` instead of `main/1` in mix-task | Use `Credo.Cli.run/1` instead of `main/1` in mix-task
| Elixir | mit | rrrene/credo,rrrene/credo |
02540138b75cb309feb2556d39698b8543a5b901 | web/router.ex | web/router.ex | defmodule Rocks.Router do
use Rocks.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", Rocks do
pipe_through :br... | defmodule Rocks.Router do
use Rocks.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", Rocks do
pipe_through :br... | Add Users resource to browser scope | Add Users resource to browser scope
| Elixir | apache-2.0 | JoshAddington/phoenix_testing |
7dc831ed565a0166c8754b3374fd6e1e3dcf397c | lib/gateway/helpers/common_router.ex | lib/gateway/helpers/common_router.ex | defmodule Gateway.Helpers.CommonRouter do
defmacro __using__(_) do
quote do
use Plug.Router
plug Plug.Parsers, parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
plug :match
plug :dispatch
import Gateway.HTTPHelper... | defmodule Gateway.Helpers.CommonRouter do
defmacro __using__(_) do
quote do
use Plug.Router
plug :match
plug Plug.Parsers, parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
plug :dispatch
import Gateway.HTTPHelpe... | Move body parsing to where it belongs | Move body parsing to where it belongs
| Elixir | mit | Nebo15/annon.api,Nebo15/annon.api |
c3aa70cb93391dc7a2f482ab0c4fedea1b441f8f | test/concurrency_test.exs | test/concurrency_test.exs | defmodule ConcurrencyTest do
use ExUnit.Case, async: true
defmodule Computator do
def double do
receive do
{sender, msg} ->
send sender, { :ok, 2 * msg }
end
end
end
# @tag :focus
test "spawns a process that passes back a message" do
# run it in a separate proce... | defmodule ConcurrencyTest do
use ExUnit.Case, async: true
defmodule Computator do
def double do
receive do
{sender, msg} ->
send sender, { :ok, 2 * msg }
end
end
end
# @tag :focus
test "spawns a process that passes back a message" do
# run it in a separate proce... | Use a simple recursive worker with a done message | Use a simple recursive worker with a done message
| Elixir | mit | thbar/elixir-playground |
a1858aed3d8e24b31c3e6c52fd8ac65168a0787c | lib/mailman/external_smtp_adapter.ex | lib/mailman/external_smtp_adapter.ex | defmodule Mailman.ExternalSmtpAdapter do
@moduledoc "Adapter for sending email via external SMTP server"
@doc "Delivers an email based on specified config"
def deliver(config, email, message) do
relay_config = [
relay: config.relay,
username: config.username,
password: config.password,
... | defmodule Mailman.ExternalSmtpAdapter do
@moduledoc "Adapter for sending email via external SMTP server"
@doc "Delivers an email based on specified config"
def deliver(config, email, message) do
relay_config = [
relay: config.relay,
username: config.username,
password: config.password,
... | Use pure email address for email envelope. | Use pure email address for email envelope.
| Elixir | mit | kamilc/mailman |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.