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 |
|---|---|---|---|---|---|---|---|---|---|
3d6c0532d96452b8925a8071dd547541107a5a55 | 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",
deps: deps ]
end
# Configuration for the OTP applic... | 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.1",
deps: deps ]
end
# Configuration for the OTP applica... | Fix Elixir version to `0.13.1` | Fix Elixir version to `0.13.1`
Signed-off-by: chatgris <f9469d12bf3d131e7aae80be27ccfe58aa9db1f1@af83.com>
| Elixir | mit | chatgris/funnel |
3a1c20ecf2abecfd47105e077977c5df483905b6 | mix.exs | mix.exs | defmodule BeeBee.Mixfile do
use Mix.Project
def project do
[
app: :beebee,
version: "1.0.0",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps
]
end
# Configuration for the OTP application
#
# Type "mix help compile... | defmodule BeeBee.Mixfile do
use Mix.Project
def project do
[
app: :beebee,
version: "1.0.0",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps
]
end
# Configuration for the OTP application
#
# Type "mix help compile... | Add plug as a child application | Add plug as a child application
| Elixir | mit | system76/beebee |
aa460346b19aa025d260062978e2387ccbc02d6b | apps/entity/test/support/factory.ex | apps/entity/test/support/factory.ex | defmodule Helix.Entity.Factory do
use ExMachina.Ecto, repo: Helix.Entity.Repo
alias HELL.PK
alias HELL.TestHelper.Random
alias Helix.Entity.Model.Entity
alias Helix.Entity.Model.EntityComponent
alias Helix.Entity.Model.EntityServer
def entity_factory do
entity_type = generate_entity_type()
%En... | defmodule Helix.Entity.Factory do
use ExMachina.Ecto, repo: Helix.Entity.Repo
alias HELL.PK
alias HELL.TestHelper.Random
alias Helix.Entity.Model.Entity
alias Helix.Entity.Model.EntityComponent
alias Helix.Entity.Model.EntityServer
@entity_types %{
"account" => Helix.Account.Model.Ac... | Update Entity primary key generation. | Update Entity primary key generation.
| Elixir | agpl-3.0 | HackerExperience/Helix,mememori/Helix,HackerExperience/Helix,renatomassaro/Helix,renatomassaro/Helix |
6bc207baf2ef8e5700a4372f82d63fcfdbbf6b09 | lib/httparrot/general_request_info.ex | lib/httparrot/general_request_info.ex | defmodule HTTParrot.GeneralRequestInfo do
def retrieve(req) do
{args, req} = :cowboy_req.qs_vals(req)
{headers, req} = :cowboy_req.headers(req)
{url, req} = :cowboy_req.url(req)
{{ip, _port}, req} = :cowboy_req.peer(req)
ip = :inet_parse.ntoa(ip) |> to_string
args = group_by_keys(args)
{... | defmodule HTTParrot.GeneralRequestInfo do
def retrieve(req) do
{args, req} = :cowboy_req.qs_vals(req)
{headers, req} = :cowboy_req.headers(req)
{url, req} = :cowboy_req.url(req)
{{ip, _port}, req} = :cowboy_req.peer(req)
ip = :inet_parse.ntoa(ip) |> to_string
args = group_by_keys(args)
{... | Fix group_by_keys/1 for Elixir 1.3 | Fix group_by_keys/1 for Elixir 1.3
Enum.group_by/3 is deprecated now, and it seems to be breaking some
tests. This fixes the failing doctest and the other failing test.
| Elixir | mit | edgurgel/httparrot,edgurgel/httparrot |
6496d62b1f8cc41cd8b301ac0de732a0f164976b | test/dialyzer/encode_typespectest.ex | test/dialyzer/encode_typespectest.ex | defmodule EncodeTypespectest do
@moduledoc "Test encoding typespecs"
def test_encode_option_separator do
["dummy", "input"] |> CSV.encode(separator: true) |> Enum.to_list()
end
def test_encode_option_escape_character do
["dummy", "input"] |> CSV.encode(escape_character: ?") |> Enum.to_list()
end
... | defmodule EncodeTypespectest do
@moduledoc "Test encoding typespecs"
def test_encode_option_separator do
["dummy", "input"] |> CSV.encode(separator: true) |> Enum.to_list()
end
def test_encode_option_escape_character do
["dummy", "input"] |> CSV.encode(escape_character: ?") |> Enum.to_list()
end
... | Fix map definition in encode typespec | Fix map definition in encode typespec
| Elixir | mit | beatrichartz/csv,beatrichartz/csv |
22f26053ef5a1b7a27513c1236559dbf50a4b334 | priv/repo/seeds.exs | priv/repo/seeds.exs | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# AtomStyleTweaks.Repo.insert!(%AtomStyleTweaks.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so o... | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# AtomStyleTweaks.Repo.insert!(%AtomStyleTweaks.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so o... | Add some test data to mess with | Add some test data to mess with
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
fef337916e1d40e027cec06f2595b975939ddeef | lib/ex_twilio/resources/transcription.ex | lib/ex_twilio/resources/transcription.ex | defmodule ExTwilio.Transcription do
@moduledoc """
Represents an Transcription resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/transcriptions)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
stat... | defmodule ExTwilio.Transcription do
@moduledoc """
Represents an Transcription resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/api/recording-transcription)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
... | Update broken link to Transcription API | Update broken link to Transcription API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
b69d41368f49fef19d3440940df07da0f9a03006 | web/router.ex | web/router.ex | defmodule HaruElixirApi.Router do
use HaruElixirApi.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 "/", HaruElixirApi... | defmodule HaruElixirApi.Router do
use HaruElixirApi.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 "/", HaruElixirApi... | Add fetch review crawling route | Add fetch review crawling route
| Elixir | mit | haruio/haru-elixir-api,haruio/haru-elixir-api |
c61c4a1e9acf5d900f95e17ac450f4c67b8b6e6f | upgrade.exs | upgrade.exs | defmodule TheJuice.UpgradeCallbacks do
import Gatling.Bash
def before_mix_digest(env) do
bash("npm", ~w[install], cd: env.build_dir)
bash("npm", ~w[run deploy], cd: env.build_dir)
end
def before_upgrade_service(env) do
bash("mix", ~w[ecto.setup], cd: env.build_dir)
bash("mix", ~w[run priv/repo... | defmodule TheJuice.UpgradeCallbacks do
import Gatling.Bash
def before_mix_digest(env) do
bash("npm", ~w[install], cd: env.build_dir)
bash("npm", ~w[run deploy], cd: env.build_dir)
end
def before_upgrade_service(env) do
bash("mix", ~w[ecto.migrate], cd: env.build_dir)
end
end
| Revert changes to deploy script | Revert changes to deploy script
| Elixir | agpl-3.0 | omegaphoenix/omegaphoenix.github.com,omegaphoenix/omegaphoenix.github.com |
d507591657d48420188eb612b9eb41189ee67e62 | nucleotide-count/example.exs | nucleotide-count/example.exs | defmodule DNA do
@nucleotides [?A, ?C, ?G, ?T]
@doc """
Counts individual nucleotides in a DNA strand.
## Examples
iex> DNA.count('AATAA', ?A)
4
iex> DNA.count('AATAA', ?T)
1
"""
def count(strand, nucleotide) do
Enum.count strand, &(&1 == nucleotide)
end
@doc """
Returns a summary o... | defmodule DNA do
@nucleotides [?A, ?C, ?G, ?T]
@doc """
Counts individual nucleotides in a DNA strand.
## Examples
iex> DNA.count('AATAA', ?A)
4
iex> DNA.count('AATAA', ?T)
1
"""
def count(strand, nucleotide) do
Enum.count strand, &(&1 == nucleotide)
end
@doc """
Returns a summary o... | Remove the last HashDict.new call (in a comment) | Remove the last HashDict.new call (in a comment)
| Elixir | mit | montague/xelixir,henrik/xelixir,elasticdog/xelixir,exercism/xelixir,tjcelaya/xelixir,victorlcampos/xelixir,wobh/xelixir,cezarykosko/xelixir,Egogre/xelixir,parkerl/xelixir |
7b3f0253309b154b2abd6a1b6c71c0125f1e2454 | mix.exs | mix.exs | defmodule ExercismTestRunner.Mixfile do
use Mix.Project
def project do
[app: :tests,
version: "0.0.1",
elixir: "~> 1.0",
deps: deps,
test_paths: ["exercises"]]
end
def application do
[applications: [:logger]]
end
defp deps do
[{:poison, "~> 1.4.0"}]
end
end
| defmodule ExercismTestRunner.Mixfile do
use Mix.Project
def project do
[app: :tests,
version: "0.0.1",
elixir: "~> 1.0",
deps: deps,
test_paths: ["exercises"]]
end
def application do
[applications: [:logger]]
end
defp deps do
[{:poison, "~> 1.4.0"}]
end
defp aliases d... | Change build to fail on compile warnings | Change build to fail on compile warnings
We had accumulated several compiler warnings throughout this project, and in
this PR I'm adding some configuration that will fail the CI build if there are
any compiler warnings by turning them into errors thanks to the
`--warnings-as-errors` flag.
| Elixir | mit | cezarykosko/xelixir,parkerl/xelixir,exercism/xelixir |
5e77cffdd0c92d11679a5745947f9054f825e6a8 | lib/ultimatum_game/main.ex | lib/ultimatum_game/main.ex | defmodule UltimatumGame.Main do
@pages ["waiting", "description", "experiment", "result"]
@roles ["visitor", "proposer", "responder"]
@states ["allocating", "judging", "finished"]
def game_modes, do: @game_modes
def pages, do: @pages
def roles, do: @roles
def states, do: @states
def wrap(data) do
... | defmodule UltimatumGame.Main do
@pages ["waiting", "description", "experiment", "result"]
@roles ["visitor", "proposer", "responder"]
@states ["allocating", "judging", "finished"]
def game_modes, do: @game_modes
def pages, do: @pages
def roles, do: @roles
def states, do: @states
def wrap(data) do
... | Set 0 as the default value instead of a random value | Set 0 as the default value instead of a random value
| Elixir | mit | xeejp/ultimatum-game |
cf102007f996593c3bc63b20844279fa5dc3bb50 | test/controllers/node_controller_test.exs | test/controllers/node_controller_test.exs | defmodule Matrix.NodeControllerTest do
use Matrix.ConnCase
setup %{conn: conn} do
conn = put_req_header(conn, "content-type", "application/json")
{:ok, conn: conn}
end
describe "POST /node" do
context "when node is master" do
context "with successful handshake" do
it "registers nod... | defmodule Matrix.NodeControllerTest do
use Matrix.ConnCase
setup %{conn: conn} do
Matrix.Cluster.clear
conn = put_req_header(conn, "content-type", "application/json")
{:ok, conn: conn}
end
describe "POST /node" do
context "when node is master" do
context "with successful handshake" do... | Clear cluster between each test case | Clear cluster between each test case
| Elixir | mit | nemanja-m/matrix,nemanja-m/matrix |
88141302a034ce899fbd34b109f4e5fd339cb92d | priv/repo/migrations/20150719154222_create_user.exs | priv/repo/migrations/20150719154222_create_user.exs | defmodule MyApp_7191136.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string
add :email, :string
add :access_token, :string
add :refresh_token, :string
timestamps
end
end
end
| defmodule MyApp_7191136.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string
add :email, :string
add :access_token, :text
add :refresh_token, :text
timestamps
end
end
end
| Use text fields which are unlimited in length rather than the default varchar 255 | Use text fields which are unlimited in length rather than the default varchar 255
| Elixir | mit | wsmoak/my_app_7191136 |
b344170366e0f96ae85db541695e1b0b74d55659 | test/benchee/formatters/json_test.exs | test/benchee/formatters/json_test.exs | defmodule Benchee.Formatters.JSONTest do
use ExUnit.Case
doctest Benchee.Formatters.JSON
@filename "test.json"
test ".output returns the suite again unchanged" do
suite = %{
config: %{
json: %{file: @filename}
},
statistics: %{
"My Job" => %{
some: "value"
}
},
... | defmodule Benchee.Formatters.JSONTest do
use ExUnit.Case
doctest Benchee.Formatters.JSON
@filename "test.json"
test ".output returns the suite again unchanged" do
suite = %{
config: %{
json: %{file: @filename}
},
statistics: %{
"My Job" => %{
some: "value"
... | Correct code indention in test | Correct code indention in test
| Elixir | mit | PragTob/benchee_json |
fd9aa28db0fe87c964c9fc78c0c39b354348e02e | lib/appsignal/fallbacks.ex | lib/appsignal/fallbacks.ex | unless Code.ensure_loaded?(Appsignal.Phoenix) do
defmodule Appsignal.Plug.NotAvailableError do
@moduledoc false
defexception []
def message(_) do
"""
Appsignal.Plug was used but not present in the project's dependencies.
Since :appsignal 2.0, Appsignal's Phoenix integration was moved t... | unless Code.ensure_loaded?(Appsignal.Phoenix) do
defmodule Appsignal.Plug.NotAvailableError do
@moduledoc false
defexception []
def message(_) do
"""
Appsignal.Plug was used but not present in the project's dependencies.
Since :appsignal 2.0, Appsignal's Phoenix integration was moved t... | Use Github repos in fallback messages | Use Github repos in fallback messages
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir |
0a55aa4cc3d46fd5924dc7c11e7a597985c3d175 | farmbot_os/platform/host/configurator.ex | farmbot_os/platform/host/configurator.ex | defmodule FarmbotOS.Platform.Host.Configurator do
@moduledoc false
use Supervisor
import FarmbotCore.Config,
only: [update_config_value: 4]
@doc false
def start_link(args) do
Supervisor.start_link(__MODULE__, args, name: __MODULE__)
end
defp start_node() do
case Node.start(:"farmbot-host@12... | defmodule FarmbotOS.Platform.Host.Configurator do
@moduledoc false
use Supervisor
@doc false
def start_link(args) do
Supervisor.start_link(__MODULE__, args, name: __MODULE__)
end
defp start_node() do
case Node.start(:"farmbot-host@127.0.0.1") do
{:ok, _} -> :ok
_ -> :ok
end
end
... | Fix host only race condition causing token to delete itself | Fix host only race condition causing token to delete itself
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
88eb2b574ccb895c8f5e56d6debe8c4c0a42824b | elixir/mix.exs | elixir/mix.exs | defmodule CucumberGherkin.MixProject do
use Mix.Project
@vsn "17.0.2"
@github "https://github.com/cucumber/cucumber/tree/master/gherkin/elixir"
@name "CucumberGherkin"
def project do
[
app: :cucumber_gherkin,
version: @vsn,
name: @name,
description: description(),
package: ... | defmodule CucumberGherkin.MixProject do
use Mix.Project
@vsn "17.0.2"
@github "https://github.com/cucumber/cucumber/tree/master/gherkin/elixir"
@name "CucumberGherkin"
def project do
[
app: :cucumber_gherkin,
version: @vsn,
name: @name,
description: description(),
package: ... | Update messages dependency for gherkin elixir | Update messages dependency for gherkin elixir
| Elixir | mit | cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin |
32580bf2ef36f3f68d5f8b7166f727123eedf537 | farmbot_os/lib/farmbot_os/alert_helpers.ex | farmbot_os/lib/farmbot_os/alert_helpers.ex | defmodule FarmbotOS.AlertHelpers do
def firmware_missing(package) when package in ~w(arduino farmduino farmduino_k14 express_k10) do
%{
kind: :rpc_request,
args: %{label: "findme"},
body: [%{kind: :flash_firmware, args: %{package: "arduino"}}]
}
|> FarmbotCeleryScript.AST.decode()
|>... | defmodule FarmbotOS.AlertHelpers do
def firmware_missing(package) when package in ~w(arduino farmduino farmduino_k14 express_k10) do
%{
kind: :rpc_request,
args: %{label: "findme"},
body: [%{kind: :flash_firmware, args: %{package: package}}]
}
|> FarmbotCeleryScript.AST.decode()
|> F... | Fix firmware missing alert_helper not using package name | Fix firmware missing alert_helper not using package name
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
1a7b121826192e0b5b211f206fc984661faec49c | lib/mix/tasks/compile_asn1.ex | lib/mix/tasks/compile_asn1.ex | defmodule Mix.Tasks.Compile.Asn1 do
@moduledoc """
This task compiles all ASN.1 files (in `asn1/*.asn`) into erlang sources into `src` directory.
After that Erlang compiler (task Compile.Erlang) shall be run to compile them into .beam binaries.
"""
@shortdoc "Compiles ASN.1 files to Erlang sources"
use Mix... | defmodule Mix.Tasks.Compile.Asn1 do
@moduledoc """
This task compiles all ASN.1 files (in `asn1/*.asn`) into erlang sources into `src` directory.
After that Erlang compiler (task Compile.Erlang) shall be run to compile them into .beam binaries.
"""
@shortdoc "Compiles ASN.1 files to Erlang sources"
use Mix... | Fix compile warning for ANS.1 compiler | Fix compile warning for ANS.1 compiler
| Elixir | apache-2.0 | esl/MongoosePush,esl/MongoosePush,esl/MongoosePush |
becb23085bee3cf94993f390c1c7eae621cd3639 | test/controllers/page_controller_test.exs | test/controllers/page_controller_test.exs | defmodule Phobs.PageControllerTest do
use Phobs.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
| defmodule Phobs.PageControllerTest do
use Phobs.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Phoenix Observer"
end
end
| Fix builtin test by referencing Phobs' title | Fix builtin test by referencing Phobs' title
| Elixir | mit | joekain/phobs |
86beacdc4e3373be476d83b614ed1fa6586325b0 | test/views/page_view_test.exs | test/views/page_view_test.exs | defmodule SlackCoder.PageViewTest do
use SlackCoder.ConnCase, async: true
alias SlackCoder.PageView
alias SlackCoder.Github.PullRequest.Commit
alias SlackCoder.Github.PullRequest.PR
describe "pull_request.html" do
it "blank commit" do
expect {:safe, _} = PageView.render("pull_request.html", commit... | defmodule SlackCoder.PageViewTest do
use SlackCoder.ConnCase, async: true
alias SlackCoder.PageView
alias SlackCoder.Github.PullRequest.Commit
alias SlackCoder.Github.PullRequest.PR
describe "pull_request.html" do
it "bare minimum commit data" do
expect {:safe, _} = PageView.render("pull_request.h... | Fix up tests. Watching first auto deploy... | Fix up tests. Watching first auto deploy...
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
22051322a7c316fc04558a77842cfb23e5326c26 | config/prod.exs | config/prod.exs | use Mix.Config
config :course_planner, CoursePlanner.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "course-planner-backend.herokuapp.com", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
cache_static_manifest: "priv/static/manifest.json",
secret_key_base: System.get_env("... | use Mix.Config
config :course_planner, CoursePlanner.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "course-planner-backend.herokuapp.com", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
cache_static_manifest: "priv/static/cache_manifest.json",
secret_key_base: System.get... | Update cache manifest file name. | Update cache manifest file name.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
4a12e4618400f2e3b067941e7cd0e8aa815e277d | test/credo/check/readability/prefer_implicit_try_test.exs | test/credo/check/readability/prefer_implicit_try_test.exs | defmodule Credo.Check.Readability.PreferImplicitTryTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.PreferImplicitTry
test "it should report cases where a `try` block is the entire body of the function" do
"""
defmodule ModuleWithExplicitTry do
def failing_function(first) do
try do
... | defmodule Credo.Check.Readability.PreferImplicitTryTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.PreferImplicitTry
test "it should NOT report implicit use of `try`" do
"""
defmodule ModuleWithImplicitTry do
def failing_function(first) do
to_string(first)
rescue
_ -> :rescued
... | Fix order of tests for PreferImplicitTry | Fix order of tests for PreferImplicitTry
Refs #264
| Elixir | mit | rrrene/credo,rrrene/credo |
6f7723e6fc52c9d3966959d5e1587bdf72a66412 | 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
... | Format the code with mix format | Format the code with mix format
| Elixir | mit | teamon/tesla,monterail/tesla |
1ec60d29e9f487c4e1dc00fd7b80556a9cb01a62 | apps/bors_database/priv/repo/migrations/20170823012140_change_users_login_type_to_citext.exs | apps/bors_database/priv/repo/migrations/20170823012140_change_users_login_type_to_citext.exs | defmodule BorsNG.Database.Repo.Migrations.ChangeUsersLoginTypeToCitext do
use Ecto.Migration
def up do
execute "CREATE EXTENSION IF NOT EXISTS citext"
alter table(:users) do
modify :login, :citext
end
end
def down do
alter table(:users) do
modify :login, :string
end
execu... | defmodule BorsNG.Database.Repo.Migrations.ChangeUsersLoginTypeToCitext do
use Ecto.Migration
@adapter Application.get_env(:bors_database, BorsNG.Database.Repo)[:adapter]
def up do
case @adapter do
Ecto.Adapters.Postgres ->
execute "CREATE EXTENSION IF NOT EXISTS citext"
alter table(:us... | Exclude MySQL from the `citext` migration | Exclude MySQL from the `citext` migration
MySQL has no such extension, and in fact, it's case-insensitive by default anyway.
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
26864f920ba8eade64e185c419eea697ebcd5496 | mix.exs | mix.exs | defmodule Floki.Mixfile do
use Mix.Project
def project do
[app: :floki,
version: "0.4.0",
elixir: ">= 1.0.0",
package: package,
description: description,
docs: [readme: "README.md"],
deps: deps]
end
def application do
[applications: [:mochiweb]]
end
defp deps do
... | defmodule Floki.Mixfile do
use Mix.Project
def project do
[app: :floki,
version: "0.4.0",
elixir: ">= 1.0.0",
package: package,
description: description,
docs: [readme: "README.md"],
deps: deps]
end
def application do
[applications: [:mochiweb]]
end
defp deps do
... | Fix missing "src" dir from package file | Fix missing "src" dir from package file
| Elixir | mit | philss/floki,philss/floki |
35aa38184668088844c2cc55334718d8fba4c68b | lib/poxa/supervisor.ex | lib/poxa/supervisor.ex | defmodule Poxa.Supervisor do
use Supervisor
@doc false
def start_link do
Supervisor.start_link(__MODULE__, [])
end
@doc """
The supervisor will spawn a `GenEvent` named `Poxa.Event` and also a `Watcher`
to monitor a `Poxa.SubscriptionHandler`. If the web hook URL is configured,
it will also spawn ... | defmodule Poxa.Supervisor do
use Supervisor
@doc false
def start_link do
Supervisor.start_link(__MODULE__, [])
end
@doc """
The supervisor will spawn a `GenEvent` named `Poxa.Event` and also a `Watcher`
to monitor a `Poxa.SubscriptionHandler`. If the web hook URL is configured,
it will also spawn ... | Change Poxa.Supervisor to check if web hook was configured | Change Poxa.Supervisor to check if web hook was configured
| Elixir | mit | edgurgel/poxa,edgurgel/poxa,edgurgel/poxa |
b625a3c7931349ba0475fb680fcdf02c34aaf93d | mix.exs | mix.exs | defmodule SlimFast.Mixfile do
use Mix.Project
@version "0.9.1"
def project do
[app: :slim_fast,
build_embedded: Mix.env == :prod,
deps: deps,
description: """
An Elixir library for rendering slim templates.
""",
elixir: "~> 1.0",
package: package,
source_url: "https:/... | defmodule SlimFast.Mixfile do
use Mix.Project
@version "0.9.1"
def project do
[app: :slim_fast,
build_embedded: Mix.env == :prod,
deps: deps,
description: """
An Elixir library for rendering slim templates.
""",
elixir: "~> 1.0",
package: package,
source_url: "https:/... | Add henrik as a maintainer | Add henrik as a maintainer
| Elixir | mit | slime-lang/slime,Rakoth/slime |
7c4ce7023eeaf258e867fc13be8dbb8ac88c1a71 | mix.exs | mix.exs | defmodule CowboyElixirExample.Mixfile do
use Mix.Project
def project do
[app: :cowboy_elixir_example,
version: "0.0.1",
elixir: "~> 1.2.0",
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[
mod: ... | defmodule CowboyElixirExample.Mixfile do
use Mix.Project
def project do
[app: :cowboy_elixir_example,
version: "0.0.2",
elixir: "~> 1.2.0",
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[
mod: ... | Update dependencies to allow for newer version of Cowboy 1.0.x | Update dependencies to allow for newer version of Cowboy 1.0.x
| Elixir | mit | IdahoEv/cowboy-elixir-example |
10c6b0d2e02fd081076bd8ed7b9cfc84961651df | api/lib/api/images/router.ex | api/lib/api/images/router.ex | defmodule Api.Images.Router do
use Plug.Router
alias Api.Documents.Index
import Api.RouterUtils
plug :match
plug Api.Documents.ReadableProjectsPlug
plug :dispatch
get "/:id" do
with %{ project: project } <- Index.get(id),
:ok <- access_for_project_allowed(conn.private[:readable_projects], p... | defmodule Api.Images.Router do
use Plug.Router
alias Api.Documents.Index
import Api.RouterUtils
plug :match
plug Api.Documents.ReadableProjectsPlug
plug :dispatch
get "/:id" do
with %{ project: project } <- Index.get(id),
:ok <- access_for_project_allowed(conn.private[:readable_projects], p... | Make sure images are cached by the browser | Make sure images are cached by the browser
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
799b5e9ae5a3cd109b6873b655a3d53ded92b4ea | web/models/team.ex | web/models/team.ex | defmodule EspiDni.Team do
use EspiDni.Web, :model
schema "teams" do
field :slack_token, :string
field :google_token, :string
field :google_refresh_token, :string
field :name, :string
field :url, :string
field :slack_id, :string
... | defmodule EspiDni.Team do
use EspiDni.Web, :model
schema "teams" do
field :slack_token, :string
field :google_token, :string
field :google_refresh_token, :string
field :name, :string
field :url, :string
field :slack_id, :string
... | Add google columns as optional fields | Add google columns as optional fields
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni |
e325d85daa81688830934b69168dacce39fdc296 | lib/ex_money/web/views/api/v2/category_view.ex | lib/ex_money/web/views/api/v2/category_view.ex | defmodule ExMoney.Web.Api.V2.CategoryView do
use ExMoney.Web, :view
alias ExMoney.Web.Api.V2.CategoryView
def render("index.json", %{categories: categories}) do
render_many(categories, CategoryView, "category.json")
end
def render("category.json", %{category: category}) do
%{
id: category.id... | defmodule ExMoney.Web.Api.V2.CategoryView do
use ExMoney.Web, :view
alias ExMoney.Web.Api.V2.CategoryView
def render("index.json", %{categories: categories}) do
render_many(categories, CategoryView, "category.json")
end
def render("category.json", %{category: category}) do
%{
id: category.id... | Add parent_id and human_name to category api v2 | Add parent_id and human_name to category api v2
| Elixir | isc | gaynetdinov/ex_money,gaynetdinov/ex_money |
fc2d90da9e75c61f441748c832f46f553b52a4e0 | 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.start nil, nil
Credo.CLI.run(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.CLI.main(argv)
end
end
| Revert "Use `Credo.Cli.run/1` instead of `main/1` in mix-task" | Revert "Use `Credo.Cli.run/1` instead of `main/1` in mix-task"
This reverts commit c5a3d5c2369c8cf62e9696f0bdabad6cafa37478.
| Elixir | mit | rrrene/credo,rrrene/credo |
a6fef569ea1f10aa616d89603008920c3aa670dc | test/jumubase_web/views/error_view_test.exs | test/jumubase_web/views/error_view_test.exs | defmodule JumubaseWeb.ErrorViewTest do
use JumubaseWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
setup %{conn: conn} do
conn =
conn
|> bypass_through(JumubaseWeb.Router, [:browser])
|> get("/")
{:ok, conn: conn}
end
... | defmodule JumubaseWeb.ErrorViewTest do
use JumubaseWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
setup %{conn: conn} do
conn =
conn
|> bypass_through(JumubaseWeb.Router, [:browser])
|> get("/")
{:ok, conn: conn}
end
... | Fix failing error view test | Fix failing error view test
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
62eace04aedb8b67cfea7934dc53b0c4f6129595 | messages/elixir/mix.exs | messages/elixir/mix.exs | defmodule CucumberMessages.MixProject do
@moduledoc false
use Mix.Project
@vsn "13.2.1"
@github "https://github.com/cucumber/cucumber/tree/master/messages/elixir"
@name "CucumberMessages"
def project do
[
app: :cucumber_messages,
version: @vsn,
name: @name,
description: descrip... | defmodule CucumberMessages.MixProject do
@moduledoc false
use Mix.Project
@vsn "13.2.1"
@github "https://github.com/cucumber/cucumber/tree/master/messages/elixir"
@name "CucumberMessages"
def project do
[
app: :cucumber_messages,
version: @vsn,
name: @name,
description: descrip... | Update dependency protox to ~> 1.3.0 | Update dependency protox to ~> 1.3.0
| Elixir | mit | cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber |
3a072fd4ac39b21b0e79092c3a806af4f6bea13a | 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 :krihelinator, Krihelinator.Web.Endpoint,
http... | 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 :krihelinator, Krihelinator.Web.Endpoint,
http... | Fix live code reload of templates and views | Web: Fix live code reload of templates and views
| Elixir | mit | Nagasaki45/krihelinator,Nagasaki45/krihelinator,Nagasaki45/krihelinator,Nagasaki45/krihelinator |
a8b399a12d8a0c4b8d0d56d84d08e5b5105b47f4 | test/routers/status_router_test.exs | test/routers/status_router_test.exs | defmodule StatusRouterTest do
use Funnel.TestCase, async: true
use Dynamo.HTTP.Case
@endpoint StatusRouter
test "returns 200" do
conn = get("/")
assert conn.status == 200
end
test "returns json" do
conn = get("/")
assert conn.resp_headers["Content-Type"] == "application/json"
end
tes... | defmodule StatusRouterTest do
use Funnel.TestCase, async: true
use Dynamo.HTTP.Case
@endpoint StatusRouter
test "returns 200" do
conn = get("/")
assert conn.status == 200
end
test "returns json" do
conn = get("/")
assert conn.resp_headers["Content-Type"] == "application/json"
end
tes... | Fix test on ES status | Fix test on ES status
Signed-off-by: chatgris <f9469d12bf3d131e7aae80be27ccfe58aa9db1f1@af83.com>
| Elixir | mit | chatgris/funnel |
e7be6dbae621ebf04f033f796ebf05b2ca292323 | test/atom_tweaks_web/controllers/admin/release_note_controller_test.exs | test/atom_tweaks_web/controllers/admin/release_note_controller_test.exs | defmodule AtomTweaksWeb.Admin.ReleaseNoteControllerTest do
use AtomTweaksWeb.ConnCase
alias AtomTweaksWeb.ForbiddenUserError
alias AtomTweaksWeb.NotLoggedInError
describe "index when not logged in" do
test "returns unauthorized", context do
assert_raise NotLoggedInError, fn ->
request_admin_... | defmodule AtomTweaksWeb.Admin.ReleaseNoteControllerTest do
use AtomTweaksWeb.ConnCase
alias AtomTweaksWeb.ForbiddenUserError
alias AtomTweaksWeb.NotLoggedInError
describe "index when not logged in" do
test "returns unauthorized", context do
assert_raise NotLoggedInError, fn ->
request_admin_... | Add assertion to ensure the link href is correct | Add assertion to ensure the link href is correct
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
a0e5eb1e7c1ab8e14b46cee7928ac1ca74c044aa | lib/elixir_script/manifest.ex | lib/elixir_script/manifest.ex | defmodule ElixirScript.Manifest do
@moduledoc false
@spec read_manifest(binary) :: nil
def read_manifest(_manifest) do
end
@spec write_manifest(binary, [{atom, map}], map) :: :ok
def write_manifest(manifest_path, modules, _opts) do
data = Enum.reduce(modules, %{}, fn {module, info}, current_data ->
... | defmodule ElixirScript.Manifest do
@moduledoc false
@spec read_manifest(binary) :: nil
def read_manifest(_manifest) do
end
@spec write_manifest(binary, [{atom, map}], map) :: :ok
def write_manifest(manifest_path, modules, opts) do
output_path = if opts.output == nil or opts.output == :stdout do
... | Add output path for js_path | Add output path for js_path
| Elixir | mit | elixirscript/elixirscript,bryanjos/elixirscript |
280e1a7cae644efa458d3fae23b7bea8fcf08aaf | web/views/error_view.ex | web/views/error_view.ex | defmodule Core.ErrorView do
use Core.Web, :view
def render("404.html", _assigns) do
"Page not found"
end
def render("500.html", _assigns) do
"Internal server error"
end
def render("401.json", _assigns) do
%{
message: "Authentication required. Log in to perform this action"
}
end
... | defmodule Core.ErrorView do
use Core.Web, :view
def render("404.html", _assigns) do
"Page not found"
end
def render("500.html", _assigns) do
"Internal server error"
end
def render("401.json", _assigns) do
%{
message: "Authentication required. Log in to perform this action"
}
end
... | Add view for "403 Forbidden" errors | Add view for "403 Forbidden" errors
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
f673ae2f31fb90132c0e45d2ce5b47df5dec30ea | web/controllers/image_controller.ex | web/controllers/image_controller.ex | defmodule DrinkMe.ImageController do
use DrinkMe.Web, :controller
require HTTPotion
plug :scrub_params, "image" when action in [:create]
plug :action
def create(conn, %{"image" => image_params}) do
case download(image_params["path"]) do
{ :ok, path } ->
spawn fn -> modify(path) end
... | defmodule DrinkMe.ImageController do
use DrinkMe.Web, :controller
require HTTPotion
plug :scrub_params, "image" when action in [:create]
plug :action
def create(conn, %{"image" => image_params}) do
case download(image_params["path"]) do
{ :ok, path } ->
Task.start fn ->
modify(p... | Apply requested changes to image | Apply requested changes to image
| Elixir | mit | doomspork/drink_me |
34fb85749df24d156ccd3b27c5a24c2903b9b878 | lib/animu/account/user.ex | lib/animu/account/user.ex | defmodule Animu.Account.User do
use Ecto.Schema
import Ecto.Changeset
alias __MODULE__, as: User
#@derive {Poison.Encoder, except: [:__meta__]}
schema "users" do
field :first_name, :string
field :last_name, :string
field :email, :string
field :username, :string
field :password, :string... | defmodule Animu.Account.User do
use Ecto.Schema
import Ecto.Changeset
alias __MODULE__, as: User
@derive {Poison.Encoder, except: [:__meta__]}
schema "users" do
field :first_name, :string
field :last_name, :string
field :email, :string
field :username, :string
field :password, :string,... | Add poison derive back to User schema | Add poison derive back to User schema
| Elixir | mit | elarkham/animu,elarkham/animu |
de8a5ceaed601b09e60f6adc1fe4130bd16726a7 | test/support/conn_case.ex | test/support/conn_case.ex | defmodule Core.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 databa... | defmodule Core.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 databa... | Add our test helpers into test flow | Add our test helpers into test flow
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
6a6abf836d4afbd2ab3b9a44fbc41afbba6a43e2 | bench/ets_bench.exs | bench/ets_bench.exs | defmodule ETSBench do
use Benchfella
before_each_bench _ do
tid = :ets.new(:my_table, [:public])
{:ok, tid}
end
after_each_bench tid do
IO.inspect length(:ets.tab2list(tid))
:ets.delete(tid)
end
bench "ets insert", [_unused: inspect_table(bench_context)] do
tid = bench_context
:et... | defmodule ETSBench do
use Benchfella
before_each_bench _ do
tid = :ets.new(:my_table, [:public])
{:ok, tid}
end
after_each_bench tid do
IO.inspect length(:ets.tab2list(tid))
:ets.delete(tid)
end
bench "ets insert", [unused: inspect_table(bench_context)] do
tid = bench_context
:ets... | Fix a warning about an unused variable | Fix a warning about an unused variable
| Elixir | mit | alco/benchfella,alco/benchfella |
509dd5d35b51c2092f643e3bf63d32cdd357191b | mix.exs | mix.exs | defmodule Trot.Mixfile do
use Mix.Project
@version "0.1.0"
def project do
[app: :trot,
version: @version,
elixir: "~> 1.0",
deps: deps,
# Hex
description: description,
package: package]
end
def application do
[applications: [:logger, :plug, :cowboy]]
end
defp dep... | defmodule Trot.Mixfile do
use Mix.Project
@version "0.1.0-dev"
def project do
[app: :trot,
version: @version,
elixir: "~> 1.0",
deps: deps,
# Hex
description: description,
package: package]
end
def application do
[applications: [:logger, :plug, :cowboy]]
end
defp... | Add -dev tag to version | Add -dev tag to version
| Elixir | apache-2.0 | hexedpackets/trot |
e7fdb65721aac902045c147eb50e156467cf104d | mix.exs | mix.exs | defmodule Credo.Mixfile do
use Mix.Project
def project do
[
app: :credo,
version: "0.9.3",
elixir: ">= 1.4.0",
escript: [main_module: Credo.CLI],
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
test_coverage: [tool: Coverex.... | defmodule Credo.Mixfile do
use Mix.Project
def project do
[
app: :credo,
version: "0.9.3",
elixir: ">= 1.4.0",
escript: [main_module: Credo.CLI],
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
test_coverage: [tool: Coverex.... | Update jason constraint to ~> 1.0 | Update jason constraint to ~> 1.0
| Elixir | mit | rrrene/credo,rrrene/credo |
5f02de1e3deda948f15dec98bc3ae7f8df7fc606 | mix.exs | mix.exs | defmodule GymTcpApi.Mixfile do
use Mix.Project
def project do
[app: :gym_tcp_api,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" ... | defmodule GymTcpApi.Mixfile do
use Mix.Project
def project do
[app: :gym_tcp_api,
version: "0.1.0",
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" ... | Update minimal required elixir version. | Update minimal required elixir version.
| Elixir | bsd-3-clause | zoq/gym_tcp_api,zoq/gym_tcp_api |
b5dd3d1b25a55841f6a1a7b986525c9824326abe | lib/fun_with_flags/store/persistent/ecto/null_repo.ex | lib/fun_with_flags/store/persistent/ecto/null_repo.ex | defmodule FunWithFlags.NullEctoRepo do
@moduledoc false
# This is here just to raise some more helpful errors if a user
# forgets to configure an Ecto repo.
@error_msg "The NullEctoRepo doesn't implement this. You must configure a proper repo to persist flags with Ecto."
def all(_), do: raise(@err... | defmodule FunWithFlags.NullEctoRepo do
@moduledoc false
# This is here just to raise some more helpful errors if a user
# forgets to configure an Ecto repo.
@error_msg "The NullEctoRepo doesn't implement this. You must configure a proper repo to persist flags with Ecto."
def all(_), do: raise(@err... | Add Repo.__adapter__/0 impl to NullRepo | Add Repo.__adapter__/0 impl to NullRepo
| Elixir | mit | tompave/fun_with_flags |
875384aaadb09bae99d84a4af6c253e57aab46a8 | lib/tilex_web/controllers/auth_controller.ex | lib/tilex_web/controllers/auth_controller.ex | defmodule TilexWeb.AuthController do
use TilexWeb, :controller
plug Ueberauth
alias Guardian.Plug
alias Tilex.{Developer, Repo}
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
case authenticate(auth) do
{:ok, developer} ->
conn = Plug.sign_in(conn, developer)
... | defmodule TilexWeb.AuthController do
use TilexWeb, :controller
plug Ueberauth
alias Guardian.Plug
alias Tilex.{Developer, Repo}
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
case authenticate(auth) do
{:ok, developer} ->
conn = Plug.sign_in(conn, developer)
... | Use hosted_domain for checking allowed domain in email | Use hosted_domain for checking allowed domain in email
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
9cc08c3d479d35d63b4a6564c3fae769d7b4d9ec | web/router.ex | web/router.ex | defmodule Core.Router do
use Core.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 "/", Core do
pipe_through :api
... | defmodule Core.Router do
use Core.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"]
plug Core.Auth, repo: Core.Repo
end
scope ... | Check session in all API calls | Check session in all API calls
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
a6c87c8359bc019a8af02096a9ca428d40eb6f74 | lib/tesla/middleware/follow_redirects.ex | lib/tesla/middleware/follow_redirects.ex | defmodule Tesla.Middleware.FollowRedirects do
@doc """
Follow 301/302 redirects
Example:
defmodule MyClient do
use Tesla
plug Tesla.Middleware.FollowRedirects, max_redirects: 3 # defaults to 5
end
"""
@max_redirects 5
@redirect_statuses [301, 302, 307, 308]
def call(env, next, opts \\ []) ... | defmodule Tesla.Middleware.FollowRedirects do
@doc """
Follow 301/302 redirects
Example:
defmodule MyClient do
use Tesla
plug Tesla.Middleware.FollowRedirects, max_redirects: 3 # defaults to 5
end
"""
@max_redirects 5
@redirect_statuses [301, 302, 307, 308]
def call(env, next, opts \\ []) ... | Fix warnings in FollowRedirects middleware | Fix warnings in FollowRedirects middleware | Elixir | mit | teamon/tesla,monterail/tesla |
05da610b34d1f91169fb03b6b2feac5be5dde832 | apps/lexibomb_server/lib/lexibomb_server/board/square.ex | apps/lexibomb_server/lib/lexibomb_server/board/square.ex | defmodule LexibombServer.Board.Square do
@moduledoc """
"""
defstruct [
adjacent_bombs: 0,
bomb?: false,
revealed?: false,
tile: "",
]
@inactive "#"
def deactivate(square) do
%{square | revealed?: true, tile: @inactive}
end
def inactive?(square) do
square.tile === @inactive
... | defmodule LexibombServer.Board.Square do
@moduledoc """
"""
defstruct [
adjacent_bombs: 0,
bomb?: false,
revealed?: false,
tile: "",
]
@inactive "#"
def deactivate(square) do
%{square | revealed?: true, tile: @inactive}
end
def inactive?(square) do
square.tile === @inactive
... | Change the 0 adjacent bombs symbol to a middle dot | Change the 0 adjacent bombs symbol to a middle dot
I did like the "◦" because it looks more like a zero, but it is a bit
heavy when displaying the board knowing that a lot of revealed spaces
will have no adjacent bombs.
| Elixir | isc | elasticdog/lexibomb |
bdcbc404467dd5322c3abe7bb855dcbc396b34f3 | lib/exrm_deb.ex | lib/exrm_deb.ex | defmodule ReleaseManager.Plugin.Deb do
require ReleaseManager.Config
use ReleaseManager.Plugin
alias ExrmDeb.{Control, Data, Deb}
def before_release(_), do: nil
def after_release(%{deb: true} = config) do
case ExrmDeb.Config.build_config do
{:ok, config} -> start_build(config)
_ ... | defmodule ReleaseManager.Plugin.Deb do
require ReleaseManager.Config
use ReleaseManager.Plugin
alias ExrmDeb.{Control, Data, Deb}
def before_release(_), do: nil
def after_release(%{deb: true} = _config) do
case ExrmDeb.Config.build_config do
{:ok, config} -> start_build(config)
_ ... | Remove reference to unused argument | Remove reference to unused argument
| Elixir | mit | samuelebistoletti/exrm_deb,samuelebistoletti/exrm_deb,johnhamelink/exrm_deb,johnhamelink/exrm_deb |
a2db428c2104c45412be574d9a9e62fe11e8ff3f | lib/meditate.ex | lib/meditate.ex | defmodule Mix.Tasks.Meditate do
use Mix.Task
@shortdoc "Start the koans"
def run(args) do
Application.ensure_all_started(:elixir_koans)
Code.compiler_options(ignore_module_conflict: true)
{parsed, _, _} = OptionParser.parse(args)
modules =
parsed
|> initial_module
|> ok?
... | defmodule Mix.Tasks.Meditate do
use Mix.Task
@shortdoc "Start the koans"
def run(args) do
Application.ensure_all_started(:elixir_koans)
Code.compiler_options(ignore_module_conflict: true)
{parsed, _, _} = OptionParser.parse(args, switches: [])
modules =
parsed
|> initial_module
... | Fix deprecated option for OptionParser warning | Fix deprecated option for OptionParser warning
| Elixir | mit | elixirkoans/elixir-koans |
56ccf70ad8432c95bade0c2cc2f8a8bf2c902a2f | .formatter.exs | .formatter.exs | [
inputs: ["*.{ex,exs}", "{test}/**/*.{ex,exs}"],
line_length: 80
]
| [
inputs: ["*.{ex,exs}", "{test}/**/*.{ex,exs}"]
]
| Remove 80 limit from root of project (CI is format checking build artifacts?) | Remove 80 limit from root of project (CI is format checking build artifacts?)
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
f49b01c0487309539c04f5c498dd4fc572d3a3ee | 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 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 ... | 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 ... | Add typespecs for the private WordList functions | Add typespecs for the private WordList functions
| Elixir | isc | elasticdog/lexibomb |
542ac0d373116adb9ef36a6fa0c958f9a45140f4 | apps/hard_hat/lib/hard_hat/users.ex | apps/hard_hat/lib/hard_hat/users.ex | defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHat.response
def w... | defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat, except: [get: 2]
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHa... | Use the verb "get" for consistency | Use the verb "get" for consistency
Rather that use the inconsistent verbs that are in place in the upstream
API documentation, I think it makes sense to standardize on using "get"
for pure GET requests, which also is familiar to other usages of the
term throughout Elixir as a language. The verbs "fetch" and "show"
eit... | Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni |
a52463361364258f6744aad86ad7a2f96f68b544 | test/controllers/page_controller_test.exs | test/controllers/page_controller_test.exs | defmodule MarcCx.PageControllerTest do
use MarcCx.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
| defmodule MarcCx.PageControllerTest do
use MarcCx.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "marc.cx"
end
end
| Update the page controller test to make it pass | Update the page controller test to make it pass
| Elixir | mit | marcaddeo/marc.cx,marcaddeo/marc.cx,marcaddeo/marc.cx |
1670fdd01869aef598633f69f93c019d31391031 | lib/jumubase_web/views/encoders/csv_encoder.ex | lib/jumubase_web/views/encoders/csv_encoder.ex | NimbleCSV.define(CSVParser, separator: "\t", escape: "\"")
defmodule JumubaseWeb.CSVEncoder do
@moduledoc """
A tool to export registration data as comma-separated values.
"""
import JumubaseWeb.Internal.PerformanceView, only: [category_name: 1]
alias Jumubase.Showtime.{Participant, Performance}
def enco... | NimbleCSV.define(CSVParser, separator: "\t", escape: "\"")
defmodule JumubaseWeb.CSVEncoder do
@moduledoc """
A tool to export registration data as comma-separated values.
"""
import JumubaseWeb.Internal.PerformanceView, only: [category_name: 1]
alias Jumubase.Showtime.{Participant, Performance}
def enco... | Make exported CSV compatible with MS Excel | Make exported CSV compatible with MS Excel
We need to ensure that Excel opens the CSV correctly out of the box, without having to tweak import settings. This involves converting the data to UTF-16 little-endian encoding and adding a so-called BOM (Byte Order Mark), an approach described in detail here: https://underth... | Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
231d4d439735b1215e5f945cd83ec4f32346ea49 | lib/ex_twilio/resources/incoming_phone_number.ex | lib/ex_twilio/resources/incoming_phone_number.ex | defmodule ExTwilio.IncomingPhoneNumber do
@moduledoc """
Represents an IncomingPhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/incoming-phone-numbers)
"""
defstruct sid: nil,
account_sid: nil,
identity_sid: nil,
date_created: n... | defmodule ExTwilio.IncomingPhoneNumber do
@moduledoc """
Represents an IncomingPhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/incoming-phone-numbers)
"""
defstruct sid: nil,
account_sid: nil,
address_sid: nil,
address_requirem... | Add new fields to incoming phone number resource | Add new fields to incoming phone number resource
Also changed the order to match the alphabetical order in the
documentation to simplify things a bit, since Elixir structs are built
on top of maps and ordering shouldn't be important
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
55aeae7529a70aafbb488cfd6c8d863c8ca2d2a7 | test/controllers/api/developer_post_controller_test.exs | test/controllers/api/developer_post_controller_test.exs | defmodule Tilex.Api.DeveloperPostControllerTest do
use TilexWeb.ConnCase
alias Tilex.Factory
test "returns a developer's most recent posts", %{conn: conn} do
jackdonaughy = Factory.insert!(:developer, username: "jackdonaughy")
jack_post_titles = [
"30 Rock Is Awesome",
"I'm a Big Meanie",
... | defmodule Tilex.Api.DeveloperPostControllerTest do
use TilexWeb.ConnCase
alias Tilex.Factory
test "returns a developer's most recent posts", %{conn: conn} do
jackdonaughy = Factory.insert!(:developer, username: "jackdonaughy")
jack_post_titles = [
"30 Rock Is Awesome",
"I'm a Big Meanie",
... | Store posts with timestamp in developer post controller test | Store posts with timestamp in developer post controller test
[Fixes #351]
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
4be90200267e7bc732cae6871d6e4910d24a24e6 | lib/react_phoenix.ex | lib/react_phoenix.ex | defmodule ReactPhoenix do
@moduledoc """
Functions for rendering of React.js components.
"""
@doc """
(Depricated) provides functions for client-side rendering of React.js components
As of v0.4.0, please use `ElixirCabinet.ClientSide.react_component/2` instead. Provided for backward
compatability for ve... | defmodule ReactPhoenix do
@moduledoc """
Functions for rendering of React.js components.
"""
@doc """
(Depricated) provides functions for client-side rendering of React.js components
As of v0.4.0, please use `ReactPhoenix.ClientSide.react_component/2` instead. Provided for backward
compatability for ver... | FIX docs: remove reference to ElixirCabinet | FIX docs: remove reference to ElixirCabinet
| Elixir | mit | geolessel/react-phoenix |
8526ecd8cbf0841ace5abf4c248408ce4cfa9e12 | port_demo/lib/port_demo.ex | port_demo/lib/port_demo.ex | defmodule Top do
@moduledoc """
Documentation for Top.
"""
@doc """
Hello world.
## Examples
iex> Top.hello
:world
"""
def hello do
:world
end
end
| defmodule Top do
@moduledoc """
Documentation for Top.
"""
def report(), do: Top.Server.report()
def report(key), do: Top.Server.report(key)
def stop(), do: Top.Server.stop
end
| Include basic API functions for top-level module | Include basic API functions for top-level module
| Elixir | unlicense | GeoffreyPS/on_ports,GeoffreyPS/on_ports |
327691555dff885944cce463c21019751fa7eb19 | test/support/integration_case.ex | test/support/integration_case.ex | defmodule RemoteRetro.IntegrationCase do
use ExUnit.CaseTemplate
use Wallaby.DSL
alias RemoteRetro.{Repo, Retro, TestHelpers}
import TestHelpers
setup_all context do
{:ok, _} = Application.ensure_all_started(:wallaby)
:timer.sleep(100)
Application.put_env(:wallaby, :base_url, "http://localhost:... | defmodule RemoteRetro.IntegrationCase do
use ExUnit.CaseTemplate
use Wallaby.DSL
alias RemoteRetro.{Repo, Retro, TestHelpers}
import TestHelpers
setup_all context do
{:ok, _} = Application.ensure_all_started(:wallaby)
:timer.sleep(100)
Application.put_env(:wallaby, :base_url, "http://localhost:... | Remove reference to no-longer-used test tag | Remove reference to no-longer-used test tag
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
d7b40deb2321ce0c5425c9ea7e28ccb29f58e96a | test/action_for_children/web/controllers/callback_controller_test.exs | test/action_for_children/web/controllers/callback_controller_test.exs | defmodule ActionForChildren.Web.CallbackControllerTest do
use ActionForChildren.Web.ConnCase
test "logged in user is show callback view", %{conn: conn} do
user = insert_user()
conn = assign(conn, :user, user)
conn = get conn, user_callback_path(conn, :show, user)
contents = [
"good to talk",... | defmodule ActionForChildren.Web.CallbackControllerTest do
use ActionForChildren.Web.ConnCase
test "logged in user is show callback view", %{conn: conn} do
user = insert_user()
conn = assign(conn, :user, user)
conn = get conn, user_callback_path(conn, :show, user)
contents = [
"good to talk",... | Fix test in callback controller | Fix test in callback controller
| Elixir | bsd-3-clause | cast-fuse/action-for-children,cast-fuse/action-for-children |
154684e453087777bc3c4bbb1079d219b57e12a6 | lib/atom_tweaks_web/controllers/page_controller.ex | lib/atom_tweaks_web/controllers/page_controller.ex | defmodule AtomTweaksWeb.PageController do
@moduledoc """
Handles requests for the root-level resources.
"""
use AtomTweaksWeb, :controller
alias AtomTweaks.Tweaks.Tweak
import Ecto.Query, only: [from: 2]
@doc """
Renders the root-level index page.
"""
def index(conn, params) do
type = params[... | defmodule AtomTweaksWeb.PageController do
@moduledoc """
Handles requests for the root-level resources.
"""
use AtomTweaksWeb, :controller
alias AtomTweaks.Tweaks.Tweak
import Ecto.Query, only: [from: 2]
@doc """
Renders the root-level index page.
"""
def index(conn, params) do
type = params[... | Exclude forks from main tweak listing | Exclude forks from main tweak listing
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
2fccb798592a8c0210fd7e6bf55e7eed3d72ce98 | lib/tesla/adapter/httpc.ex | lib/tesla/adapter/httpc.ex | defmodule Tesla.Adapter.Httpc do
def call(env, _opts) do
with {:ok, {status, headers, body}} <- request(env) do
format_response(env, status, headers, body)
end
end
defp format_response(env, {_, status, _}, headers, body) do
%{env | status: status,
headers: headers,
bo... | defmodule Tesla.Adapter.Httpc do
@http_opts ~w(timeout connect_timeout ssl essl autoredirect proxy_auth version relaxed url_encode)a
def call(env, opts) do
with {:ok, {status, headers, body}} <- request(env, opts || []) do
format_response(env, status, headers, body)
end
end
defp format_response(... | Add support for Httpc options | Add support for Httpc options
| Elixir | mit | monterail/tesla,teamon/tesla |
1ae5d1f317878a031fced750713e0e006dbbf463 | lib/poxa/channels_handler.ex | lib/poxa/channels_handler.ex | defmodule Poxa.ChannelsHandler do
require Lager
alias Poxa.AuthorizationHelper
alias Poxa.Subscription
def init(_transport, req, _opts) do
{:upgrade, :protocol, :cowboy_rest}
end
def allowed_methods(req, state) do
{["GET"], req, state}
end
def is_authorized(req, channel) do
Authorization... | defmodule Poxa.ChannelsHandler do
require Lager
alias Poxa.AuthorizationHelper
alias Poxa.Subscription
def init(_transport, req, _opts) do
{:upgrade, :protocol, :cowboy_rest}
end
def allowed_methods(req, state) do
{["GET"], req, state}
end
def is_authorized(req, state) do
AuthorizationHe... | Rename channels handler state on is_authorized | Rename channels handler state on is_authorized
| Elixir | mit | edgurgel/poxa,theinventor/rs-poxa,edgurgel/poxa,joshk/poxa,waffleio/poxa,RobertoSchneiders/poxa,waffleio/poxa,edgurgel/poxa,RobertoSchneiders/poxa,joshk/poxa |
516f8fa9e4adad7cede881b84cbb6231ae56024a | config/config.exs | config/config.exs | import Config
# Do not bother trying to emit cache-busting notifications,
# so that we don't need to declare the optional dependencies.
#
# This only applies to the dev env of the library, and this
# config file won't even be included in the packaged library.
#
config :fun_with_flags, :cache_bust_notifications, enable... | import Config
# Do not bother trying to emit cache-busting notifications,
# so that we don't need to declare the optional dependencies.
#
# This only applies to the dev env of the library, and this
# config file won't even be included in the packaged library.
#
config :fun_with_flags, :cache_bust_notifications, enable... | Stop using deprecated Mix.env in the local env. | Stop using deprecated Mix.env in the local env.
| Elixir | mit | tompave/fun_with_flags_ui,tompave/fun_with_flags_ui |
74cd48e891601bb7f5140e40321166d525bc667b | mix_ex/test/bucket_test.exs | mix_ex/test/bucket_test.exs | defmodule MixEx.BucketTest do
use ExUnit.Case, async: true
test "stores values by key" do
{:ok, bucket} = MixEx.Bucket.start_link
assert MixEx.Bucket.get(bucket, "milk") == nil
MixEx.Bucket.put(bucket, "milk", 3)
assert MixEx.Bucket.get(bucket, "milk") == 3
end
end
| defmodule MixEx.BucketTest do
use ExUnit.Case, async: true
setup do
{:ok, bucket} = MixEx.Bucket.start_link
{:ok, bucket: bucket}
end
test "stores values by key", %{bucket: bucket} do
assert MixEx.Bucket.get(bucket, "milk") == nil
MixEx.Bucket.put(bucket, "milk", 3)
assert MixEx.Bucket.get(bucket, "mil... | Add setup to bucket test | Add setup to bucket test
| Elixir | mit | Quirk0o/secret-elixir |
c83bd0c306aea84f51006ad99a2edc1636da92f2 | lib/code_corps/services/project.ex | lib/code_corps/services/project.ex | defmodule CodeCorps.Services.ProjectService do
@moduledoc """
Handles special CRUD operations for `CodeCorps.Project`.
"""
import Ecto.Query
alias CodeCorps.{Project, Repo, StripeConnectPlan, StripeConnectSubscription}
def update_project_totals(%Project{stripe_connect_plan: %StripeConnectPlan{id: plan_id... | defmodule CodeCorps.Services.ProjectService do
@moduledoc """
Handles special CRUD operations for `CodeCorps.Project`.
"""
import Ecto.Query
alias CodeCorps.{Project, Repo, StripeConnectPlan, StripeConnectSubscription}
def update_project_totals(%Project{stripe_connect_plan: %StripeConnectPlan{id: plan_id... | Fix duplicate declaration credo warning | Fix duplicate declaration credo warning
| Elixir | mit | code-corps/code-corps-api,crodriguez1a/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api |
9e831ef7b12e78606764e9acd79da7591cc2f768 | lib/ex_twilio/resources/sip_credential_list.ex | lib/ex_twilio/resources/sip_credential_list.ex | defmodule ExTwilio.SipCredentialList do
@moduledoc """
Represents an SIP CredentialList in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/credential-list)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
date_created: nil,
da... | defmodule ExTwilio.SipCredentialList do
@moduledoc """
Represents an SIP CredentialList in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
date_created: ni... | Update redirect to SipCredentialList API | Update redirect to SipCredentialList API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
c508eb352bca4c983c2419c405b245598b66d3fa | lib/wobserver/util/metrics.ex | lib/wobserver/util/metrics.ex | defmodule Wobserver.Util.Metrics do
@moduledoc ~S"""
Metrics
TODO: Needs config.
"""
alias Wobserver.System.Memory
def overview do
memory()
|> Kernel.++(io())
|> Keyword.merge(custom_metrics())
|> Keyword.merge(custom_generated_metrics())
end
def memory do
[erlang_vm_used_memory_... | defmodule Wobserver.Util.Metrics do
@moduledoc ~S"""
Metrics
TODO:
- Needs config.
- Needs docs.
- Needs cleanup.
- Needs tests.
"""
alias Wobserver.System.Memory
def overview do
memory()
|> Kernel.++(io())
|> Keyword.merge(custom_metrics())
|> Keyword.merge(custom_generat... | Update Metric moduledoc with todos. | Update Metric moduledoc with todos.
| Elixir | mit | shinyscorpion/wobserver,shinyscorpion/wobserver |
8b635307774eda3f47b018e23b8521c62028cd61 | web/helpers/session.ex | web/helpers/session.ex | defmodule HelloPhoenix.Session do
alias HelloPhoenix.{Repo, User}
def authenticate(%{"email" => email, "password" => password}) do
user = Repo.get_by(User, email: String.downcase(email))
case check_password(user, password) do
true -> {:ok, user}
_ -> :error
end
end
defp check_password... | defmodule HelloPhoenix.Session do
alias HelloPhoenix.{Repo, User}
def authenticate(%{"email" => email, "password" => password}) do
user = Repo.get_by(User, email: String.downcase(email))
case check_password(user, password) do
true -> {:ok, user}
_ -> :error
end
end
defp check_password... | Add dummy pw check when user isn't found | Add dummy pw check when user isn't found
| Elixir | mit | bigardone/phoenix-react-redux-template,bigardone/phoenix-react-redux-template |
a4b3fff9899dbab71674a40a14396f7125c7b283 | lib/farmbot/celery_script/ast/node/reboot.ex | lib/farmbot/celery_script/ast/node/reboot.ex | defmodule Farmbot.CeleryScript.AST.Node.Reboot do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args []
use Farmbot.Logger
def execute(_, _, env) do
env = mutate_env(env)
Logger.warn 1, "Going down for a reboot!"
Farmbot.BotState.set_sync_status(:maintenance)
Farmbot.BotState.force... | defmodule Farmbot.CeleryScript.AST.Node.Reboot do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args [:package]
use Farmbot.Logger
def execute(%{package: :arduino_firmware}, _, env) do
env = mutate_env(env)
Logger.warn 1, "Reinitializing Arduino Firmware."
Farmbot.BotState.set_sync_sta... | Add new RPC for reinit fw | Add new RPC for reinit fw
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
894c5b360f1451d20b5ac4f74d3185509c249a56 | lib/dogma/rules.ex | lib/dogma/rules.ex | defmodule Dogma.Rules do
@moduledoc """
Responsible for running of the appropriate rule set on a given set of scripts
with the appropriate configuration.
"""
alias Dogma.Formatter
alias Dogma.Script
@default_rule_set Dogma.RuleSet.All
@doc """
Runs the rules in the current rule set on the given scr... | defmodule Dogma.Rules do
@moduledoc """
Responsible for running of the appropriate rule set on a given set of scripts
with the appropriate configuration.
"""
alias Dogma.Formatter
alias Dogma.Script
@default_rule_set Dogma.RuleSet.All
@doc """
Runs the rules in the current rule set on the given scr... | Test files in parallel using Task.async | Test files in parallel using Task.async
| Elixir | mit | linearregression/dogma,eksperimental/dogma,meadsteve/dogma,knewter/dogma,henrik/dogma,rrrene/dogma,simonewebdesign/dogma,jacknoble/dogma,timbuchwaldt/dogma,aerosol/dogma,5thWall/dogma |
ac28ed12b1eddebd493f67e1bfa0f451f73e9a8f | lib/mix/lib/mix/tasks/iex.ex | lib/mix/lib/mix/tasks/iex.ex | defmodule Mix.Tasks.Iex do
use Mix.Task
@hidden true
def run(_) do
raise Mix.Error, message: "Cannot start IEx after the VM was booted. " <>
"To use IEx with Mix, please run: iex -S mix"
end
end
| defmodule Mix.Tasks.Iex do
use Mix.Task
@hidden true
@moduledoc false
def run(_) do
raise Mix.Error, message: "Cannot start IEx after the VM was booted. " <>
"To use IEx with Mix, please run: iex -S mix"
end
end
| Make IEx task with @moduledoc false | Make IEx task with @moduledoc false
| Elixir | apache-2.0 | antipax/elixir,gfvcastro/elixir,joshprice/elixir,antipax/elixir,ggcampinho/elixir,kimshrier/elixir,kelvinst/elixir,gfvcastro/elixir,lexmag/elixir,kimshrier/elixir,lexmag/elixir,beedub/elixir,pedrosnk/elixir,pedrosnk/elixir,michalmuskala/elixir,ggcampinho/elixir,kelvinst/elixir,elixir-lang/elixir,beedub/elixir |
e448136a14f5ee126150f4bafff3420fb4554dbb | worker/lib/geo_transformer.ex | worker/lib/geo_transformer.ex | defmodule GeoTransformer do
def from(changes, epsg) do
{:ok, crs} = Proj.from_epsg(epsg)
for change <- changes do transform_change change, crs end
end
defp transform_change(change = %{doc: %{resource: %{"geometry" => %{} = geometry}}}, crs) do
put_in(change.doc.resource["geometry"]["coordinates"], ... | defmodule GeoTransformer do
def from(changes, epsg) do
{:ok, crs} = Proj.from_epsg(epsg)
for change <- changes do transform_change change, crs end
end
defp transform_change(change = %{doc: %{resource: %{"geometry" => %{} = geometry}}}, crs) do
put_in(change.doc.resource["geometry"]["coordinates"], ... | Return lng/lat instead of lat/lng in GeoTransformer | Return lng/lat instead of lat/lng in GeoTransformer
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
fd74d73e3d718d2b786e5280abb601efe89a1496 | api/lib/api/router.ex | api/lib/api/router.ex | defmodule Api.Router do
use Plug.Router
plug :match
plug(Plug.Parsers,
parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
)
plug :dispatch
forward("/resources", to: Api.Resources.Router)
match _ do
send_resp(conn, 404, "Requested page not found!")
end
def child_... | defmodule Api.Router do
use Plug.Router
plug :match
plug(Plug.Parsers,
parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
)
plug :dispatch
forward("/resources", to: Api.Resources.Router)
match _ do
send_resp(conn, 404, "Requested page not found!")
end
def child_... | Use Plug.Cowboy instead of Plug.Adapters.Cowboy2 | Use Plug.Cowboy instead of Plug.Adapters.Cowboy2
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
b443e87707f3a769009e6853adb92a8f441ce207 | lib/koans/20_comprehensions.ex | lib/koans/20_comprehensions.ex | defmodule Comprehensions do
use Koans
@intro "A comprehension is made of three parts: generators, filters, and collectibles. We will look at how these interact with eachother"
koan "The generator, `n <- [1, 2, 3, 4]`, is providing the values for our comprehension" do
assert (for n <- [1, 2, 3, 4], do:... | defmodule Comprehensions do
use Koans
@intro "A comprehension is made of three parts: generators, filters, and collectibles. We will look at how these interact with eachother"
koan "The generator, `n <- [1, 2, 3, 4]`, is providing the values for our comprehension" do
assert (for n <- [1, 2, 3, 4], do: n * n... | Remove Windows-style carriage returns from line endings | Remove Windows-style carriage returns from line endings
| Elixir | mit | elixirkoans/elixir-koans |
b24f887c56d19878ea05e88a07538337c3a8bd1d | lib/credo/service/ets_table_helper.ex | lib/credo/service/ets_table_helper.ex | defmodule Credo.Service.ETSTableHelper do
@moduledoc false
defmacro __using__(_opts \\ []) do
quote do
use GenServer
alias Credo.Service.ETSTableHelper
@table_name __MODULE__
def start_link(opts \\ []) do
{:ok, _pid} = GenServer.start_link(__MODULE__, opts, name: __MODULE__)
... | defmodule Credo.Service.ETSTableHelper do
@moduledoc false
defmacro __using__(_opts \\ []) do
quote do
use GenServer
alias Credo.Service.ETSTableHelper
@table_name __MODULE__
def start_link(opts \\ []) do
{:ok, _pid} = GenServer.start_link(__MODULE__, opts, name: __MODULE__)
... | Stop serializing reads from ETS services through a GenServer | Stop serializing reads from ETS services through a GenServer
| Elixir | mit | rrrene/credo,rrrene/credo |
a5cc0b37900ee4a51e832e48e54009869ca03464 | lib/action_for_children/web/plugs/auth.ex | lib/action_for_children/web/plugs/auth.ex | defmodule ActionForChildrenWeb.Plugs.Auth do
import Plug.Conn
alias ActionForChildren.Accounts
alias ActionForChildren.User
def init(opts) do
opts
end
def call(%{assigns: %{user: %User{}}} = conn, _opts), do: conn
def call(conn, _opts) do
uuid = get_session(conn, :uuid)
if user = uuid && A... | defmodule ActionForChildrenWeb.Plugs.Auth do
import Plug.Conn
alias ActionForChildren.Accounts
alias ActionForChildren.User
def init(opts) do
opts
end
def call(%{assigns: %{user: %User{}}} = conn, _opts), do: conn
def call(conn, _opts) do
uuid = get_session(conn, :uuid)
if user = uuid && A... | Delete uuid when logging out but keep version in session | Delete uuid when logging out but keep version in session
| Elixir | bsd-3-clause | cast-fuse/action-for-children,cast-fuse/action-for-children |
f39fb4d2f88c812cadba55dd0381539133a103cc | web/routers/application_router.ex | web/routers/application_router.ex | defmodule ApplicationRouter do
use Dynamo.Router
prepare do
# Pick which parts of the request you want to fetch
# You can comment the line below if you don't need
# any of them or move them to a forwarded router
conn.fetch([:cookies, :session, :headers, :params, :body]).assign(:layout, "application... | defmodule ApplicationRouter do
use Dynamo.Router
prepare do
# Pick which parts of the request you want to fetch
# You can comment the line below if you don't need
# any of them or move them to a forwarded router
conn.fetch([:cookies, :session, :headers, :params, :body]).assign(:layout, "application... | Enable forwarding to sessions router | Enable forwarding to sessions router
| Elixir | mit | louishawkins/mogo-chat,louishawkins/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,di-stars/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,HashNuke/mogo-chat,louishawkins/mogo-chat,di-stars/mogo-chat,sashafklein/bloc-mogo,sashafklein/bloc-mogo |
595451b5a3c32d570431d96c23f6e87535d99a44 | web/views/page_view.ex | web/views/page_view.ex | defmodule SlackCoder.PageView do
use SlackCoder.Web, :view
def status_class(:success), do: :success
def status_class(:failed), do: :danger
def status_class(:pending), do: :warning
end
| defmodule SlackCoder.PageView do
use SlackCoder.Web, :view
def status_class(:success), do: :success
def status_class(:failed), do: :danger
def status_class(:pending), do: :warning
def status_class(_), do: :default
end
| Add default status for unknown status classes... | Add default status for unknown status classes...
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
4d97462c177a609720163a6da2c4a69b277a86f5 | lib/shaker/router.ex | lib/shaker/router.ex | defmodule Shaker.Router do
use Plug.Builder
plug Plug.RequestId
plug Plug.Parsers, parsers: [:urlencoded, :json], json_decoder: Poison
use Trot.Router
require Logger
get "/", do: Shaker.salt_call("/")
post "/:tgt/:fun" do
{user, pass} = conn.req_headers |> Enum.into(%{}) |> Shaker.auth_info(conn.pa... | defmodule Shaker.Router do
use Plug.Builder
plug Plug.RequestId
plug Plug.Parsers, parsers: [:urlencoded, :json], json_decoder: Poison
use Trot.Router
require Logger
get "/", do: Shaker.salt_call("/")
post "/:tgt/:fun" do
{user, pass} = conn.req_headers |> Enum.into(%{}) |> Shaker.auth_info(conn.pa... | Convert tuple into dict for JSON conversion. | Convert tuple into dict for JSON conversion.
| Elixir | mit | hexedpackets/shaker |
2f905158bc55e666f4f4dbbcc662c7bec167ff42 | lib/tilex/cache.ex | lib/tilex/cache.ex | defmodule Tilex.Cache do
def cache(key, value_block) do
Cachex.get(:tilex_cache, key)
|> process_cache(key, value_block)
end
defp process_cache({:ok, value}, _,_), do: value
defp process_cache({:missing, _}, key, value_block) do
value = value_block.()
Cachex.set!(:tilex_cache, key, value)
... | defmodule Tilex.Cache do
def cache(key, value_block) do
Cachex.get(:tilex_cache, key)
|> process_cache(key, value_block)
end
defp process_cache({:ok, value}, _, _), do: value
defp process_cache({:missing, _}, key, value_block) do
value = value_block.()
Cachex.set!(:tilex_cache, key, value)
... | Add comma; a credo readability concern | Add comma; a credo readability concern
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
b820aa122c50358e707738b2d6900fda83593247 | lib/phoenix/template/eex_engine.ex | lib/phoenix/template/eex_engine.ex | defmodule Phoenix.Template.EExEngine do
@moduledoc """
The Phoenix engine that handles the `.eex` extension.
"""
@behaviour Phoenix.Template.Engine
def compile(path, name) do
EEx.compile_file(path, engine: engine_for(name), line: 1)
end
defp engine_for(name) do
case Phoenix.Template.format_enco... | defmodule Phoenix.Template.EExEngine do
@moduledoc """
The Phoenix engine that handles the `.eex` extension.
"""
@behaviour Phoenix.Template.Engine
def compile(path, name) do
EEx.compile_file(path, engine: engine_for(name), line: 1, trim: true)
end
defp engine_for(name) do
case Phoenix.Template... | Trim whitespace on EEx engines when Elixir >= 1.1 | Trim whitespace on EEx engines when Elixir >= 1.1 | Elixir | mit | Smulligan85/phoenix,Rumel/phoenix,y-yagi/phoenix,Smulligan85/phoenix,dmarkow/phoenix,rodrigues/phoenix,foxnewsnetwork/phoenix,iStefo/phoenix,lancehalvorsen/phoenix,omotenko/phoenix_auth,stevedomin/phoenix,keathley/phoenix,eksperimental/phoenix,0x00evil/phoenix,Kosmas/phoenix,jwarwick/phoenix,brucify/phoenix,michalmuska... |
8346d3d8881e4ab07f17c64acf80d18135f82c56 | web/models/team_from_auth.ex | web/models/team_from_auth.ex | defmodule EspiDni.TeamFromAuth do
@moduledoc """
Create or retreive the team from an auth request
"""
import Ecto.Query
alias Ueberauth.Auth
alias EspiDni.Repo
alias EspiDni.Team
def find_or_create(%Auth{} = auth) do
result = auth.credentials
|> team_params
|> create_or_update
end
de... | defmodule EspiDni.TeamFromAuth do
@moduledoc """
Create or retreive the team from an auth request
"""
import Ecto.Query
alias Ueberauth.Auth
alias EspiDni.Repo
alias EspiDni.Team
def find_or_create(%Auth{} = auth) do
auth
|> team_params
|> create_or_update
end
defp team_params(auth) ... | Use bot auth_token not users | Use bot auth_token not users
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni |
e81396f99a1d2af2b1ae40d94d96c6cc44bdbb75 | config/test.exs | config/test.exs | use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :chess, ChessWeb.Endpoint,
http: [port: 4001],
server: true
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :chess, Chess.Repo,
ada... | use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :chess, ChessWeb.Endpoint,
http: [port: 4001],
server: true
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :chess, Chess.Repo,
ada... | Allow switching PG port with env variable | Allow switching PG port with env variable
| Elixir | mit | danbee/chess,danbee/chess,danbee/chess |
9d4d959473d3eefcef9324e3546e7eb19c201df7 | lib/credo/cli.ex | lib/credo/cli.ex | defmodule Credo.CLI do
@moduledoc """
`Credo.CLI` is the entrypoint for both the Mix task and the escript.
It takes the parameters passed from the command line and translates them into
a Command module (see the `Credo.CLI.Command` namespace), the work directory
where the Command should run and a `Credo.Execu... | defmodule Credo.CLI do
@moduledoc """
`Credo.CLI` is the entrypoint for both the Mix task and the escript.
It takes the parameters passed from the command line and translates them into
a Command module (see the `Credo.CLI.Command` namespace), the work directory
where the Command should run and a `Credo.Execu... | Add default argument to Credo.CLI.main/1 | Add default argument to Credo.CLI.main/1
| Elixir | mit | rrrene/credo,rrrene/credo |
0f16f26cc87aabd32d6330668c80614bd9c4318c | priv/repo/seeds.exs | priv/repo/seeds.exs | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Asciinema.Repo.insert!(%Asciinema.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they w... | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Asciinema.Repo.insert!(%Asciinema.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they w... | Migrate Users to Accounts for db setup task | Migrate Users to Accounts for db setup task
The change in c25820677e2f1c216da309f919f38fc51780d96e (Renaming Users module to Accounts) broke the setup task when creating the database. | Elixir | apache-2.0 | asciinema/asciinema.org,asciinema/asciinema-server,asciinema/asciinema-server,asciinema/asciinema.org,asciinema/asciinema.org,asciinema/asciinema-server,asciinema/asciinema-server,asciinema/asciinema.org |
9fa37e172dfd2ecbcbdfa46a0b0c786afd7b9bf1 | web/models/leap_year.ex | web/models/leap_year.ex | defmodule LeapYear do
import Guardsafe, only: [divisible_by?: 2]
def leap_year?(year) when divisible_by?(year, 400), do: true
def leap_year?(year) when divisible_by?(year, 100), do: false
def leap_year?(year), do: divisible_by?(year, 400)
end
| defmodule LeapYear do
import Guardsafe, only: [divisible_by?: 2]
def leap_year?(year) when divisible_by?(year, 400), do: true
def leap_year?(year) when divisible_by?(year, 100), do: false
def leap_year?(year), do: divisible_by?(year, 4)
end
| Fix leap year calculation bug. | Fix leap year calculation bug.
| Elixir | mit | DevL/yearly |
12cd1bf6c3e997390cf3ce752384a87771d4fefa | lib/tilex/cache.ex | lib/tilex/cache.ex | defmodule Tilex.Cache do
def cache(key, value_block) do
:tilex_cache
|> Cachex.get(key)
|> process_cache(key, value_block)
end
defp process_cache({:ok, value}, _, _), do: value
defp process_cache({:missing, _}, key, value_block) do
value = value_block.()
Cachex.set!(:tilex_cache, key, valu... | defmodule Tilex.Cache do
def cache(key, value_block) do
:tilex_cache
|> Cachex.get(key)
|> process_cache(key, value_block)
end
defp process_cache({:ok, nil}, key, value_block) do
value = value_block.()
Cachex.put!(:tilex_cache, key, value)
value
end
defp process_cache({:ok, value}, _... | Update Cachex code for 3.1.3 | Update Cachex code for 3.1.3
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
983db49c002d9d59fdb3df76b224b7fad496200a | lib/meditate.ex | lib/meditate.ex | defmodule Mix.Tasks.Meditate do
use Mix.Task
alias Options
def run(args) do
Application.ensure_all_started(:elixir_koans)
Code.compiler_options(ignore_module_conflict: true)
{:ok, watcher} = Watcher.start
Process.monitor(watcher)
Options.start(args)
Options.initial_koan
|> ok?
|... | defmodule Mix.Tasks.Meditate do
use Mix.Task
alias Options
@shortdoc "Start the koans"
def run(args) do
Application.ensure_all_started(:elixir_koans)
Code.compiler_options(ignore_module_conflict: true)
{:ok, watcher} = Watcher.start
Process.monitor(watcher)
Options.start(args)
Option... | Add shortdoc to display task in mix list | Add shortdoc to display task in mix list
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans |
72f8601231866db45b7db73247d402fbfef40176 | lib/slack_coder/github.ex | lib/slack_coder/github.ex | defmodule SlackCoder.Github do
require Logger
alias SlackCoder.Github.EventProcessor
def client do
Tentacat.Client.new(%{
user: Application.get_env(:slack_coder, :github)[:user],
password: Application.get_env(:slack_coder, :github)[:pat]
})
end
@events ~w(commit_comment create delete dep... | defmodule SlackCoder.Github do
require Logger
alias SlackCoder.Github.EventProcessor
def client do
Tentacat.Client.new(%{
user: Application.get_env(:slack_coder, :github)[:user],
password: Application.get_env(:slack_coder, :github)[:pat]
})
end
@events ~w(commit_comment create delete dep... | Make back into string to Enum.member works correctly. | Make back into string to Enum.member works correctly.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
0d97336a42ebd04f56af965815ecfcb68e5aa3df | apps/rpc/mix.exs | apps/rpc/mix.exs | defmodule Mercator.RPC.Mixfile do
use Mix.Project
def project do
[app: :rpc,
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 == :prod,
sta... | defmodule Mercator.RPC.Mixfile do
use Mix.Project
def project do
[app: :rpc,
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 == :prod,
sta... | Add bitcoin_tool_ex to RPC applications | Add bitcoin_tool_ex to RPC applications
| Elixir | lgpl-2.1 | hrobeers/mercator,hrobeers/mercator,hrobeers/mercator |
58e49ef2644255258eca151770ffeff272cd38c6 | config/dispatcher.ex | config/dispatcher.ex | defmodule Dispatcher do
use Plug.Router
def start(_argv) do
port = 80
IO.puts "Starting Plug with Cowboy on port #{port}"
Plug.Adapters.Cowboy.http __MODULE__, [], port: port
:timer.sleep(:infinity)
end
plug Plug.Logger
plug :match
plug :dispatch
get "/hello" do
send_resp( conn, 200... | defmodule Dispatcher do
use Plug.Router
def start(_argv) do
port = 80
IO.puts "Starting Plug with Cowboy on port #{port}"
Plug.Adapters.Cowboy.http __MODULE__, [], port: port
:timer.sleep(:infinity)
end
plug Plug.Logger
plug :match
plug :dispatch
get "/hello" do
send_resp( conn, 200... | Add trailing slash to dispatched routes | Add trailing slash to dispatched routes
| Elixir | mit | nvdk/abb-musemtech-workshop,mu-semtech/mu-project,langens-jonathan/ReactiveMailServiceExample,langens-jonathan/ReactiveMailServiceExample |
125aa848e0425bbc113dfa8467680567f60f95f4 | 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
# Configures the endpoint
config :matrix, Matrix.Endpoint,
url: [host: "localhost"]... | # 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
# Configures the endpoint
config :matrix, Matrix.Endpoint,
url: [host: "localhost"]... | Set agents directory from env variable | Set agents directory from env variable
| Elixir | mit | nemanja-m/matrix,nemanja-m/matrix |
f305073c80d825b975feae59e3c1eccdd522b8c2 | api/lib/api/auth/bearer.ex | api/lib/api/auth/bearer.ex | defmodule Api.Auth.Bearer do
alias Core.Config
alias Api.Auth.Rights
alias Api.Auth.Guardian
@anonymous "anonymous"
def get_user_for_bearer(nil), do: anonymous_user()
def get_user_for_bearer(bearer) do
token = String.replace bearer, "Bearer ", ""
case Guardian.resource_from_token(token) do
{... | defmodule Api.Auth.Bearer do
alias Core.Config
alias Api.Auth.Rights
alias Api.Auth.Guardian
@anonymous "anonymous"
def get_user_for_bearer(nil) do
anonymous_user()
|> update_readable_projects
end
def get_user_for_bearer(bearer) do
token = String.replace bearer, "Bearer ", ""
case Guardi... | Set all projects as readable for non-anonymous admin users | Set all projects as readable for non-anonymous admin users
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.