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 |
|---|---|---|---|---|---|---|---|---|---|
51cb681d117e267a36fa3b028ad8f1457c1f5a17 | test/kitsune_test.exs | test/kitsune_test.exs | defmodule Person do
defstruct name: nil, age: nil
end
defmodule PersonRepresenter do
use Kitsune.JSON
property :name
property :age
end
defmodule KitsuneTest do
use ExUnit.Case
doctest Kitsune
test "the truth" do
person = %Person{name: "Nikki", age: 18}
PersonRepresenter.to_json(person)
e... | defmodule Person do
defstruct name: nil, age: nil
end
defmodule PersonRepresenter do
use Kitsune.JSON
property :name
property :age
end
defmodule KitsuneTest do
use ExUnit.Case
doctest Kitsune
test "Transforms data to json" do
person = %Person{name: "Nikki", age: 18}
{:ok, json} = PersonRep... | Update test to verify the json returned. | Update test to verify the json returned.
| Elixir | mit | edubkendo/kitsune |
c4a77d5f061e24331f335f4e21b321b381fb5606 | test/support/test_app.ex | test/support/test_app.ex | defmodule TestApp.Router do
use Phoenix.Router
forward "/frontends", PhoenixFrontendDeploys.Web
end
defmodule TestApp do
use Phoenix.Endpoint, otp_app: :test_app
plug TestApp.Router
end
| defmodule TestApp.Router do
use Phoenix.Router
get "/frontends", PhoenixFrontendDeploys.FrontendController, :index
get "/revisions", TestController, :index
post "revisions/activate", TestController, :activate
end
defmodule TestApp do
use Phoenix.Endpoint, otp_app: :test_app
plug TestApp.Router
end
defm... | Make the TestApp match the new API | Make the TestApp match the new API
| Elixir | mit | mfeckie/phoenix_frontend_deploys,mfeckie/phoenix_frontend_deploys |
b39101efb86da2e6a0cc54c05e44518398ab4315 | test/models/retro_test.exs | test/models/retro_test.exs | defmodule RemoteRetro.RetroTest do
use RemoteRetro.ModelCase
describe "JSON encoding of the model struct" do
test "is enabled" do
idea = %RemoteRetro.Retro{id: 5, stage: "idea-generation"}
encoded = Poison.encode!(idea)
assert encoded =~ ~r/"id":5/i
assert encoded =~ ~r/"stage":"idea-... | defmodule RemoteRetro.RetroTest do
use RemoteRetro.ModelCase
alias RemoteRetro.Retro
describe "JSON encoding of the model struct" do
test "is enabled" do
idea = %Retro{id: 5, stage: "idea-generation"}
encoded = Poison.encode!(idea)
assert encoded =~ ~r/"id":5/i
assert encoded =~ ~r/... | Use alias in retro test | Use alias in retro test
| Elixir | mit | tnewell5/remote_retro,stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro |
404612992b1de7a16b0e70cf892da931fcf2abfe | lib/web/socket_handler.ex | lib/web/socket_handler.ex | defmodule ExBees.SocketHandler do
@behaviour :cowboy_websocket_handler
def init(_, _req, _opts) do
{:upgrade, :protocol, :cowboy_websocket}
end
# TODO: add infinite timeout
@timeout 60000 # terminate if no activity for one minute
#Called on websocket connection initialization.
def websocket_init(_t... | defmodule ExBees.SocketHandler do
@behaviour :cowboy_websocket_handler
def init(_, _req, _opts) do
{:upgrade, :protocol, :cowboy_websocket}
end
#Called on websocket connection initialization.
def websocket_init(_type, req, _opts) do
state = %{}
{:ok, req, state}
end
# Handle other message... | Disable timout for websocket connection | Disable timout for websocket connection
| Elixir | mit | Mehonoshin/ex_bees |
d57fdacca96d224c1f73cba4d411644c8cde52b7 | test/features/stage_progression_realtime_update_test.exs | test/features/stage_progression_realtime_update_test.exs | defmodule StageProgressionRealtimeUpdateTest do
use RemoteRetro.IntegrationCase, async: false
import ShorterMaps
test "realtime stage progression for connected users", ~M{retro, session: facilitator_session, non_facilitator} do
participant_session = new_authenticated_browser_session(non_facilitator)
ret... | defmodule StageProgressionRealtimeUpdateTest do
use RemoteRetro.IntegrationCase, async: false
import ShorterMaps
@tag [
retro_stage: "prime-directive",
]
test "realtime stage progression for connected users", ~M{retro, session: facilitator_session, non_facilitator} do
participant_session = new_authe... | Build performance: shift RealTimeStageProgressionTest to proceed from prime directive to idea generation | Build performance: shift RealTimeStageProgressionTest to proceed from prime directive to idea generation
- this saves several user iteractions in the test that we don't actually need to go through, as previously the retro started in the idea generation stage, and the automated user had to have an idea submitted befo... | Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
ec6594cf4c488867c0ee79917c3142e0c670892b | web/router.ex | web/router.ex | defmodule Gatekeeper.Router do
use Gatekeeper.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :browser_session do
plug Guardian.Plug.VerifySession
plug Guardian.... | defmodule Gatekeeper.Router do
use Gatekeeper.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :requires_auth do
plug Guardian.Plug.VerifySession
plug Guardian.Pl... | Make the pipeline name more obvious to its intent | Make the pipeline name more obvious to its intent | Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
449a7875ba9953e33eb2059fa26dc002e6f371d0 | test/views/layout_view_test.exs | test/views/layout_view_test.exs | defmodule RemoteRetro.LayoutViewTest do
use RemoteRetro.ConnCase, async: true
alias RemoteRetro.LayoutView
test "app_js is served by the webpack dev server (at port 5001) in dev" do
Mix.env(:dev)
conn = get build_conn(), "/"
assert LayoutView.app_js(conn) =~ "localhost:5001"
Mix.env(:test... | defmodule RemoteRetro.LayoutViewTest do
use RemoteRetro.ConnCase, async: false
alias RemoteRetro.LayoutView
test "app_js is served by the webpack dev server (at port 5001) in dev" do
Mix.env(:dev)
conn = get build_conn(), "/"
assert LayoutView.app_js(conn) =~ "localhost:5001"
Mix.env(:tes... | Set view test that manipultes mix env to async to false to avoid corrupting other tests | Set view test that manipultes mix env to async to false to avoid corrupting other tests
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,samdec11/remote_retro |
f5c74e9added7621f45a629583af3ce296231e5b | lib/jumubase_web/controllers/internal/stage_controller.ex | lib/jumubase_web/controllers/internal/stage_controller.ex | defmodule JumubaseWeb.Internal.StageController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Foundation.Contest
plug :add_home_breadcrumb
plug :add_breadcrumb, name: gettext("Contests"), path_fun: &Routes.internal_contest_path/2, action: :index
# Check nested contest permissions... | defmodule JumubaseWeb.Internal.StageController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Foundation.Contest
plug :add_home_breadcrumb
plug :add_breadcrumb, name: gettext("Contests"), path_fun: &Routes.internal_contest_path/2, action: :index
# Check nested contest permissions... | Sort stages by name before displaying them to user | Sort stages by name before displaying them to user
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
a12087cdeffde1b2a1f256ab338d78ca87574f20 | lib/jumubase_web/controllers/api/performance_controller.ex | lib/jumubase_web/controllers/api/performance_controller.ex | defmodule JumubaseWeb.Api.PerformanceController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Showtime
alias Jumubase.Showtime.PerformanceFilter
def index(conn, %{"contest_id" => contest_id, "venue_id" => stage_id, "date" => date} = params) do
contest = Foundation.get_contest!(... | defmodule JumubaseWeb.Api.PerformanceController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Foundation.Contest
alias Jumubase.Showtime
alias Jumubase.Showtime.PerformanceFilter
def index(conn, %{"contest_id" => contest_id, "venue_id" => stage_id, "date" => date}) do
contest... | Clean up /performances endpoint logic in REST API | Clean up /performances endpoint logic in REST API
This changes the controller to support two sets of params when asking for performances: Either by venue and date, or by contest category and results public flag.
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
36960c93ab503372d0cbdd8f9ebe1da3c71f75ce | priv/repo/migrations/20170204224749_create_food.exs | priv/repo/migrations/20170204224749_create_food.exs | defmodule OpenPantry.Repo.Migrations.CreateFood do
use Ecto.Migration
alias OpenPantry.Food
def change do
create table(:foods) do
add :name, :string
add :serving_size, :decimal
add :calories, :integer
add :calories_from_fat, :integer
add :calcium, :integer
add :sodium, :in... | defmodule OpenPantry.Repo.Migrations.CreateFood do
use Ecto.Migration
alias OpenPantry.Food
def up do
create table(:foods) do
add :name, :string
add :serving_size, :decimal
add :calories, :integer
add :calories_from_fat, :integer
add :calcium, :integer
add :sodium, :intege... | Fix irreversible migration to separate up/down | Fix irreversible migration to separate up/down | Elixir | mit | MasbiaSoupKitchenNetwork/open_pantry,bglusman/open_pantry,openpantry/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,openpantry/open_pantry,fcapovilla/open_pantry,openpantry/open_pantry,fcapovilla/open_pantry,bglusman/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,openpantry/open_pantry,bglusman/open_pantry,fcapovil... |
a77a93fecf301d6b23235eecd7beebe1a31a760e | lib/serum/plugin/macros.ex | lib/serum/plugin/macros.ex | defmodule Serum.Plugin.Macros do
@moduledoc false
_moduledocp = "Provides macros for defining the `Serum.Plugin` module."
defmacro defcallback({:"::", _, [{name, meta, args} = call, return]}) do
arg_expr = quote(do: args :: term())
quote do
@callback unquote(call) :: unquote(return)
@callba... | defmodule Serum.Plugin.Macros do
@moduledoc false
_moduledocp = "Provides macros for defining the `Serum.Plugin` module."
defmacro defcallback({:::, _, [{name, meta, args} = call, return]}) do
arg_expr = quote(do: args :: term())
quote do
@callback unquote(call) :: unquote(return)
@callback... | Format the code for Elixir v1.8.x | Format the code for Elixir v1.8.x
| Elixir | mit | Dalgona/Serum |
4b1f51b6f4a6d249039d841a76a10eb7e4ffdfb0 | test/support/hello_world_web_server.ex | test/support/hello_world_web_server.ex | defmodule HelloWorldWebServer do
def start(port) do
args = [
bind_address: 'localhost',
port: port,
ipfamily: :inet,
modules: [__MODULE__],
server_name: 'Hello World',
server_root: '.',
document_root: '.'
]
:inets.start(:httpd, args, :stand_alone)
end
def unq... | defmodule HelloWorldWebServer do
def start(port) do
args = [
bind_address: 'localhost',
port: port,
ipfamily: :inet,
modules: [__MODULE__],
server_name: 'Hello World',
server_root: '.',
document_root: '.'
]
:inets.start(:httpd, args, :stand_alone)
end
def unq... | Fix a warning about unused data | Fix a warning about unused data
| Elixir | mit | DNNX/badging |
23ed62df774861f13d7dadd3d39ed657e45a369e | test/serum_test.exs | test/serum_test.exs | defmodule SerumTest do
use ExUnit.Case, async: true
import Serum
@tag :skip
test "start/2" do
end
test "init_data/0" do
init_data()
assert %{} == build_data()
end
test "put_data/2" do
init_data()
put_data(:a, 1)
assert %{a: 1} == build_data()
end
test "get_data/1" do
init... | defmodule SerumTest do
use ExUnit.Case, async: true
import Serum
@tag :skip
test "start/2" do
end
test "init_data/0" do
init_data()
assert %{} == build_data()
end
test "put_data/2" do
init_data()
put_data("key", 123)
assert %{"key" => 123} == build_data()
end
test "get_data/1... | Add more tests for `Serum` module | Add more tests for `Serum` module
| Elixir | mit | Dalgona/Serum |
1426f9b0a7114a2238fcab16686e1f2f97914cd4 | apps/admin/config/dev.exs | apps/admin/config/dev.exs | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :emporium_admin, EmporiumAdmin.Endpoint,
http:... | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :emporium_admin, EmporiumAdmin.Endpoint,
http:... | Change Dev Port to 4001 | Change Dev Port to 4001
| Elixir | apache-2.0 | jsqu99/emporium,cas27/emporium |
6f2c751e2b06e884c46b2391d80539439478e1bb | test/credo/check_test.exs | test/credo/check_test.exs | defmodule Credo.CheckTest do
use Credo.TestHelper
alias Credo.Check
@generated_lines 1000
test "it should determine the correct scope for long modules in reasonable time" do
source_file =
"""
# some_file.ex
defmodule AliasTest do
def test do
[
#{for _ <- 1..@gener... | defmodule Credo.CheckTest do
use Credo.TestHelper
alias Credo.Check
@generated_lines 1000
test "it should determine the correct scope for long modules in reasonable time" do
source_file =
"""
# some_file.ex
defmodule AliasTest do
def test do
[
#{for _ <- 1..@gener... | Clarify time measured via :timer.tc/1 | Clarify time measured via :timer.tc/1
| Elixir | mit | rrrene/credo,rrrene/credo |
bfb4bbadc5d368b6120182b4d4c7574ab383f0eb | installer/mix.exs | installer/mix.exs | defmodule Phx.New.MixProject do
use Mix.Project
def project do
[
app: :phx_new,
start_permanent: Mix.env == :prod,
version: "1.4.0-dev",
elixir: "~> 1.5"
]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
... | defmodule Phx.New.MixProject do
use Mix.Project
@url "https://github.com/phoenixframework/phoenix/installer"
def project do
[
app: :phx_new,
start_permanent: Mix.env() == :prod,
version: "1.4.0-dev",
elixir: "~> 1.5",
package: [
maintainers: [
"Chris McCord",
... | Add hex config to support phx_new package | Add hex config to support phx_new package
| Elixir | mit | evax/phoenix,eksperimental/phoenix,0x00evil/phoenix,michalmuskala/phoenix,Kosmas/phoenix,phoenixframework/phoenix,nshafer/phoenix,optikfluffel/phoenix,keathley/phoenix,jwarwick/phoenix,Gazler/phoenix,dmarkow/phoenix,michalmuskala/phoenix,Joe-noh/phoenix,eksperimental/phoenix,Joe-noh/phoenix,keathley/phoenix,jwarwick/ph... |
86d5495bb3eb0154da7270ab51399c7e2e11b434 | lib/credo/cli.ex | lib/credo/cli.ex | defmodule Credo.CLI do
@moduledoc """
`Credo.CLI` is the entrypoint for both the Mix task and the escript.
It takes the parameters passed from the command line and translates them into
a Command module (see the `Credo.CLI.Command` namespace), the work directory
where the Command should run and a `Credo.Execu... | defmodule Credo.CLI do
@moduledoc """
`Credo.CLI` is the entrypoint for both the Mix task and the escript.
It takes the parameters passed from the command line and translates them into
a Command module (see the `Credo.CLI.Command` namespace), the work directory
where the Command should run and a `Credo.Execu... | Use exit/1 instead of System.halt/1 | Use exit/1 instead of System.halt/1
| Elixir | mit | rrrene/credo,rrrene/credo |
fe8f4c4cdc85e275a438de6eb12659ee2e263164 | lib/tilex_web/controllers/api/developer_post_controller.ex | lib/tilex_web/controllers/api/developer_post_controller.ex | defmodule TilexWeb.Api.DeveloperPostController do
use TilexWeb, :controller
def index(conn, params) do
posts = Tilex.Posts.by_developer(params["username"], limit: 3)
render(conn, "index.json", posts: posts)
end
end
| defmodule TilexWeb.Api.DeveloperPostController do
@moduledoc """
This module implements a public API for querying Tilex data.
"""
use TilexWeb, :controller
alias Tilex.{Posts}
@doc """
This function allows external requesters to retrieve a developer's three most
recent posts.
"""
def index(conn, p... | Document our user-facing API module and function | Document our user-facing API module and function
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
138a2d952c588d537a771009f712e50499307701 | priv/repo/migrations/20170614234439_nilify_all_task_volunteer.exs | priv/repo/migrations/20170614234439_nilify_all_task_volunteer.exs | defmodule CoursePlanner.Repo.Migrations.NilifyAllTaskVolunteer do
use Ecto.Migration
def change do
drop_if_exists index(:tasks, [:user_id])
alter table(:tasks) do
modify :user_id, references(:users, on_delete: :nilify_all)
end
end
end
| defmodule CoursePlanner.Repo.Migrations.NilifyAllTaskVolunteer do
use Ecto.Migration
def change do
drop_if_exists index(:tasks, [:user_id])
alter table(:tasks) do
remove :user_id
add :user_id, references(:users, on_delete: :nilify_all)
end
end
end
| Revert "Revert "Fix weird behavior on migration."" | Revert "Revert "Fix weird behavior on migration.""
This reverts commit 333dc3efdd2ce3cc95eacd78d922fb784cbcca46.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
7414c8e74305819b89f73c6903d764bb0eeb1136 | lib/neoboard/widget_supervisor.ex | lib/neoboard/widget_supervisor.ex | defmodule Neoboard.WidgetSupervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
cond do
Neoboard.Widgets.auto_start? ->
children = Enum.map(Neoboard.Widgets.enabled, &(worker(&1, [])))
true ->
children = []
end
super... | defmodule Neoboard.WidgetSupervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
cond do
Neoboard.Widgets.auto_start? ->
children = Enum.map(Neoboard.Widgets.enabled, &(worker(&1, [])))
true ->
children = []
end
super... | Allow 20 restarts for widget workers | Allow 20 restarts for widget workers
| Elixir | mit | neopoly/neoboard,neopoly/neoboard,neopoly/neoboard |
c035554228af824252ba4f8bea5c39f20ce3e044 | test/models/company_test.exs | test/models/company_test.exs | defmodule Gatekeeper.CompanyTest do
use Gatekeeper.ModelCase
alias Gatekeeper.Company
@valid_attrs %{departure_date: "2010-04-17 14:00:00", join_date: "2010-04-17 14:00:00", name: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = Company.changeset(%Company{}, @val... | defmodule Gatekeeper.CompanyTest do
use Gatekeeper.ModelCase
alias Gatekeeper.Company
@valid_attrs %{departure_date: "2010-04-17 14:00:00", join_date: "2010-04-17 14:00:00", name: "some content"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = Company.changeset(%Company{}, @val... | Add specs on company active? | Add specs on company active? | Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
431051e4d2a395e23301d6aa138d79c6cffb7628 | mix.exs | mix.exs | defmodule SendgridElixir.Mixfile do
use Mix.Project
def project do
[app: :sendgrid,
version: "0.0.2",
elixir: "~> 1.2",
package: package,
description: description,
source_url: project_url,
homepage_url: project_url,
build_embedded: Mix.env == :prod,
start_permanent: Mix.... | defmodule SendGrid.Mixfile do
use Mix.Project
def project do
[app: :sendgrid,
version: "0.0.2",
elixir: "~> 1.2",
package: package,
description: description,
source_url: project_url,
homepage_url: project_url,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env ==... | Rename module to match rest of project | Rename module to match rest of project
| Elixir | mit | alexgaribay/sendgrid_elixir |
49637a88a4a80f71f10d86d874cc1b7a58595363 | config/test.exs | config/test.exs | use Mix.Config
config :phoenix_frontend_deploys,
asset_directory: System.cwd <> "/test/frontend_assets",
live_filename: "live"
| use Mix.Config
config :phoenix_frontend_deploys,
asset_directory: System.cwd <> "/test/frontend_assets",
live_filename: "live"
# This is so we can test the controllers
config :phoenix,
format_encoders: [json: Poison]
| Add some phoenix config to all JSON encoding | Add some phoenix config to all JSON encoding
| Elixir | mit | mfeckie/phoenix_frontend_deploys,mfeckie/phoenix_frontend_deploys |
0c432e764f3d904f2e8ab73dc02053e6d3eb7b56 | vivaldi/lib/peer/coordinate_logger.ex | vivaldi/lib/peer/coordinate_logger.ex | defmodule Vivaldi.Peer.CoordinateStash do
@moduledoc """
All coordinate-update events are sent here. Events are logged to stdout.
TODO: Also log events to a centralized log aggregator.
"""
use GenServer
require Logger
# API
def start_link(node_id) do
GenServer.start_link(__MODULE__, {}, name: g... | defmodule Vivaldi.Peer.CoordinateLogger do
@moduledoc """
All coordinate-update events are sent here. Events are logged to stdout.
TODO: Also log events to a centralized log aggregator.
"""
use GenServer
require Logger
# API
def start_link(config) do
node_id = config[:node_id]
GenServer.sta... | Configure CoordinateLogger using config module | Configure CoordinateLogger using config module
| Elixir | mit | pixyj/vivaldi,pixyj/vivaldi |
f8273fd990a35c7c67690a7a2404be5003296807 | mix.exs | mix.exs | defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[
app: :phoenix,
version: "0.3.1",
elixir: "~> 0.14.2",
deps: deps(Mix.env),
package: [
contributors: ["Chris McCord", "Darko Fabijan"],
licenses: ["MIT"],
links: [github: "https://github.com/phoen... | defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[
app: :phoenix,
version: "0.3.1",
elixir: "~> 0.14.2",
deps: deps(Mix.env),
package: [
contributors: ["Chris McCord", "Darko Fabijan"],
licenses: ["MIT"],
links: [github: "https://github.com/phoen... | Make calliope an optional dep | Make calliope an optional dep
| Elixir | mit | begleynk/phoenix,paulcsmith/phoenix,cas27/phoenix,greyhwndz/phoenix,henrik/phoenix,yoavlt/phoenix,bsodmike/phoenix,stevedomin/phoenix,lono-devices/phoenix,optikfluffel/phoenix,jamilabreu/phoenix,mitchellhenke/phoenix,romul/phoenix,optikfluffel/phoenix,korobkov/phoenix,DavidAlphaFox/phoenix,lancehalvorsen/phoenix,Cultiv... |
f7670bfe76ab2408a1445094c20a1feca91cfd98 | lib/mix/tasks/battle_snake/createdb.ex | lib/mix/tasks/battle_snake/createdb.ex | defmodule Mix.Tasks.BattleSnake.Createdb do
alias BattleSnake.GameForm
use Mix.Task
@shortdoc "creates the mnesia database"
def run(_) do
:stopped = :mnesia.stop
:ok = :mnesia.delete_schema([node()])
:ok = :mnesia.create_schema([node()])
:ok = :mnesia.start()
{:atomic, :ok} = :mnesia.creat... | defmodule Mix.Tasks.BattleSnake.Createdb do
alias BattleSnake.GameForm
use Mix.Task
@shortdoc "creates the mnesia database"
def run(_) do
:stopped = :mnesia.stop
:ok = :mnesia.delete_schema([node()])
:ok = :mnesia.create_schema([node()])
:ok = :mnesia.start()
{:atomic, :ok} = :mnesia.crea... | Maintain a disk copy of the game form table. | Maintain a disk copy of the game form table.
| Elixir | agpl-3.0 | Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake |
394baa388fd294fe18ca2b873e57bc094f2315a5 | test/integration/adapters/sendgrid_test.exs | test/integration/adapters/sendgrid_test.exs | defmodule Swoosh.Integration.Adapters.SendgridTest do
use ExUnit.Case, async: true
import Swoosh.Email
@moduletag integration: true
setup_all do
config = [api_key: System.get_env("SENDGRID_API_KEY"), domain: Sytem.get_env("SENDGRID_DOMAIN")]
{:ok, config: config}
end
test "simple deliver", %{con... | defmodule Swoosh.Integration.Adapters.SendgridTest do
use ExUnit.Case, async: true
import Swoosh.Email
@moduletag integration: true
setup_all do
config = [api_key: System.get_env("SENDGRID_API_KEY"), domain: System.get_env("SENDGRID_DOMAIN")]
{:ok, config: config}
end
test "simple deliver", %{co... | Fix typo in Sendgrid integration tests | Fix typo in Sendgrid integration tests
| Elixir | mit | dbulic/swoosh,swoosh/swoosh |
c6e393ffc973e40ca0fd466f7e43d2482279bd58 | mix.exs | mix.exs | defmodule Rotor.Mixfile do
use Mix.Project
def project do
[app: :rotor,
version: "0.2.0",
elixir: ">= 0.14.2",
description: description,
package: package,
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def applica... | defmodule Rotor.Mixfile do
use Mix.Project
def project do
[app: :rotor,
version: "0.2.0",
elixir: ">= 0.14.2",
description: description,
package: package,
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def applica... | Add license to hex config | Add license to hex config
| Elixir | mit | HashNuke/rotor |
e9423eb46f1eb13700bc287ead7caf241ec073a4 | lib/phoenix_poker/utils.ex | lib/phoenix_poker/utils.ex | defmodule PhoenixPoker.Utils do
use Timex
@moduledoc false
def yyyymmdd_now() do
now = Timex.now("-9")
now.year * 10000 + now.month * 100 + now.day
end
def dollars_n_cents(cents) do
'$' ++ Float.to_string(cents / 100)
end
def mailto_link(game_night) do
subj = "Poker Results: #{game... | defmodule PhoenixPoker.Utils do
use Timex
@moduledoc false
def yyyymmdd_now() do
now = Timex.now("-9")
now.year * 10000 + now.month * 100 + now.day
end
def dollars_n_cents(cents) do
'$' ++ Float.to_string(cents / 100)
end
def mailto_link(game_night) do
subj = "Poker Results: #{game... | Order email results winnings DESC and then names ASC. TODO: a "totals" row at the bottom, just like on the cashout page. TODO: connect to a mailer so Jay doesn't care. | Order email results winnings DESC and then names ASC.
TODO: a "totals" row at the bottom, just like on the cashout page.
TODO: connect to a mailer so Jay doesn't care.
| Elixir | mit | JohnB/phoenix_poker,JohnB/phoenix_poker |
1a4bb5f32a8c905ff235c727a7c4993e40819cbc | test/game/explosion_test.exs | test/game/explosion_test.exs | defmodule Game.ExplosionTest do
use ExUnit.Case, async: true
doctest Game.Explosion
alias Game.Explosion, as: Explosion
@t_past 1_471_605_231_831
@t_future 2_271_605_231_831
test "Default explosion struct" do
ex = %Explosion{}
assert 0.0 = ex.x
assert 0.0 = ex.y
end
test "Convert struct... | defmodule Game.ExplosionTest do
use ExUnit.Case, async: true
alias Elixoids.News
alias Game.Server, as: Game
test "Convert struct to state sent to client" do
{:ok, pid} = Game.start_link(2, 1)
News.subscribe(0)
Game.explosion(pid, 1.0, 2.0)
assert_receive {:explosion, [1.0, 2.0]}, 500
end
en... | Fix and refactor explosion test | Fix and refactor explosion test
| Elixir | mit | devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids,devstopfix/elixoids |
124923a325fff2dcf0bef5157a9592dfaf927229 | test/credo/check/readability/parentheses_on_zero_arity_defs_test.exs | test/credo/check/readability/parentheses_on_zero_arity_defs_test.exs | defmodule Credo.Check.Readability.ParenthesesOnZeroArityDefsTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.ParenthesesOnZeroArityDefs
#
# cases NOT raising issues
#
test "it should NOT report expected code" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, param... | defmodule Credo.Check.Readability.ParenthesesOnZeroArityDefsTest do
use Credo.TestHelper
@described_check Credo.Check.Readability.ParenthesesOnZeroArityDefs
#
# cases NOT raising issues
#
test "it should NOT report expected code" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, param... | Test Crashes on zero arity function in macro Credo.Check.Readability.ParenthesesOnZeroArityDefs crashes if a macro defines a zero-arity function. Added a test to demonstrate the issue. | Test Crashes on zero arity function in macro
Credo.Check.Readability.ParenthesesOnZeroArityDefs crashes if a macro defines a zero-arity function. Added a test to demonstrate the issue.
| Elixir | mit | rrrene/credo,rrrene/credo |
4294af3e1124e50a561d6fe62dd37a337176ed1a | config/config.exs | config/config.exs | use Mix.Config
config :logger, level: :debug
config :mnesia, dir: 'mnesia'
config :sasl, sasl_error_logger: false
config :ejabberd,
file: "config/ejabberd.yml",
log_path: "logs/ejabberd.log"
| use Mix.Config
config :ex_unit, :assert_receive_timeout, 1000
config :logger, level: :debug
config :mnesia, dir: 'mnesia'
config :sasl, sasl_error_logger: false
config :ejabberd,
file: "config/ejabberd.yml",
log_path: "logs/ejabberd.log"
| Set ex_unit receive timeout to 1000ms | Set ex_unit receive timeout to 1000ms
| Elixir | mit | scrogson/romeo,Carel-Ttrumpet/romeo |
aa871c6224e7fa6d2917948cf78bd6ff80ade2c1 | web/schema.ex | web/schema.ex | defmodule TheScratch.Schema do
@moduledoc """
GraphQL Schema
"""
alias TheScratch.UserResolver
use Absinthe.Schema
import_types TheScratch.Schema.Types
query do
field :users, list_of(:user) do
resolve &TUserResolver.all/2
end
end
end
| defmodule TheScratch.Schema do
@moduledoc """
GraphQL Schema
"""
alias TheScratch.UserResolver
use Absinthe.Schema
import_types TheScratch.Schema.Types
query do
field :users, list_of(:user) do
resolve &UserResolver.all/2
end
end
end
| Fix typo TUserResolver -> UserResolver | Fix typo TUserResolver -> UserResolver
| Elixir | mit | korczis/the-scratch,korczis/the-scratch,korczis/the-scratch |
2d5700424e6394f985cfe14190f07d66b3e7e57a | config/config.exs | config/config.exs | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the paren... | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the paren... | Fix net tiktime for syncronysation | Fix net tiktime for syncronysation
| Elixir | mit | NickolayStorm/AgentBalanser |
5fd906ee134a7734496beec3a174223cfd3927cb | web/views/annotation_view.ex | web/views/annotation_view.ex | defmodule Core.AnnotationView do
use Core.Web, :view
def render("index.json", %{annotations: annotations}) do
%{data: render_many(annotations, Core.AnnotationView, "annotation.json")}
end
def render("show.json", %{annotation: annotation}) do
%{data: render_one(annotation, Core.AnnotationView, "annotat... | defmodule Core.AnnotationView do
use Core.Web, :view
def render("index.json", %{annotations: annotations}) do
render_many(annotations, Core.AnnotationView, "annotation.json")
end
def render("show.json", %{annotation: annotation}) do
render_one(annotation, Core.AnnotationView, "annotation.json")
end
... | Fix Annotation View: render the object itself only | Fix Annotation View: render the object itself only
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
075326a886a30049141759ab6dbd32fe83fd9f3d | test/models/preview_test.exs | test/models/preview_test.exs | defmodule CodeCorps.PreviewTest do
use CodeCorps.ModelCase
alias CodeCorps.Preview
test "changeset renders body html from markdown" do
changeset = Preview.changeset(%Preview{}, %{markdown: "A **strong** element"}, nil)
assert changeset.valid?
assert changeset |> get_change(:body) == "<p>A <strong>st... | defmodule CodeCorps.PreviewTest do
use CodeCorps.ModelCase
alias CodeCorps.Preview
test "changeset renders body html from markdown" do
changeset = Preview.changeset(%Preview{}, %{markdown: "A **strong** element"}, nil)
assert changeset.valid?
assert changeset |> get_change(:body) == "<p>A <strong>st... | Fix typo in preview test | Fix typo in preview test
| Elixir | mit | crodriguez1a/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api,code-corps/code-corps-api |
a1d3f0b960e7c291ca8db813cf718e4954a9273a | lib/ircbot/hooks/ping_hook.ex | lib/ircbot/hooks/ping_hook.ex | defmodule PingHook do
@replies [
"pong", "shpunk", "spank", "pork", "dong",
]
@num_replies Enum.count(@replies)
def run(sender, text) do
if String.downcase(text) == "ping" do
{:reply, sender, Enum.at(@replies, :random.uniform(@num_replies)-1)}
end
end
end
| defmodule PingHook do
@replies [
"pong", "shpunk", "spank", "pork", "dong",
]
@num_replies Enum.count(@replies)
def run(sender, text) do
case String.downcase(text) do
"ping" ->
if sender == "nox" do
{:reply, sender, "<3"}
else
{:reply, sender, Enum.at(@replies,... | Add ping messages for nox | Add ping messages for nox | Elixir | mit | alco/beamie_bot |
bfc425a4e5ec7f922158301bbdaba4f264b971f1 | Problem016/Elixir/solution_1.exs | Problem016/Elixir/solution_1.exs | :math.pow(2, 1000) |> round
|> to_char_list
|> Enum.map(fn (c) -> c - hd('0') end)
|> Enum.sum
|> inspect
|> IO.puts | :math.pow(2, 1000) |> round
|> to_charlist
|> Enum.map(fn (c) -> c - hd('0') end)
|> Enum.sum
|> inspect
|> IO.puts
| Fix deprecated function in Problem016/Elixir/soluation_1.exs | Fix deprecated function in Problem016/Elixir/soluation_1.exs
| Elixir | mit | DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectE... |
821440ef3448fb5f2a76f7c9df19d3e0d1d323fb | apps/ello_search/test/ello_search/page_test.exs | apps/ello_search/test/ello_search/page_test.exs | defmodule Ello.Search.PageTest do
use Ello.Search.Case
alias Ello.Core.{Repo, Factory, Network}
alias Ello.Search.Page
alias Ello.Search.User.{Search, Index}
setup do
Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
Index.delete
Index.create
{:ok, %{}}
end
test "from_results - han... | defmodule Ello.Search.PageTest do
use Ello.Search.Case
alias Ello.Search.Page
test "from_results - handles empty results gracefully", _ do
results = %{"_shards" => %{"failed" => 0, "successful" => 5,
"total" => 5}, "hits" => %{"hits" => [], "max_score" => nil, "total" => 0},
"timed_out" => false, "... | Remove unneeded aliases and setup. | Remove unneeded aliases and setup.
This fixes some compilation warnings when running tests.
| Elixir | mit | ello/apex,ello/apex,ello/apex |
4f12b60e68307c2c5e3ec0c438a7749ae98fa70e | port_demo/lib/port_demo/top_server.ex | port_demo/lib/port_demo/top_server.ex | defmodule Top.Server do
use GenServer
### Notes and snippits
## Port.open({:spawn, "top -n 0"}, [:binary])
end | defmodule Top.Server do
use GenServer
# @regex ~r/.*:\s(?<total_processes>\d*)\s.*,\s(?<running_processes>\d*).*,\s(?<stuck_processes>\d*).*,\s(?<sleeping_processes>\d*)\s.*,\s(?<threads>\d*).*\\n(?<date>\d*/\d*/\d*)\s(?<time>\d*:\d*:\d*)\\n.*:\s(?<1m_load_avg>\d*\.\d*),\s(?<5m_load_avg>\d*\.\d*),\s(?<15m_load_avg>... | Add the grosses regex in the world | Add the grosses regex in the world
| Elixir | unlicense | GeoffreyPS/on_ports,GeoffreyPS/on_ports |
220998cd32ac9f0a9be3636f81305c3e3428d005 | web/models/door.ex | web/models/door.ex | defmodule Gatekeeper.Door do
use Gatekeeper.Web, :model
alias Gatekeeper.Repo
schema "doors" do
field :name, :string
has_many :door_group_doors, Gatekeeper.DoorGroupDoor
has_many :door_groups, through: [:door_group_doors, :door_group]
timestamps
end
@required_fields ~w(name)
@optional_fi... | defmodule Gatekeeper.Door do
use Gatekeeper.Web, :model
alias Gatekeeper.Repo
schema "doors" do
field :name, :string
has_many :door_group_doors, Gatekeeper.DoorGroupDoor
has_many :door_groups, through: [:door_group_doors, :door_group]
timestamps
end
@required_fields ~w(name)
@optional_fi... | Allow access to a DoorGroup via Company | Allow access to a DoorGroup via Company | Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
3567e2dca802e17995467d0726d7d6c0846da433 | web/models/fact.ex | web/models/fact.ex | defmodule Core.Fact do
@moduledoc """
A Fact is a collection of annotations that answers a question.
## Fields
Field | Type |
:------------ | :------------- | :---------------------
`question` | `belongs_to` | `Core.Question`
`annotations` | `many_to_many` | `Core.Tag` through `Co... | defmodule Core.Fact do
@moduledoc """
A Fact is a collection of annotations that answers a question.
## Fields
Field | Type |
:------------ | :------------- | :---------------------
`question` | `belongs_to` | `Core.Question`
`annotations` | `many_to_many` | `Core.Tag` through `Co... | Make "annotations" to be required field in Fact | Make "annotations" to be required field in Fact
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
c8b8375e311fc790abc30c2187a7c198dfcf24d7 | test/hound_test.exs | test/hound_test.exs | defmodule HoundTest do
use ExUnit.Case
use Hound.Helpers
setup do
Hound.start_session
parent = self
on_exit fn-> Hound.end_session(parent) end
:ok
end
test "should return driver info" do
{:ok, driver_info} = Hound.driver_info
assert is_atom(driver_info[:driver_type])
end
test "... | defmodule HoundTest do
use ExUnit.Case
use Hound.Helpers
setup do
Hound.start_session
parent = self
on_exit fn-> Hound.end_session(parent) end
:ok
end
test "should return driver info" do
{:ok, driver_info} = Hound.driver_info
assert driver_info[:driver_type] == nil
end
test "sh... | Check if driver type is nil | Check if driver type is nil
| Elixir | mit | oivoodoo/hound,jontonsoup/hound,esbullington/hound,jontonsoup/hound,oivoodoo/hound,esbullington/hound,HashNuke/hound,lowks/hound,HashNuke/hound,lowks/hound |
dff056b0526497b527cee82aad060b414d900c69 | web/models/chat_message.ex | web/models/chat_message.ex | defmodule Classlab.ChatMessage do
use Classlab.Web, :model
# Fields
schema "chat_messages" do
field :body, :string
timestamps()
belongs_to :event, Classlab.Event
belongs_to :user, Classlab.User
end
# Composable Queries
# Changesets & Validations
@fields ~w(body)
def changeset(struct,... | defmodule Classlab.ChatMessage do
@moduledoc """
Chat messages are messages in an event. They're not
personal messages between users.
"""
use Classlab.Web, :model
# Fields
schema "chat_messages" do
field :body, :string
timestamps()
belongs_to :event, Classlab.Event
belongs_to :user, Clas... | Add documentation for chat message model | Add documentation for chat message model
| Elixir | mit | classlab/classlab,classlab/classlab |
63cf7f7a2a863edb3bc9ff7c201e3948beb41641 | test/test_helper.exs | test/test_helper.exs | Mix.Task.run "ecto.create", ["quiet", "-r", "ExMachina.TestRepo"]
Mix.Task.run "ecto.migrate", ["-r", "ExMachina.TestRepo"]
ExMachina.TestRepo.start_link
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(ExMachina.TestRepo, :manual)
| Mix.Task.run "ecto.drop", ["quiet", "-r", "ExMachina.TestRepo"]
Mix.Task.run "ecto.create", ["quiet", "-r", "ExMachina.TestRepo"]
Mix.Task.run "ecto.migrate", ["-r", "ExMachina.TestRepo"]
ExMachina.TestRepo.start_link
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(ExMachina.TestRepo, :manual)
| Drop the database for each test run | Drop the database for each test run
Now that we are using a single file for migrations, we should drop the
database each test run to get the new schema.
| Elixir | mit | thoughtbot/ex_machina |
fbb7c1961788272670652b52c7deb469b6b6f6e7 | lib/atom_tweaks_web/views/error_view.ex | lib/atom_tweaks_web/views/error_view.ex | defmodule AtomTweaksWeb.ErrorView do
use AtomTweaksWeb, :view
def render("404.html", _assigns) do
"Page not found"
end
def render("500.html", _assigns) do
"Internal server error"
end
# In case no render clause matches or no
# template is found, let's render it as 500
def template_not_found(_t... | defmodule AtomTweaksWeb.ErrorView do
@doc """
View functions for HTTP error states.
"""
use AtomTweaksWeb, :view
@doc """
Renders the page for the given template.
Since we don't have fancy error pages yet, we're just rendering the text of the status code.
"""
def render("404.html", _assigns), do: "P... | Add a handler for status 422 | Add a handler for status 422
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
5269588e067ca89dfe3ba30d87b9923a566d31f8 | lib/koans.ex | lib/koans.ex | defmodule Koans do
defmacro koan(name, body) do
compiled_name = String.to_atom(name)
quote do
@koans unquote(compiled_name)
def unquote(compiled_name)() do
try do
unquote(body)
:ok
rescue
e in _ -> e
end
end
end
end
defmacro __us... | defmodule Koans do
defmacro koan(name, body) do
compiled_name = String.to_atom(name)
quote do
@koans unquote(compiled_name)
def unquote(compiled_name)() do
try do
unquote(body)
:ok
rescue
e in _ -> e
end
end
end
end
defmacro __us... | Disable warnings about unused variables | Disable warnings about unused variables
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans |
0de0aead3a6099114a1a4304fe450c802cf891fb | lib/gym_tcp_api.ex | lib/gym_tcp_api.ex | _ = """
@file gym_tcp_api.ex
@author Marcus Edel
GymTcpApi handler.
"""
defmodule GymTcpApi do
use Application
def start(_type, _args) do
import Supervisor.Spec
poolboy_config = [
{:name, {:local, pool_name()}},
{:worker_module, GymTcpApi.Worker},
{:size, Application.get_env(:gym... | _ = """
@file gym_tcp_api.ex
@author Marcus Edel
GymTcpApi handler.
"""
defmodule GymTcpApi do
use Application
def start(_type, _args) do
import Supervisor.Spec
poolboy_config = [
{:name, {:local, pool_name()}},
{:worker_module, GymTcpApi.Worker},
{:size, Application.get_env(:gym... | Use fifo strategy for the worker. | Use fifo strategy for the worker.
| Elixir | bsd-3-clause | zoq/gym_tcp_api,zoq/gym_tcp_api |
8e6e97545217d2c775a25c77372e3a47d92f36da | lib/phoenix/endpoint/server.ex | lib/phoenix/endpoint/server.ex | defmodule Phoenix.Endpoint.Server do
# The supervisor for the underlying handlers.
@moduledoc false
@handler Phoenix.Endpoint.CowboyHandler
use Supervisor
def start_link(otp_app, endpoint) do
if endpoint.config(:server) do
Supervisor.start_link(__MODULE__, {otp_app, endpoint})
else
:igno... | defmodule Phoenix.Endpoint.Server do
# The supervisor for the underlying handlers.
@moduledoc false
@handler Phoenix.Endpoint.CowboyHandler
use Supervisor
def start_link(otp_app, endpoint) do
if endpoint.config(:server) do
Supervisor.start_link(__MODULE__, {otp_app, endpoint})
else
:igno... | Move nil check to a to_port implementation | Move nil check to a to_port implementation
| Elixir | mit | Joe-noh/phoenix,fbjork/phoenix,mschae/phoenix,hsavit1/phoenix,vic/phoenix,CultivateHQ/phoenix,gjaldon/phoenix,jamilabreu/phoenix,daytonn/phoenix,tony612/phoenix,jamilabreu/phoenix,scrogson/phoenix,manukall/phoenix,dmarkow/phoenix,greyhwndz/phoenix,DavidAlphaFox/phoenix,justnoxx/phoenix,manukall/phoenix,nshafer/phoenix,... |
94d93cf61fb1b66885fc236164761719ba198cc9 | test/views/error_view_test.exs | test/views/error_view_test.exs | defmodule Tilex.ErrorViewTest do
use TilexWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(TilexWeb.ErrorView, "404.html", []) ==
"Page not found"
end
test "render 500.html" do
... | defmodule Tilex.ErrorViewTest do
use TilexWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(TilexWeb.ErrorView, "404.html", []) == "Page not found"
end
test "render 500.html" do
assert ... | Format the error view test | Format the error view test
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
f11197fd04d7da609b377694d601358d32bf70c2 | lib/elixir/mix.exs | lib/elixir/mix.exs | defmodule Elixir.Mixfile do
use Mix.Project
def project do
[app: :elixir,
version: System.version,
build_per_environment: false,
escript: [
embed_elixir: false,
main_module: :elixir,
emu_args: "%%! -noshell\n"
]]
end
end
| defmodule Elixir.Mixfile do
use Mix.Project
def project do
[app: :elixir,
version: System.version,
build_per_environment: false]
end
end
| Remove escript from elixir app | Remove escript from elixir app
| Elixir | apache-2.0 | gfvcastro/elixir,kimshrier/elixir,kimshrier/elixir,gfvcastro/elixir,kelvinst/elixir,lexmag/elixir,pedrosnk/elixir,beedub/elixir,kelvinst/elixir,lexmag/elixir,ggcampinho/elixir,pedrosnk/elixir,ggcampinho/elixir,elixir-lang/elixir,antipax/elixir,joshprice/elixir,michalmuskala/elixir,beedub/elixir,antipax/elixir |
bc9ddc57dbbeb44b65dcbecc597728895cca4a55 | web/router.ex | web/router.ex | defmodule MyApp_802337.Router do
use MyApp_802337.Web, :router
pipeline :before do
plug TrailingFormatPlug
end
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 ... | defmodule MyApp_802337.Router do
use MyApp_802337.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug TrailingFormatPlug
plug :accepts, ["json"]
end
scope "/", MyApp_802337 do
pipe... | Move trailing_format_plug into the :api pipeline instead of :before | Move trailing_format_plug into the :api pipeline instead of :before
| Elixir | mit | wsmoak/my_app_802337 |
e2d275abcf132a59e291ba85683f7e5e6c56f781 | lib/mix/tasks/phoenix.server.ex | lib/mix/tasks/phoenix.server.ex | defmodule Mix.Tasks.Phoenix.Server do
use Mix.Task
@shortdoc "Starts applications and their servers"
@moduledoc """
Starts the application by configuring all endpoints servers to run.
"""
def run(args) do
Application.put_env(:phoenix, :serve_endpoints, true, persistent: true)
Mix.Task.run "app.sta... | defmodule Mix.Tasks.Phoenix.Server do
use Mix.Task
@shortdoc "Starts applications and their servers"
@moduledoc """
Starts the application by configuring all endpoints servers to run.
## Command line options
This task accepts the same command-line arguments as `app.start`. For additional
information, ... | Add documentation note about args which cross-reference app.start | Add documentation note about args which cross-reference app.start
| Elixir | mit | optikfluffel/phoenix,vic/phoenix,jamilabreu/phoenix,eksperimental/phoenix,0x00evil/phoenix,safi/phoenix,bsmr-erlang/phoenix,bsmr-erlang/phoenix,lono-devices/phoenix,ericmj/phoenix,romul/phoenix,korobkov/phoenix,eksperimental/phoenix,keathley/phoenix,optikfluffel/phoenix,thegrubbsian/phoenix,dmarkow/phoenix,jwarwick/pho... |
5dddd047e8904317f0552e7de47b36951a9fa569 | lib/dogma/rules.ex | lib/dogma/rules.ex | defmodule Dogma.Rules do
@doc """
Returns a list of all modules that define a Dogma rule.
In order to add a new rule, you must namespace it under Dogma.Rules, and add
it to the list in the Dogma.Rules.rule_list private function.
"""
def list do
Enum.map rule_list, &Module.concat( Dogma.Rules, &1 )
e... | defmodule Dogma.Rules do
@doc """
Returns a list of all modules that define a Dogma rule.
In order to add a new rule, you must namespace it under Dogma.Rules, and add
it to the list in the Dogma.Rules.rule_list private function.
"""
def list do
Enum.map rule_list, &Module.concat( Dogma.Rules, &1 )
e... | Add NegatedIfUnless to rule list. | Add NegatedIfUnless to rule list.
I forgot *again*. We need to resolve #24
| Elixir | mit | simonewebdesign/dogma,jacknoble/dogma,meadsteve/dogma,henrik/dogma,aerosol/dogma,rrrene/dogma,iszlai/dogma,5thWall/dogma,timbuchwaldt/dogma,knewter/dogma,linearregression/dogma,eksperimental/dogma |
87f30cc5f4345966aafff0cb4307a7cea5e80d45 | lib/xee/theme_server.ex | lib/xee/theme_server.ex | defmodule Xee.ThemeServer do
@moduledoc """
The server to store experiment themes.
"""
def experiment(name, file: file, host: host, participant: participant) do
id = Xee.TokenGenerator.generate()
[{module, _} | _] = Code.load_file(file)
host = File.read!(host)
participant = File.read!(participa... | defmodule Xee.ThemeServer do
@moduledoc """
The server to store experiment themes.
"""
def experiment(name, file: file, host: host, participant: participant) do
[{module, _} | _] = Code.load_file(file)
host = File.read!(host)
participant = File.read!(participant)
experiment = %Xee.Experiment{th... | Use theme names as theme IDs | Use theme names as theme IDs
| Elixir | mit | xeejp/xee,xeejp/xee,xeejp/xee,xeejp/xee,xeejp/xee |
2ed891389cb7411952e29480ff69f735e8217004 | lib/koans/01_equalities.ex | lib/koans/01_equalities.ex | defmodule Equalities do
use Koans
koan "We shall contemplate truth by testing reality, via equality" do
assert true == ___
end
koan "Not something is the opposite of it" do
assert !true == ___
end
koan "To understand reality, we must compare our expectations against reality" do
assert 2 == 1 ... | defmodule Equalities do
use Koans
# Replace ___ with the answer to make the koan pass.
koan "We shall contemplate truth by testing reality, via equality" do
assert true == ___
end
koan "Not something is the opposite of it" do
assert !true == ___
end
koan "To understand reality, we must compare ... | Add explanation for the first koan | Add explanation for the first koan
| Elixir | mit | elixirkoans/elixir-koans,samstarling/elixir-koans |
f369d099d98f782709651a6202fc654fbfe7e00e | web/models/idea.ex | web/models/idea.ex | defmodule RemoteRetro.Idea do
use RemoteRetro.Web, :model
@derive {Poison.Encoder, except: [:__meta__, :retro, :user, :votes]}
schema "ideas" do
field :category, :string
field :body, :string
belongs_to :retro, RemoteRetro.Retro, type: Ecto.UUID
belongs_to :user, RemoteRetro.User
has_many :vo... | defmodule RemoteRetro.Idea do
use RemoteRetro.Web, :model
@derive {Poison.Encoder, except: [:__meta__, :retro, :user, :votes, :assignee]}
schema "ideas" do
field :category, :string
field :body, :string
belongs_to :retro, RemoteRetro.Retro, type: Ecto.UUID
belongs_to :user, RemoteRetro.User
h... | Remove assignee association from preloading | Remove assignee association from preloading
| Elixir | mit | samdec11/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
50b74a80f90521f019ec132478aac462536487d7 | lib/ex_twilio/resources/call.ex | lib/ex_twilio/resources/call.ex | defmodule ExTwilio.Call do
@moduledoc """
Represents an Call resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/calls)
"""
defstruct sid: nil,
parent_call_sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
... | defmodule ExTwilio.Call do
@moduledoc """
Represents an Call resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/api/call-resource)
"""
defstruct sid: nil,
parent_call_sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
... | Update link to Call API | Update link to Call API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
a05b3b6b6193ca77ccd61b847ef4ab77fd06a14e | lib/who_web/controllers/chamber_controller.ex | lib/who_web/controllers/chamber_controller.ex | defmodule WhoWeb.ChamberController do
use WhoWeb, :controller
alias Who.ProPublicaAPI.Bill
alias Who.ProPublicaAPI.Chamber
def show(conn, %{"chamber" => chamber}) do
[members | _tail] = Chamber.get_members_by_chamber(chamber)
[floor_actions | _tail] = Chamber.get_recent_chamber_actions(chamber)
[... | defmodule WhoWeb.ChamberController do
use WhoWeb, :controller
alias Who.ProPublicaAPI.Bill
alias Who.ProPublicaAPI.Chamber
def show(conn, %{"chamber" => chamber}) do
case chamber == "house" || chamber == "senate" do
false ->
render conn, WhoWeb.ErrorView, "404.html"
true ->
[m... | Refactor controller action to avoid API request failure for non-existent chambers | Refactor controller action to avoid API request failure for non-existent chambers
| Elixir | mit | ryancharris/who,ryancharris/who |
eadd1be7fa36a0973c2b7fe525fe5aaba2ce264d | test/xandra_test.exs | test/xandra_test.exs | defmodule XandraTest do
use ExUnit.Case, async: true
test "options validation in Xandra.start_link/1" do
assert_raise NimbleOptions.ValidationError, ~r{invalid node: "foo:bar"}, fn ->
Xandra.start_link(nodes: ["foo:bar"])
end
assert_raise ArgumentError, ~r{cannot use multiple nodes in the :nodes... | defmodule XandraTest do
use ExUnit.Case, async: true
test "options validation in Xandra.start_link/1" do
assert_raise NimbleOptions.ValidationError, ~r{invalid node: "foo:bar"}, fn ->
Xandra.start_link(nodes: ["foo:bar"])
end
assert_raise ArgumentError, ~r{cannot use multiple nodes in the :nodes... | Add a couple of tests | Add a couple of tests
| Elixir | isc | lexhide/xandra |
26eef88a776d597e9e944f8ba9255755850a168f | web/services/github_api.ex | web/services/github_api.ex | defmodule Pullhub.GithubApi do
require Logger
alias Pullhub.Repo
def user_repositories(nil) do
nil
end
def user_repositories(user) do
Tentacat.Client.new(%{access_token: user.github_token})
|> Tentacat.Repositories.list_mine
|> simplify_repositories
|> convert_repository_to_structs(user... | defmodule Pullhub.GithubApi do
require Logger
alias Pullhub.PullRequest
alias Pullhub.Repo
alias Pullhub.Repository
alias Pullhub.User
def repositories(nil) do
nil
end
def repositories(%User{} = user) do
Tentacat.Client.new(%{access_token: user.github_token})
|> Tentacat.Repositories.list... | Add pull requests capability to GithubApi wrapper module | Add pull requests capability to GithubApi wrapper module
| Elixir | mit | substancelab/pullhub,substancelab/pullhub,substancelab/pullhub |
e324ed40040d6e2229f94f42b50b7fb0f69a2f1d | backend/web/views/v1/meal_view.ex | backend/web/views/v1/meal_view.ex | defmodule MealprepBackend.V1.MealView do
use MealprepBackend.Web, :view
alias MealprepBackend.V1.IngredientView
def render("index.json", %{meals: meals}) do
%{data: render_many(meals, MealprepBackend.V1.MealView, "meal.json")}
end
def render("show.json", %{meal: meal}) do
%{data: render_one(meal, Me... | defmodule MealprepBackend.V1.MealView do
use MealprepBackend.Web, :view
alias MealprepBackend.V1.IngredientView
def render("index.json", %{meals: meals}) do
%{data: render_many(meals, MealprepBackend.V1.MealView, "meal.json")}
end
def render("show.json", %{meal: meal}) do
%{data: render_one(meal, Me... | Use meal summary for meals list | Use meal summary for meals list
Full meal ingredients and components only for showing a single meal.
| Elixir | apache-2.0 | ilkka/mealprep,ilkka/mealprep,ilkka/mealprep |
07a36496f179b0d20496bccd2bd74ceead070068 | mix.exs | mix.exs | defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[app: :phoenix,
version: "0.5.0",
elixir: "~> 1.0.1 or ~> 1.1",
deps: deps,
package: [
contributors: ["Chris McCord", "Darko Fabijan", "José Valim"],
licenses: ["MIT"],
links: [github: "https://github.com/phoen... | defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[app: :phoenix,
version: "0.5.0",
elixir: "~> 1.0.1 or ~> 1.1",
deps: deps,
package: [
contributors: ["Chris McCord", "Darko Fabijan", "José Valim"],
licenses: ["MIT"],
links: %{github: "https://github.com/phoe... | Make hex happy with new :link map | Make hex happy with new :link map
| Elixir | mit | nicrioux/phoenix,elliotcm/phoenix,CultivateHQ/phoenix,ericmj/phoenix,CultivateHQ/phoenix,DavidAlphaFox/phoenix,0x00evil/phoenix,jamilabreu/phoenix,lancehalvorsen/phoenix,javimolla/phoenix,daytonn/phoenix,vic/phoenix,esbullington/phoenix-1,JHKennedy4/phoenix,evax/phoenix,seejee/phoenix,phoenixframework/phoenix,Kosmas/ph... |
3482cd655e1d3a58c1a63f70829677861c7ace34 | mix.exs | mix.exs | Code.ensure_loaded?(Hex) and Hex.start
defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[
app: :phoenix,
version: "0.2.3",
elixir: "~> 0.13.0",
deps: deps(Mix.env),
package: [
contributors: ["Chris McCord", "Darko Fabijan"],
licenses: ["MIT"],
l... | Code.ensure_loaded?(Hex) and Hex.start
defmodule Phoenix.Mixfile do
use Mix.Project
def project do
[
app: :phoenix,
version: "0.2.3",
elixir: "~> 0.13.0",
deps: deps(Mix.env),
package: [
contributors: ["Chris McCord", "Darko Fabijan"],
licenses: ["MIT"],
l... | Update ex_doc to use only: | Update ex_doc to use only: [:docs]
| Elixir | mit | Kosmas/phoenix,rafbgarcia/phoenix,andrewvy/phoenix,mobileoverlord/phoenix,pap/phoenix,javimolla/phoenix,cas27/phoenix,phoenixframework/phoenix,ugisozols/phoenix,y-yagi/phoenix,Fluxuous/phoenix,FND/phoenix,jwarwick/phoenix,andrewvy/phoenix,ericmj/phoenix,omotenko/phoenix_auth,StevenNunez/phoenix,nshafer/phoenix,maxnordl... |
93c097a2a76b5cbbb98bae72f522b8cf8445670b | mix.exs | mix.exs | defmodule ExDocEPUB.Mixfile do
use Mix.Project
@version "0.0.3"
def project do
[app: :ex_doc_epub,
version: @version,
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
# Hex.pm
description: description,
package: packag... | defmodule ExDocEPUB.Mixfile do
use Mix.Project
@version "0.0.3"
def project do
[app: :ex_doc_epub,
version: @version,
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
# Hex.pm
description: description,
package: packag... | Add missing metadata field: maintainers | Add missing metadata field: maintainers
| Elixir | mit | milmazz/ex_doc_epub |
687c26fe60e1307ee58f091874ac269ecf5ff732 | priv/repo/migrations/20170616131353_add_minimum_teaching_days.exs | priv/repo/migrations/20170616131353_add_minimum_teaching_days.exs | defmodule CoursePlanner.Repo.Migrations.AddMinimumTeachingDays do
use Ecto.Migration
def change do
alter table(:terms) do
add :minimum_teaching_days, :integer, null: false
end
end
end
| defmodule CoursePlanner.Repo.Migrations.AddMinimumTeachingDays do
use Ecto.Migration
def change do
alter table(:terms) do
add :minimum_teaching_days, :integer, null: false, default: 1
end
end
end
| Add default value to new column. | Add default value to new column.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
081096b335eef86f0f4086b0b079cf55d65823d3 | mix.exs | mix.exs | defmodule Bowser.MixProject do
use Mix.Project
def project do
[
app: :bowser,
version: "0.2.0",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
aliases: [test: "test --no-start"],
releases: releases(),
deps: deps()
]
end
# Run "mix help compile.app" to ... | defmodule Bowser.MixProject do
use Mix.Project
def project do
[
app: :bowser,
version: "0.2.0",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
aliases: [test: "test --no-start"],
releases: releases(),
deps: deps()
]
end
# Run "mix help compile.app" to ... | Update dependency credo to ~> 1.1.0 | Update dependency credo to ~> 1.1.0
| Elixir | mit | kevinkjt2000/discord-minecraft-server-status |
a77417da63bf72fcc9a3425ceb4703977686f5d6 | mix.exs | mix.exs | defmodule Credo.Mixfile do
use Mix.Project
def project do
[
app: :credo,
version: "0.3.13",
elixir: "~> 1.0",
escript: [main_module: Credo.CLI],
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
test_coverage: [tool: Coverex.Task],
... | defmodule Credo.Mixfile do
use Mix.Project
def project do
[
app: :credo,
version: "0.3.13",
elixir: "~> 1.1",
escript: [main_module: Credo.CLI],
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
test_coverage: [tool: Coverex.Task],
... | Set minimum Elixir version to 1.1 | Set minimum Elixir version to 1.1
| Elixir | mit | rrrene/credo,rrrene/credo |
a7b23135ac3bdd4913ed05cef1f010e25707f78b | lib/appsignal/error/backend.ex | lib/appsignal/error/backend.ex | defmodule Appsignal.Error.Backend do
@moduledoc false
@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
@behaviour :gen_event
def init(opts), do: {:ok, opts}
def handle_event({:error, gl, {_, _, _, metadata}... | defmodule Appsignal.Error.Backend do
@moduledoc false
@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
@behaviour :gen_event
def init(opts), do: {:ok, opts}
def handle_event({:error, gl, {_, _, _, metadata}... | Remove unused variable from Error.Backend.handle_event/2 | Remove unused variable from Error.Backend.handle_event/2
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir |
d35f222c6722505e44d241747cb067771f285341 | mix.exs | mix.exs | defmodule Floki.Mixfile do
use Mix.Project
def project do
[app: :floki,
version: "0.5.0",
name: "Floki",
elixir: ">= 1.0.0",
package: package,
description: description,
docs: [extras: ["README.md"]],
source_url: "https://github.com/philss/floki",
deps: deps]
end
def... | defmodule Floki.Mixfile do
use Mix.Project
def project do
[app: :floki,
version: "0.5.0",
name: "Floki",
elixir: ">= 1.0.0",
package: package,
description: description,
docs: [extras: ["README.md"]],
source_url: "https://github.com/philss/floki",
deps: deps]
end
def... | Fix package description for Hex | Fix package description for Hex
| Elixir | mit | philss/floki,philss/floki |
613d9db21409d3b9e5443d7ef6cd7217bce70844 | mix.exs | mix.exs | defmodule Httparrot.Mixfile do
use Mix.Project
@description """
HTTP Request & Response Server. An incomplete clone of http://httpbin.org
"""
def project do
[ app: :httparrot,
version: "0.3.3",
elixir: "~> 1.0",
name: "HTTParrot",
description: @description,
package: packa... | defmodule Httparrot.Mixfile do
use Mix.Project
@description """
HTTP Request & Response Server. An incomplete clone of http://httpbin.org
"""
def project do
[ app: :httparrot,
version: "0.3.3",
elixir: "~> 1.0",
name: "HTTParrot",
description: @description,
package: packa... | Update links definition on hex package description | Update links definition on hex package description
[ci skip]
| Elixir | mit | jordan0day/httparrot,edgurgel/httparrot,edgurgel/httparrot |
99d384c3c541834bbf9c1951dd215d3bc481014c | 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... | Clarify what should be used in place of a two condition `cond`. | Clarify what should be used in place of a two condition `cond`.
An `if` statement should be recommended when a cond with less than two conditions besides `true` is found. | Elixir | mit | rrrene/credo,rrrene/credo |
f199642f81e2475aa7b56f7540755e7bdcf71da9 | lib/credo/issue.ex | lib/credo/issue.ex | defmodule Credo.Issue do
defstruct check: nil,
category: nil,
priority: 0,
severity: nil,
message: nil,
filename: nil,
line_no: nil,
column: nil,
exit_status: 0,
trigger:... | defmodule Credo.Issue do
defstruct check: nil,
category: nil,
priority: 0,
severity: nil,
message: nil,
filename: nil,
line_no: nil,
column: nil,
exit_status: 0,
trigger:... | Remove Inspect implemenation for Issues | Remove Inspect implemenation for Issues
| Elixir | mit | rrrene/credo,rrrene/credo |
330a47ba5e625d89cf4b1c08bbb2a32c2d4cf52e | lib/share/endpoint.ex | lib/share/endpoint.ex | defmodule Share.Endpoint do
use Phoenix.Endpoint, otp_app: :share
socket "/socket", Share.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.
plug Plug.Static,
at:... | defmodule Share.Endpoint do
use Phoenix.Endpoint, otp_app: :share
socket "/socket", Share.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.
plug Plug.Static,
at:... | Set lifetime of a session to 30 days | Set lifetime of a session to 30 days
| Elixir | agpl-3.0 | ryo33/Yayaka19,ryo33/Yayaka19 |
2f845d4e3a7771b4ba1711aacccfbc547a9638fd | lib/gateway/router.ex | lib/gateway/router.ex | defmodule Gateway.Router do
@moduledoc """
Gateway HTTP Router
"""
use Plug.Router
plug :match
plug :dispatch
forward "/apis", to: Gateway.HTTP.API
end
| defmodule Gateway.Router do
@moduledoc """
Gateway HTTP Router
"""
use Plug.Router
plug Plug.Parsers, parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
plug :match
plug :dispatch
forward "/apis", to: Gateway.HTTP.API
end
| Add top-level plug to parse json request bodies | Add top-level plug to parse json request bodies
| Elixir | mit | Nebo15/annon.api,Nebo15/annon.api |
171a5d5fcd0e5c2bda33350ec8c6404781174612 | lib/neopixel.ex | lib/neopixel.ex | defmodule Blinker do
use GenServer
def start_link(pin, opts) do
{:ok, pid} = Gpio.start_link(pin, :output)
GenServer.start_link(__MODULE__, pid, opts)
blink_forever(pid)
end
def handle_call(:on, _from, pid), do: {:reply, Gpio.write(pid, 1)}
def handle_call(:off, _from, pid), do: {:reply, Gpio.w... | defmodule Blinker do
require Gpio
use GenServer
def start_link(pin, opts) do
{:ok, pid} = Gpio.start_link(pin, :output)
GenServer.start_link(__MODULE__, pid, opts)
end
def handle_call(:on, _from, pid), do: {:reply, Gpio.write(pid, 1)}
def handle_call(:off, _from, pid), do: {:reply, Gpio.write(pid... | Simplify the code a little | Simplify the code a little
| Elixir | mit | GregMefford/nerves_io_neopixel,alexrothenberg/nerves_neopixel,GregMefford/nerves_neopixel |
8c7e663ce3e8fb5c4ef909e03960fcf53946959e | lib/gullintanni/pipeline/supervisor.ex | lib/gullintanni/pipeline/supervisor.ex | defmodule Gullintanni.Pipeline.Supervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
def start_pipeline(config) do
Supervisor.start_child(__MODULE__, [config])
end
def init(_) do
children = [
worker(Gullintanni.Pipeline, [], restart: ... | alias Experimental.DynamicSupervisor
defmodule Gullintanni.Pipeline.Supervisor do
use DynamicSupervisor
def start_link do
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
end
def start_pipeline(config) do
DynamicSupervisor.start_child(__MODULE__, [config])
end
def init(_) do
ch... | Use the new DynamicSupervisor instead of :simple_one_for_one | Use the new DynamicSupervisor instead of :simple_one_for_one
This is the interface that will be used in Elixir in the near future.
See: https://github.com/elixir-lang/gen_stage/issues/12
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni |
ab6d16ca18eedc53bd74b7c4d16942dc8d9918da | lib/smppex/pdu/ton_npi_defaults.ex | lib/smppex/pdu/ton_npi_defaults.ex | defmodule SMPPEX.Pdu.TONNPIDefaults do
@moduledoc """
Module for automatic TON/NPI detection
"""
@digits ?0..?9
@short_code 3..8
@long_code 10..15
def ton_npi(address) when is_binary(address) do
address
|> address_type()
|> ton_npi_by_type()
end
defp address_type(address) do
if has... | defmodule SMPPEX.Pdu.TONNPIDefaults do
@moduledoc """
Module for automatic TON/NPI detection
"""
alias SMPPEX.Compat
@digits ?0..?9
@short_code 3..8
@long_code 10..15
def ton_npi(address) when is_binary(address) do
address
|> address_type()
|> ton_npi_by_type()
end
defp address_type... | Use Compat.to_charlist instead of Kernel.to_charlist to retain compatibility | Use Compat.to_charlist instead of Kernel.to_charlist to retain compatibility
| Elixir | mit | savonarola/smppex |
29d8fac237c781b17ab243f999caba4b25376119 | web/controllers/auth_controller.ex | web/controllers/auth_controller.ex | defmodule MyApp_808732.AuthController do
use MyApp_808732.Web, :controller
def index(conn, _params) do
redirect conn, external: "https://www.fitbit.com/oauth2/authorize"
end
end
| defmodule MyApp_808732.AuthController do
use MyApp_808732.Web, :controller
def index(conn, _params) do
redirect conn, external: Fitbit.authorize_url!(scope: "settings sleep")
end
end
| Use url generated by Fitbit strategy module | Use url generated by Fitbit strategy module
| Elixir | mit | wsmoak/my_app_808732 |
a473c4d50bd14d44b669de2e4593f5c1a2bb0539 | web/controllers/course_matrix_controller.ex | web/controllers/course_matrix_controller.ex | defmodule CoursePlanner.CourseMatrixController do
@moduledoc false
use CoursePlanner.Web, :controller
alias CoursePlanner.OfferedCourses
def index(conn, %{"term_id" => term_id}) do
render(conn, "index.html",
courses: OfferedCourses.find_by_term_id(term_id) ,
matrix: OfferedCourses.student_matr... | defmodule CoursePlanner.CourseMatrixController do
@moduledoc false
use CoursePlanner.Web, :controller
alias CoursePlanner.OfferedCourses
import Canary.Plugs
plug :authorize_controller
def index(conn, %{"term_id" => term_id}) do
render(conn, "index.html",
courses: OfferedCourses.find_by_term_id(... | Add authorization plug to course matrix controller | Add authorization plug to course matrix controller
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
1117daef6cca2e9af3551a14118fd197f515fe23 | lib/elixlsx/workbook.ex | lib/elixlsx/workbook.ex | defmodule Elixlsx.Workbook do
@moduledoc ~S"""
Root structure for excel files. Must contain at least one
Elixlsx.Sheet object.
The datetime property can optionally be set to override
the "created at" date. It defaults to the current time.
"""
alias Elixlsx.Sheet
alias Elixlsx.Workbook
defstruct shee... | defmodule Elixlsx.Workbook do
@moduledoc ~S"""
Root structure for excel files. Must contain at least one
Elixlsx.Sheet object.
The datetime property can optionally be set to override
the "created at" date. It defaults to the current time.
"""
alias Elixlsx.Sheet
alias Elixlsx.Workbook
defstruct shee... | Replace unknown calendar type with String | integer | nil | Replace unknown calendar type with String | integer | nil
| Elixir | mit | xou/elixlsx |
ec35e0b89304a2acac0aaa0b10edba1e6c1b6873 | lib/serum/dev_server/command_handler/impl.ex | lib/serum/dev_server/command_handler/impl.ex | defmodule Serum.DevServer.CommandHandler.Impl do
@moduledoc false
_moduledocp = """
An implementation of `Serum.DevServer.CommandHandler` behaviour.
"""
alias Serum.DevServer.CommandHandler
@behaviour CommandHandler
@impl CommandHandler
@spec open_url(url :: binary()) :: :ok | :error
def open_url(... | defmodule Serum.DevServer.CommandHandler.Impl do
@moduledoc false
_moduledocp = """
An implementation of `Serum.DevServer.CommandHandler` behaviour.
"""
alias Serum.DevServer.CommandHandler
@behaviour CommandHandler
@impl CommandHandler
@spec open_url(url :: binary()) :: :ok | :error
def open_url(... | Fix command to open a browser in windows | Fix command to open a browser in windows
| Elixir | mit | Dalgona/Serum |
7890c42784bf072204999b6e34fe478c449c1f79 | apps/ello_v2/web/controllers/related_post_controller.ex | apps/ello_v2/web/controllers/related_post_controller.ex | defmodule Ello.V2.RelatedPostController do
use Ello.V2.Web, :controller
alias Ello.Core.Content
alias Ello.V2.PostView
def index(conn, params) do
{related_to, posts} = fetch_related_posts(conn, params)
conn
|> track_post_view(posts, stream_kind: "related", stream_id: related_to.id)
|> render(Po... | defmodule Ello.V2.RelatedPostController do
use Ello.V2.Web, :controller
alias Ello.Core.Content
alias Ello.V2.PostView
def index(conn, params) do
{related_to, posts} = fetch_related_posts(conn, params)
conn
|> track_post_view(posts, stream_kind: "related", stream_id: related_to.id)
|> api_rende... | Use new api_render in related posts. | Use new api_render in related posts.
| Elixir | mit | ello/apex,ello/apex,ello/apex |
910b7c6d775188d290f6f184765ddd80c288d50c | lib/farmbot/celery_script/ast/node/emergency_unlock.ex | lib/farmbot/celery_script/ast/node/emergency_unlock.ex | defmodule Farmbot.CeleryScript.AST.Node.EmergencyUnlock do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args []
def execute(_, _, env) do
env = mutate_env(env)
case Farmbot.Firmware.emergency_unlock do
:ok -> {:ok, env}
{:error, reason} -> {:error, reason, env}
end
end
end... | defmodule Farmbot.CeleryScript.AST.Node.EmergencyUnlock do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args []
use Farmbot.Logger
def execute(_, _, env) do
env = mutate_env(env)
case Farmbot.Firmware.emergency_unlock do
:ok ->
Logger.success 1, "Bot is Successfully unlocked... | Add log for unlocked bot. | Add log for unlocked bot.
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
865c9a74aa33d598c37a323fa6c5c01be7fcabfa | template/config/dev.exs | template/config/dev.exs | use Mix.Config
config :phoenix, <%= application_module %>.Router,
port: System.get_env("PORT") || 4000,
ssl: false,
host: "localhost",
code_reload: true,
cookies: true,
consider_all_requests_local: true,
session_key: "_<%= application_name %>_key",
session_secret: "<%= session_secret %>"
config :logge... | use Mix.Config
config :phoenix, <%= application_module %>.Router,
port: System.get_env("PORT") || 4000,
ssl: false,
host: "localhost",
code_reload: true,
cookies: true,
consider_all_requests_local: true,
session_key: "_<%= application_name %>_key",
session_secret: "<%= session_secret %>"
config :logge... | Fix syntax error in templated config file. | Fix syntax error in templated config file.
Fixes #271, for a compiler error for newly generated applications.
| Elixir | mit | begleynk/phoenix,Dahoon/phoenix,bsmr-erlang/phoenix,Joe-noh/phoenix,yoavlt/phoenix,mvidaurre/phoenix,jxs/phoenix,andrewvy/phoenix,yonglehou/phoenix,jeffweiss/phoenix,rafbgarcia/phoenix,phoenixframework/phoenix,milafrerichs/phoenix,0x00evil/phoenix,sadiqmmm/phoenix,wsmoak/phoenix,seejee/phoenix,rodrigues/phoenix,trarbr/... |
3cbb54de6476e0e374c9d1923d009c2e7cb03387 | lib/slax/users/user.ex | lib/slax/users/user.ex | defmodule Slax.User do
use SlaxWeb, :model
schema "users" do
field(:slack_id, :string)
field(:github_username, :string)
field(:github_access_token, :string)
end
@required_fields ~w(slack_id)
@optional_fields ~w(github_username github_access_token)
def changeset(user, params \\ %{}) do
use... | defmodule Slax.User do
use SlaxWeb, :model
schema "users" do
field(:slack_id, :string)
field(:github_username, :string)
field(:github_access_token, :string)
end
@required_fields ~w(slack_id)
@optional_fields ~w(github_username github_access_token)
def changeset(user, params \\ %{}) do
use... | Fix changeset for newer version of ecto | Fix changeset for newer version of ecto
| Elixir | mit | revelrylabs/slax,revelrylabs/slax,revelrylabs/slax |
d01f0d11ac44ea6e574c06fc57470143dd32809d | 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, %... | Deal with invalid parameters even better | Deal with invalid parameters even better
| Elixir | mit | revelrylabs/slax,revelrylabs/slax,revelrylabs/slax |
bd6351dcaeeac09c695b773afb23f05b7c9dd906 | priv/repo/migrations/20170822170625_change_memberships.exs | priv/repo/migrations/20170822170625_change_memberships.exs | defmodule Api.Repo.Migrations.ChangeMemberships do
use Ecto.Migration
alias Api.{Repo, Team, TeamMember}
def change do
alter table(:users_teams) do
add :role, :string, default: "member"
end
# Commented out since this script only needed to be ran once and it causes
# a sync problem between... | defmodule Api.Repo.Migrations.ChangeMemberships do
use Ecto.Migration
def change do
alter table(:users_teams) do
add :role, :string, default: "member"
end
# Commented out since this script only needed to be ran once and it causes
# a sync problem between the DB and the Team Model when runnin... | Remove warnings from old migration | Remove warnings from old migration
| Elixir | mit | portosummerofcode/psc-api |
64558e81c8ef5ef93522afd0362484e410296b64 | test/mix/tasks/phoenix/new_test.exs | test/mix/tasks/phoenix/new_test.exs | defmodule Mix.Tasks.Phoenix.NewTest do
use ExUnit.Case
@app_name "photo_blog"
@destination_path "/tmp"
setup_all do
Mix.Tasks.Phoenix.New.run([@app_name, @destination_path])
:ok
end
test "creates files and directories" do
expected_files = [".gitignore",
"README.md",
"lib",
"... | defmodule Mix.Tasks.Phoenix.NewTest do
use ExUnit.Case
@app_name "photo_blog"
@destination_path "/tmp"
setup_all do
Mix.Tasks.Phoenix.New.run([@app_name, @destination_path])
on_exit fn() -> File.rm_rf(project_path) end
:ok
end
test "creates files and directories" do
expected_files = [".gi... | Fix test callbacks (teardown_all -> on_exit | Fix test callbacks (teardown_all -> on_exit
| Elixir | mit | lono-devices/phoenix,jwarwick/phoenix,KazuCocoa/phoenix,Joe-noh/phoenix,andrewvy/phoenix,marcioj/phoenix,robomc/phoenix,rodrigues/phoenix,pap/phoenix,foxnewsnetwork/phoenix,Ben-Evolently/phoenix,hotvulcan/phoenix,linearregression/phoenix,maxnordlund/phoenix,CD1212/phoenix,Gazler/phoenix,cas27/phoenix,mobileoverlord/pho... |
0f72ef7d5311b39243e20a4163063bdc1d47fd40 | test/spotthestation2_web/controllers/page_controller_test.exs | test/spotthestation2_web/controllers/page_controller_test.exs | defmodule SpotTheStation2.PageControllerTest do
use Spotthestation2Web.ConnCase
test "GET /", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
test "GET /cologne.ics", %{conn: conn} do
conn = get(conn, "/cologne.ics")
assert response(conn, 200... | defmodule SpotTheStation2.PageControllerTest do
use Spotthestation2Web.ConnCase
test "GET /", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Welcome to SpotTheStation iCal Feed"
end
test "GET /cologne.ics", %{conn: conn} do
conn = get(conn, "/cologne.ics")
assert re... | Test broke after updating phoenix | Test broke after updating phoenix | Elixir | mit | elitau/spotthestation,elitau/spotthestation |
b4a0c6264663f6c5ace51a80ad1a0983b7d86481 | lib/trot/supervisor.ex | lib/trot/supervisor.ex | defmodule Trot.Supervisor do
@moduledoc false
@doc false
def start_link do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
@doc false
def init([]) do
import Supervisor.Spec
port = Application.get_env(:trot, :port, 4000)
router_module = Application.get_env(:trot, :router, Trot.... | defmodule Trot.Supervisor do
@moduledoc false
@doc false
def start_link do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
@doc false
def init([]) do
import Supervisor.Spec
port = case Application.get_env(:trot, :port, 4000) do
port when is_binary(port) -> String.to_integer(... | Convert ports specified in the config as a string into an integer before starting cowboy. | Convert ports specified in the config as a string into an integer before starting cowboy.
| Elixir | apache-2.0 | hexedpackets/trot |
a0d161fd94c1c49fd6fbafcc9f81545006d8a697 | apps/server/lib/server/type/controller.ex | apps/server/lib/server/type/controller.ex | defmodule HELM.Server.Type.Controller do
import Ecto.Query
alias HELF.{Broker, Error}
alias HELM.Server.Repo
alias HELM.Server.Type.Schema, as: ServerTypeSchema
def create(server_type) do
ServerTypeSchema.create_changeset(%{server_type: server_type})
|> Repo.insert()
end
def find(server_type) d... | defmodule HELM.Server.Type.Controller do
import Ecto.Query
alias HELF.{Broker, Error}
alias HELM.Server.Repo
alias HELM.Server.Type.Schema, as: ServerTypeSchema
def create(server_type) do
ServerTypeSchema.create_changeset(%{server_type: server_type})
|> Repo.insert()
end
def find(server_type) d... | Remove trailling whitespace from Server.Type.Controller. | Remove trailling whitespace from Server.Type.Controller.
| Elixir | agpl-3.0 | renatomassaro/Helix,HackerExperience/Helix,mememori/Helix,renatomassaro/Helix,HackerExperience/Helix |
d4f19f00eaa2f7728ebd05f99ea00ab003af885f | lib/jumubase_web/controllers/api/performance_controller.ex | lib/jumubase_web/controllers/api/performance_controller.ex | defmodule JumubaseWeb.Api.PerformanceController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Showtime
alias Jumubase.Showtime.PerformanceFilter
def index(conn, %{"contest_id" => contest_id, "venue_id" => stage_id, "date" => date}) do
contest = Foundation.get_contest!(contest_i... | defmodule JumubaseWeb.Api.PerformanceController do
use JumubaseWeb, :controller
alias Jumubase.Foundation
alias Jumubase.Showtime
alias Jumubase.Showtime.PerformanceFilter
def index(conn, %{"contest_id" => contest_id, "venue_id" => stage_id, "date" => date} = params) do
contest = Foundation.get_contest!(... | Allow filtering performances by contest category in REST API | Allow filtering performances by contest category in REST API
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
ec77ee91d7a9628c7366956410972a8e2e06027e | lib/api_web/actions/medium_actions.ex | lib/api_web/actions/medium_actions.ex | defmodule ApiWeb.MediumActions do
use Api.Web, :action
@http Application.get_env(:api, :http_lib)
def get_latest_posts(count) do
url = "https://medium.com/@portosummercode/latest?count=#{count}&format=json"
with {:ok, response} <- @http.get(url), do: remove_prefix(response)
end
defp remove_prefix(... | defmodule ApiWeb.MediumActions do
use Api.Web, :action
@http Application.get_env(:api, :http_lib)
def get_latest_posts(count) do
url = "https://medium.com/@makeorbreak.io/latest?count=#{count}&format=json"
with {:ok, response} <- @http.get(url), do: remove_prefix(response)
end
defp remove_prefix(r... | Fix medium endpoint used for latest posts | Fix medium endpoint used for latest posts | Elixir | mit | portosummerofcode/psc-api |
f571916473216cf647406f344637efcd712968a4 | test/test_helper.exs | test/test_helper.exs | ExUnit.start
ExUnit.configure exclude: :pending, trace: true
| ExUnit.start
if System.get_env("FOCUS") == "1" do
ExUnit.configure(exclude: [:test, :pending], trace: true, include: :focus)
else
ExUnit.configure exclude: :pending, trace: true
end
| Allow me to focus when working | Allow me to focus when working
| Elixir | mit | thbar/elixir-playground |
308daf82ca5e1863f4c5214515cba56e90c95959 | web/models/question.ex | web/models/question.ex | defmodule Core.Question do
use Core.Web, :model
schema "questions" do
field :title, :string
many_to_many :question_tags, Core.Tag, join_through: Core.QuestionTag
field :answer, {:array, :map}, virtual: true
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
... | defmodule Core.Question do
use Core.Web, :model
schema "questions" do
field :title, :string
many_to_many :question_tags, Core.Tag, join_through: Core.QuestionTag
field :answer, {:array, :map}, virtual: true
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
... | Update model Question. Allow keys as strings (not only atoms) | Update model Question. Allow keys as strings (not only atoms)
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
3c3990afcf0b28145045ae78f4289f5075161a5e | lib/slack_coder/slack.ex | lib/slack_coder/slack.ex | defmodule SlackCoder.Slack do
use Slack
import SlackCoder.Slack.Helper
alias SlackCoder.Config
require Logger
@online_message """
:slack: *Slack* :computer: *Coder* online!
Reporting on any PRs since last online...
"""
def send_to(user, message) do
send :slack, {user, String.strip(message)}
end... | defmodule SlackCoder.Slack do
use Slack
import SlackCoder.Slack.Helper
alias SlackCoder.Config
require Logger
@online_message """
:slack: *Slack* :computer: *Coder* online!
Reporting on any PRs since last online...
"""
def send_to(user, message) when is_binary(user) do
String.to_atom(user) |> sen... | Make sure user names are converted to atoms so that we can find them the user list. | Make sure user names are converted to atoms so that we can find them the user list.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
17d6324598139f8509448872048fdf6ff72a5499 | exercises/leap/leap.exs | exercises/leap/leap.exs | defmodule Year do
@doc """
Returns whether 'year' is a leap year.
A leap year occurs:
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
except every year that is evenly divisible by 400.
"""
@spec leap_year?(non_neg_integer) :: boolean
def leap_year?... | defmodule Year do
@doc """
Returns whether 'year' is a leap year.
A leap year occurs:
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400
"""
@spec leap_year?(non_neg_integer) :: boolean
def leap_year?(ye... | Update doc to match orginal README | Update doc to match orginal README
| Elixir | mit | cezarykosko/xelixir,exercism/xelixir,parkerl/xelixir |
c6cb4a285e387ad165eb22b9c8ab7268bbeb1f96 | lib/mailman/context.ex | lib/mailman/context.ex | defmodule Mailman.Context do
@moduledoc "Defines the configuration for both rendering and sending of messages"
defstruct config: nil, composer: %Mailman.EexComposeConfig{}
def get_config(context) do
case context.config do
# if config in context is nil, read it from config.exs
nil -> get_mix_con... | defmodule Mailman.Context do
@moduledoc "Defines the configuration for both rendering and sending of messages"
defstruct config: nil, composer: %Mailman.EexComposeConfig{}
def get_config(context) do
case context.config do
# if config in context is nil, read it from config.exs
nil -> get_mix_con... | Fix typo in config generation | Fix typo in config generation
| Elixir | mit | kamilc/mailman |
8964f4fcc195d63acf7a77a45477d91ec514079a | lib/blinkchain/application.ex | lib/blinkchain/application.ex | defmodule Blinkchain.Application do
@moduledoc false
use Application
require Logger
def start(_type, _args) do
Logger.debug("Blinkchain Application starting")
children = [
Blinkchain.HAL
]
opts = [strategy: :one_for_one, name: Blinkchain.Supervisor]
Supervisor.start_link(children, ... | defmodule Blinkchain.Application do
@moduledoc false
use Application
require Logger
def start(_type, _args) do
Logger.debug("Blinkchain Application starting")
children = [
Blinkchain.HAL
]
opts = [
name: Blinkchain.Supervisor,
strategy: :one_for_one,
max_restarts: 5,
... | Allow short bursts of restarts without giving up | Allow short bursts of restarts without giving up
| Elixir | mit | GregMefford/nerves_io_neopixel,GregMefford/nerves_neopixel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.