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 |
|---|---|---|---|---|---|---|---|---|---|
c3214ecea11b34d34f284b289f3d43e6df2a356b | config/test.exs | config/test.exs | use Mix.Config
config :blog, Blog.Endpoint,
http: [port: System.get_env("PORT") || 4001]
| use Mix.Config
config :blog, Blog.Endpoint,
http: [port: System.get_env("PORT") || 4001]
config :logger,
level: :error
| Change the log level to error | Change the log level to error
| Elixir | mit | marcioj/elixir_blog |
6682e5b07cd9e136233783c4fc79ecfe36188719 | 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 :participate_api, ParticipateApi.Endpoint,
http: [port: 4001],
server: false
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :partici... | use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :participate_api, ParticipateApi.Endpoint,
http: [port: 4001],
server: false
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :partici... | Increase db ownership timeout so we have more time to poke around with IEx.pry | Increase db ownership timeout so we have more time to poke around with IEx.pry
| Elixir | mit | oliverbarnes/participate-api,oliverbarnes/participate-new-api,participateapp/api |
fd164c59cd075c0a3c44f325b637bc6e95c91c27 | lib/marc_cx/endpoint.ex | lib/marc_cx/endpoint.ex | defmodule MarcCx.Endpoint do
use Phoenix.Endpoint, otp_app: :marc_cx
# 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 in production.
plug Plug.Static,
at: "/", from: :marc_cx, gzip: false,
... | defmodule MarcCx.Endpoint do
use Phoenix.Endpoint, otp_app: :marc_cx
# 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 in production.
plug Plug.Static,
at: "/", from: :marc_cx, gzip: Mix.env... | Use gzip in production on static files | Use gzip in production on static files
| Elixir | mit | marcaddeo/marc.cx,marcaddeo/marc.cx,marcaddeo/marc.cx |
75a16ee3b55c88d787d7201d5dc695cb0197390a | lib/mogo_chat/config.ex | lib/mogo_chat/config.ex | # Production
defmodule MogoChat.Config do
use Phoenix.Config.App
config :router, port: 4000
config :plugs, code_reload: false
end
# Development
defmodule MogoChat.Config.Dev do
use MogoChat.Config
config :router, port: System.get_env("PORT") || 4000
config :plugs, code_reload: true
config :logger, leve... | # Production
defmodule MogoChat.Config do
use Phoenix.Config.App
config :router, port: 4000
config :plugs, code_reload: false
end
# Development
defmodule MogoChat.Config.Dev do
use MogoChat.Config
config :router, port: System.get_env("PORT") || "4000"
config :plugs, code_reload: true
config :logger, le... | Use port env var if available | Use port env var if available
| Elixir | mit | louishawkins/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,sashafklein/bloc-mogo,louishawkins/mogo-chat,louishawkins/mogo-chat,sashafklein/bloc-mogo,HashNuke/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,di-stars/mogo-chat,di-stars/mogo-chat |
33c24dc214a4d779d9811d3cfb858254c686e4dc | lib/bottler/helpers/gce.ex | lib/bottler/helpers/gce.ex | defmodule Bottler.Helpers.GCE do
@moduledoc """
Interface helpers with GCE `gcloud` executable
"""
def instances(config) do
"gcloud compute instances list"
|> exec(config)
|> String.replace("PREEMPTIBLE", "") # why that extra column?
|> String.replace(~r/[ ]+/, " ")
|> String.split("\n"... | defmodule Bottler.Helpers.GCE do
@moduledoc """
Interface helpers with GCE `gcloud` executable
"""
def instances(config) do
"gcloud compute instances list"
|> exec(config)
|> String.replace("PREEMPTIBLE", "") # why that extra column?
|> String.replace(~r/[ ]+/, " ")
|> String.split("\n"... | Fix GCE fetch only running servers | Fix GCE fetch only running servers
| Elixir | mit | rubencaro/bottler |
983b90bda91b4cc38623949b2fc04e32b386d3d4 | lib/instagram_link/endpoint.ex | lib/instagram_link/endpoint.ex | defmodule InstagramLink.Endpoint do
use Phoenix.Endpoint, otp_app: :instagram_link
socket "/socket", InstagramLink.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 in production.
... | defmodule InstagramLink.Endpoint do
use Phoenix.Endpoint, otp_app: :instagram_link
socket "/socket", InstagramLink.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 in production.
... | Set session cookie length to 1 year | Set session cookie length to 1 year
| Elixir | mit | keichan34/hello_link,keichan34/hello_link |
a1ec2c52784669177b7864d0cecdbb77a300f3d1 | lib/credo/execution/task/require_requires.ex | lib/credo/execution/task/require_requires.ex | defmodule Credo.Execution.Task.RequireRequires do
use Credo.Execution.Task
alias Credo.Sources
def call(%Execution{requires: requires} = exec) do
requires
|> Sources.find
|> Enum.each(&Code.require_file/1)
exec
end
end
| defmodule Credo.Execution.Task.RequireRequires do
use Credo.Execution.Task
alias Credo.Sources
def call(%Execution{requires: requires} = exec, _opts) do
requires
|> Sources.find
|> Enum.each(&Code.require_file/1)
exec
end
end
| Fix loading of custom checks | Fix loading of custom checks
This fixes the loading of the RequireRequires task.
Without the 2nd param, the task is not executed and loading of custom checks fails. | Elixir | mit | rrrene/credo,rrrene/credo |
72d6347ff9d46fc173bbbc464a803ff4c89b47be | lib/ex_twilio/resources/conference.ex | lib/ex_twilio/resources/conference.ex | defmodule ExTwilio.Conference do
@moduledoc """
Represents an Conference resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/conference)
"""
defstruct sid: nil,
friendly_name: nil,
status: nil,
date_created: nil,
date_updated: nil,... | defmodule ExTwilio.Conference do
@moduledoc """
Represents an Conference resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/api/conference-resource)
"""
defstruct sid: nil,
friendly_name: nil,
status: nil,
date_created: nil,
date_upd... | Update redirect link to Conference API | Update redirect link to Conference API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
442eaab12bb06c89d17c27c2be1f1c7365ed38df | web/views/shared_view.ex | web/views/shared_view.ex | defmodule VerkWeb.SharedView do
use VerkWeb.Web, :view
def enqueued_at(nil), do: "N/A"
def enqueued_at(timestamp) do
timestamp |> Timex.from_seconds |> Timex.format!("{ISO}")
end
end
| defmodule VerkWeb.SharedView do
use VerkWeb.Web, :view
def enqueued_at(nil), do: "N/A"
def enqueued_at(timestamp) do
timestamp |> Timex.DateTime.from_seconds |> Timex.format!("{ISO}")
end
end
| Fix SharedView with proper Timex function | Fix SharedView with proper Timex function
| Elixir | mit | edgurgel/verk_web,edgurgel/verk_web |
b302daf29bc503f81de395fedd355a22d01cb3dd | lib/eex/engine.ex | lib/eex/engine.ex | defmodule EEx.Engine do
@moduledoc """
This is the basic EEx engine that ships with Elixir.
An engine needs to implement two functions:
* `handle_text(buffer, text)` - it receives the buffer,
the text and must return a new quoted expression;
* `handle_expr(buffer, marker, expr)` - it receives the buffer... | defmodule EEx.Engine do
@moduledoc """
This is the basic EEx engine that ships with Elixir.
An engine needs to implement two functions:
* `handle_text(buffer, text)` - it receives the buffer,
the text and must return a new quoted expression;
* `handle_expr(buffer, marker, expr)` - it receives the buffer... | Add behavior info to EEx.Engine | Add behavior info to EEx.Engine
| Elixir | apache-2.0 | kelvinst/elixir,elixir-lang/elixir,beedub/elixir,gfvcastro/elixir,lexmag/elixir,kimshrier/elixir,antipax/elixir,kelvinst/elixir,ggcampinho/elixir,joshprice/elixir,gfvcastro/elixir,pedrosnk/elixir,lexmag/elixir,antipax/elixir,kimshrier/elixir,michalmuskala/elixir,beedub/elixir,ggcampinho/elixir,pedrosnk/elixir |
7050fca643a75238088162cb0e6d92e3b1f285f9 | 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.Executi... | 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.Executi... | Halt Credo in CLI.main/1 instead of MainProcess | Halt Credo in CLI.main/1 instead of MainProcess
| Elixir | mit | rrrene/credo,rrrene/credo |
d4c6b34c3f76ba6dad66c50655dc2d8759ad0df2 | test/views/layout_view_test.exs | test/views/layout_view_test.exs | defmodule RemoteRetro.LayoutViewTest do
use RemoteRetroWeb.ConnCase, async: false
alias RemoteRetroWeb.LayoutView
test "app_js is served by the webpack dev server (at port 5001) in dev" do
Application.put_env(:remote_retro, :env, :dev)
conn = get build_conn(), "/"
assert LayoutView.app_js(conn... | defmodule RemoteRetro.LayoutViewTest do
use RemoteRetroWeb.ConnCase, async: false
alias RemoteRetroWeb.LayoutView
test "app_js is served by the webpack dev server (at port 5001) in dev" do
Application.put_env(:remote_retro, :env, :dev)
conn = get build_conn(), "/"
assert LayoutView.app_js(conn) =~ "l... | Fix line endings in layout view | Fix line endings in layout view
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
8847e048ca31d69de4ea5db2889fb4583bec8f3c | lib/slack_coder.ex | lib/slack_coder.ex | defmodule SlackCoder 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 = [
# Start the Ecto repository
worker(SlackCoder.Repo, []),
# S... | defmodule SlackCoder 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 = [
# Start the Ecto repository
worker(SlackCoder.Repo, []),
# S... | Allow not starting up github. | Allow not starting up github.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
8efecebc4a9e56a7422ebf6610f00728829b1a5b | lib/chess/moves.ex | lib/chess/moves.ex | defmodule Chess.Moves do
@moduledoc false
alias Chess.Moves.Pawn
alias Chess.Moves.Rook
def available(board, {file, rank}) do
piece = board["#{file},#{rank}"]
case piece do
%{"type" => "pawn"} ->
Pawn.moves(board, {file, rank})
%{"type" => "rook"} ->
Rook.moves(board, {fil... | defmodule Chess.Moves do
@moduledoc false
alias Chess.Moves.Pawn
alias Chess.Moves.Rook
def available(board, {file, rank}) do
piece = board["#{file},#{rank}"]
case piece do
%{"type" => "pawn"} ->
Pawn.moves(board, {file, rank})
%{"type" => "rook"} ->
Rook.moves(board, {fil... | Stop all other pieces causing an error | Stop all other pieces causing an error
| Elixir | mit | danbee/chess,danbee/chess,danbee/chess |
995feddc00f48bd5bed9e6884494c36acf3b2f1a | nerves.exs | nerves.exs | use Mix.Config
version =
Path.join(__DIR__, "VERSION")
|> File.read!
|> String.strip
config :nerves_system_nanopi_neo, :nerves_env,
type: :system,
version: version,
compiler: :nerves_package,
artifact_url: ["https://github.com/dhanson358/nerves_system_nanopi_neo/releases/download/v0.0.16/nerves_system_n... | use Mix.Config
version =
Path.join(__DIR__, "VERSION")
|> File.read!
|> String.strip
config :nerves_system_nanopi_neo, :nerves_env,
type: :system,
version: version,
compiler: :nerves_package,
artifact_url: ["https://github.com/dhanson358/nerves_system_nanopi_neo/releases/download/v0.0.17/nerves_system_n... | Update build version w/ new system_br | Update build version w/ new system_br
| Elixir | apache-2.0 | troygnichols/nerves_system_nanopi_neo,dhanson358/nerves_system_nanopi_neo |
3db1eb08b520a627447c741a455151b0d067a803 | mix.exs | mix.exs | compile_peg_task = "tasks/compile.peg.exs"
if File.exists?(compile_peg_task) do
Code.eval_file "tasks/compile.peg.exs"
end
defmodule Conform.Mixfile do
use Mix.Project
def project do
[app: :conform,
version: "0.10.1",
elixir: "~> 0.15.1",
escript: [main_module: Conform],
compilers: [:peg... | compile_peg_task = "tasks/compile.peg.exs"
if File.exists?(compile_peg_task) do
Code.eval_file "tasks/compile.peg.exs"
end
defmodule Conform.Mixfile do
use Mix.Project
def project do
[app: :conform,
version: "0.10.1",
elixir: "~> 0.15.1",
escript: [main_module: Conform],
compilers: [:peg... | Add compile task to hex package | Add compile task to hex package
| Elixir | mit | bitwalker/conform |
f4777a6d8af58d4452d0073bb224c2eb3e70b0aa | lib/ex_twilio/resources/application.ex | lib/ex_twilio/resources/application.ex | defmodule ExTwilio.Application do
@moduledoc """
Represents an Application resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/applications)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
friendly_name: nil,
account_... | defmodule ExTwilio.Application do
@moduledoc """
Represents an Application resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/usage/api/applications)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
friendly_name: nil,
account... | Update redirect to Application API | Update redirect to Application API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
0d576a2065a2e407713191f9ad655de9a33d13ac | web/views/project_view.ex | web/views/project_view.ex | defmodule Aelita2.ProjectView do
use Aelita2.Web, :view
def stringify_state(state) do
case state do
0 -> "Waiting"
1 -> "Running"
end
end
end
| defmodule Aelita2.ProjectView do
use Aelita2.Web, :view
def stringify_state(state) do
case state do
0 -> "Waiting to run"
1 -> "Running"
end
end
end
| Use a more descriptive string | Use a more descriptive string
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
dca181096720f723f65dcd09ee0c801947e346b0 | 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() :: Queens.t()
@spec new({integer, integer}, {integer, integer}) :: Queens.t()
def new(white, black) do
end
@doc """
G... | 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... | Remove invalid spec from queen-attack | Remove invalid spec from queen-attack
Because of this invalid spec, the solution boilerplate wouldn't even
compile due to:
```
** (CompileError) queen_attack.exs:8: spec for undefined function new/0
```
| Elixir | mit | exercism/xelixir |
2a0b52c0b1036bc403243eba270600e059ec1ea2 | api/lib/api/auth/bearer.ex | api/lib/api/auth/bearer.ex | defmodule Api.Auth.Bearer do
alias Api.Auth.Rights
alias Api.Auth.Guardian
def get_user_for_bearer(nil), do: Rights.empty()
def get_user_for_bearer(bearer) do
token = String.replace bearer, "Bearer ", ""
{:ok, user, _} = Guardian.resource_from_token(token)
# TODO handle error
user
end
end | defmodule Api.Auth.Bearer do
alias Api.Auth.Rights
alias Api.Auth.Guardian
def get_user_for_bearer(nil), do: Rights.empty()
def get_user_for_bearer(bearer) do
token = String.replace bearer, "Bearer ", ""
case Guardian.resource_from_token(token) do
{:ok, user, _} -> user
_ -> Rights.empty() ... | Handle unauthorized access when token wrong | Handle unauthorized access when token wrong
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
3692608daa14fcba64c43f0447f867266cc27b17 | lib/choicest_web/controllers/comparison_controller.ex | lib/choicest_web/controllers/comparison_controller.ex | defmodule ChoicestWeb.ComparisonController do
use ChoicestWeb, :controller
alias Choicest.Contestants
alias Choicest.Contestants.Comparison
action_fallback ChoicestWeb.FallbackController
def results(conn, %{"image_id" => image_id}) do
comparisons = Contestants.list_image_comparisons!(image_id)
rend... | defmodule ChoicestWeb.ComparisonController do
use ChoicestWeb, :controller
alias Choicest.Contestants
alias Choicest.Contestants.Comparison
action_fallback ChoicestWeb.FallbackController
def results(conn, %{"image_id" => image_id}) do
comparisons = Contestants.list_image_comparisons!(image_id)
rend... | Add location header to comparison creation | Add location header to comparison creation
| Elixir | mit | Cadiac/choicest,Cadiac/choicest,Cadiac/choicest |
d4e50c516e35c900a737b21deca23ee8ebae4156 | 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
end
| 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)
... | Add a create action for jobs | Add a create action for jobs
| Elixir | mit | smoynes/get_a_job_ex,smoynes/get_a_job_ex |
dca64e9e6ab9cb7deefd6efee5cc9237f8c35b75 | lib/erlef/admins/notifications.ex | lib/erlef/admins/notifications.ex | defmodule Erlef.Admins.Notifications do
@moduledoc false
import Swoosh.Email
@type notification_type() :: :new_email_request | :new_slack_invite
@type params() :: map()
@spec new(notification_type(), params()) :: Swoosh.Email.t()
def new(:new_email_request, _) do
msg = """
A new email request wa... | defmodule Erlef.Admins.Notifications do
@moduledoc false
import Swoosh.Email
@type notification_type() :: :new_email_request | :new_slack_invite
@type params() :: map()
@spec new(notification_type(), params()) :: Swoosh.Email.t()
def new(:new_email_request, _) do
msg = """
A new email request wa... | Send slack invites for erlef to its own alias | Send slack invites for erlef to its own alias
| Elixir | apache-2.0 | simplabs/website,simplabs/website |
d87eba0ea2ccf771a2605351d8b0650abf0193ba | lib/credo/check/readability/double_boolean_negation.ex | lib/credo/check/readability/double_boolean_negation.ex | defmodule Credo.Check.Readability.DoubleBooleanNegation do
@moduledoc """
Having double negations in your code reduces readability.
# Double boolean negation:
!!var
# or:
not not var
Using `!!` will be inconsistent for some values like `nil`.
Try to be more explicit for handling boole... | defmodule Credo.Check.Readability.DoubleBooleanNegation do
@moduledoc """
Having double negations in your code reduces readability.
# Double boolean negation:
!!var
# or:
not not var
Using `!!` will be inconsistent for some values like `nil`.
Try to be more explicit for handling boole... | Fix indentation on new check | Fix indentation on new check
| Elixir | mit | rrrene/credo,rrrene/credo |
74c3ed0cfbfe917b6c386211fc64ff4925fdc036 | lib/mix/test/mix/tasks/clean_test.exs | lib/mix/test/mix/tasks/clean_test.exs | Code.require_file "../../test_helper.exs", __DIR__
defmodule Mix.Tasks.CleanTest do
use MixTest.Case
test "compile a project without mixfile" do
in_fixture "no_mixfile", fn ->
Mix.Tasks.Compile.run []
assert File.regular?("ebin/Elixir.A.beam")
Mix.Tasks.Clean.run []
refute File.regular... | Code.require_file "../../test_helper.exs", __DIR__
defmodule Mix.Tasks.CleanTest do
use MixTest.Case
defmodule DepsApp do
def project do
[
app: :sample,
version: "0.1.0",
deps: [
{ :tidy, "0.1.0", path: "elixir-lang/tidy" }
]
]
end
end
test "compi... | Test mix clean with the --all flag. | Test mix clean with the --all flag.
| Elixir | apache-2.0 | beedub/elixir,kimshrier/elixir,pedrosnk/elixir,gfvcastro/elixir,antipax/elixir,gfvcastro/elixir,kelvinst/elixir,joshprice/elixir,antipax/elixir,lexmag/elixir,ggcampinho/elixir,elixir-lang/elixir,beedub/elixir,kelvinst/elixir,pedrosnk/elixir,ggcampinho/elixir,michalmuskala/elixir,kimshrier/elixir,lexmag/elixir |
c88ce29476099a19c3176aa599e8741e624106fe | mix.exs | mix.exs | defmodule Matrix.Mixfile do
use Mix.Project
def project do
[app: :matrix,
version: "0.0.1",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: de... | defmodule Matrix.Mixfile do
use Mix.Project
def project do
[
app: :matrix,
version: "0.0.1",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
... | Use BDD like syntax for ExUnit | Use BDD like syntax for ExUnit
| Elixir | mit | nemanja-m/matrix,nemanja-m/matrix |
f9e7ab47e0a0b7b0a74387f1901a5eaf24859b29 | 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, 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... | Use set number of bins on SNP density route | Use set number of bins on SNP density route
| Elixir | agpl-3.0 | genenetwork/gn_server,chfi/gn_server |
b8e14f69f96fcd72890cec6cb60c4cde61a0816f | test/tesla/middleware/decode_rels_test.exs | test/tesla/middleware/decode_rels_test.exs | defmodule Tesla.Middleware.DecodeRelsTest do
use ExUnit.Case
defmodule Client do
use Tesla
plug Tesla.Middleware.DecodeRels
adapter fn env ->
{:ok,
case env.url do
"/rels" ->
Tesla.put_headers(env, [
{"link", ~s(<https://api.github.com/resource?page=2>; r... | defmodule Tesla.Middleware.DecodeRelsTest do
use ExUnit.Case
defmodule Client do
use Tesla
plug Tesla.Middleware.DecodeRels
adapter fn env ->
{:ok,
case env.url do
"/rels-with-no-quotes" ->
Tesla.put_headers(env, [
{"link", ~s(<https://api.github.com/reso... | Add test example of unquoted rel. | Add test example of unquoted rel.
| Elixir | mit | monterail/tesla,teamon/tesla |
02d5e4b274a9283dda88978ff9fbf393456cdb0c | web/controllers/term_controller.ex | web/controllers/term_controller.ex | defmodule CoursePlanner.TermController do
use CoursePlanner.Web, :controller
alias CoursePlanner.Terms
def new(conn, _params) do
render(conn, "new.html", changeset: Terms.new)
end
def create(conn, %{"term" => term_params}) do
case Terms.create_term(term_params) do
{:ok, _term} ->
conn... | defmodule CoursePlanner.TermController do
use CoursePlanner.Web, :controller
alias CoursePlanner.Terms
def new(conn, _params) do
render(conn, "new.html", changeset: Terms.new)
end
def create(conn, %{"term" => term_params}) do
case Terms.create_term(term_params) do
{:ok, _term} ->
conn... | Rename variable to express it is not used | Rename variable to express it is not used
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
3ad6f84c3cbc463f032937bd2b7bfe6783037f71 | installer/templates/phx_ecto/data_case.ex | installer/templates/phx_ecto/data_case.ex | defmodule <%= app_module %>.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
Finally, if the test case interacts with the database,
it cannot be async. For this reason, ... | defmodule <%= app_module %>.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
Finally, if the test case interacts with the database,
it cannot be async. For this reason, ... | Fix errors_on when using array field changeset | Fix errors_on when using array field changeset
## Overview
`errors_on/1` raises an error when it receives a changeset with an array
field which was `cast`-ed with an invalid type.
## Details
When validating the type of an array field fails, `cast/4` it will put an error on the changeset, such as:
```elixir
[my_list_f... | Elixir | mit | jwarwick/phoenix,rafbgarcia/phoenix,michalmuskala/phoenix,Gazler/phoenix,nshafer/phoenix,0x00evil/phoenix,nshafer/phoenix,keathley/phoenix,eksperimental/phoenix,0x00evil/phoenix,phoenixframework/phoenix,nshafer/phoenix,jwarwick/phoenix,keathley/phoenix,phoenixframework/phoenix,rafbgarcia/phoenix,optikfluffel/phoenix,0x... |
2a58a080889f676a9fa2d37ea679c29d549be9be | lib/captcha.ex | lib/captcha.ex | defmodule AdventOfCode2017.Captcha do
@doc ~S"""
The captcha requires you to review a sequence of digits (your puzzle input) and
find the sum of all digits that match the next digit in the list. The list is circular,
so the digit after the last digit is the first digit in the list.
## Examples
iex> Ad... | defmodule AdventOfCode2017.Captcha do
@doc ~S"""
The captcha requires you to review a sequence of digits (your puzzle input) and
find the sum of all digits that match the next digit in the list. The list is circular,
so the digit after the last digit is the first digit in the list.
## Examples
iex> Ad... | Add spec for edge cases | Add spec for edge cases
| Elixir | mit | thbar/elixir-playground |
bd31787be782b38cd3a8d0fda623affd69915624 | mix.exs | mix.exs | defmodule PublicGoods.Mixfile do
use Mix.Project
def project do
[app: :xee_public_goods,
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 == :pr... | defmodule PublicGoods.Mixfile do
use Mix.Project
def project do
[app: :xee_public_goods,
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 == :pr... | Use the fixed version of json_diff_ex | Use the fixed version of json_diff_ex
| Elixir | mit | xeejp/xee_public_goods |
35fec81d57e890a7aa095493a1f16f95f19c5aa7 | backend/web/views/v1/ingredient_class_view.ex | backend/web/views/v1/ingredient_class_view.ex | defmodule MealprepBackend.V1.IngredientClassView do
use MealprepBackend.Web, :view
def render("index.json", %{ingredientclasses: ingredientclasses}) do
render_many(ingredientclasses, MealprepBackend.V1.IngredientClassView, "ingredient_class.json")
end
def render("show.json", %{ingredient_class: ingredient... | defmodule MealprepBackend.V1.IngredientClassView do
use MealprepBackend.Web, :view
def render("index.json", %{ingredientclasses: ingredientclasses}) do
render_many(ingredientclasses, MealprepBackend.V1.IngredientClassView, "ingredient_class.json")
end
def render("show.json", %{ingredient_class: ingredient... | Rename ingredient class parent id property | Rename ingredient class parent id property
| Elixir | apache-2.0 | ilkka/mealprep,ilkka/mealprep,ilkka/mealprep |
3a2ede15843e4c1cef8d4d06499ed61598e0312c | mix.exs | mix.exs | defmodule Hound.Mixfile do
use Mix.Project
def project do
[ app: :hound,
version: "0.7.0",
elixir: ">= 1.0.2",
description: description,
deps: deps(Mix.env),
package: package,
docs: [readme: true, main: "README.md"]
]
end
def application do
[
applications... | defmodule Hound.Mixfile do
use Mix.Project
def project do
[ app: :hound,
version: "0.7.0",
elixir: ">= 1.0.4",
description: description,
deps: deps(Mix.env),
package: package,
docs: [readme: true, main: "README.md"]
]
end
def application do
[
applications... | Update minimum elixir version to 1.0.4 | Update minimum elixir version to 1.0.4
| Elixir | mit | jontonsoup/hound,jontonsoup/hound,esbullington/hound,esbullington/hound,HashNuke/hound,oivoodoo/hound,lowks/hound,lowks/hound,HashNuke/hound,oivoodoo/hound |
f3a5ac15202fd7c144978b9d70dfd3c26722b2a4 | mix.exs | mix.exs | defmodule WebDriver.Mixfile do
use Mix.Project
def project do
[ app: :webdriver,
version: "0.5.0",
source_url: "https://github.com/stuart/elixir-webdriver",
homepage_url: "http://stuart.github.io/elixir-webdriver",
deps: deps(Mix.env)
]
end
# Configuration for the OTP applicati... | defmodule WebDriver.Mixfile do
use Mix.Project
def project do
[ app: :webdriver,
version: "0.5.0",
source_url: "https://github.com/stuart/elixir-webdriver",
homepage_url: "http://stuart.github.io/elixir-webdriver",
package: package,
deps: deps(Mix.env)
]
end
# Configurati... | Add package info for hex.pm | Add package info for hex.pm
| Elixir | mit | stuart/elixir-webdriver,fazibear/elixir-webdriver,stuart/elixir-webdriver,fazibear/elixir-webdriver |
d8747cb3e447e2f0f5886d2e5540f4c7a1aba885 | test/recs_test.exs | test/recs_test.exs | defmodule RecsTest do
use ExUnit.Case, async: true
setup do
{:ok, conn} = Recs.start_link(host: "localhost", port: 6379)
{:ok, %{conn: conn}}
end
test "command/2", %{conn: c} do
assert Recs.command(c, ["SET", "foo", "1"]) == "OK"
assert Recs.command(c, ["GET", "foo"]) == "1"
end
test "pip... | defmodule RecsTest do
use ExUnit.Case, async: true
setup context do
if context[:no_setup] do
{:ok, %{}}
else
{:ok, conn} = Recs.start_link
{:ok, %{conn: conn}}
end
end
@tag :no_setup
test "start_link/1: returns a pid" do
assert {:ok, pid} = Recs.start_link
assert is_pid... | Add a test for Recs.start_link/1 | Add a test for Recs.start_link/1
| Elixir | mit | whatyouhide/redix |
6866d0d38035819e47a921aa5ade14d0bc8303cc | web/controllers/issue_controller.ex | web/controllers/issue_controller.ex | defmodule Slax.IssueController do
use Slax.Web, :controller
plug Slax.Plugs.VerifySlackToken, :issue
plug Slax.Plugs.VerifyUser
def start(conn, %{"text" => ""}) do
text conn, """
*Issue commands:*
/issue <org/repo> <issue title> [issue body preceded by a newline]
"""
end
def start(conn, %... | defmodule Slax.IssueController do
use Slax.Web, :controller
plug Slax.Plugs.VerifySlackToken, :issue
plug Slax.Plugs.VerifyUser
def start(conn, %{"text" => ""}) do
text conn, """
*Issue commands:*
/issue <org/repo> <issue title> [issue body preceded by a newline]
"""
end
def start(conn, %... | Support multiple lines of text when creating an issue | Support multiple lines of text when creating an issue
| Elixir | mit | revelrylabs/slax,revelrylabs/slax,revelrylabs/slax |
6b22c4fcfdd3561a88c82f25cd5adaf57692af9e | web/database.py.ex | web/database.py.ex |
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='root',
password='secret',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.... |
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='openqua',
password='xxxxxxxxxxxxxxx',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor... | Add database class for web | Add database class for web
| Elixir | bsd-3-clause | openqua/openqua |
abed12d37022012133da51b4acbbf07bd61dab32 | mix.exs | mix.exs | defmodule Benchfella.Mixfile do
use Mix.Project
def project do
[
app: :benchfella,
version: "0.3.3",
elixir: "~> 1.0",
description: description,
package: package,
]
end
def application do
[applications: []]
end
defp description do
"Microbenchmarking tool for ... | defmodule Benchfella.Mixfile do
use Mix.Project
def project do
[
app: :benchfella,
version: "0.3.3",
elixir: "~> 1.0",
description: description(),
package: package(),
deps: deps(),
]
end
def application do
[applications: []]
end
defp description do
"Mic... | Add ex_doc to please Hex | Add ex_doc to please Hex
| Elixir | mit | alco/benchfella,alco/benchfella |
5dc29d84533464504dbfaa8430394144906e0212 | web/controllers/annotation_tag_controller.ex | web/controllers/annotation_tag_controller.ex | defmodule Core.AnnotationTagController do
use Core.Web, :controller
alias Core.AnnotationTag
plug Guardian.Plug.EnsureAuthenticated, %{handler: Core.Auth}
def create(conn, params) do
changeset = AnnotationTag.changeset(%AnnotationTag{}, params)
case Repo.insert(changeset) do
{:ok, _annotation_t... | defmodule Core.AnnotationTagController do
use Core.Web, :controller
alias Core.AnnotationTag
alias Core.Annotation
plug :find
plug Core.Auth, %{key: :annotation, type: "annotations"}
def create(conn, params) do
changeset = AnnotationTag.changeset(%AnnotationTag{}, params)
case Repo.insert(changes... | Add Core.Auth plug to Core.AnnotationTagController | Add Core.Auth plug to Core.AnnotationTagController
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
60f58bac80d80ef723a2d3b579a0ccb8647da414 | mix.exs | mix.exs | defmodule Scheme.Mixfile do
use Mix.Project
def project do
[app: :lighthouse,
version: "0.2.0",
elixir: "~> 1.1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
escript: escript_config,
deps: deps]
end
# Configuration for the OTP application
#
# Ty... | defmodule Scheme.Mixfile do
use Mix.Project
def project do
[app: :lighthouse,
version: "0.2.0",
elixir: "~> 1.3.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
escript: escript_config,
deps: deps]
end
# Configuration for the OTP application
#
# Ty... | Upgrade supported Elixir to 1.3.3 | Upgrade supported Elixir to 1.3.3
| Elixir | mit | jwhiteman/lighthouse-scheme |
2bff4f75affdcb51c16aa5ef2ac616905cee21b3 | .iex.exs | .iex.exs | import_file_if_available("~/.iex.exs")
alias Tilex.{
Channel,
Developer,
Post,
Repo,
}
| import_file_if_available("~/.iex.exs")
alias Tilex.{
Channel,
Developer,
Liking,
Post,
Repo,
}
| Add an alias to IEx session | Add an alias to IEx session
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
c782af029d1322f78244ea8d55f15653ad88c677 | test/uart_test.exs | test/uart_test.exs | defmodule UARTTest do
use ExUnit.Case
alias Nerves.UART
# Define the following environment variables for your environment:
#
# NERVES_UART_PORT1 - e.g., COM1 or ttyS0
# NERVES_UART_PORT2
#
# The unit tests expect those ports to exist, be different ports,
# and be connected to each other through a... | defmodule UARTTest do
use ExUnit.Case
alias Nerves.UART
# Define the following environment variables for your environment:
#
# NERVES_UART_PORT1 - e.g., COM1 or ttyS0
# NERVES_UART_PORT2
#
# The unit tests expect those ports to exist, be different ports,
# and be connected to each other through a... | Improve help message when env not set for tests | Improve help message when env not set for tests
| Elixir | apache-2.0 | nerves-project/nerves_uart |
857ac7309c7a192dca6c935e0b30e7c4832b446d | web/workers/token_refresh_worker.ex | web/workers/token_refresh_worker.ex | defmodule EspiDni.TokenRefreshWorker do
require Logger
@fourty_five_minutes 2_700
def perform(team_id) do
Logger.info "Runing refresh job for team: #{team_id}"
team = EspiDni.Repo.get(EspiDni.Team, team_id)
EspiDni.TokenManager.refresh_token!(team)
EspiDni.TokenRefreshWorker.queue_job(team)
e... | defmodule EspiDni.TokenRefreshWorker do
require Logger
@fourty_five_minutes 2_700
def perform(team_id) do
Logger.info "Runing refresh job for team: #{team_id}"
team = EspiDni.Repo.get(EspiDni.Team, team_id)
EspiDni.TokenManager.refresh_token!(team)
EspiDni.TokenRefreshWorker.queue_job(team)
e... | Use correct module name in worker queue_job method | Use correct module name in worker queue_job method
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni |
ca46afbd199d3e1d5d210b337f75a5094409ef98 | test/funnel/percolator_test.exs | test/funnel/percolator_test.exs | defmodule Funnel.PercolatorTest do
use Funnel.TestCase, async: true
test "percolator is alive" do
percolator = case Funnel.Percolator.start_link do
{:error, {:already_started, percolator}} ->
percolator
{:ok, percolator} ->
percolator
end
end
end
| defmodule Funnel.PercolatorTest do
use Funnel.TestCase, async: true
test "percolator is alive" do
percolator = case Funnel.Percolator.start_link do
{:error, {:already_started, percolator}} ->
percolator
{:ok, percolator} ->
percolator
end
assert Process.alive?(percolator)
... | Remove removing of assert in test | [Doh] Remove removing of assert in test
>_<
Signed-off-by: chatgris <f9469d12bf3d131e7aae80be27ccfe58aa9db1f1@af83.com>
| Elixir | mit | chatgris/funnel |
51343c8a8881915d288fdd0e155b21872001ae17 | lib/ex_twilio/resources/lookup.ex | lib/ex_twilio/resources/lookup.ex | defmodule ExTwilio.Lookup do
@moduledoc """
Represents the Lookup Api provided by Twilio
- [Twilio docs](https://www.twilio.com/docs/api/lookups)
"""
alias ExTwilio.{Parser, Config}
alias ExTwilio.UrlGenerator, as: Url
@base_url "https://lookups.twilio.com/v1/PhoneNumbers/"
defmodule PhoneNumber ... | defmodule ExTwilio.Lookup do
@moduledoc """
Represents the Lookup Api provided by Twilio
- [Twilio docs](https://www.twilio.com/docs/lookup/api)
"""
alias ExTwilio.{Parser, Config}
alias ExTwilio.UrlGenerator, as: Url
@base_url "https://lookups.twilio.com/v1/PhoneNumbers/"
defmodule PhoneNumber d... | Update link to Lookup API | Update link to Lookup API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
f23525fd3bb34cefb55ccf8854be99cd0f0e7be1 | lib/nerves_mdnsd.ex | lib/nerves_mdnsd.ex | defmodule NervesMdnsd do
@moduledoc """
Start the mdns daemon as a port process
"""
@doc """
"""
def start do
# Start mdnsd supervisor
end
def start_link do
# TODO: open a port, start mdnsd -debug
end
end
| defmodule Nerves.Mdnsd do
@moduledoc """
Start the mdns daemon as a port process.
"""
@doc """
"""
def start do
# Start mdnsd supervisor
end
def start_link do
# TODO: open a port, start mdnsd -debug
end
def start_daemon do
Port.open({:spawn_executable, :code.priv_dir(:nerves_mdnsd) ++... | Add code to start the daemon | Add code to start the daemon
| Elixir | apache-2.0 | amolenaar/nerves_dnssd |
4290226240d30f8170c35fc8d7a58f69788f95f9 | worker/lib/indexer.ex | worker/lib/indexer.ex | defmodule Indexer do
def index(documents) do
IO.inspect documents
end
end | defmodule Indexer do
def index(documents) when is_list(documents) do
for document <- documents, do: index document
end
def index(document) do
IO.inspect document
end
end | Prepare indexing each element individually | Prepare indexing each element individually
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
2316731cdecea78835fa3a64e4cdea315864f62d | lib/ex_twilio/resources/sip_domain.ex | lib/ex_twilio/resources/sip_domain.ex | defmodule ExTwilio.SipDomain do
@moduledoc """
Represents a SIP Domain resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/domain)
"""
defstruct sid: nil,
friendly_name: nil,
account_sid: nil,
api_version: nil,
domain_name: nil,
... | defmodule ExTwilio.SipDomain do
@moduledoc """
Represents a SIP Domain resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/sip/api/sip-domain-resource)
"""
defstruct sid: nil,
friendly_name: nil,
account_sid: nil,
api_version: nil,
do... | Update redirect to SipDomain API | Update redirect to SipDomain API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
0538f20456415f4522f45e4ef235d0e83f79bf9f | lib/wobserver/web/router/static.ex | lib/wobserver/web/router/static.ex | defmodule Wobserver.Web.Router.Static do
@moduledoc ~S"""
Static router mostly for the browsers interface.
Returns the following resources:
- `/`, for the main html page.
- `/main.css`, for main css stylesheet.
- `/app.js`, for the Javascript code.
- `/license`, for the *MIT* license information.... | defmodule Wobserver.Web.Router.Static do
@moduledoc ~S"""
Static router mostly for the browsers interface.
Returns the following resources:
- `/`, for the main html page.
- `/main.css`, for main css stylesheet.
- `/app.js`, for the Javascript code.
- `/license`, for the *MIT* license information.... | Update Static router to use baked in assets. | Update Static router to use baked in assets. | Elixir | mit | shinyscorpion/wobserver,shinyscorpion/wobserver |
1fd0a5c84bf1f1ce767cebfabab9e66b35a05fb1 | test/support/appsignal/wrapped_nif.ex | test/support/appsignal/wrapped_nif.ex | defmodule Appsignal.WrappedNif do
import ExUnit.Assertions
alias Appsignal.Nif
def start_link do
{:ok, pid} =
Agent.start_link(fn -> %{create_root_span: [], close_span: []} end, name: __MODULE__)
ExUnit.Callbacks.on_exit(fn ->
ref = Process.monitor(pid)
assert_receive {:DOWN, ^ref, _, ... | defmodule Appsignal.WrappedNif do
import ExUnit.Assertions
alias Appsignal.Nif
def start_link do
{:ok, pid} = Agent.start_link(fn -> %{} end, name: __MODULE__)
ExUnit.Callbacks.on_exit(fn ->
ref = Process.monitor(pid)
assert_receive {:DOWN, ^ref, _, _, _}, 500
end)
{:ok, pid}
end
... | Remove unneeded default lists in WrappedNif | Remove unneeded default lists in WrappedNif
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir |
cb141db07a3b2318f8ccb959378d3c19c62c39d7 | lib/tesla/middleware/bearer_auth.ex | lib/tesla/middleware/bearer_auth.ex | defmodule Tesla.Middleware.BearerAuth do
@moduledoc """
Bearer authentication middleware.
Adds a `{"authorization", "Bearer <token>"}` header.
## Examples
```
defmodule MyClient do
use Tesla
# static configuration
plug Tesla.Middleware.BearerAuth, token: "token"
# dynamic token
def ... | defmodule Tesla.Middleware.BearerAuth do
@moduledoc """
Bearer authentication middleware.
Adds a `{"authorization", "Bearer <token>"}` header.
## Examples
```
defmodule MyClient do
use Tesla
# static configuration
plug Tesla.Middleware.BearerAuth, token: "token"
# dynamic token
def ... | Fix typo in BearerAuth docs | Fix typo in BearerAuth docs
| Elixir | mit | monterail/tesla,teamon/tesla |
9396487af4f30afe383c1e7c3a0d8871df576205 | lib/sinetris_blog/helpers/application.ex | lib/sinetris_blog/helpers/application.ex | defmodule SinetrisBlog.Helper.Application do
defmacro __using__(_options) do
quote do
import unquote(__MODULE__)
end
end
def current_user(conn) do
conn
|> Plug.Conn.fetch_session
|> Plug.Conn.get_session(:username)
|> SinetrisBlog.User.get
end
def authorize(conn) do
if curr... | defmodule SinetrisBlog.Helper.Application do
defmacro __using__(_options) do
quote do
import unquote(__MODULE__)
end
end
def current_user(conn) do
conn
|> Plug.Conn.fetch_session
|> Plug.Conn.get_session(:username)
|> SinetrisBlog.User.get
end
def authorize(conn) do
if curr... | Use atoms instead of int for status code | Use atoms instead of int for status code
| Elixir | mit | sinetris/sinetris-blog,sinetris/sinetris-blog,sinetris/sinetris-blog |
8c0c314e78b40f4d5d19bc6755b09e4fa8cb3974 | 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... | Replace deprecated call to Code.load_file/1 | Replace deprecated call to Code.load_file/1
This function was replaced by Code.compile_file/1 and is deprecated with
planned removal in 1.9.
See: https://github.com/elixir-lang/elixir/pull/7201
| Elixir | mit | samstarling/elixir-koans,elixirkoans/elixir-koans |
ec082f0e72dd43a28528605128d786649944bf88 | test/koans/map_sets_koans_test.exs | test/koans/map_sets_koans_test.exs | defmodule MapSetsTest do
use ExUnit.Case
import TestHarness
test "MapSets" do
answers = [
1,
3,
:ok,
true,
{:multiple, [true, false]},
true,
false,
5,
false,
true,
7,
[1, 2, 3, 4, 5],
]
test_all(MapSets, answers)
end
end
| defmodule MapSetsTest do
use ExUnit.Case
import TestHarness
test "MapSets" do
answers = [
1,
3,
{:multiple, [false, true]},
true,
{:multiple, [true, false]},
true,
false,
5,
false,
true,
7,
[1, 2, 3, 4, 5],
]
test_all(MapSets, a... | Fix broken mapset koan test | Fix broken mapset koan test
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans |
d67cc7108d8dac7bab73797e77843651865c9611 | farmbot_core/priv/config/migrations/20190705203806_add_firmware_needs_open_flag.exs | farmbot_core/priv/config/migrations/20190705203806_add_firmware_needs_open_flag.exs | defmodule FarmbotCore.Config.Repo.Migrations.AddFirmwareNeedsOpenFlag do
use Ecto.Migration
import FarmbotCore.Config, only: [update_config_value: 4]
import FarmbotCore.Config.MigrationHelpers
def change do
update_config_value(:bool, "settings", "firmware_needs_flash", true)
create_settings_config("fir... | defmodule FarmbotCore.Config.Repo.Migrations.AddFirmwareNeedsOpenFlag do
use Ecto.Migration
import FarmbotCore.Config.MigrationHelpers
def change do
create_settings_config("firmware_needs_open", :bool, false)
end
end
| Remove ref to unused col in migration. | Remove ref to unused col in migration.
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
83dd0f4b46cfcd74abb7e9875d51c0f3e7be0158 | lib/ontag_core_web/controllers/me_controller.ex | lib/ontag_core_web/controllers/me_controller.ex | defmodule OntagCoreWeb.MeController do
use OntagCoreWeb, :controller
plug OntagCoreWeb.Authentication when action in [:index, :add_medium_credential]
action_fallback OntagCoreWeb.FallbackController
def index(conn, _) do
user =
conn.assigns[:current_user]
conn
|> put_status(:ok)
|> json(... | defmodule OntagCoreWeb.MeController do
use OntagCoreWeb, :controller
alias OntagCore.Repo
alias OntagCore.Accounts.MediumCredential
plug OntagCoreWeb.Authentication when action in [:index, :add_medium_credential]
action_fallback OntagCoreWeb.FallbackController
def index(conn, _) do
user =
conn.a... | Add medium_credential in the returned object in /me | Add medium_credential in the returned object in /me
| Elixir | mit | CommonActionForum/ontag_core,CommonActionForum/ontag_core |
3b9812f76e2d0eb888d98566c551e98cfba89465 | test/atom_style_tweaks_web/models/user_test.exs | test/atom_style_tweaks_web/models/user_test.exs | defmodule AtomStyleTweaks.UserTest do
use AtomStyleTweaks.ModelCase
alias AtomStyleTweaksWeb.User
@valid_attrs %{name: "an-admin-user", github_id: 12_345, site_admin: true, avatar_url: "https://example.com"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}... | defmodule AtomStyleTweaks.UserTest do
use AtomStyleTweaks.ModelCase
alias AtomStyleTweaksWeb.User
@valid_attrs %{name: "an-admin-user", github_id: 12_345, site_admin: true, avatar_url: "https://example.com/"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{... | Update old tests for validate_url change | Update old tests for validate_url change
(Even though they're going to be ripped out when this is all done)
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
3edcd9dca28636160e6a7c94d77edbd14426a6d5 | config/prod.secret.exs | config/prod.secret.exs | use Mix.Config
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_key_base: System.get_env("SECRET_KEY_BASE")
config :aelita2, Aelita2.Repo,
adapter: Ecto.Ada... | use Mix.Config
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_key_base: System.get_env("SECRET_KEY_BASE")
config :aelita2, Aelita2.Repo,
adapter: Ecto.Ada... | Fix another Github typo; it's spelled GitHub | Fix another Github typo; it's spelled GitHub
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
35fd8271a7c09ed649f96106d56f198cc80795b8 | farmbot_os/lib/mix/tasks.farmbot/nerves_hub.ex | farmbot_os/lib/mix/tasks.farmbot/nerves_hub.ex | defmodule Mix.Tasks.Farmbot.NervesHub do
use Mix.Task
alias NimbleCSV.RFC4180, as: CSV
alias Mix.NervesHubCLI.Shell
def run([org]) do
Application.ensure_all_started(:nerves_hub_cli)
auth = Shell.request_auth()
case NervesHubUserAPI.Device.list(org, "farmbot", auth) do
{:ok, %{"data" => data... | defmodule Mix.Tasks.Farmbot.NervesHub do
use Mix.Task
alias NimbleCSV.RFC4180, as: CSV
alias Mix.NervesHubCLI.Shell
def run([org]) do
Application.ensure_all_started(:nerves_hub_cli)
auth = Shell.request_auth()
case NervesHubUserAPI.Device.list(org, "farmbot", auth) do
{:ok, %{"data" => data... | Update NervesHub device task to include healthy status | Update NervesHub device task to include healthy status
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
2a74f477fcac6ecf3ab7dc51e7a05326756df02b | lib/ex_unit/test/ex_unit/cli_formatter_test.exs | lib/ex_unit/test/ex_unit/cli_formatter_test.exs | Code.require_file "../../test_helper.exs", __FILE__
defmodule ExUnit.CLIFormatterTest do
use ExUnit.Case, sync: false
defp exec_test(file) do
System.cmd("#{elixir_path} #{file}")
end
defp elixir_path do
File.expand_path("../../../../../bin/elixir", __FILE__)
end
test :print_stacktrace_when_raisi... | Code.require_file "../../test_helper.exs", __FILE__
defmodule ExUnit.CLIFormatterTest do
use ExUnit.Case, sync: false
defp exec_test(file) do
System.cmd("#{elixir_path} #{file}")
end
defp elixir_path do
File.expand_path("../../../../../bin/elixir", __FILE__)
end
test :print_stacktrace_when_raisi... | Improve test to verify ExUnit.Runner is not in the stacktrace | Improve test to verify ExUnit.Runner is not in the stacktrace
| Elixir | apache-2.0 | gfvcastro/elixir,kelvinst/elixir,pedrosnk/elixir,pedrosnk/elixir,antipax/elixir,beedub/elixir,michalmuskala/elixir,lexmag/elixir,ggcampinho/elixir,ggcampinho/elixir,kimshrier/elixir,beedub/elixir,kelvinst/elixir,gfvcastro/elixir,elixir-lang/elixir,antipax/elixir,lexmag/elixir,joshprice/elixir,kimshrier/elixir |
9f0d079fc7df70c3dbef9c7f8330de78a7dc245a | lib/poxa/supervisor.ex | lib/poxa/supervisor.ex | defmodule Poxa.Supervisor do
use Supervisor
def start_link do
:supervisor.start_link({:local, __MODULE__}, __MODULE__, [])
end
def init([]) do
children = [worker(GenEvent, [[name: Poxa.Event]])]
supervise children, strategy: :one_for_one
end
end
| defmodule Poxa.Supervisor do
use Supervisor
@doc false
def start_link do
:supervisor.start_link({:local, __MODULE__}, __MODULE__, [])
end
@doc """
The supervisor will spawn a GenEvent named Poxa.Event
"""
def init([]) do
children = [worker(GenEvent, [[name: Poxa.Event]])]
supervise childre... | Add missing docs to Poxa.Supervisor | Add missing docs to Poxa.Supervisor
| Elixir | mit | waffleio/poxa,waffleio/poxa,edgurgel/poxa,RobertoSchneiders/poxa,joshk/poxa,edgurgel/poxa,edgurgel/poxa,RobertoSchneiders/poxa,joshk/poxa |
a466d82c4e5d067a6749a1f71703010d221f66f2 | lib/ircbot/evaluator.ex | lib/ircbot/evaluator.ex | defmodule Evaluator do
def eval(expr, opts \\ []) do
lang = Keyword.get(opts, :lang, "elixir")
version = Keyword.get(opts, :version)
hostname = System.get_env("BEAMIE_HOST")
port = System.get_env("BEAMIE_PORT")
if hostname != "" and port != "" do
url = 'http://#{hostname}:#{port}/eval/#{la... | defmodule Evaluator do
def eval(expr, opts \\ []) do
lang = Keyword.get(opts, :lang, "elixir")
version = Keyword.get(opts, :version)
hostname = System.get_env("BEAMIE_HOST")
port = System.get_env("BEAMIE_PORT")
if hostname != "" and port != "" do
url = 'http://#{hostname}:#{port}/eval/#{la... | Increase timeout to 3 seconds | Increase timeout to 3 seconds | Elixir | mit | alco/beamie_bot |
c27f8ff70b3776efdcb6d4a97f8efb2e8404c96a | lib/who/jobs.ex | lib/who/jobs.ex | defmodule Who.Jobs do
alias Who.Repo
alias Who.Member
alias Who.ProPublicaAPI.Chamber
def populate_members_table do
[%{"members" => senators}] = Chamber.get_members_by_chamber("senate")
[%{"members" => reps}] = Chamber.get_members_by_chamber("house")
members = senators ++ reps
for member <- m... | defmodule Who.Jobs do
alias Who.Repo
alias Who.Member
alias Who.ProPublicaAPI.Chamber
def update_members_table do
Repo.delete_all(Who.Member)
[%{"members" => senators}] = Chamber.get_members_by_chamber("senate")
[%{"members" => reps}] = Chamber.get_members_by_chamber("house")
members = senato... | Clear member table before updating records with API response | Clear member table before updating records with API response
| Elixir | mit | ryancharris/who,ryancharris/who |
f999d6c573136ded1ddc45854c3dfa430b0d22bd | test/koans/comprehensions_koans_test.exs | test/koans/comprehensions_koans_test.exs | defmodule ComprehensionsTests do
use ExUnit.Case
import TestHarness
test "Comprehensions" do
answers = [
[1, 4, 9, 16],
[1, 4, 9, 16],
["Hello World", "Apple Pie"],
["little dogs", "little cats", "big dogs", "big cats"],
[4, 5, 6],
["Apple Pie", "Pecan Pie", "Pu... | defmodule ComprehensionsTests do
use ExUnit.Case
import TestHarness
test "Comprehensions" do
answers = [
[1, 4, 9, 16],
[1, 4, 9, 16],
["Hello World", "Apple Pie"],
["little dogs", "little cats", "big dogs", "big cats"],
[4, 5, 6],
%{"Pecan" => "Pecan Pie", "Pum... | Update the comprehensions test to match the actual koan | Update the comprehensions test to match the actual koan
| Elixir | mit | elixirkoans/elixir-koans |
72f0e91b2cf8b3a81439081430f2c22889a0a572 | lib/tilex/integrations.ex | lib/tilex/integrations.ex | defmodule Tilex.Integrations do
@slack_notifier Application.get_env(:tilex, :slack_notifier)
@twitter_notifier Application.get_env(:tilex, :twitter_notifier)
def notify(conn, post = %Tilex.Post{}) do
developer = Tilex.Repo.one(Ecto.assoc(post, :developer))
channel = Tilex.Repo.one(Ecto.assoc(post, :chann... | defmodule Tilex.Integrations do
@slack_notifier Application.get_env(:tilex, :slack_notifier)
@twitter_notifier Application.get_env(:tilex, :twitter_notifier)
def notify(conn, post = %Tilex.Post{}) do
developer = Tilex.Repo.one(Ecto.assoc(post, :developer))
channel = Tilex.Repo.one(Ecto.assoc(post, :chann... | Move similarly named functions next to each other | Move similarly named functions next to each other
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
218dec87a3b1af49024a1b5e0a6f09278ff43fc1 | lib/operations.ex | lib/operations.ex | defmodule Operations do
def sum(a, b) do
a + b
end
def sub(a, b) do
a - b
end
def mult(a, b), do: a * b
def mult(0, b), do: 0
def mult(a, 0), do: 0
def div(0, b), do: 0
def div(a, 0) do
raise ArgumentError, message: "can't divide by zero"
end
def div(a, b), do: a / b
end
| defmodule Operations do
def sum(a, b) do
a + b
end
def sub(a, b) do
a - b
end
def mult(a, b) do
a * b
end
def div(0, b), do: 0
def div(a, 0) do
raise ArgumentError, message: "can't divide by zero"
end
def div(a, b), do: a / b
end
| Remove two unecessary function definition | Remove two unecessary function definition
| Elixir | mit | brunoskonrad/ci-tests-elixir,paulodiovani/ci-tests-elixir |
d5e24465e71a182dd449ac26f6585255540971b8 | lib/httparrot/retrieve_request_handler.ex | lib/httparrot/retrieve_request_handler.ex | defmodule HTTParrot.RetrieveRequestHandler do
@moduledoc """
Retreive saved request and clear the conresponding :id
"""
alias HTTParrot.GeneralRequestInfo
use HTTParrot.Cowboy, methods: ~w(GET POST PUT HEAD OPTIONS)
def content_types_provided(req, state) do
{[{{"application", "json", []}, :retrieve_sto... | defmodule HTTParrot.RetrieveRequestHandler do
@moduledoc """
Retreive saved request and clear the conresponding :id
"""
use HTTParrot.Cowboy, methods: ~w(GET POST PUT HEAD OPTIONS)
def content_types_provided(req, state) do
{[{{"application", "json", []}, :retrieve_stored}], req, state}
end
def retri... | Fix warning for unused alias for GeneralRequestInfo | Fix warning for unused alias for GeneralRequestInfo
| Elixir | mit | edgurgel/httparrot,edgurgel/httparrot |
410eb4ee14f6035db9eb16ae1b126d36660f8f85 | apps/webapp/web/controllers/doc_controller.ex | apps/webapp/web/controllers/doc_controller.ex | defmodule Webapp.DocController do
use Webapp.Web, :controller
@docs_path System.get_env("APP_HOME") <> "/docs"
def index(conn, _params) do
{:ok, list_of_docs_name} = File.ls(@docs_path)
list_of_docs = Enum.map(list_of_docs_name, fn(filename) ->
%{title: doc_title(filename), filename: "#{filename}"}... | defmodule Webapp.DocController do
use Webapp.Web, :controller
@docs_path System.get_env("APP_HOME") <> "/docs"
def index(conn, _params) do
{:ok, list_of_docs_name} = File.ls(@docs_path)
list_of_docs = Enum.map(list_of_docs_name, fn(filename) ->
%{title: doc_title(filename), filename: "#{filename}"}... | Set @app_name in DocController and leave a TODO to implement a plug to set it in Webapp.Router | Set @app_name in DocController and leave a TODO to implement a plug to set it in Webapp.Router
| Elixir | mit | iporaitech/pwr2-docker,iporaitech/pwr2-docker |
3269fcc0abfa3ec43dcdd0c0c9f724685beeaf94 | apps/baumeister/lib/baumeister.ex | apps/baumeister/lib/baumeister.ex | defmodule Baumeister do
alias Baumeister.BaumeisterFile
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
# Define workers and child supervisors to be supervised
... | defmodule Baumeister do
alias Baumeister.BaumeisterFile
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
# Define workers and child supervisors to be supervised
... | Remove the console event writer from the standard configuration, it is not required for tests. | Remove the console event writer from the standard configuration, it is not required for tests.
| Elixir | apache-2.0 | alfert/baumeister,alfert/baumeister,alfert/baumeister |
dc16f49849158733a98eedd88035f6a7c3c5926d | mix.exs | mix.exs | defmodule Bowser.MixProject do
use Mix.Project
def project do
[
app: :bowser,
version: "0.1.0",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_appli... | defmodule Bowser.MixProject do
use Mix.Project
def project do
[
app: :bowser,
version: "0.1.0",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_appli... | Switch back to master branch of nostrum | Switch back to master branch of nostrum
| Elixir | mit | kevinkjt2000/discord-minecraft-server-status |
cd34e2b2de4cb65df3151dcb4d3d2527e7e2af85 | time_tracker_backend/test/models/user_test.exs | time_tracker_backend/test/models/user_test.exs | defmodule TimeTrackerBackend.UserTest do
use TimeTrackerBackend.ModelCase
alias TimeTrackerBackend.{User, Repo}
@valid_attrs %{name: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "... | defmodule TimeTrackerBackend.UserTest do
use TimeTrackerBackend.ModelCase
alias TimeTrackerBackend.{User, Repo}
@valid_attrs %{name: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "... | Remove dumb non-test from phoenix app | Remove dumb non-test from phoenix app
| Elixir | mit | knewter/time-tracker,knewter/time-tracker |
59707144cbda51a3da63bcad97e57b2e8f1ba179 | apps/helix_account/lib/account/model/session.ex | apps/helix_account/lib/account/model/session.ex | defmodule Helix.Account.Model.SessionSerializer do
@behaviour Guardian.Serializer
alias Helix.Account.Model.Account
@opaque session :: String.t
# REVIEW: What is this expecting to receive exactly ? I'll make it temporarily
# just store the account's id
@spec for_token(Account.t) :: {:ok, session}
de... | defmodule Helix.Account.Model.SessionSerializer do
@behaviour Guardian.Serializer
alias Helix.Account.Model.Account
@opaque session :: String.t
# REVIEW: What is this expecting to receive exactly ? I'll make it temporarily
# just store the account's id
@spec for_token(Account.t) :: {:ok, session}
de... | Fix bad call on SessionSerializer.from_token | Fix bad call on SessionSerializer.from_token
| Elixir | agpl-3.0 | mememori/Helix,renatomassaro/Helix,HackerExperience/Helix,HackerExperience/Helix,renatomassaro/Helix |
49f4b5fd063d7d865788a5f3bf35a489c7e66ffa | lib/discount/markdown.ex | lib/discount/markdown.ex | defmodule Discount.Markdown do
@on_load { :init, 0 }
def init do
path = :filename.join(:code.priv_dir(:discount), 'markdown')
:ok = :erlang.load_nif(path, 1)
end
def nif_to_html(_) do
exit(:nif_library_not_loaded)
end
def parse_doc_list(documents) do
Enum.map documents, &(parse_doc(&1))
... | defmodule Discount.Markdown do
@on_load { :init, 0 }
def init do
path = :filename.join(:code.priv_dir(:discount), 'markdown')
:ok = :erlang.load_nif(path, 1)
end
def nif_to_html(_) do
exit(:nif_library_not_loaded)
end
def parse_doc_list(documents) do
documents
|> Enum.map(&Task.async... | Use tasks for document list parsing | Use tasks for document list parsing | Elixir | mit | asaaki/discount.ex,asaaki/discount.ex |
2068925b186433d74b1d3f496868a9fbed8385d5 | assignments/elixir/grains/grains_test.exs | assignments/elixir/grains/grains_test.exs | Code.load_file("grains.exs")
ExUnit.start
defmodule GrainsTest do
use ExUnit.Case
test "square 1" do
assert 1 == Grains.square(1)
end
test "square 2" do
assert 2 == Grains.square(2)
end
test "square 3" do
assert 4 == Grains.square(3)
end
test "square 4" do
assert 8 == Grains.square(... | Code.load_file("grains.exs")
ExUnit.start
# NOTE: :math.pow/2 doesn't do what you'd expect:
# `:math.pow(2, 64) == :math.pow(2, 64) - 1` is true.
#
# It's best to avoid functions operating on floating point numbers for very
# large numbers.
defmodule GrainsTest do
use ExUnit.Case
test "square 1" do
assert 1 ... | Add warning about :math.pow to elixir grains | Add warning about :math.pow to elixir grains
| Elixir | mit | tjcelaya/xelixir,henrik/xelixir,cezarykosko/xelixir,Egogre/xelixir,wobh/xelixir,victorlcampos/xelixir,parkerl/xelixir,elasticdog/xelixir,exercism/xelixir,montague/xelixir |
3cbfa4ab46ae1573e50ad643f93e64d2c6841006 | lib/worker/batcher/get_code_owners.ex | lib/worker/batcher/get_code_owners.ex | defmodule BorsNG.Worker.Batcher.GetCodeOwners do
@moduledoc """
Get the CODEOWNERS file from the repository
"""
alias BorsNG.GitHub
@type terror :: :fetch_failed | :parse_failed | :status | :timeout_sec
@spec get(GitHub.tconn(), binary) :: {:ok, BorsNG.CodeOwners.t()} | {:error, terror}
def get(repo_co... | defmodule BorsNG.Worker.Batcher.GetCodeOwners do
@moduledoc """
Get the CODEOWNERS file from the repository
"""
alias BorsNG.GitHub
@type terror :: :fetch_failed | :parse_failed | :status | :timeout_sec
@spec get(GitHub.tconn(), binary) :: {:ok, BorsNG.CodeOwners.t()} | {:error, terror}
def get(repo_co... | Support all of the CODEOWNERS locations documented by GitHub | Support all of the CODEOWNERS locations documented by GitHub
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
43af26529f98c06a3f67eb65c883e20a32cec646 | test/support/helpers.ex | test/support/helpers.ex | defmodule Helpers do
@moduledoc false
def call_compiled_function(module, func, args \\ []) when is_list(args) do
File.mkdir "tmp"
filename = Macro.underscore(inspect(module) <> "_" <> to_string(func))
path = Path.join("tmp", filename <> ".mjs")
ElixirScript.Compiler.compile(module, [output: path])... | defmodule Helpers do
@moduledoc false
def call_compiled_function(module, func, args \\ []) when is_list(args) do
File.mkdir "tmp"
filename = Macro.underscore(inspect(module) <> "_" <> to_string(func))
path = Path.join("tmp", filename <> ".mjs")
ElixirScript.Compiler.compile(module, [output: path])... | Remove IO.puts in node test runner helper | Remove IO.puts in node test runner helper
| Elixir | mit | elixirscript/elixirscript,bryanjos/elixirscript |
7b740230d3a40caf9ee6a1809a5cd2fa1d813fa7 | test/controllers/page_controller_test.exs | test/controllers/page_controller_test.exs | defmodule CoursePlanner.PageControllerTest do
use CoursePlanner.ConnCase
test "GET /", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
| defmodule CoursePlanner.PageControllerTest do
use CoursePlanner.ConnCase
alias CoursePlanner.User
setup do
user =
%User{
name: "Test User",
email: "testuser@example.com",
password: "secret",
password_confirmation: "secret"
}
conn =
Phoenix.ConnTest.buil... | Add user to the index page test | Add user to the index page test
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
58cc2eaa9cfbdb19c3bedcc9cb5d553b7c7b69be | lib/ex_unit/escaper.ex | lib/ex_unit/escaper.ex | defmodule ExUnit::Escaper do
defrecord Flag, as: nil
defimpl String::Inspect, for: Flag do
def inspect(record), do: record.as
def to_binary(record), do: record.as
end
# Replace _ by a record that when inspected prints "_"
def escape({ :_, _, false }) do
quote { unquote(Flag).new(as: "_") }
e... | # In some assertions we need to show a guard clause
# in the exception message. This usually works fine
# except if the clause has a "_", which means that
# we cannot show it because evaluating it would
# generate a "unbound _" error.
#
# For such cases, we can use `ExUnit::Escaper.escape`
# to escape the expression re... | Add some explanation for ExUnit::Escaper. | Add some explanation for ExUnit::Escaper.
| Elixir | apache-2.0 | lexmag/elixir,kelvinst/elixir,pedrosnk/elixir,beedub/elixir,joshprice/elixir,beedub/elixir,kimshrier/elixir,lexmag/elixir,ggcampinho/elixir,ggcampinho/elixir,antipax/elixir,kelvinst/elixir,gfvcastro/elixir,michalmuskala/elixir,kimshrier/elixir,gfvcastro/elixir,elixir-lang/elixir,pedrosnk/elixir,antipax/elixir |
086fc3599eadf5d32459b7850b379779b17e02e5 | test/models/user_test.exs | test/models/user_test.exs | defmodule Core.UserTest do
use Core.ModelCase
alias Core.User
@valid_attrs %{crypted_password: "some content", email: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "changeset with ... | defmodule Core.UserTest do
use Core.ModelCase
alias Core.User
@valid_attrs %{password: "some password", email: "aaa@aaa.aa"}
test "User creation with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "User creation with no attributes" do
... | Add some tests for User parameters | Add some tests for User parameters
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
ed6038db5c531105cc566db41dc54eae4e5f297a | lib/credo/check/refactor/cond_statements.ex | lib/credo/check/refactor/cond_statements.ex | defmodule Credo.Check.Refactor.CondStatements do
@moduledoc """
Each cond statement should have 3 or more statements including the
"always true" statement. Otherwise an `if` and `else` construct might be more
appropriate.
Example:
cond do
x == y -> 0
true -> 1
end
# should be writte... | defmodule Credo.Check.Refactor.CondStatements do
@moduledoc """
Each cond statement should have 3 or more statements including the
"always true" statement. Otherwise an `if` and `else` construct might be more
appropriate.
Example:
cond do
x == y -> 0
true -> 1
end
# should be writte... | Correct formatting to fix build | Correct formatting to fix build
| Elixir | mit | rrrene/credo,rrrene/credo |
90f57bbd77a58f226237d8e5a6af0f14b90d59ba | mix.exs | mix.exs | defmodule PrimeEx.Mixfile do
use Mix.Project
def project do
[app: :prime_ex,
version: "0.1.0",
elixir: "~> 1.4",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
compilers: [:rustler] ++ Mix.compilers(),
rustler_crates: rustler_crates(),
deps: deps()]
en... | defmodule PrimeEx.Mixfile do
use Mix.Project
def project do
[app: :prime_ex,
version: "0.1.0",
elixir: "~> 1.4",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
compilers: [:rustler] ++ Mix.compilers(),
rustler_crates: rustler_crates(),
deps: deps()]
en... | Fix typo in rustler_crates definition | Fix typo in rustler_crates definition
| Elixir | mit | ddresselhaus/primal_ex |
7ae2dae06803fdb235fa4bd067c50e40c0d65902 | mix.exs | mix.exs | defmodule Slime.Mixfile do
use Mix.Project
@version "0.10.0"
def project do
[app: :slime,
build_embedded: Mix.env == :prod,
deps: deps,
description: """
An Elixir library for rendering slim templates.
""",
elixir: "~> 1.0",
package: package,
source_url: "https://githu... | defmodule Slime.Mixfile do
use Mix.Project
@version "0.11.0"
def project do
[app: :slime,
build_embedded: Mix.env == :prod,
deps: deps,
description: """
An Elixir library for rendering slim templates.
""",
elixir: "~> 1.0",
package: package,
source_url: "https://githu... | Add Louis and bump version | Add Louis and bump version
| Elixir | mit | slime-lang/slime,Rakoth/slime |
3884618c550545f42b78320b401cc19dfc99f8be | lib/csv/defaults.ex | lib/csv/defaults.ex | defmodule CSV.Defaults do
@moduledoc ~S"""
The module defaults of CSV.
"""
defmacro __using__(_) do
quote do
@separator ?,
@newline ?\n
@carriage_return ?\r
@delimiter << @carriage_return :: utf8 >> <> << @newline :: utf8 >>
@double_quot... | defmodule CSV.Defaults do
@moduledoc ~S"""
The module defaults of CSV.
"""
defmacro __using__(_) do
quote do
@separator ?,
@newline ?\n
@carriage_return ?\r
@delimiter << @carriage_return :: utf8 >> <> << @newline :: utf8 >>
@double_quot... | Set force_quotes default to false. | Set force_quotes default to false.
| Elixir | mit | beatrichartz/csv,beatrichartz/csv |
f1495b88d9a168a16c4bb98a7fb8b381cb67bcce | lib/poxa/crypto_helper.ex | lib/poxa/crypto_helper.ex | defmodule Poxa.CryptoHelper do
@spec hmac256_to_string(binary, binary) :: binary
def hmac256_to_string(app_secret, to_sign) do
:hmac.hmac256(app_secret, to_sign)
|> :hmac.hexlify
|> :string.to_lower
|> String.from_char_list!
end
@spec md5_to_string(binary) :: binary
def md5_to_string(data) do... | defmodule Poxa.CryptoHelper do
@spec hmac256_to_string(binary, binary) :: binary
def hmac256_to_string(app_secret, to_sign) do
:hmac.hmac256(app_secret, to_sign)
|> :hmac.hexlify
|> :string.to_lower
|> String.from_char_list!
end
@spec md5_to_string(binary) :: binary
def md5_to_string(data) do... | Use crypto:hash instead of crypto:md5 | Use crypto:hash instead of crypto:md5
Warning on R16B02
| Elixir | mit | joshk/poxa,RobertoSchneiders/poxa,RobertoSchneiders/poxa,joshk/poxa,edgurgel/poxa,theinventor/rs-poxa,edgurgel/poxa,waffleio/poxa,edgurgel/poxa,waffleio/poxa |
4f5563a4cf768e6527b67cdfa5be871ea38ff1b3 | lib/ex_twilio/resources/recording.ex | lib/ex_twilio/resources/recording.ex | defmodule ExTwilio.Recording do
@moduledoc """
Represents an Recording resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/recordings)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
call_sid: nil,
... | defmodule ExTwilio.Recording do
@moduledoc """
Represents an Recording resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/api/recording)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
call_sid: nil,
... | Update redirect to Recording API | Update redirect to Recording API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
eee960ed8de42c295a15c6d170d54798d71996f3 | gherkin/elixir/mix.exs | gherkin/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/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber |
b54160e1320e83ceb85221771e02fca88e32995c | test/models/user_test.exs | test/models/user_test.exs | defmodule Xee.UserTest do
use Xee.ModelCase
alias Xee.User
@valid_attrs %{crypted_password: "some content", name: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "changeset with inva... | defmodule Xee.UserTest do
use Xee.ModelCase
alias Xee.User
setup do
Mix.Tasks.Ecto.Migrate.run(["--all", "Xee.Repo"]);
on_exit fn ->
Mix.Tasks.Ecto.Rollback.run(["--all", "Xee.Repo"])
end
end
@valid_attrs %{name: "valid_name", password: "valid_password"}
@valid_attrs2 %{name: "valid_na... | Fix test for user model. | Fix test for user model.
| Elixir | mit | xeejp/xee,xeejp/xee,xeejp/xee,xeejp/xee,xeejp/xee |
f8d1fff360ce0ac062df4e6ad93572b5e8b08347 | web/models/developer.ex | web/models/developer.ex | defmodule Tilex.Developer do
use Tilex.Web, :model
schema "developers" do
field :email, :string
field :username, :string
field :google_id, :string
field :twitter_handle, :string
field :admin, :boolean
field :editor, :string
has_many :posts, Tilex.Post
timestamps()
end
def cha... | defmodule Tilex.Developer do
use Tilex.Web, :model
schema "developers" do
field :email, :string
field :username, :string
field :google_id, :string
field :twitter_handle, :string
field :admin, :boolean
field :editor, :string
has_many :posts, Tilex.Post
timestamps()
end
def cha... | Remove editor from require validation | Remove editor from require validation
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
539b410938c3de847c93c06833d1e13e200c9ad8 | lib/hello.ex | lib/hello.ex | defmodule Hello do
defdelegate [
start_listener(uri),
start_listener(uri, trans_opts),
start_listener(uri, trans_opts, protocol, proto_opts, router_mod),
stop_listener(uri),
call_service(name, request),
call_service(name, identifier, request),
bind_handler(uri, callback_... | defmodule Hello do
defdelegate [
start_listener(uri),
start_listener(uri, trans_opts),
start_listener(uri, trans_opts, protocol, proto_opts, router_mod),
start_listener(name, uri, trans_opts, protocol, proto_opts, router_mod),
stop_listener(uri),
call_service(name, request),
... | Add start_listener/6 to Hello elixir module | Add start_listener/6 to Hello elixir module
| Elixir | mit | travelping/hello |
19a7df1539dea9e4025493d1dcb55520ae746d6d | lib/cobalt/dynamo.ex | lib/cobalt/dynamo.ex | defmodule Cobalt.Dynamo do
use Dynamo
config :dynamo,
# The environment this Dynamo runs on
env: Mix.env,
# The OTP application associated with this Dynamo
otp_app: :cobalt,
# The endpoint to dispatch requests to
endpoint: ApplicationRouter,
# The route from which static assets are s... | defmodule Cobalt.Dynamo do
use Dynamo
config :dynamo,
# The environment this Dynamo runs on
env: Mix.env,
# The OTP application associated with this Dynamo
otp_app: :cobalt,
# The endpoint to dispatch requests to
endpoint: ApplicationRouter,
# The route from which static assets are s... | Test server should start in port 4001 | Test server should start in port 4001
| Elixir | mit | louishawkins/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,louishawkins/mogo-chat,HashNuke/mogo-chat,louishawkins/mogo-chat,di-stars/mogo-chat,sashafklein/bloc-mogo,sashafklein/bloc-mogo,di-stars/mogo-chat |
3df4ad30cd231acf036e574d85a61a9db87411da | test/support/helpers/showtime_test_helpers.ex | test/support/helpers/showtime_test_helpers.ex | defmodule Jumubase.ShowtimeTestHelpers do
import Jumubase.Factory
@doc """
Returns valid attributes for creating an Appearance,
including nested data that isn't handled by the Factory.
"""
def valid_appearance_attrs do
params_with_assocs(:appearance)
# Replace linked by nested participant
|> Ma... | defmodule Jumubase.ShowtimeTestHelpers do
import Jumubase.Factory
@doc """
Returns valid attributes for creating an Appearance,
including nested data that isn't handled by the Factory.
"""
def valid_appearance_attrs do
params_for(:appearance)
|> Map.put(:participant, params_for(:participant))
end... | Clean up Showtime test helpers | Clean up Showtime test helpers
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
9e695badfede89cbc00ee42908cd19cf15f71266 | lib/http/endpoint.ex | lib/http/endpoint.ex | defmodule Tokenizer.HTTP.Endpoint do
@moduledoc """
Phoenix Endpoint for tokenizer_api application.
"""
use Phoenix.Endpoint, otp_app: :tokenizer_api
require Logger
# Allow acceptance tests to run in concurrent mode
if Application.get_env(:tokenizer_api, :sql_sandbox) do
Logger.warn("This endpoint i... | defmodule Tokenizer.HTTP.Endpoint do
@moduledoc """
Phoenix Endpoint for tokenizer_api application.
"""
use Phoenix.Endpoint, otp_app: :tokenizer_api
require Logger
# Allow acceptance tests to run in concurrent mode
if Confex.get(:tokenizer_api, :sql_sandbox) do
Logger.warn("This endpoint is running... | Read sql sandbox env at runtime | Read sql sandbox env at runtime
| Elixir | mit | Nebo15/tokenizer.api |
17e1f0af352cf32f383f85431c081591a4a0214b | web/router.ex | web/router.ex | defmodule MyApp_7191136.Router do
use MyApp_7191136.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", MyApp_7191136 do
pipe_through :browser # Use t... | defmodule MyApp_7191136.Router do
use MyApp_7191136.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", MyApp_7191136 do
pipe_through :browser # Use t... | Add users resource to browser scope | Add users resource to browser scope
| Elixir | mit | wsmoak/my_app_7191136 |
0c534a7cf2e14ee59f1854c27d362d84a9174b01 | lib/exsoda/configuration.ex | lib/exsoda/configuration.ex | defmodule Exsoda.Configuration do
@derive [Poison.Encoder]
defstruct id: nil, name: nil, type: nil, properties: nil
@derive [Poison.Decoder]
defmodule Property do
defstruct name: nil, value: nil
end
end
| defmodule Exsoda.Configuration do
@derive [Poison.Encoder]
defstruct id: nil, name: nil, type: nil, properties: nil, domainCName: nil
@derive [Poison.Decoder]
defmodule Property do
defstruct name: nil, value: nil
end
end
| Include config cname for dealing with inheritance | Include config cname for dealing with inheritance
| Elixir | apache-2.0 | rozap/exsoda |
f5fba8de52ce21880ef97474f97d6f08e18cdf2c | test/credo/sources_test.exs | test/credo/sources_test.exs | defmodule Credo.SourcesTest do
use ExUnit.Case
test "Credo.Sources.find" do
files = ["credo.ex", "credo_test.exs", "config.exs"]
expected = ["credo.ex"]
assert expected == Credo.Sources.exclude(files, [~r/test/, ~r/\.exs$/])
end
test "Credo.Sources.exclude" do
files = ["credo.ex", "credo_test.... | defmodule Credo.SourcesTest do
use ExUnit.Case
test "Credo.Sources.find" do
files = ["credo.ex", "credo_test.exs", "config.exs"]
expected = ["credo.ex"]
assert expected == Credo.Sources.exclude(files, [~r/test/, ~r/\.exs$/])
end
test "Credo.Sources.exclude" do
files = ["credo.ex", "credo_test.... | Add another failing test for Sources.exclude | Add another failing test for Sources.exclude
| Elixir | mit | rrrene/credo,rrrene/credo |
f1e7ece29e76446d950075773dadefe692917647 | lib/gandalf.ex | lib/gandalf.ex | defmodule Gandalf do
import Plug.Conn
def init(options) do
options
end
def call(conn, options) do
conn
|> check_access(options)
end
defp check_access(conn, options) do
case check_cookie(conn, options) do
true -> conn
false -> handle_unauthorized_access(conn, options)
end
... | defmodule Gandalf do
use Plug.Builder
plug Plug.Parsers, parsers: [:urlencoded]
def call(conn, options) do
conn = super(conn, options) # call Plug.Parser
conn
|> check_access(options)
end
defp check_access(conn, options) do
case check_cookie(conn, options) do
true -> conn
false ... | Use Plug Builder with Plug Parser | Use Plug Builder with Plug Parser
| Elixir | mit | siepet/gandalf |
3b6b49e246fae2da8733245b2eae7dddb96ce349 | lib/benchee/config.ex | lib/benchee/config.ex | defmodule Benchee.Config do
@moduledoc """
Functions to handle the configuration of Benchee, exposes `init` function.
"""
alias Benchee.Time
@doc """
Returns the initial benchmark configuration for Benhee, composed of defauls
and an optional custom confiuration.
Configuration times are given in second... | defmodule Benchee.Config do
@moduledoc """
Functions to handle the configuration of Benchee, exposes `init` function.
"""
alias Benchee.Time
@doc """
Returns the initial benchmark configuration for Benhee, composed of defauls
and an optional custom confiuration.
Configuration times are given in second... | Make sure time server is started | Make sure time server is started
| Elixir | mit | PragTob/benchee |
fc607b3922b54507bcb4a511b808116f68b279d0 | lib/swoosh/adapter.ex | lib/swoosh/adapter.ex | defmodule Swoosh.Adapter do
@moduledoc ~S"""
Specification of the email delivery adapter.
"""
@typep config :: Keyword.t
@callback deliver(%Swoosh.Email{}, config) :: {:ok, term} | {:error, term}
end
| defmodule Swoosh.Adapter do
@moduledoc ~S"""
Specification of the email delivery adapter.
"""
@type t :: module
@type email :: Email.t
@typep config :: Keyword.t
@doc """
Delivers an email with the given config.
"""
@callback deliver(email, config) :: {:ok, term} | {:error, term}
end
| Improve docs and typespecs in Swoosh.Adapter | Improve docs and typespecs in Swoosh.Adapter
| Elixir | mit | dighjd12/swoosh,swoosh/swoosh,dbulic/swoosh |
efcd432ad3812c2389a241d06a03534ec60da9d7 | apps/entity/test/controller/entity_service_test.exs | apps/entity/test/controller/entity_service_test.exs | defmodule HELM.Entity.Controller.EntityServiceTest do
use ExUnit.Case, async: true
alias HELF.Broker
@moduletag :umbrella
setup do
email = Burette.Internet.email()
password = Burette.Internet.password()
params = %{email: email, password_confirmation: password, password: password}
{:ok, param... | defmodule HELM.Entity.Controller.EntityServiceTest do
use ExUnit.Case, async: true
alias HELF.Broker
@moduletag :umbrella
setup do
email = Burette.Internet.email()
password = Burette.Internet.password()
params = %{email: email, password_confirmation: password, password: password}
{:ok, param... | Remove sleep from entity test, it's not needed since `account:create` already awaits for entity creation. | Remove sleep from entity test, it's not needed since `account:create` already awaits for entity creation.
| Elixir | agpl-3.0 | HackerExperience/Helix,mememori/Helix,HackerExperience/Helix,renatomassaro/Helix,renatomassaro/Helix |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.