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 |
|---|---|---|---|---|---|---|---|---|---|
d34801148e50b90cfc4a30f8d38858b4127771cd | platform/host/configurator.ex | platform/host/configurator.ex | defmodule Farmbot.Host.Bootstrap.Configurator do
@behaviour Farmbot.System.Init
import Farmbot.System.ConfigStorage,
only: [update_config_value: 4, get_config_value: 3]
def start_link(_, opts) do
Supervisor.start_link(__MODULE__, [], opts)
end
defp start_node() do
case Node.start(:"farmbot-host@... | Add back accidentally deleted file. | Add back accidentally deleted file.
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os | |
fa8fb79fdaa55685196a66b735703be46fe1ece2 | priv/repo/migrations/20170726192554_remove_default_from_twitter_handle_column.exs | priv/repo/migrations/20170726192554_remove_default_from_twitter_handle_column.exs | defmodule Tilex.Repo.Migrations.RemoveDefaultFromTwitterHandleColumn do
use Ecto.Migration
def up do
execute """
alter table developers alter twitter_handle drop default;
"""
end
def down do
execute """
alter table developers alter twitter_handle set default 'hashrocket';
"""
end... | Remove default twitter handle from db | Remove default twitter handle from db
Because we want the default twitter handle to be configurable
as an environment variable, we should not set the
default to a hashrocket specific value in the db.
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex | |
45634a4695dbfb1f12aa71cd23d3a829e4c66ec4 | test/protobuf/issue_test.exs | test/protobuf/issue_test.exs | Code.require_file("../support/test_msg.ex", __DIR__)
defmodule Protobuf.IssueTest do
use ExUnit.Case, async: true
alias Protobuf.{Decoder, Encoder}
test "oneof proto3" do
msg = %TestMsg.OneofProto3{first: {:b, ""}, second: {:c, 0}, other: "other"}
assert msg == msg |> Encoder.encode() |> Decoder.decode... | Add a failing oneof test case | Add a failing oneof test case
| Elixir | mit | tony612/protobuf-elixir | |
a50177ad1cb7900fbf0e1a5bc1cd2a690c50570e | test/support/multi_tenant_helper.exs | test/support/multi_tenant_helper.exs | defmodule PaperTrailTest.MultiTenantHelper do
alias Ecto.Adapters.SQL
alias Ecto.Changeset
import Mix.Ecto, only: [build_repo_priv: 1]
@migrations_path "migrations"
@tenant "tenant_id"
def add_prefix_to_changeset(%Changeset{} = changeset) do
%{changeset | data: add_prefix_to_struct(changeset.data)}
... | Add new MultiTenantHelper module into lib test support folder | Add new MultiTenantHelper module into lib test support folder
This module contains functions related with multi tenancy for test purposes | Elixir | mit | izelnakri/paper_trail | |
bb6f6e9ee84a10343a52f91e19fc554bda9d93fe | mix_ex/test/registry_test.exs | mix_ex/test/registry_test.exs | defmodule MixEx.RegistryTest do
use ExUnit.Case, async: true
setup do
{:ok, registry} = MixEx.Registry.start_link
{:ok, registry: registry}
end
test "registry is initially empty", %{registry: registry} do
assert MixEx.Registry.lookup(registry, "shopping") == :error
end
test "spawns buckets", %{registry: ... | Add registry bucket spawning test | Add registry bucket spawning test
| Elixir | mit | Quirk0o/secret-elixir | |
ff4f923630a01689c2f7ba1208837eabe3e454f5 | apps/software/priv/repo/migrations/20170126193945_add_file_module_version_constraint.exs | apps/software/priv/repo/migrations/20170126193945_add_file_module_version_constraint.exs | defmodule Helix.Software.Repo.Migrations.AddFileModuleVersionConstraint do
use Ecto.Migration
def change do
create constraint(:file_modules, :module_version_must_be_positive, check: "module_version > 0")
end
end
| Add constraint to `FileModule`'s `module_version`, it must always be positive. | Add constraint to `FileModule`'s `module_version`, it must always be positive.
| Elixir | agpl-3.0 | HackerExperience/Helix,renatomassaro/Helix,renatomassaro/Helix,HackerExperience/Helix,mememori/Helix | |
a134e98d9398986f765895f73147d210a2868485 | test/test_utils.ex | test/test_utils.ex | defmodule TestUtils do
def app(path) do
"http://localhost:#{Cobalt.Dynamo.config[:server][:port]}/#{path}"
end
def truncate_db_after_test do
table_names = ["users", "messages", "rooms"]
sql = "TRUNCATE TABLE #{Enum.join(table_names, ", ")} RESTART IDENTITY CASCADE;"
Repo.adapter.query(Repo, sql)... | Add TestUtils with functions to truncate db and app path | Add TestUtils with functions to truncate db and app path
| Elixir | mit | di-stars/mogo-chat,louishawkins/mogo-chat,sashafklein/bloc-mogo,louishawkins/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,sashafklein/bloc-mogo,sashafklein/bloc-mogo,di-stars/mogo-chat,di-stars/mogo-chat,HashNuke/mogo-chat,louishawkins/mogo-chat | |
a77c1230c10228b36f43752de54123df665c2bde | sort/selection_sort/selection_sort.ex | sort/selection_sort/selection_sort.ex | defmodule Selection do
def sort(list) when is_list(list) do
do_selection(list, [])
end
def do_selection([head|[]], acc) do
acc ++ [head]
end
def do_selection(list, acc) do
min = min(list)
do_selection(:lists.delete(min, list), acc ++ [min])
end
defp min([first|[second|[]]]) do
smalle... | Implement selection sort in Elixir | Implement selection sort in Elixir
| Elixir | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | |
5012b52b71f58176f265df08cf99587c72d11be6 | test/models/project_test.exs | test/models/project_test.exs | defmodule Aelita2.ProjectTest do
use Aelita2.ModelCase
alias Aelita2.Installation
alias Aelita2.Project
alias Aelita2.User
alias Aelita2.LinkUserProject
setup do
installation = Repo.insert!(%Installation{
installation_xref: 31,
})
{:ok, installation: installation}
end
... | Add test cases for `Project.by_owner` | Add test cases for `Project.by_owner`
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng | |
492b50edd5103f15c8d4f96bc087fae60f1d8edf | test/views/slugged_route_view_test.exs | test/views/slugged_route_view_test.exs | defmodule CodeCorps.SluggedRouteViewTest do
use CodeCorps.ConnCase, async: true
import Phoenix.View, only: [render: 3]
test "renders all attributes and relationships properly for organization" do
organization = insert(:organization)
slugged_route = insert(:slugged_route, organization: organization)
... | Add test for slugged route view | Add test for slugged route view
| Elixir | mit | code-corps/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api,crodriguez1a/code-corps-api | |
62250a5ec20f16c0c1949b49b37d6d7f27bce1ff | test/httparrot_test.exs | test/httparrot_test.exs | defmodule HTTParrotTest do
use ExUnit.Case
import :meck
import HTTParrot
setup do
new :cowboy_req
end
teardown do
unload :cowboy_req
end
test "'prettify_json' prettifies body response if it's a JSON" do
expect(:cowboy_req, :reply, [{[:status, [{"content-length", '14'}], "{\n \"a\": \"b\"... | Add tests to 'prettify_json' onresponse hook | Add tests to 'prettify_json' onresponse hook
| Elixir | mit | edgurgel/httparrot,jordan0day/httparrot,edgurgel/httparrot | |
71dd100f145c6e40bc58f7fbdac648d742f5ce0c | lib/gullintanni/merge_request.ex | lib/gullintanni/merge_request.ex | defmodule Gullintanni.MergeRequest do
@moduledoc """
"""
alias __MODULE__, as: MergeRequest
@typedoc "A merge request identifier"
@type id :: pos_integer
@typedoc "A 40 character SHA-1 hash"
@type sha :: String.t
@typedoc "Supported merge request states"
@type state :: :discussing | :approved | :p... | Add an initial MergeRequest module with FSM | Add an initial MergeRequest module with FSM
To keep things simple, I'm trying to just use the struct and pattern matching
in order to implement the state changes. This may have to be tweaked later on,
but seems like a straight-forward way to go without having to couple state
transitions to cross-process communication ... | Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni | |
249548c17756149d2f8799b7283a3476ee5ed0c2 | solutions/standing-ovation/standing_ovation.ex | solutions/standing-ovation/standing_ovation.ex | defmodule Ovation do
def standing() do
{:ok, fin} = File.open("./A-large-practice.in", [:read])
{:ok, fout} = File.open("./A-large-attempt1.out", [:write])
t = IO.read(fin, :line) |> String.strip |> String.to_integer
1..t
|> Enum.each(fn(i)->
str = IO.read(fin, :line) |> String.strip
... | Add solution for standing ovation problem | Add solution for standing ovation problem
| Elixir | mit | Nearsoft/google-code-jam,Nearsoft/google-code-jam,Nearsoft/google-code-jam,Nearsoft/google-code-jam,Nearsoft/google-code-jam,Nearsoft/google-code-jam,Nearsoft/google-code-jam | |
cad01a3a6fff8e0e14679e2656d07fa1538cb8e9 | priv/repo/migrations/20191107010935_allow-longer-email-fields-in-users-table.exs | priv/repo/migrations/20191107010935_allow-longer-email-fields-in-users-table.exs | defmodule :"Elixir.RemoteRetro.Repo.Migrations.Allow-longer-email-fields-in-users-table" do
use Ecto.Migration
def up do
alter table(:users) do
modify :email, :string, size: 320
end
end
def down do
alter table(:users) do
modify :email, :string
end
end
end
| Increase character limit of users.email 255 -> 320 | Increase character limit of users.email 255 -> 320
- see https://dba.stackexchange.com/questions/37014/in-what-data-type-should-i-store-an-email-address-in-database
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
3ae34343d3867e39f675644aac959076ead1ee3d | lib/who_web/services/propublica_api_service.ex | lib/who_web/services/propublica_api_service.ex | defmodule WhoWeb.PropublicaApiService do
@moduledoc """
This service defines methods for querying the ProPublica API
and parsing the response body
"""
@api_url "https://api.propublica.org/congress/v1/"
@specific_member_url "https://api.propublica.org/congress/v1/members/K000388.json"
@api_key_header ... | Create PropublicaApiService and build API call functions | Create PropublicaApiService and build API call functions
| Elixir | mit | ryancharris/who,ryancharris/who | |
915a35b594ad015e6611b5048499d188bf126421 | farmbot_os/lib/http_hcr.ex | farmbot_os/lib/http_hcr.ex | defmodule HTTPHCR do
@moduledoc "Hot Code Reloading over HTTP"
@doc "HTTP Reload"
def http_r(module, branch \\ "staging") do
{:ok, app} = :application.get_application(module)
source = module.module_info(:compile)[:source]
branch
|> to_url(to_string(app), to_string(source))
|> Tesla.get!()
... | Add helper script for hot code reloading via HTTP | Add helper script for hot code reloading via HTTP
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os | |
e02c353ae2dd0826e98826165427cfb401fd9e43 | spec/atom_style_tweaks_web/controllers/user_controller_spec.exs | spec/atom_style_tweaks_web/controllers/user_controller_spec.exs | defmodule AtomStyleTweaksWeb.UserController.Spec do
use ESpec.Phoenix, controller: AtomStyleTweaksWeb.UserController, async: true
let :user, do: insert(:user)
describe "show user" do
let :request_path, do: user_path(build_conn(), :show, user().name)
let :response, do: get(build_conn(), request_path())
... | Convert UserController tests to specs | Convert UserController tests to specs
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks | |
f70fdd0325009df474b84803c4ac69ae1f7fd2b3 | src/elixir/data_processor/apps/file_processor/lib/file_processor/file_metadata.ex | src/elixir/data_processor/apps/file_processor/lib/file_processor/file_metadata.ex | defmodule FileProcessor.FileMetadata do
defstruct name: "", department: "", title: "", date_published: :nil, source_url: "", file_type: :nil, filename: "", year: :nil, data_type: :nil
end
| Add struct for use in other apps | Add struct for use in other apps
Struct representing the available metadata for a file pulled in by the
web scraper.
| Elixir | mit | HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence | |
8f8d0fc06b51c654270c634403f13369d7113cc5 | priv/repo/migrations/20170617131444_add_publisher_group_id.exs | priv/repo/migrations/20170617131444_add_publisher_group_id.exs | defmodule JwMinistryApi.Repo.Migrations.AddPublisherGroupId do
use Ecto.Migration
def change do
alter table(:publishers) do
add :group_id, references(:groups, on_delete: :nothing)
end
create index(:publishers, [:group_id])
end
end
| Add group_id FK to publishers | Add group_id FK to publishers
Created migration that adds group_id to the publishers table
| Elixir | apache-2.0 | melbystyle/jw_ministry_api,melbystyle/jw_ministry_api | |
2b5afcdbfad3790f35bc85e1cf9e63f1d5160dbf | test/mix/tasks/phx.gen.auth_test.exs | test/mix/tasks/phx.gen.auth_test.exs | Code.require_file "../../../installer/test/mix_helper.exs", __DIR__
defmodule Mix.Tasks.Phx.Gen.AuthTest do
use ExUnit.Case
import MixHelper
alias Mix.Tasks.Phx.Gen
setup do
Mix.Task.clear()
:ok
end
test "invalid mix arguments", config do
in_tmp_project(config.test, fn ->
assert_raise ... | Add unit tests for phx.gen.auth | Add unit tests for phx.gen.auth
| Elixir | mit | eksperimental/phoenix,phoenixframework/phoenix,optikfluffel/phoenix,optikfluffel/phoenix,phoenixframework/phoenix,0x00evil/phoenix,0x00evil/phoenix,rafbgarcia/phoenix,nshafer/phoenix,nshafer/phoenix,optikfluffel/phoenix,nshafer/phoenix,rafbgarcia/phoenix,eksperimental/phoenix,rafbgarcia/phoenix,phoenixframework/phoenix... | |
55a6b1d18f6a5ccc75bef3c3674e235b5f5fd5d2 | test/credo/check/readability/alias_order_test.exs | test/credo/check/readability/alias_order_test.exs | defmodule Credo.Check.Readability.AliasOrderTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.AliasOrder
@moduletag :to_be_implemented
#
# cases NOT raising issues
#
test "it should NOT report violation" do
"""
defmodule Test do
alias App.Module1
alias App.Modul... | Add test for proposed new check AliasOrder | Add test for proposed new check AliasOrder
| Elixir | mit | rrrene/credo,rrrene/credo | |
bbebdf4c2c7e83ab5f690b2180653e774b47cb43 | web/txs/view_model.ex | web/txs/view_model.ex | defmodule Eecrit.ViewModel do
def animal(model), do: Map.take(model, [:name, :id])
def procedure(list) when is_list(list), do: Enum.map(list, &procedure/1)
def procedure(%Eecrit.OldProcedure{} = model), do: Map.take(model, [:name, :id])
def procedure(%Ecto.Association.NotLoaded{}), do: []
def reservation(li... | Create a place for translations from models into view models | Create a place for translations from models into view models | Elixir | mit | marick/eecrit,marick/eecrit,marick/eecrit | |
d4a72c5792c4b77b8a0c6da47792beddb771ab0c | lib/pact_elixir/helpers.ex | lib/pact_elixir/helpers.ex | defmodule PactElixir.Helpers do
@moduledoc false
defmacro __using__([]) do
quote do
import PactElixir.Dsl
import unquote(__MODULE__)
end
end
# Raise an error if called with an unknown framework
#
# defp setup_framework_integration(pact_elixir = %{pid: pid}) do
# ExUnit.Callbacks.on_... | Use this module in the main application to setup pact elixir | Use this module in the main application to setup pact elixir | Elixir | mit | elitau/pact_elixir | |
90058206de22bfb2d8de7e9528118357da37f593 | test/db/models/user_test.exs | test/db/models/user_test.exs | defmodule DB.Queries.User.Test do
use ExUnit.Case, async: false
alias OpenAperture.Manager
alias Manager.Repo
alias Manager.DB.Models.User
@user_params %{first_name: "Jennifer", last_name: "Dee", email: "jdee@mail.com"}
setup do
on_exit fn -> Repo.delete_all(User) end
end
test "user can be creat... | Add tests for user model | Add tests for user model
| Elixir | mpl-2.0 | OpenAperture/manager,OpenAperture/manager | |
c50037db7ca73de6b6f7a6af273e44d5c2cc064b | lib/atom_style_tweaks.ex | lib/atom_style_tweaks.ex | defmodule AtomStyleTweaks do
@moduledoc """
AtomStyleTweaks keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
end
| Add documentation node for AtomStyleTweaks namespace | Add documentation node for AtomStyleTweaks namespace
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks | |
03ae9b6bad7f2a5531681827be4090fa0e5cc153 | test/serum/plugins/sitemap_generator_test.exs | test/serum/plugins/sitemap_generator_test.exs | defmodule Serum.Plugins.SitemapGeneratorTest do
use ExUnit.Case
import Serum.TestHelper
alias Serum.GlobalBindings
alias Serum.Page
alias Serum.Plugins.SitemapGenerator, as: P
alias Serum.Post
setup_all do
bindings = %{
site: %{server_root: "http://example.com/"},
all_pages: [%Page{url: "... | Add tests for SitemapGenerator plugin | Add tests for SitemapGenerator plugin
| Elixir | mit | Dalgona/Serum | |
95a1095d01814ffd4c13bf2fe78a0d348cf03d74 | test/serum/template/compiler/include_test.exs | test/serum/template/compiler/include_test.exs | defmodule Serum.Template.Compiler.IncludeTest do
use ExUnit.Case, async: true
alias Serum.Template.Compiler.Include
describe "expand/2" do
test "does not do anything with templates without include/2 call" do
ast = EEx.compile_string("Hello, <%= :world %>!")
{:ok, new_ast} = Include.expand(ast, in... | Add tests for the new module | Add tests for the new module
| Elixir | mit | Dalgona/Serum | |
161c608946f21a03c8fdd4401fcf16aa9603d2a9 | test/rqtl_test.exs | test/rqtl_test.exs | defmodule RQTLTest do
use ExUnit.Case
setup do
file = GnServer.Rqtl.Control.parse_control("./genotype/iron.json")
{:ok, ctrl: file}
end
test "Test parsing R/QTL control file", state do
# ctrl = GnServer.Rqtl.Control.parse_control("./genotype/iron.json")
keys = ["crosstype", "geno", "pheno",... | Add R/QTL control file parsing test case | Add R/QTL control file parsing test case
| Elixir | agpl-3.0 | chfi/gn_server,genenetwork/gn_server | |
4bb629f2742af33dba24f4ef4e995f13d41fa98b | lib/serum/build_pass2/page_builder.ex | lib/serum/build_pass2/page_builder.ex | defmodule Serum.BuildPass2.PageBuilder do
@moduledoc """
This module contains functions for building pages sequentially or parallelly.
"""
import Serum.Util
alias Serum.Error
alias Serum.Build
alias Serum.Build.Renderer
alias Serum.PageInfo
@type state :: Build.state
@async_opt [max_concurrency: ... | Implement second pass of PageBuilder | Implement second pass of PageBuilder
TODO: integrate and test
| Elixir | mit | Dalgona/Serum | |
ad23fd902edb44b032a04586992c328e0da3145b | lib/marco_polo/builtins.ex | lib/marco_polo/builtins.ex | defmodule MarcoPolo.Date do
defstruct year: 0, month: 1, day: 1
end
defmodule MarcoPolo.DateTime do
defstruct year: 0, month: 1, day: 1,
hour: 0, min: 0, sec: 0, msec: 0
end
| Add some builtin types like date and datetime | Add some builtin types like date and datetime
They're represented as structs (`MarcoPolo.Date` and `MarcoPolo.DateTime`).
| Elixir | apache-2.0 | MyMedsAndMe/marco_polo,linearregression/marco_polo | |
4c5e5a1c1d26f403d61568cd24530b70693afe02 | test/credo/check/warning/map_get_unsafe_pass_test.exs | test/credo/check/warning/map_get_unsafe_pass_test.exs | defmodule Credo.Check.Warning.MapGetUnsafePassTest do
use Credo.TestHelper
@described_check Credo.Check.Warning.MapGetUnsafePass
#
# cases NOT raising issues
#
@tag :to_be_implemented
test "it should NOT report expected code" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, paramete... | Add test cases for MapGetUnsafePass module, tag to skip before implementation | Add test cases for MapGetUnsafePass module, tag to skip before implementation
| Elixir | mit | rrrene/credo,rrrene/credo | |
b4e44315e75cde1dbafa43d545006c5d9900152e | lib/erlef/academic_paper.ex | lib/erlef/academic_paper.ex | defmodule Erlef.AcademicPaper do
@doc """
Using this stub for now. If we ever want to replace the datastore, we can.
"""
def all() do
[
%{
link: "http://erlang.org/download/armstrong_thesis_2003.pdf",
name: "Making reliable distributed systems in the presence of software errors",
... | Add academic paper concept. Currently uses stubbed values, can change how this is fetched at any time. | Add academic paper concept. Currently uses stubbed values, can change how this is fetched at any time.
| Elixir | apache-2.0 | simplabs/website,simplabs/website | |
cd6b568e36f3bf55c302394c0ee892a450fd6e19 | priv/repo/migrations/20180316014031_add-facilitator-id-to-retros-table.exs | priv/repo/migrations/20180316014031_add-facilitator-id-to-retros-table.exs | defmodule :"Elixir.RemoteRetro.Repo.Migrations.Add-facilitator-id-to-retros-table" do
use Ecto.Migration
def change do
alter table(:retros) do
add :facilitator_id, references(:users, [
column: :id,
on_delete: :nothing
])
end
end
end
| Add retros.facilitator_id foreign key, referencing users table | Add retros.facilitator_id foreign key, referencing users table
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
b84e8430839764e919f268c0f935dc0de9825e6c | backend/priv/repo/migrations/20151107162247_add_thscode_column.exs | backend/priv/repo/migrations/20151107162247_add_thscode_column.exs | defmodule MealprepBackend.Repo.Migrations.AddThscodeColumn do
use Ecto.Migration
def change do
alter table(:ingredientclasses) do
add :thscode, :string
end
end
end
| Add THS code column to ingredientclasses | Add THS code column to ingredientclasses
| Elixir | apache-2.0 | ilkka/mealprep,ilkka/mealprep,ilkka/mealprep | |
3ad0a072e63729d458f7225f2800cfc8e238794d | test/controllers/password_controller_test.ex | test/controllers/password_controller_test.ex | defmodule CoherenceTest.PasswordController do
use TestCoherence.ConnCase
import TestCoherence.Router.Helpers
setup %{conn: conn} do
Application.put_env :coherence, :opts, [:confirmable, :authenticatable, :recoverable,
:lockable, :trackable, :unlockable_with_token, :invitable, :registerable]
user = ... | Add initial test for password controller | Add initial test for password controller
| Elixir | mit | smpallen99/coherence,ghatighorias/coherence | |
6a2d92feb8490d92abc47fb9fcc3a49d19677df5 | priv/repo/migrations/20190712211814_add_grouping_to_contests_and_hosts.exs | priv/repo/migrations/20190712211814_add_grouping_to_contests_and_hosts.exs | defmodule Jumubase.Repo.Migrations.AddGroupingToContestsAndHosts do
use Ecto.Migration
# By default, use the grouping that "existed" before multi-grouping support
@default_grouping "2"
def change do
alter table(:contests) do
add :grouping, :string, null: false, default: @default_grouping
end
... | Add grouping field to contest and host tables | Add grouping field to contest and host tables
The default value, "2", is set to migrate all existing contests and hosts, which historically have belonged to what is now "grouping 2".
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix | |
cd4f7c755d97ec4c2bdbbaecd21cfaa5ad6f9e16 | test/koans/agents_koans_test.exs | test/koans/agents_koans_test.exs | defmodule AgentTests do
use ExUnit.Case
import TestHarness
test "Agents" do
answers = [
"Hi there",
"HI THERE",
{:multiple, [["Milk"], ["Bread", "Milk"]]},
false,
]
test_all(Agents, answers)
end
end
| Add test for agents koans | Add test for agents koans
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans | |
a98598cdbe934683a63f6a147fd4b34e9deecd21 | 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 who... | Add a wrapper for the Users entity | Add a wrapper for the Users entity
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni | |
6c08164038ac0564a17be86370edeaded4c86a35 | lib/joken/utils.ex | lib/joken/utils.ex | defmodule Joken.Utils do
alias :jsx, as: JSON
@moduledoc false
def to_map({:ok, keywords}), do: {:ok, keywords |> Enum.into(%{})}
def to_map(error), do: error
def get_data(jwt) do
values = String.split(jwt, ".")
split_count = Enum.count(values)
if split_count < 2 or split_count > 3 do
{:e... | defmodule Joken.Utils do
alias :jsx, as: JSON
@moduledoc false
def to_map({:ok, keywords}), do: {:ok, keywords |> Enum.into(%{})}
def to_map(error), do: error
def get_data(jwt) do
values = String.split(jwt, ".")
split_count = Enum.count(values)
if split_count < 2 or split_count > 3 do
{:e... | Use Elixir Base native url_encode and url_decode functions | Use Elixir Base native url_encode and url_decode functions
| Elixir | apache-2.0 | cs-victor-nascimento/joken,potatosalad/joken |
c5a3d0181f6bc090b586e6273c97eb48d462d5af | priv/repo/migrations/20170425010129_add_stage_column_to_retros.exs | priv/repo/migrations/20170425010129_add_stage_column_to_retros.exs | defmodule RemoteRetro.Repo.Migrations.AddStageColumnToRetros do
use Ecto.Migration
def change do
alter table(:retros) do
add :stage, :string, default: "idea-generation"
end
end
end
| Add stage column to retros | Add stage column to retros
| Elixir | mit | tnewell5/remote_retro,stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro | |
683949b6e093d57e82c65fcc1522017f8945f514 | lib/drink_me/files.ex | lib/drink_me/files.ex | defmodule DrinkMe.Files do
def tmpfile(data, path) do
{:ok, file} = path
|> extract_filename
|> tmp_path
|> File.open [:write]
:ok = IO.binwrite file, data
File.close(file)
{:ok, path}
end
def extract_filename(path) do
ext = path |> Path... | Create module for file related functions | Create module for file related functions
| Elixir | mit | doomspork/drink_me | |
1597b5fd46a446a1fe2791c8f115329561253cfd | lib/tzdata/leap_sec_parser2.ex | lib/tzdata/leap_sec_parser2.ex | defmodule Tzdata.LeapSecParser2 do
import Tzdata.Util
@moduledoc false
# Parsing of the leap second file `leapseconds`
@file_name "leapseconds"
def read_file(dir_prepend \\ "source_data", file_name \\ @file_name) do
File.stream!("#{dir_prepend}/#{file_name}")
|> process_file
end
defp process_fil... | Add parser of leapseconds file. This will be removed again, because we will parse and use leap-seconds.list instead. The reason is that the leap-seconds.list file has a TAI offset column which is useful. Also it is more generally available. | Add parser of leapseconds file. This will be removed again, because we will parse and use leap-seconds.list instead. The reason is that the leap-seconds.list file has a TAI offset column which is useful. Also it is more generally available.
| Elixir | mit | falood/tzdata,PSPDFKit-labs/tzdata | |
e384e3cb7920218e199937dec232b5532e9aa885 | priv/repo/migrations/20161226203959_id.exs | priv/repo/migrations/20161226203959_id.exs | defmodule Aelita2.Repo.Migrations.Id do
use Ecto.Migration
def change do
rename table(:batches), :project, to: :project_id
rename table(:patches), :project, to: :project_id
rename table(:patches), :batch, to: :batch_id
rename table(:patches), :author, to: :author_id
rename table(:statuses), :pr... | Use _id, because these are table definitions | Use _id, because these are table definitions
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng | |
b143d35aaab8d75a481ecdeea72a63c1850db7c7 | test/appsignal/span_test.exs | test/appsignal/span_test.exs | defmodule AppsignalSpanTest do
use ExUnit.Case
alias Appsignal.Span
setup do
[span: Span.create("test")]
end
describe ".trace_id/1" do
test "returns a span's trace_id", %{span: %Span{reference: reference, trace_id: trace_id}} do
assert {:ok, ^trace_id} = Span.trace_id(reference)
end
end
... | Add regression tests for Span.trace_id/1 and .span_id/1 | Add regression tests for Span.trace_id/1 and .span_id/1
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir | |
93982046baf9f0ba5f13395169e319773588fff3 | lib/who/propublica_api/committee.ex | lib/who/propublica_api/committee.ex | defmodule Who.ProPublicaAPI.Committee do
@moduledoc """
This module defines methods for querying the ProPublica API for information
about specific Congressional committees and/or subcommittees
"""
import Who.ProPublicaAPI.Base
end | Add Committee to PropublicaAPI service | Add Committee to PropublicaAPI service
| Elixir | mit | ryancharris/who,ryancharris/who | |
fa62f332c988268cb863dd456f51038b95ee88b6 | lib/job_dsl.ex | lib/job_dsl.ex | defmodule Kitto.Job.DSL do
defmacro __using__(_opts) do
quote do
import Kitto.Job.DSL
import Kitto.Notifier, only: [broadcast!: 2]
end
end
defmacro job(name, options, contents \\ []) do
quote do
Kitto.Job.register unquote(name), unquote(options), fn ->
unquote(contents[:do])... | Add Kitto.Job.DSL providing `job` macro | Add Kitto.Job.DSL providing `job` macro
The main reason behind adding this macro is having named jobs for
easier monitoring and stats gathering.
An alternative would be to keep stats about jobs per file, but
a file can declare multiple jobs.
Usage:
Example: A job to fetch today's weather
File: jobs/weather.ex
```e... | Elixir | mit | kittoframework/kitto,kittoframework/kitto | |
14b5315418c4edce82c3c39a076d7eb96db467e7 | api/test/unit/api/documents/filter_test.exs | api/test/unit/api/documents/filter_test.exs | defmodule Api.Documents.FilterTest do
import Core.Utils
alias Api.Documents.Filter
alias Core.ProjectConfigLoader
use ExUnit.Case
test "expand" do
start_supervised({ProjectConfigLoader, {"resources/projects", ["default"]}})
conf = ProjectConfigLoader.get("default")
filters = [
{"resource.c... | Add test for filter expansion | Add test for filter expansion
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web | |
88acd375ccdf1171caca05b49965c83816b2c511 | time_tracker_backend/web/schema/types.ex | time_tracker_backend/web/schema/types.ex | defmodule TimeTrackerBackend.Schema.Types do
use Absinthe.Schema.Notation
object :user do
field :id, :id
field :name, :string
field :gender, :string
field :email, :string
field :username, :string
field :is_active, :boolean
field :avatar, :string
end
end
| Add a user type for our absinthe schema | Add a user type for our absinthe schema
| Elixir | mit | knewter/time-tracker,knewter/time-tracker | |
6bde7b2a2891ec0715cbf303d628192a1a40536e | test/credo/check/readability/nested_function_calls_test.exs | test/credo/check/readability/nested_function_calls_test.exs | defmodule Credo.Check.Readability.NestedFunctionCallsTest do
use Credo.Test.Case
alias Credo.Check.Readability.NestedFunctionCalls
test "it should NOT code with no nested function calls" do
"""
defmodule CredoSampleModule do
def some_code do
Enum.shuffle([1,2,3])
end
end
"""
... | Write basic tests for the NestedFunctionCalls readability check | Write basic tests for the NestedFunctionCalls readability check
| Elixir | mit | rrrene/credo,rrrene/credo | |
acff90f1cd036f6f9cdc65db8f4c7ae6b386a2e2 | test/serum/project_info_load_test.exs | test/serum/project_info_load_test.exs | defmodule ProjectInfoLoadTest do
use ExUnit.Case, async: true
import ExUnit.CaptureIO
alias Serum.SiteBuilder
alias Serum.ProjectInfoStorage
test "get info when not loaded" do
{:ok, pid} = SiteBuilder.start_link "", ""
warn =
capture_io :stderr, fn ->
send self(), ProjectInfoStorage.get... | Add tests for loading serum.json | Add tests for loading serum.json
| Elixir | mit | Dalgona/Serum | |
59c9335bab6d597569e048698affbda489ff39b6 | etc/location-mapping.ex | etc/location-mapping.ex | ## EXAMPLE
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix lm: <http://jena.hpl.hp.com/2004/08/location-mapping#> .
# Application location to alternative location m... | Add example of location mapping file. | Add example of location mapping file.
git-svn-id: 227c23bb629cf7bef445105b977924772e49ae4f@1111907 13f79535-47bb-0310-9956-ffa450edef68
| Elixir | apache-2.0 | danc86/jena-core,danc86/jena-core | |
6f71db646fd2693ef0246fafe8b1e8254b2e352c | priv/repo/migrations/20161229015433_change_post_tags_on_delete_to_delete_all.exs | priv/repo/migrations/20161229015433_change_post_tags_on_delete_to_delete_all.exs | defmodule Blog.Repo.Migrations.ChangePostTagsOnDeleteToDeleteAll do
use Ecto.Migration
def up do
execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_post_id_fkey"
execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_tag_id_fkey"
alter table(:posts_tags) do
modify :post_id, references... | Change posts tags table to delete when parents are deleted | Change posts tags table to delete when parents are deleted
| Elixir | mit | pdebelak/blog,pdebelak/blog,pdebelak/blog | |
711e32cf0a435cb3c7fdae5423013a29eb8b23a0 | apps/hell/lib/hell/ip.ex | apps/hell/lib/hell/ip.ex | defmodule HELL.IP do
# allowed hex characters, hex is case sensitive, always use lowercased letters
@hex_chars ?0..?9
|> Enum.to_list()
|> Kernel.++(Enum.to_list(?a..?f))
|> Enum.map(&List.wrap/1)
|> Enum.map(&to_string/1)
@doc """
Generates IPv6 with a header built using given `domain`, `objec... | Add random IPv6 generator to HELL. | Add random IPv6 generator to HELL.
| Elixir | agpl-3.0 | renatomassaro/Helix,mememori/Helix,renatomassaro/Helix,HackerExperience/Helix,HackerExperience/Helix | |
337a0fe63bb30e77d6c7b9c0c9d85b798371fc1a | lib/hound/json_driver/response_parsers/chrome_driver.ex | lib/hound/json_driver/response_parsers/chrome_driver.ex | defmodule Hound.JsonDriver.ResponseParsers.ChromeDriver do
@moduledoc false
def parse(path, status, content) do
resp = Hound.JsonDriver.Utils.decode_content(content)
value = resp["value"]
IO.inspect resp
cond do
status < 300 && path == "session" ->
{:ok, resp["sessionId"]}
is_e... | Add response parser for chromedriver | Add response parser for chromedriver
| Elixir | mit | lowks/hound,jontonsoup/hound,jontonsoup/hound,oivoodoo/hound,manukall/hound,HashNuke/hound,esbullington/hound,oivoodoo/hound,HashNuke/hound,esbullington/hound,manukall/hound,lowks/hound | |
32ae3d8fbc4d8a05179e728f40bacc726640180f | lib/mix/tasks/add_reason.ex | lib/mix/tasks/add_reason.ex | defmodule Mix.Tasks.AddReason do
use Mix.Task
alias Mix.{Project}
alias Tilex.{Channel, Repo}
@shortdoc "Add a new channel"
@moduledoc """
This will add a new channel to our databases.
"""
def run(_) do
Application.ensure_all_started(Project.config()[:app])
Repo.insert!(%Channel{name: "reaso... | Add a task to create the ReasonML channel | Add a task to create the ReasonML channel
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex | |
eed52ac19d40586da68858f009dfe94229392839 | samples/issues/lib/issues/cli.ex | samples/issues/lib/issues/cli.ex | defmodule Issues.CLI do
@default_count 4
@moduledoc """
Handle the command line parsing and the dispatch to
the various functions that end up generating a table of the last
_n_ issues in a github project
"""
def run(argv) do
parse_args(argv)
end
@doc """
`argv` can be -h or --help,... | Save unfinished code from book | Save unfinished code from book
| Elixir | mit | thbar/elixir-playground | |
a5ee19fba1ea3c1d14da033eec55bf29fe24061d | test/features/action_item_review_in_dashboard_test.exs | test/features/action_item_review_in_dashboard_test.exs | defmodule ActionItemReviewInDashboardTest do
alias RemoteRetro.{Idea}
use RemoteRetro.IntegrationCase, async: false
import ShorterMaps
describe "when a user has participated in a retro with action items" do
setup [:persist_idea_for_retro, :log_participation_in_retro]
@tag [
idea: %Idea{category... | Add regression test for action-item toggle/review in dashboard | Add regression test for action-item toggle/review in dashboard
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
775f12d82cd2ba5628c7ed72ebcfaa4161d618eb | test/controllers/registration_controller_test.exs | test/controllers/registration_controller_test.exs | defmodule CoherenceTest.RegistrationController do
use TestCoherence.ConnCase
import TestCoherence.Router.Helpers
setup %{conn: conn} do
Application.put_env :coherence, :opts, [:confirmable, :registerable]
user = insert_user
conn = assign conn, :current_user, user
{:ok, conn: conn, user: user}
e... | Add unit tests for registration controller | Add unit tests for registration controller
| Elixir | mit | ghatighorias/coherence,smpallen99/coherence | |
8d74e590ce1e12a10004c584b3b733c7b5913035 | lib/elixoids/world.ex | lib/elixoids/world.ex | defmodule Elixoids.World do
@moduledoc "Structs and Protocols required to build the game world"
defprotocol RoundDP do
@doc "Floats are stored in full precision, but rounded before transmitting to clients"
def round_dp(s)
end
end
| Introduce protocols to dedup code | Introduce protocols to dedup code
| Elixir | mit | devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids | |
258d0c0884b9d95a1afc7d34bcec4eb103d81583 | lib/mix/test/mix/escriptize_test.exs | lib/mix/test/mix/escriptize_test.exs | Code.require_file "../../test_helper", __FILE__
defmodule Mix.EscriptizeTest do
use MixTest.Case
test "generate simple escript" do
in_tmp "escripttest", fn ->
mix "new ."
main_module = "defmodule Escripttest do\ndef start do\n:ok = :application.start(:escripttest)\nend\ndef main(args) do\nIO.puts ... | Add miminal mix escriptize test | Add miminal mix escriptize test
| Elixir | apache-2.0 | beedub/elixir,kimshrier/elixir,gfvcastro/elixir,ggcampinho/elixir,pedrosnk/elixir,lexmag/elixir,kimshrier/elixir,elixir-lang/elixir,michalmuskala/elixir,joshprice/elixir,kelvinst/elixir,pedrosnk/elixir,antipax/elixir,lexmag/elixir,gfvcastro/elixir,ggcampinho/elixir,kelvinst/elixir,antipax/elixir,beedub/elixir | |
9bb4bff9c3b3cb30bf6dd21b266fdcaccc01bfb8 | test/marco_polo_misc_test.exs | test/marco_polo_misc_test.exs | defmodule MarcoPoloMiscTest do
use ExUnit.Case, async: true
import MarcoPolo
alias MarcoPolo.Document
alias MarcoPolo.RID
setup do
{:ok, conn} = MarcoPolo.start_link(
connection: {:db, "MarcoPoloTest", "plocal"},
user: TestHelpers.user(),
password: TestHelpers.password()
)
{:o... | Add a "misc" test case | Add a "misc" test case
I added the `MarcoPoloMiscTest` test case to test miscellaneous
interactions with the database. I'm not particularly happy with the name
of the test case (and with it being a regular test inside `test/`) as
probably this is better as an "integration" test, but for now it's fine.
| Elixir | apache-2.0 | MyMedsAndMe/marco_polo,linearregression/marco_polo | |
ecd41bfd95301e04af5200bf52871c82edeb65c7 | lib/farmbot/celery_script/ast/node/change_ownership.ex | lib/farmbot/celery_script/ast/node/change_ownership.ex | defmodule Farmbot.CeleryScript.AST.Node.ChangeOwnership do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
alias Farmbot.System.ConfigStorage
allow_args []
def execute(_, pairs, env) do
env = mutate_env(env)
pair_map = Map.new(pairs, fn(%{args: %{label: label, value: value}}) -> {label, value} en... | Add new cs node for changing environments | Add new cs node for changing environments
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os | |
6264a3f51413f067dec7d61cc0bcd45082a75ee3 | test/custom_route_test.exs | test/custom_route_test.exs | defmodule CoursePlanner.CustomRouteTest do
use CoursePlanner.ConnCase
alias CoursePlanner.CustomRoute
import CoursePlanner.Factory
setup(%{user_role: role}) do
{:ok, user: build(role, %{id: 1})}
end
describe "user_show_path" do
@tag user_role: :coordinator
test "coordinator goes to coordinato... | Add tests for custom route | Add tests for custom route
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner | |
e9fca5515e70c47d43ae6f525f95c34f0ede87e5 | farmbot_core/lib/farmbot_core/asset_helpers.ex | farmbot_core/lib/farmbot_core/asset_helpers.ex | defmodule FarmbotCore.AssetHelpers do
@moduledoc """
Helpers for the console at runtime.
Example:
iex()> use FarmbotCore.AssetHelpers
iex()> Repo.all(Device)
[%Device{}]
"""
@doc false
defmacro __using__(_opts) do
require Logger
Logger.warn "Don't use this in production please!"... | Add helper module for working with assets. | Add helper module for working with assets.
This saves a lot of typing when debugging issues from
iex
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os | |
a9d07a517976796d6655e28adf8d63bbe69406f8 | lib/drink_me/images.ex | lib/drink_me/images.ex | defmodule DrinkMe.Images do
def mogrify(path, changes) do
System.cmd "mogrify", mogrify_args(path, changes), stderr_to_stdout: true
path
end
def shrink(path) do
args = ~w(--quality=60-80 --ext=-shrunk.png -- #{path})
System.cmd "pngquant", args, stderr_to_stdout: true
shrunk_path = path <> "-... | Move mogrify/pngquant functions into a module | Move mogrify/pngquant functions into a module
| Elixir | mit | doomspork/drink_me | |
daaf64285b0807bffb2102be0eafc79e3e1fe04f | priv/repo/migrations/20190908224414_add-not-null-constraints-to-votes.exs | priv/repo/migrations/20190908224414_add-not-null-constraints-to-votes.exs | defmodule :"Elixir.RemoteRetro.Repo.Migrations.Add-not-null-constraints-to-votes" do
use Ecto.Migration
def up do
drop_if_exists index(:votes, [:user_id])
drop_if_exists index(:votes, [:idea_id])
drop constraint(:votes, "votes_user_id_fkey")
drop constraint(:votes, "votes_idea_id_fkey")
alter... | Add not null constraints to votes.{user_id, idea_id} | Add not null constraints to votes.{user_id, idea_id}
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
482ac1f4d7666190ca57bf68e1921f7a88b22740 | priv/repo/migrations/20170317210210_add_published_at_to_posts.exs | priv/repo/migrations/20170317210210_add_published_at_to_posts.exs | defmodule Tilex.Repo.Migrations.AddPublishedAtToPosts do
use Ecto.Migration
def change do
alter table(:posts) do
add :published_at, :timestamptz, null: false, default: fragment("now()")
end
end
end
| Add a published at time to post | Add a published at time to post
https://github.com/hashrocket/tilex/projects/1#card-1266821
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex | |
d1036a77a45986f8ea30fc355fc5cac873dbe200 | spec/atom_style_tweaks_web/page_metadata_spec.exs | spec/atom_style_tweaks_web/page_metadata_spec.exs | defmodule AtomStyleTweaksWeb.PageMetadata.Spec do
use ESpec.Phoenix
use Phoenix.HTML
alias AtomStyleTweaksWeb.PageMetadata
import Phoenix.ConnTest
@endpoint AtomStyleTweaksWeb.Endpoint
describe "set" do
let! :original_site_name, do: Application.get_env(:atom_style_tweaks, :site_name)
let :addit... | Convert PageMetadata tests to specs | Convert PageMetadata tests to specs
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks | |
ff1a8cc32ebfa03f6ec383d9739213ad496699ae | spec/atom_style_tweaks_web/markdown_engine_spec.exs | spec/atom_style_tweaks_web/markdown_engine_spec.exs | defmodule AtomStyleTweaksWeb.MarkdownEngine.Spec do
use ESpec.Phoenix, async: true
alias AtomStyleTweaksWeb.MarkdownEngine
def bad_func(_, _) do
raise "bummer"
end
def github(match, _) do
if match =~ ~r/@github/ || match =~ ~r/@both/ do
"github-replacement"
end
end
def tweaks(match, ... | Convert MarkdownEngine tests to specs | Convert MarkdownEngine tests to specs
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks | |
6631f286bc4dca757027f88bc64d4b650f7f8d98 | test/phoenix/transports/long_poller_test.exs | test/phoenix/transports/long_poller_test.exs | defmodule Phoenix.Tranports.LongPollerTest do
use ExUnit.Case, async: true
use ConnHelper
import ExUnit.CaptureIO
alias Phoenix.Transports.LongPoller
alias Phoenix.Tranports.LongPollerTest.Router
def conn_with_session(session \\ %{}) do
%Conn{private: %{plug_session: session}}
|> put_private(:phoen... | Add LongPoller controller unit tests. | Add LongPoller controller unit tests.
| Elixir | mit | evax/phoenix,ephe-meral/phoenix,Ben-Evolently/phoenix,VictorZeng/phoenix,jeffkreeftmeijer/phoenix,Kosmas/phoenix,keathley/phoenix,trarbr/phoenix,rodrigues/phoenix,javimolla/phoenix,ephe-meral/phoenix,gjaldon/phoenix,DavidAlphaFox/phoenix,mobileoverlord/phoenix,Gazler/phoenix,Joe-noh/phoenix,beni55/phoenix,paulcsmith/ph... | |
4a3baa271a94bf29e47e8ce29c536d73c9d782f0 | samples/issues/test/github_test.exs | samples/issues/test/github_test.exs | defmodule GitHubTest do
use ExUnit.Case
test "fetches data" do
import Issues.GitHub, only: [ fetch_issues: 2]
fetch_issues("thbar", "kiba")
end
end
| Add a test (careful, it will actually call http for real) | Add a test (careful, it will actually call http for real)
| Elixir | mit | thbar/elixir-playground | |
87a14857d2259db691e908716b839731ed71e5a3 | web/controllers/auth_controller.ex | web/controllers/auth_controller.ex | defmodule MyApp_7191136.AuthController do
use MyApp_7191136.Web, :controller
def index(conn, _params) do
redirect conn, external: "https://www.fitbit.com/oauth2/authorize"
end
end
| Add auth controller with hard-coded redirect url | Add auth controller with hard-coded redirect url
| Elixir | mit | wsmoak/my_app_7191136 | |
3e0e5f41ca8a60df4bb8373a70d0dfd87a3855eb | elixir/day3/day3.exs | elixir/day3/day3.exs | # Add a timeout to the pitcher or catcher. What happens when you time out?
ball_glove = fn -> receive do
{:pitch, pitcher} ->
send pitcher, {:catch, self()}
after
1_000 -> IO.puts "nothing after 1s in catcher"
end
end
catcher = spawn ball_glove
:timer.sleep(2000)
send catcher, {:pitch, self()}
receive... | Add elixir day 3 easy | Add elixir day 3 easy
| Elixir | mit | hemslo/seven-in-seven,hemslo/seven-in-seven,hemslo/seven-in-seven | |
899c3b7a937da62d31b67ab4344b876663203b42 | test/otp_test.exs | test/otp_test.exs | # allows standalone run
Code.require_file "test/test_helper.exs"
defmodule OTPTest do
use ExUnit.Case, async: true
# inspiration http://culttt.com/2016/08/24/understanding-genserver-elixir/
defmodule Storage do
use GenServer
# convenience method to start the module as a genserver
def start_li... | Implement simple state management with GenServer | Implement simple state management with GenServer
| Elixir | mit | thbar/elixir-playground | |
9f9869068e2f4b052cd965a5e73ca80ed86c6896 | lib/rqtl.ex | lib/rqtl.ex |
defmodule GnServer.Rqtl.Control do
defstruct crosstype: "", geno: "", pheno: "", phenocovar: "",
covar: "", gmap: "", alleles: [], genotypes: {}, sex: {},
cross_info: {}, x_chr: "", na_strings: []
@doc """
Parses a JSON-formatted R/QTL2 control file.
"""
def parse_control(path) do
{:ok, file} =... | Add module to parse control file & serve tracks, based on URI info in control file | Add module to parse control file & serve tracks,
based on URI info in control file
| Elixir | agpl-3.0 | genenetwork/gn_server,chfi/gn_server | |
06c2307e1ebf9ee9e1ee0bc606b88ede87b04f4b | lib/addict/plugs/authenticated.ex | lib/addict/plugs/authenticated.ex | defmodule Addict.Plugs.Authenticated do
@moduledoc """
Authenticated plug can be used to filter actions for users that are
authenticated.
"""
import Plug.Conn
use Phoenix.Controller
def init(options) do
options
end
@doc """
Call represents the use of the plug itself.
When called, it will a... | defmodule Addict.Plugs.Authenticated do
@moduledoc """
Authenticated plug can be used to filter actions for users that are
authenticated.
"""
import Plug.Conn
def init(options) do
options
end
@doc """
Call represents the use of the plug itself.
When called, it will assign `current_user` to `... | Call redirect method directly from Phoenix.Controller module | Call redirect method directly from Phoenix.Controller module
By calling "use" we were injecting the whole Controller code inside the plug,
which was not the objective. | Elixir | mit | trenpixster/addict,jjt/addict,mrluc/addict,trenpixster/addict,breakoutbit/addict,pap/addict,altenwald/addict,suranyami/addict,esbullington/addict |
c0b4a34edf4f861047da1469afd09545063e9795 | test/features/access_stage_help_test.exs | test/features/access_stage_help_test.exs | defmodule AccessStageHelpTest do
use RemoteRetro.IntegrationCase, async: false
import ShorterMaps
@tag [
retro_stage: "action-items",
]
test "Distributing action items via email", ~M{retro, session} do
retro_path = "/retros/" <> retro.id
visit(session, retro_path)
trigger_help(session)
... | Add end-to-end test for accessing stage help | Add end-to-end test for accessing stage help
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
c42bcb8fc2d0e1ae437325345e23847d3d6d1769 | test/wobserver/application_test.exs | test/wobserver/application_test.exs | defmodule Wobserver.ApplicationTest do
use ExUnit.Case
describe "port" do
test "returns a default port" do
assert Wobserver.Application.port > 0
end
test "returns a set port" do
:meck.new Application, [:passthrough]
:meck.expect Application, :get_env, fn (:wobserver, option, _) ->
... | Add test for main Application. (test: mode) | Add test for main Application. (test: mode) | Elixir | mit | shinyscorpion/wobserver,shinyscorpion/wobserver | |
692be7142f9c1829a9e6d7f0d4dafe6fc0e44e06 | priv/repo/migrations/20150720200301_add_index_for_postings_and_users.exs | priv/repo/migrations/20150720200301_add_index_for_postings_and_users.exs | defmodule ElixirStatus.Repo.Migrations.AddIndexForPostingsAndUsers do
use Ecto.Migration
def change do
create index(:postings, ["public", "published_at"])
create index(:users, ["provider", "user_name"])
end
end
| Add index on postings and users | Add index on postings and users
| Elixir | mit | lidashuang/elixirstatus-web,Hanspagh/elixirstatus-web,philnash/elixirstatus-web,rrrene/elixirstatus-web,rrrene/elixirstatus-web,fazibear/elixirstatus-web,Hanspagh/elixirstatus-web | |
a4d05a6bce8393b48dfcd638b84edc7c55676820 | rustler_mix/lib/mix/tasks/compile.rustler.ex | rustler_mix/lib/mix/tasks/compile.rustler.ex | defmodule Mix.Tasks.Compile.Rustler do
@moduledoc false
use Mix.Task
def run(_args) do
IO.puts([
IO.ANSI.yellow(),
"""
The `:rustler` compiler has been deprecated since v0.22.0 and will be
removed in v1.0.
To remove this warning, please consult the CHANGELOG for v0.22.0.
... | Add compiler task back in for backwards compatibility | Add compiler task back in for backwards compatibility
| Elixir | apache-2.0 | hansihe/Rustler | |
9073735f1c7dc7d4ff64677f85d273998482f008 | programming_elixir/chapter12/case2.ex | programming_elixir/chapter12/case2.ex | defmodule Bouncer do
dave = %{name: "Dave", age: 27}
case dave do
person = %{age: age} when is_number(age) and age >= 21 ->
IO.puts "You are cleared to enter the Foo Bar, #{person.name}"
_ ->
IO.puts "Sorry, no admission"
end
end
| Use of guard clauses with case | Use of guard clauses with case
| Elixir | mit | hectoregm/elixir | |
87a2f3131892db8a292c5fe23581fb6b5196fedd | elixir/day1/day1.exs | elixir/day1/day1.exs | defmodule Day1 do
# Express some geometry objects using tuples: a two-dimensional point, a line, a circle, a polygon, and a triangle.
point = {1, 2}
line = {{1, 2}, {1, 3}}
circle = {{1, 1}, 1 }
polygon = {{1, 2}, {1, 3}, {2, 3}, {2, 2}}
triangle = {{1, 2}, {3, 2}, {2, 3}}
# Write a function to compute the h... | Add elixir day 1 easy and medium | Add elixir day 1 easy and medium
| Elixir | mit | hemslo/seven-in-seven,hemslo/seven-in-seven,hemslo/seven-in-seven | |
2e4e2fe7c27eb045d6e61072cc39dc8a32f4de5f | priv/repo/migrations/20170205191245_add-ideas-table.exs | priv/repo/migrations/20170205191245_add-ideas-table.exs | defmodule :"Elixir.RemoteRetro.Repo.Migrations.Add-ideas-table" do
use Ecto.Migration
def change do
create table(:ideas) do
add :category, :string, null: false
add :body, :string, null: false
add :retro_id, references(:retros, [
column: :id,
type: :uuid,
on_delete: :de... | Add migration for creating ideas table, each idea associated to a retro | Add migration for creating ideas table, each idea associated to a retro
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro | |
fbc6a64387c561ec57b7a0d5300e8ede25cba2b2 | priv/repo/migrations/20201215025246_drop_event_types.exs | priv/repo/migrations/20201215025246_drop_event_types.exs | defmodule Erlef.Repo.Migrations.DropEventTypes do
use Ecto.Migration
def change do
alter table(:events) do
remove(:event_type_id)
end
drop table(:event_types)
end
end
| Add migration to remove event_types | Add migration to remove event_types
| Elixir | apache-2.0 | simplabs/website,simplabs/website | |
cc711f98f6de3daee8883d77c113bb9941609add | api/test/unit/worker/mapper_test.exs | api/test/unit/worker/mapper_test.exs | defmodule MapperTest do
# todo rename Mapper to Worker.Mapper
use ExUnit.Case
use Plug.Test
test "convert type to category" do
change = %{ doc: %{ resource: %{ type: "abc" }}}
%{ doc: %{ resource: resource }} = Mapper.process change
assert resource[:type] == nil
assert resource.cat... | Add test; prepare period field conversion | Add test; prepare period field conversion
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web | |
ad04f098f4b77fb7aeaa0331b39148983a5caa4f | v02/ch13/case2.edit1.exs | v02/ch13/case2.edit1.exs | user = %User{name: "Alice"}
list = [100, [1, 2, 3], %{value: 7}, user, true]
for e <- list do
x = case e do
n when is_integer(n) -> n
l when is_list(l) -> Enum.join(l, ":")
%{__struct__: User} = u -> "name = #{u.name}"
m when is_map(m) -> "value = #{m.value}"
b when is_boolean(b) -> b
end
IO.p... | Add an example for v02/ch13 | Add an example for v02/ch13
| Elixir | mit | oiax/elixir-primer | |
a5ddae5ee8108cb0b660797708106b9a79120724 | blue_sky/priv/repo/migrations/20160603170449_remove_foreign_key_constraint.exs | blue_sky/priv/repo/migrations/20160603170449_remove_foreign_key_constraint.exs | defmodule BlueSky.Repo.Migrations.RemoveForeignKeyConstraint do
use Ecto.Migration
def change do
alter table(:guesses) do
remove :question_id
add :question_id, :integer
end
end
end
| Add migration to get rid of foreign key constraints | Add migration to get rid of foreign key constraints
| Elixir | mit | Rumel/bluesky,Rumel/bluesky,Rumel/bluesky | |
4c1ffdd199f4c1b72df6b3eb2b642145d1d9f97a | web/controllers/preference_controller.ex | web/controllers/preference_controller.ex | defmodule EspiDni.PreferenceController do
use EspiDni.Web, :controller
alias EspiDni.Team
plug :authenticate
def update(conn, %{"team" => team_params}) do
team = conn.assigns.current_team
changeset = Team.changeset(team, team_params)
case Repo.update(changeset) do
{:ok, team} ->
con... | Put back controller removed by mistake | Put back controller removed by mistake
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni | |
2ca412405d50ee4ee0056bffb8ea81d63d3abcb1 | priv/repo/migrations/20171028173508_update_null_comment_values_from_github_integrations.exs | priv/repo/migrations/20171028173508_update_null_comment_values_from_github_integrations.exs | defmodule CodeCorps.Repo.Migrations.UpdateNullCommentValuesFromGithubIntegrations do
use Ecto.Migration
@consecutive_whitespace_regex ~r/\s+/
def up do
execute created_at_update()
execute created_from_update()
execute modified_at_update()
execute modified_from_update()
end
def down do
... | Update existing comment timestamps/*_from values | Update existing comment timestamps/*_from values
| Elixir | mit | code-corps/code-corps-api,code-corps/code-corps-api | |
08f8348ff3442a3894b60434db3f4e817869c8c4 | test/serum/site_builder_startup_test.exs | test/serum/site_builder_startup_test.exs | defmodule SiteBuilderStartupTest do
use ExUnit.Case, async: true
alias Serum.SiteBuilder
test "starting and stopping" do
Process.flag :trap_exit, true
# Start a SiteBuilder process and make sure all subprocesses are alive.
{:ok, pid} = SiteBuilder.start_link "", ""
processes =
[:build_data,... | Add some tests for Serum.SiteBuilder | Add some tests for Serum.SiteBuilder
| Elixir | mit | Dalgona/Serum | |
e86cc8ac3362684755dc22d45bce92cb77c4fe80 | lib/evercam_media/snapshot/cam_client.ex | lib/evercam_media/snapshot/cam_client.ex | defmodule EvercamMedia.Snapshot.CamClient do
@moduledoc """
Client to talk with the camera for various data. Currently this only fetches snapshots.
In future, we could expand this module to check camera status, video stream etc.
"""
alias EvercamMedia.HTTPClient
alias EvercamMedia.Snapshot.Util
@doc """... | Create cam client for talking to cameras | Create cam client for talking to cameras
Refactored from the current camera workers, cam_client is intended for
all communication with the client. Right now it only supports fetching a snapshot.
However, in future this module is intended to handle all requests to camera like
status check, video streams etc.
| Elixir | agpl-3.0 | shankardevy/evercam-media,shankardevy/evercam-media,evercam/evercam-server,evercam/evercam-server,shankardevy/evercam-media,evercam/evercam-media | |
eca276e7212726c6d9e2984e661ca0b6eb267c74 | scripts/release_candidate.exs | scripts/release_candidate.exs | #!/usr/bin/env elixir
{_, 0} = System.cmd("git", ["checkout", "staging"], into: IO.stream(:stdio, :line))
{_, 0} = System.cmd("git", ["fetch", "--all"], into: IO.stream(:stdio, :line))
{_, 0} = System.cmd("git", ["reset", "--hard", "origin/staging"], into: IO.stream(:stdio, :line))
version = File.read!("VERSION") |> Ve... | Add script for creating release candidate builds | Add script for creating release candidate builds
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os | |
154c903a2b87a44067692152b096fc44f07faefc | test/release_upgrade_test.exs | test/release_upgrade_test.exs | defmodule Appsignal.ReleaseUpgradeTest do
use ExUnit.Case
use Appsignal.Config
test "config_change/3" do
Appsignal.Config.initialize()
assert false == config[:skip_session_data]
# when doing a release upgrade, all runtime-set envirnoment variables get reset
Application.delete_env(:appsignal, :... | Add test for re-initializing the config when doing a release upgrade | Add test for re-initializing the config when doing a release upgrade
Issue #71
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir | |
d837ec45d7bbad9519b6d66fff4145140812c236 | priv/repo/migrations/20140115123327_create_users.exs | priv/repo/migrations/20140115123327_create_users.exs | defmodule Repo.Migrations.CreateUsers do
use Ecto.Migration
def up do
"CREATE TABLE IF NOT EXISTS users(id serial primary key, first_name text, last_name text, email text, role text, encrypted_password text)"
end
def down do
"DROP TABLE users"
end
end
| Update migration with role field | Update migration with role field
| Elixir | mit | louishawkins/mogo-chat,sashafklein/bloc-mogo,sashafklein/bloc-mogo,louishawkins/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,di-stars/mogo-chat,di-stars/mogo-chat,HashNuke/mogo-chat,di-stars/mogo-chat,louishawkins/mogo-chat,sashafklein/bloc-mogo | |
06aa3648adf29aa24df104a0debd7ac78c28d69a | test/integration_test.exs | test/integration_test.exs | defmodule IntegrationTest do
use ExUnit.Case, async: false
alias Mix.Releases.Utils
@standard_app_path Path.join([__DIR__, "fixtures", "standard_app"])
@standard_output_path Path.join([__DIR__, "fixtures", "standard_app", "rel", "standard_app"])
@umbrella_app_path Path.join([__DIR__, "fixtures", "umbrella_a... | Add integration test for standard application | Add integration test for standard application
| Elixir | mit | bitwalker/distillery,jsierles/distillery,bitwalker/distillery,jsierles/distillery | |
522773002f424a4745b84d1d1ddd59423d091a21 | priv/repo/migrations/20171024231712_create_votes_table.exs | priv/repo/migrations/20171024231712_create_votes_table.exs | defmodule RemoteRetro.Repo.Migrations.CreateVotesTable do
use Ecto.Migration
def change do
create table(:votes) do
add :user_id, references(:users, [
column: :id,
on_delete: :nothing
])
add :idea_id, references(:ideas, [
column: :id,
on_delete: :nothing
... | Add migration for votes table | Add migration for votes table
| Elixir | mit | samdec11/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
a7dec36bfa955b78ec7f429ec152172c4cf11079 | test/job_test.exs | test/job_test.exs | defmodule Kitto.JobTest do
use ExUnit.Case, async: true
use Plug.Test
test "#start calls the given job after the given interval" do
pid = self
job = fn (_) -> send pid, :ok end
interval = 100
spawn(Kitto.Job, :new, [interval, job])
:timer.sleep(interval + 10)
assert_received :ok
end
... | Add some tests for Kitto.Job | Add some tests for Kitto.Job
| Elixir | mit | kittoframework/kitto,kittoframework/kitto | |
9bcf695534a8eefdb6dfe9df3b01cdce453f89a3 | priv/repo/migrations/20201115160132_remove_unused_indexes.exs | priv/repo/migrations/20201115160132_remove_unused_indexes.exs | defmodule RemoteRetro.Repo.Migrations.RemoveUnusedIndexes do
use Ecto.Migration
def change do
drop index(:ideas, [:group_id])
drop index(:ideas, [:user_id])
drop index(:ideas, [:assignee_id])
drop index(:retros, [:facilitator_id])
end
end
| Remove unused indexes surfaced by phoenix_live_dashboard | Remove unused indexes surfaced by phoenix_live_dashboard
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | |
24927ecb55654865ff631d74c4b581a5919cfc42 | lib/mix/plugins/exrm_conform.ex | lib/mix/plugins/exrm_conform.ex | if Code.ensure_loaded?(ReleaseManager.Plugin) do
defmodule ReleaseManager.Plugin.Conform do
@name "conform"
@shortdoc "Generates a .conf for your release"
@moduledoc """
Generates a .conf for your release
This plugin ensures that your application has a .schema.exs
and .conf file for setting u... | Move exrm/conform plugin to conform project | Move exrm/conform plugin to conform project
| Elixir | mit | bitwalker/conform | |
4b5c4dac834ac926c24061987592d4f3fea3cb55 | lib/who_web/presenters/member_presenter.ex | lib/who_web/presenters/member_presenter.ex | defmodule WhoWeb.MemberPresenter do
@typedoc """
This Presenter creates a data object containing all the
important information regarding a Member.
"""
alias WhoWeb.MemberView
@type t :: %__MODULE__{
name: String.t(),
title: String.t(),
state: String.t(),
party: String.t(),
chamber: ... | Create MemberPresenter and begin populating with MemberView functions | Create MemberPresenter and begin populating with MemberView functions
| Elixir | mit | ryancharris/who,ryancharris/who |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.