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 |
|---|---|---|---|---|---|---|---|---|---|
806421e4c6a97fe21caed854cab55d2e2503b54e | lib/atom_tweaks_web/controllers/stargazer_controller.ex | lib/atom_tweaks_web/controllers/stargazer_controller.ex | defmodule AtomTweaksWeb.StargazerController do
@moduledoc """
Handles requests for tweak stargazer information.
"""
use AtomTweaksWeb, :controller
alias AtomTweaks.Tweaks
@doc """
Displays the list of a tweak's stargazers.
"""
def index(conn, %{"tweak_id" => tweak_id}) do
tweak = Tweaks.get_twea... | defmodule AtomTweaksWeb.StargazerController do
@moduledoc """
Handles requests for tweak stargazer information.
"""
use AtomTweaksWeb, :controller
alias AtomTweaks.Tweaks
@doc """
Displays the list of a tweak's stargazers.
"""
def index(conn, %{"tweak_id" => tweak_id}) do
tweak = Tweaks.get_twea... | Add fork_count to stargazers page | Add fork_count to stargazers page
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
1cd04c540fa16241b1f9c7ccdadebcde9d286efc | api/lib/api/router.ex | api/lib/api/router.ex | defmodule Api.Router do
use Plug.Router
import Api.RouterUtils, only: [send_json: 2]
plug :match
plug(Plug.Parsers,
parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
)
plug :dispatch
forward("/documents", to: Api.Documents.Router)
post "/reindex" do
Task.async fn ... | defmodule Api.Router do
use Plug.Router
import Api.RouterUtils, only: [send_json: 2]
plug :match
plug(Plug.Parsers,
parsers: [:json],
pass: ["application/json"],
json_decoder: Poison
)
plug :dispatch
forward("/documents", to: Api.Documents.Router)
post "/reindex" do
Task.async fn ... | Change route and remove comment | Change route and remove comment
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
50d771b4e7696bc80618d967dce2d88dbb0f6297 | mix.exs | mix.exs | defmodule Xandra.Mixfile do
use Mix.Project
@description "Fast, simple, and robust Cassandra driver for Elixir."
@repo_url "https://github.com/lexhide/xandra"
@version "0.10.0"
def project() do
[
app: :xandra,
version: @version,
elixir: "~> 1.6",
build_embedded: Mix.env() == :p... | defmodule Xandra.Mixfile do
use Mix.Project
@description "Fast, simple, and robust Cassandra driver for Elixir."
@repo_url "https://github.com/lexhide/xandra"
@version "0.10.0"
def project() do
[
app: :xandra,
version: @version,
elixir: "~> 1.6",
build_embedded: Mix.env() == :p... | Use "runtime: false" for Dialyxir | Use "runtime: false" for Dialyxir
| Elixir | isc | lexhide/xandra |
de58f080ca6b235a6cccb298d67d96097372c50e | mix.exs | mix.exs | defmodule Baud.Mixfile do
use Mix.Project
def project do
[app: :baud,
version: "0.5.4",
elixir: "~> 1.3",
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases(),
description: description(),
package: package(),
... | defmodule Baud.Mixfile do
use Mix.Project
def project do
[app: :baud,
version: "0.5.4",
elixir: "~> 1.3",
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases(),
description: description(),
package: package(),
... | Resolve warnings introduced in Elixir v1.7 | Resolve warnings introduced in Elixir v1.7
This commit fixes quotation warnings in `mix.exs`. The warnings were
introduced with Elixir v1.7. Example warning:
warning: found quoted keyword "tryout" but the quotes are not
required. Note that keywords are always atoms, even when quoted, and
quotes should onl... | Elixir | mit | samuelventura/baud |
99aec1c59f4876b583dccb12dfa69d487c969d37 | web/views/layout_view.ex | web/views/layout_view.ex | defmodule Appointments.LayoutView do
use Appointments.Web, :view
def active?(conn, path) do
[_ | [resource | _]] = String.split(conn.request_path, "/")
if resource == path, do: "active", else: ''
end
end
| defmodule Appointments.LayoutView do
use Appointments.Web, :view
def active?(conn, path) do
resource = String.split(conn.request_path, "/") |> Enum.at(1)
if resource == path, do: "active", else: ""
end
end
| Make active? a bit prettier | Make active? a bit prettier
| Elixir | mit | sveittir-finnar/book-me,sveittu-finnarnir/book-me,sveittir-finnar/book-me,sveittu-finnarnir/book-me |
76a51055d0e3370288720ec2c66b26c761a97339 | lib/hound/supervisor.ex | lib/hound/supervisor.ex | defmodule Hound.Supervisor do
use Supervisor.Behaviour
def start_link do
:supervisor.start_link(__MODULE__, [])
end
def init([]) do
children = [
# Define workers and child supervisors to be supervised
# worker(Shepherd.Worker, [])
]
# See http://elixir-lang.org/docs/stable/Supervi... | defmodule Hound.Supervisor do
use Supervisor.Behaviour
def start_link do
:supervisor.start_link(__MODULE__, [])
end
def init([]) do
children = [
worker(Hound.SessionServer, [])
]
# See http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html
# for other strategies and supported ... | Add session server as worker | Add session server as worker
| Elixir | mit | esbullington/hound,jontonsoup/hound,lowks/hound,manukall/hound,HashNuke/hound,lowks/hound,manukall/hound,jontonsoup/hound,oivoodoo/hound,oivoodoo/hound,knewter/hound,esbullington/hound,HashNuke/hound |
f12fac13b2c0d6c62adad9acfdce2706afc5a25f | lib/farmbot/celery_script/ast/node/read_pin.ex | lib/farmbot/celery_script/ast/node/read_pin.ex | defmodule Farmbot.CeleryScript.AST.Node.ReadPin do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args [:pin_number, :label, :pin_mode]
def execute(%{pin_number: pin_num, pin_mode: mode, label: label}, _, env) do
env = mutate_env(env)
case Farmbot.Firmware.read_pin(pin_num, mode) do
:ok... | defmodule Farmbot.CeleryScript.AST.Node.ReadPin do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args [:pin_number, :label, :pin_mode]
use Farmbot.Logger
def execute(%{pin_number: pin_num, pin_mode: mode, label: label}, _, env) do
env = mutate_env(env)
case Farmbot.Firmware.read_pin(pin_nu... | Add log for pin reads. | Add log for pin reads.
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
5bbec99c94502805a889164d852e5e9ccee1c3dd | lib/ontag_core/cms/entry.ex | lib/ontag_core/cms/entry.ex | defmodule OntagCore.CMS.Entry do
use Ecto.Schema
import Ecto.Changeset
alias OntagCore.CMS.{Entry,
Author}
schema "entries" do
field :title, :string
field :entry_type, :string
belongs_to :author, Author
timestamps()
end
def changeset(%Entry{} = entry, attrs) do
... | defmodule OntagCore.CMS.Entry do
use Ecto.Schema
import Ecto.Changeset
alias OntagCore.CMS.{Entry,
Author,
MediumPost,
ExternalHTML}
schema "entries" do
field :title, :string
field :entry_type, :string
has_one :medium_post, Medium... | Add relation Entry > MediumPost & ExternalHTML | Add relation Entry > MediumPost & ExternalHTML
| Elixir | mit | CommonActionForum/ontag_core,CommonActionForum/ontag_core |
78ad060beda10f67ce0412575b2e51208d1da6ab | test/credo/check/consistency/multi_alias_import_require_use_test.exs | test/credo/check/consistency/multi_alias_import_require_use_test.exs | defmodule Credo.Check.Consistency.MultiAliasImportRequireUseTest do
use Credo.TestHelper
@described_check Credo.Check.Consistency.MultiAliasImportRequireUse
@single """
defmodule Credo.Sample2 do
alias Foo.Bar
alias Foo.Quux
require Foo.Bar
end
"""
@multi """
defmodule Credo.Sample3 do
alias Foo.{Bar,... | defmodule Credo.Check.Consistency.MultiAliasImportRequireUseTest do
use Credo.TestHelper
@described_check Credo.Check.Consistency.MultiAliasImportRequireUse
@single """
defmodule Credo.Sample2 do
alias Foo.Bar
alias Foo.Quux
require Foo.Bar
end
"""
@multi """
defmodule Credo.Sample3 do
alias Foo.{Bar,... | Fix MultiAliasImportRequireUse tests on Elixir 1.1 | Fix MultiAliasImportRequireUse tests on Elixir 1.1
| Elixir | mit | rrrene/credo,rrrene/credo |
cf04cbb2aff3b9a9f96d70eac611d094f6c617b4 | mix.exs | mix.exs | defmodule Tesla.Mixfile do
use Mix.Project
def project do
[app: :tesla,
version: "0.1.3",
description: description,
package: package,
source_url: "https://github.com/monterail/tesla",
elixir: "~> 1.0",
deps: deps,
test_coverage: [tool: ExCoveralls]]
end
# Configuration f... | defmodule Tesla.Mixfile do
use Mix.Project
def project do
[app: :tesla,
version: "0.1.4",
description: description,
package: package,
source_url: "https://github.com/monterail/tesla",
elixir: "~> 1.0",
deps: deps,
test_coverage: [tool: ExCoveralls]]
end
# Configuration f... | Make exjsx an optional dependency | [fix] Make exjsx an optional dependency | Elixir | mit | teamon/tesla,lbarratt/tesla,monterail/tesla |
d0923f9557d0bc1548b244ea6637d785d41b1606 | web/controllers/user_controller.ex | web/controllers/user_controller.ex | defmodule Core.UserController do
use Core.Web, :controller
alias Core.User
plug Guardian.Plug.EnsureAuthenticated, %{handler: Core.Auth}
plug :authorize
def create(conn, params) do
changeset = User.changeset(%User{}, params)
case Repo.insert(changeset) do
{:ok, user} ->
conn
|... | defmodule Core.UserController do
use Core.Web, :controller
alias Core.User
plug :find when action in [:show]
plug Core.Auth, %{key: :user,
type: "users"} when action in [:show]
def create(conn, params) do
changeset = User.changeset(%User{}, params)
case Repo.insert(changeset) do... | Refactor Core.UserController. Use find and Core.Auth plugs | Refactor Core.UserController. Use find and Core.Auth plugs
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
9c8e430ba296be2d39c3e79b0cd24425226cf412 | lib/credo/check/readability/prefer_implicit_try.ex | lib/credo/check/readability/prefer_implicit_try.ex | defmodule Credo.Check.Readability.PreferImplicitTry do
@moduledoc """
We don't need to explicity use `try` in function definitions. For example, this:
defmodule ModuleWithRescue do
def failing_function(first) do
try do
to_string(first)
rescue
_ -> :rescued
end
end
end
Could be rewritten ... | defmodule Credo.Check.Readability.PreferImplicitTry do
@moduledoc """
Prefer using an implicit `try` rather than explicit `try` if you try to rescue
anything the function does.
For example, this:
def failing_function(first) do
try do
to_string(first)
rescue
_ -> :resc... | Improve docs and fix indent for PreferImplicitTry | Improve docs and fix indent for PreferImplicitTry
Refs #264
| Elixir | mit | rrrene/credo,rrrene/credo |
d5e9aa99c786aa8e37f7717cd6381c262406638f | lib/ueberauth_example_web/views/auth_view.ex | lib/ueberauth_example_web/views/auth_view.ex | defmodule UeberauthExample.AuthView do
@moduledoc false
use UeberauthExampleWeb, :view
end
| defmodule UeberauthExampleWeb.AuthView do
@moduledoc false
use UeberauthExampleWeb, :view
end
| Update AuthView namespace for 1.3 structure | Update AuthView namespace for 1.3 structure
| Elixir | mit | ueberauth/ueberauth_example,ueberauth/ueberauth_example |
b5728915905387cacdf6bf1e0d1a48ff8ee4bf4f | mix.exs | mix.exs | defmodule Trot.Mixfile do
use Mix.Project
@version File.read!("VERSION") |> String.strip
def project do
[app: :trot,
version: @version,
elixir: "~> 1.0",
deps: deps,
name: "Trot",
docs: [readme: "README.md", main: "README",
source_ref: "v#{@version}",
source_... | defmodule Trot.Mixfile do
use Mix.Project
@version File.read!("VERSION") |> String.strip
def project do
[app: :trot,
version: @version,
elixir: "~> 1.0",
deps: deps,
name: "Trot",
docs: [readme: "README.md", main: "README",
source_ref: "v#{@version}",
source_... | Add plug_heartbeat to the list of applications so exrm releases will pick it up. | Add plug_heartbeat to the list of applications so exrm releases will pick it up.
| Elixir | apache-2.0 | hexedpackets/trot |
08c1646e35162969b9a2a81a9dec76dd6a0b6358 | mix.exs | mix.exs | defmodule Elsol.Mixfile do
use Mix.Project
def project do
[app: :elsol,
version: "0.0.2",
elixir: "~> 1.0",
elixir_paths: ["lib", "lib/elsol"],
spec_paths: ["spec"],
spec_pattern: "*_spec.exs",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: d... | defmodule Elsol.Mixfile do
use Mix.Project
def project do
[app: :elsol,
version: "0.0.2",
elixir: "~> 1.0",
elixir_paths: ["lib", "lib/elsol"],
spec_paths: ["spec"],
spec_pattern: "*_spec.exs",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: d... | Update httpoision to latest minor version | Update httpoision to latest minor version
| Elixir | apache-2.0 | boonious/elsol |
b6ce7ac4f3a7d4e1b5c53d85ba893b81575a9e49 | lib/credo/check/readability/prefer_implicit_try.ex | lib/credo/check/readability/prefer_implicit_try.ex | defmodule Credo.Check.Readability.PreferImplicitTry do
@moduledoc """
We don't need to explicity use `try` in function definitions. For example, this:
defmodule ModuleWithRescue do
def failing_function(first) do
try do
to_string(first)
rescue
_ -> :rescued
end
end
end
Could be rewritten ... | defmodule Credo.Check.Readability.PreferImplicitTry do
@moduledoc """
Prefer using an implicit `try` rather than explicit `try` if you try to rescue
anything the function does.
For example, this:
def failing_function(first) do
try do
to_string(first)
rescue
_ -> :resc... | Improve docs and fix indent for PreferImplicitTry | Improve docs and fix indent for PreferImplicitTry
Refs #264
| Elixir | mit | rrrene/credo,rrrene/credo |
aa7e5c9537847885f6ca2dbe38fe287272fd94a0 | test/distillery_packager/tasks_test.exs | test/distillery_packager/tasks_test.exs | defmodule DistilleryPackagerTest.TasksTest do
use ExUnit.Case
alias DistilleryPackager.Utils.Config, as: ConfigUtil
setup_all do
dest = [ConfigUtil.root, "rel"] |> Path.join
Mix.Tasks.Release.Deb.PrepareBasePath.run(:test)
Mix.Tasks.Release.Deb.GenerateTemplates.run(:test)
on_exit fn ->
... | defmodule DistilleryPackagerTest.TasksTest do
use ExUnit.Case
alias DistilleryPackager.Utils.Config, as: ConfigUtil
setup_all do
dest = ConfigUtil.rel_dest_path()
Mix.Tasks.Release.Deb.PrepareBasePath.run(:test)
Mix.Tasks.Release.Deb.GenerateTemplates.run(:test)
on_exit fn ->
File.rm_rf!... | Fix issue with path for tests | Fix issue with path for tests
| Elixir | mit | 18Months/distillery_packager,18Months/distillery_packager |
1e507f86ac097e0ce98f9407998b18f8b055a7d8 | lib/marco_polo/rid.ex | lib/marco_polo/rid.ex | defmodule MarcoPolo.RID do
defstruct [:cluster_id, :position]
end
| defmodule MarcoPolo.RID do
@moduledoc """
Struct that represents an OrientDB record id (RID).
OrientDB identifies records with a unique id, called the record id (RID). A
RID consists of the id of the cluster the record is and the position of the
record in the cluster. The fields for the `MarcoPolo.RID` struc... | Add documentation to the `MarcoPolo.RID` module | Add documentation to the `MarcoPolo.RID` module
| Elixir | apache-2.0 | MyMedsAndMe/marco_polo,linearregression/marco_polo |
a224a682b8af4cc347de9a108cbc75c5e592d6d4 | lib/rotor/runner.ex | lib/rotor/runner.ex | defmodule Rotor.Runner do
require Logger
def run(name, changed_files, all_files) do
group = Rotor.group_info name
try do
apply group.rotor_fn, [changed_files, all_files]
rescue
error ->
Logger.debug "Error running rotor function for group: #{name}"
IO.inspect error
end
... | defmodule Rotor.Runner do
require Logger
def run(name, changed_files, all_files) do
Logger.debug "Running Rotor function for #{name}"
group = Rotor.group_info name
try do
apply group.rotor_fn, [changed_files, all_files]
rescue
error ->
Logger.debug "Error running rotor function... | Add debug message when running rotor function | Add debug message when running rotor function
| Elixir | mit | HashNuke/rotor |
f5630de5694d2c7fba638c07d1b5da484dca1194 | test/socket_id_test.exs | test/socket_id_test.exs | defmodule Poxa.SocketIdTest do
use ExUnit.Case
alias Poxa.SocketId
setup_all do
:random.seed
:ok
end
test "generate! returns a string of 2 integers" do
socket_id = SocketId.generate!
[part1, part2] = String.split(socket_id, ".")
assert {_, ""} = Integer.parse(part1)
assert {_, ""} =... | defmodule Poxa.SocketIdTest do
use ExUnit.Case
alias Poxa.SocketId
test "generate! returns a string of 2 integers" do
socket_id = SocketId.generate!
[part1, part2] = String.split(socket_id, ".")
assert {_, ""} = Integer.parse(part1)
assert {_, ""} = Integer.parse(part2)
end
end
| Remove unnecessary setup on SocketIdTest | Remove unnecessary setup on SocketIdTest
| Elixir | mit | edgurgel/poxa,edgurgel/poxa,RobertoSchneiders/poxa,joshk/poxa,waffleio/poxa,RobertoSchneiders/poxa,edgurgel/poxa,joshk/poxa,waffleio/poxa |
ba736253c01e8c55272defaf858267eadb35dc44 | priv/repo/migrations/20150826231516_create_user.exs | priv/repo/migrations/20150826231516_create_user.exs | defmodule RoutingSecurelyWithPhoenixFramework.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string
add :password_hash, :string
timestamps
end
create unique_index(:users, [:name])
end
end
| defmodule RoutingSecurelyWithPhoenixFramework.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string, null: false
add :password_hash, :string, null: false
timestamps
end
create unique_index(:users, [:name])
end
end
| Add null: false to users columns | Add null: false to users columns
| Elixir | mit | KronicDeth/routing-securely-with-phoenix-framework |
a9936f999213417df67986f971731e5e89c61b5e | apps/bors_frontend/lib/bors_ng/wobserver_security.ex | apps/bors_frontend/lib/bors_ng/wobserver_security.ex | defmodule BorsNG.WobserverSecurity do
@moduledoc """
An implementation of the wobserver security policy.
This is necessary for one reason: Bors-NG runs on Heroku,
which establishes every connection from a different load balancer IP.
The default security policy rejects connections from a different IP than
"... | defmodule BorsNG.WobserverSecurity do
@moduledoc """
An implementation of the wobserver security policy.
This is necessary for one reason: Bors-NG runs on Heroku,
which establishes every connection from a different load balancer IP.
The default security policy rejects connections from a different IP than
"... | Move the pattern to before the variable | Move the pattern to before the variable
This is another Credo warning fixed.
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
de3ba688c92226903d4db301aa41d998ff4c4526 | port_demo/lib/port_demo/application.ex | port_demo/lib/port_demo/application.ex | defmodule Top.Application do
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
# Define workers and child supervisors to be supervised
childr... | defmodule Top.Application do
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
# Define workers and child supervisors to be supervised
childr... | Add Top.Server to list of children to start | Add Top.Server to list of children to start
| Elixir | unlicense | GeoffreyPS/on_ports,GeoffreyPS/on_ports |
83a328eab160bf96eda79e54916c2db3f6005ca1 | test/jumubase_web/controllers/page_controller_test.exs | test/jumubase_web/controllers/page_controller_test.exs | defmodule JumubaseWeb.PageControllerTest do
use JumubaseWeb.ConnCase
test "GET /", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
| defmodule JumubaseWeb.PageControllerTest do
use JumubaseWeb.ConnCase
test "GET /", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Jumu Nordost"
end
end
| Fix test for home route | Fix test for home route
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
3e0beb896e6521d3e921a6aa018cd051e245e8ae | lib/ex_twilio/resources/sip_credential.ex | lib/ex_twilio/resources/sip_credential.ex | defmodule ExTwilio.SipCredential do
@moduledoc """
Represents an SIP Credential in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/credential-list#subresources)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
ip_address: nil,
... | defmodule ExTwilio.SipCredential do
@moduledoc """
Represents an SIP Credential in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource#subresources)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
ip_address:... | Update redirect to SipCredential API | Update redirect to SipCredential API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
1ed6f39d0418bda3c39f416c48b64c0b7d1540f4 | lib/ex_twilio/resources/sip_ip_address.ex | lib/ex_twilio/resources/sip_ip_address.ex | defmodule ExTwilio.SipIpAddress do
@moduledoc """
Represents an SIP IpAddress in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/ip-access-control-list#subresources)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
ip_address: nil,
... | defmodule ExTwilio.SipIpAddress do
@moduledoc """
Represents an SIP IpAddress in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource#subresources)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
ip_addre... | Update redirect to SipIpAddress API | Update redirect to SipIpAddress API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
bf7a3599e243476226628abfd8590e4ee5d85feb | test/integration/private_channel_test.exs | test/integration/private_channel_test.exs | defmodule Poxa.Integration.PrivateChannelTest do
use ExUnit.Case
@moduletag :integration
setup do
{:ok, pid} = PusherClient.start_link("ws://localhost:8080", "app_key", "secret", stream_to: self)
Application.ensure_all_started(:pusher)
Pusher.configure!("localhost", 8080, "app_id", "app_key", "secre... | defmodule Poxa.Integration.PrivateChannelTest do
use ExUnit.Case
@moduletag :integration
setup do
{:ok, pid} = PusherClient.start_link("ws://localhost:8080", "app_key", "secret", stream_to: self)
Application.ensure_all_started(:pusher)
Pusher.configure!("localhost", 8080, "app_id", "app_key", "secre... | Split private channel integration into 2 tests | Split private channel integration into 2 tests
| Elixir | mit | joshk/poxa,RobertoSchneiders/poxa,edgurgel/poxa,waffleio/poxa,edgurgel/poxa,waffleio/poxa,edgurgel/poxa,joshk/poxa,RobertoSchneiders/poxa |
7f5791688fec84774b5dc1ce719f0cc593578aca | lib/doex/io/shell.ex | lib/doex/io/shell.ex | defmodule Doex.Io.Shell do
def cmd("doex") do
if has_mix?() do
"mix doex"
else
"doex"
end
end
def cmd(raw_cmd) do
if has_mix?() do
String.replace(raw_cmd, "doex ", "mix doex.")
else
raw_cmd
end
end
def info(_msg, %{quiet: true}), do: nil
def info(msg, _), do... | defmodule Doex.Io.Shell do
def cmd("doex") do
if has_mix?() do
"mix doex"
else
"doex"
end
end
def cmd(raw_cmd) do
if has_mix?() do
String.replace(raw_cmd, "doex ", "mix doex.")
else
raw_cmd
end
end
def info(_msg, %{quiet: true}), do: nil
def info(msg, args) ... | Add an Shell.info filter for raw args supporting --quiet | Add an Shell.info filter for raw args supporting --quiet
| Elixir | mit | capbash/doex |
e0be079416b699738719e939ea5849c56509c92d | lib/xandra/compressor.ex | lib/xandra/compressor.ex | defmodule Xandra.Compressor do
@moduledoc """
A behaviour to compress and decompress binary data.
Modules implementing this behaviour can be used to compress and decompress
data using one of the compression algorithms supported by Cassandra (as of
now, lz4 and snappy).
## Example
Let's imagine you impl... | defmodule Xandra.Compressor do
@moduledoc """
A behaviour to compress and decompress binary data.
Modules implementing this behaviour can be used to compress and decompress
data using one of the compression algorithms supported by Cassandra (as of
now, lz4 and snappy).
## Example
Let's imagine you impl... | Fix typo in Xandra.Compressor docs | Fix typo in Xandra.Compressor docs
| Elixir | isc | lexhide/xandra |
7bc2f838f7f8c1021d911ebcea3a79f0beab7b39 | test/nerves_dnssd_test.exs | test/nerves_dnssd_test.exs | defmodule Nerves.DnssdTest do
use ExUnit.Case
doctest Nerves.Dnssd, import: true
def flush(amount) when is_integer(amount) do
flush([]) |> Enum.take(amount)
end
def flush(acc \\ []) do
receive do
msg ->
flush(acc ++ [msg |> strip_ref()])
after
1500 -> acc |> Enum.sort
end... | defmodule Nerves.DnssdTest do
use ExUnit.Case
doctest Nerves.Dnssd, import: true
def flush(), do: do_flush([])
def flush(amount) when is_integer(amount) do
do_flush([]) |> Enum.take(amount)
end
defp do_flush(acc) do
receive do
msg ->
do_flush(acc ++ [msg |> strip_ref()])
after
... | Fix handling of default value in function | Fix handling of default value in function
| Elixir | apache-2.0 | amolenaar/nerves_dnssd |
0252a4f8128b419287a0b23099b5d8534c4938af | lib/elixir/lib/iex/unicode_io.ex | lib/elixir/lib/iex/unicode_io.ex | defmodule IEx.UnicodeIO do
@moduledoc """
This module implements the API used by IEX to
interact with the console. This API may change
in the future without warnings.
"""
@doc """
Implements the get IO API used by IEx. It receives the
code cache, the instructions counter and needs to
return a list wi... | defmodule IEx.UnicodeIO do
@moduledoc """
This module implements the API used by IEX to
interact with the console. This API may change
in the future without warnings.
"""
@doc """
Implements the get IO API used by IEx. It receives the
code cache, the instructions counter and needs to
return a list wi... | Print node name in IEx prompt | Print node name in IEx prompt
| Elixir | apache-2.0 | kelvinst/elixir,gfvcastro/elixir,lexmag/elixir,antipax/elixir,michalmuskala/elixir,kelvinst/elixir,pedrosnk/elixir,ggcampinho/elixir,beedub/elixir,joshprice/elixir,ggcampinho/elixir,gfvcastro/elixir,pedrosnk/elixir,elixir-lang/elixir,kimshrier/elixir,beedub/elixir,kimshrier/elixir,antipax/elixir,lexmag/elixir |
908e1716e1fd8cf7c0112105061a189074558d44 | priv/templates/resource/model.ex | priv/templates/resource/model.ex | defmodule <%= module %> do
use <%= base %>.Web, :model
schema <%= inspect plural %> do
<%= for {k, _} <- attrs do %> field <%= inspect k %>, <%= inspect types[k] %><%= defaults[k] %>
<% end %>
timestamps
end
@doc """
Creates a changeset based on the `model` and `params`.
If `params` are nil, an in... | defmodule <%= module %> do
use <%= base %>.Web, :model
schema <%= inspect plural %> do
<%= for {k, _} <- attrs do %> field <%= inspect k %>, <%= inspect types[k] %><%= defaults[k] %>
<% end %>
timestamps
end
@required_fields ~w(<%= Enum.map_join(attrs, " ", &elem(&1, 0)) %>)
@optional_fields ~w()
... | Make required and optional fields clearer | Make required and optional fields clearer | Elixir | mit | CultivateHQ/phoenix,0x00evil/phoenix,Kosmas/phoenix,Rumel/phoenix,mitchellhenke/phoenix,nshafer/phoenix,daytonn/phoenix,andrewvy/phoenix,Smulligan85/phoenix,jxs/phoenix,Gazler/phoenix,sdnorm/phoenix,javimolla/phoenix,ericmj/phoenix,0x00evil/phoenix,Fluxuous/phoenix,milafrerichs/phoenix,tony612/phoenix,ybur-yug/phoenix,... |
98315e8fff13563b98a298478d93f43de0706703 | lib/nerves/utils/file.ex | lib/nerves/utils/file.ex | defmodule Nerves.Utils.File do
def untar(file, destination \\ nil) do
destination = destination || File.cwd!()
cmd("tar", ["xf", file, "--strip-components=1", "-C", destination])
|> result()
end
@doc """
Create a tar of the contents of the path and specified output file
"""
def tar(path, file)... | defmodule Nerves.Utils.File do
def untar(file, destination \\ nil) do
destination = destination || File.cwd!()
cmd("tar", ["xf", file, "--strip-components=1", "-C", destination])
|> result()
end
@doc """
Create a tar of the contents of the path and specified output file
"""
def tar(path, file)... | Add a friendly error for missing commands | Add a friendly error for missing commands
| Elixir | apache-2.0 | nerves-project/nerves,nerves-project/nerves |
043446ee2b91bfda2376b54b21f2af840bde5f57 | lib/tilex_web/channels/user_socket.ex | lib/tilex_web/channels/user_socket.ex | defmodule TilexWeb.UserSocket do
use Phoenix.Socket
## Channels
channel "post:search", Tilex.PostChannel
channel "text_converter", Tilex.TextConverterChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed ... | defmodule TilexWeb.UserSocket do
use Phoenix.Socket
## Channels
channel "post:search", Tilex.PostChannel
channel "text_converter", Tilex.TextConverterChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed ... | Break up a long line | Break up a long line
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
6e88ae447c80e9aa02eade98541fc2c91b690039 | apps/ello_events/lib/ello_events/mark_notifications_as_read.ex | apps/ello_events/lib/ello_events/mark_notifications_as_read.ex | defmodule Ello.Events.MarkNotificationsAsRead do
use Ello.Events.Sidekiq
defstruct [
user_id: nil,
last_notification_time: 0,
]
def args(struct) do
[
%{
user: %{active_record: %{id: struct.user_id, class: "User"}},
last_notification_time: parse_last_notification_time(struct),... | defmodule Ello.Events.MarkNotificationsAsRead do
use Ello.Events.Sidekiq
defstruct [
user_id: nil,
last_notification_time: 0,
]
def args(struct) do
[
%{
user: %{active_record: %{id: struct.user_id, class: "User"}},
last_notification_time: parse_last_notification_time(struct),... | Fix marking notifications as read. | Fix marking notifications as read.
| Elixir | mit | ello/apex,ello/apex,ello/apex |
8d655cdc71d0998b1c430be5a1940b81904f1f5c | lib/benchee/suite.ex | lib/benchee/suite.ex | defmodule Benchee.Suite do
defstruct [:config, :system, :run_times, :statistics, jobs: %{}]
@type optional_map :: map | nil
@type key :: atom | String.t
@type input_key :: key
@type benchmark_function :: (() -> any) | ((any) -> any)
@type t :: %__MODULE__{
config: optional_map,
system: optional_map... | defmodule Benchee.Suite do
defstruct [:config, :system, :run_times, :statistics, jobs: %{}]
@type optional_map :: map | nil
@type key :: atom | String.t
@type input_key :: key
@type benchmark_function :: (() -> any) | ((any) -> any)
@type t :: %__MODULE__{
config: optional_map,
system: optional_map... | Fix typespecs - there are 2 layers | Fix typespecs - there are 2 layers
| Elixir | mit | PragTob/benchee |
85f4fd5a7fc16038c6fc21da89f5119ca7f7e9a4 | priv/repo/migrations/20170419210307_create_user.exs | priv/repo/migrations/20170419210307_create_user.exs | defmodule RemoteRetro.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :email, :string
add :google_user_info, :jsonb
add :family_name, :string
add :given_name, :string
add :locale, :string
add :name, :string
add :picture, :stri... | defmodule RemoteRetro.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :email, :string, null: false
add :google_user_info, :jsonb, null: false
add :family_name, :string, null: false
add :given_name, :string, null: false
add :locale, :strin... | Enforce non-null constraints for user data | Enforce non-null constraints for user data
| Elixir | mit | stride-nyc/remote_retro,samdec11/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro |
61b136d16594a6de6aebe2a3c0624890d6b66c73 | test/fixtures/example_app/mix.exs | test/fixtures/example_app/mix.exs | defmodule Test.Mixfile do
use Mix.Project
def project do
[ app: :test,
version: "0.0.1",
deps: deps ]
end
# Configuration for the OTP application
def application do
[mod: { Test, [] },
applications: [:stdlib, :kernel, :elixir]]
end
# Returns the list of dependencies in the form... | defmodule Test.Mixfile do
use Mix.Project
def project do
[ app: :test,
version: "0.0.1",
deps: deps ]
end
# Configuration for the OTP application
def application do
[mod: { Test, [] },
applications: [:fake_project]]
end
# Returns the list of dependencies in the format:
# { :f... | Add fake_project to example_project :applications | Add fake_project to example_project :applications
| Elixir | mit | bitwalker/exrm,skirino/exrm,coonce/exrm,GalaxyGorilla/exrm,appunite/exrm |
111b4e16c4517cb608b28d5761722bfcd3a8526a | web/helpers/validation.ex | web/helpers/validation.ex | defmodule Appointments.Validators do
import Ecto.Changeset
def validate_uri(changeset, column) do
error_message = "Please enter a valid URL, e.g. http://www.cnn.com."
value = get_field(changeset, column)
case value do
nil -> changeset
_ ->
case is_valid?(value) do
false -... | defmodule Appointments.Validators do
import Ecto.Changeset
def validate_uri(changeset, column) do
error_message = "Please enter a valid URL, e.g. http://www.cnn.com."
value = get_field(changeset, column)
if value != nil && !is_valid?(value) do
add_error(changeset, column, error_message)
else... | Increase readability + fix credo issue | Increase readability + fix credo issue
| Elixir | mit | sveittir-finnar/book-me,sveittir-finnar/book-me,sveittu-finnarnir/book-me,sveittu-finnarnir/book-me |
667260da2b5e7933d0a62ba1b876d37116bcf61e | lib/talon/page_controller.ex | lib/talon/page_controller.ex | defmodule Talon.PageController do
defmacro __using__(opts) do
quote do
opts = unquote(opts)
talon = opts[:context] || raise("context option required")
plug :set_context, talon: talon
# TODO: Add docs for each of these and indicate they are overridable
@spec set_context(Plug.Conn.t, ... | defmodule Talon.PageController do
defmacro __using__(opts) do
quote do
opts = unquote(opts)
talon = opts[:context] || raise("context option required")
plug :set_context, talon: talon
@spec page(Plug.Conn.t, Map.t) :: Plug.Conn.t
def page(conn, params) do
page = Map.get(params... | Tweak implementation and remove cruft from PageController | Tweak implementation and remove cruft from PageController | Elixir | mit | talonframework/talon,talonframework/talon |
1dffd22c2de4b19541b0b1c6bc9137e5064c4919 | mix.exs | mix.exs | defmodule ExercismTestRunner.Mixfile do
use Mix.Project
def project do
[app: :tests,
version: "0.0.1",
elixir: "~> 1.1",
deps: deps,
test_paths: ["exercises"]]
end
def application do
[applications: [:logger]]
end
defp deps do
[{:poison, "~> 1.4.0"}]
end
end
| defmodule ExercismTestRunner.Mixfile do
use Mix.Project
def project do
[app: :tests,
version: "0.0.1",
elixir: "~> 1.3",
deps: deps,
test_paths: ["exercises"]]
end
def application do
[applications: [:logger]]
end
defp deps do
[{:poison, "~> 1.4.0"}]
end
end
| Unify Elixir version at 1.3 | Unify Elixir version at 1.3
| Elixir | mit | cezarykosko/xelixir,parkerl/xelixir,exercism/xelixir |
090187ce889cdd5f12ecc2a340c1147a8ac5a473 | test/test_helper.exs | test/test_helper.exs | ExUnit.start()
defmodule TestHarness do
import ExUnit.Assertions
def test_all(module, answers) do
module.all_koans
|> check_answer_count(answers, module)
|> Enum.zip(answers)
|> run_all(module)
|> check_results
end
defp check_answer_count(koans, answers, module) do
koans_count = lengt... | timeout = 1000 # ms
ExUnit.start(timeout: timeout)
defmodule TestHarness do
import ExUnit.Assertions
def test_all(module, answers) do
module.all_koans
|> check_answer_count(answers, module)
|> Enum.zip(answers)
|> run_all(module)
|> check_results
end
defp check_answer_count(koans, answers... | Set ExUnit timeout for quicker process debugging | Set ExUnit timeout for quicker process debugging
| Elixir | mit | elixirkoans/elixir-koans |
8634d15e35b379c2a6b4fe7b6beb31676e96a295 | 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: Fitbit.authorize_url!(scope: "settings sleep")
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
def callback(conn, %{"code" => code}) do
token = Fitbit.get_token!(code: code)
IO.inspect token
redirect conn, to: ... | Add callback function to auth controller | Add callback function to auth controller
| Elixir | mit | wsmoak/my_app_808732 |
5dc1032594ea89a123e1a5542aae8dc088d941e9 | web/router.ex | web/router.ex | defmodule PhoenixTutorial.Router do
use Phoenix.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", PhoenixTutorial do
pipe_through :browser # Use the defau... | defmodule PhoenixTutorial.Router do
use Phoenix.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", PhoenixTutorial do
pipe_through :browser # Use the defau... | Add new route for future HelloController | Add new route for future HelloController
| Elixir | mit | kenshin23/phoenix_tutorial |
bd37209d16f9c39132d400e8c606af771afca01d | elixir/mix.exs | elixir/mix.exs | defmodule RabbitmqTutorials.Mixfile do
use Mix.Project
def project do
[app: :rabbitmq_tutorials,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application
#
# Type "mix hel... | defmodule RabbitmqTutorials.Mixfile do
use Mix.Project
def project do
[app: :rabbitmq_tutorials,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application
#
# Type "mix hel... | Update Elixir dependency version: AMQP | Update Elixir dependency version: AMQP | Elixir | apache-2.0 | rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rab... |
6876ba77f540947b9d87b8d217d6109e9e24b558 | lib/benchfella/cli_util.ex | lib/benchfella/cli_util.ex | defmodule Benchfella.CLI.Util do
def read_all_input(lines \\ []) do
case IO.binread(:line) do
:eof ->
lines |> Enum.reverse |> Enum.join("")
{:error, reason} ->
Mix.raise "Error reading from input: #{inspect reason}"
line ->
read_all_input([line|lines])
end
end
d... | defmodule Benchfella.CLI.Util do
def read_all_input(lines \\ []) do
case IO.binread(:line) do
:eof ->
lines |> Enum.reverse |> Enum.join("")
{:error, reason} ->
Mix.raise "Error reading from input: #{inspect reason}"
line ->
read_all_input([line|lines])
end
end
d... | Fix the order of snapshots in the bench.cmp comparison | Fix the order of snapshots in the bench.cmp comparison
This was a regression in 2fbe632d6944c3dc20fa930967ab9577d2bb4dd3
| Elixir | mit | alco/benchfella,alco/benchfella |
804d9a3cd801da3b89032935a6c341389834e44e | priv/repo/migrations/20180211153304_create_open_pantry_user_managed_facility.exs | priv/repo/migrations/20180211153304_create_open_pantry_user_managed_facility.exs | defmodule OpenPantry.Repo.Migrations.CreateOpenPantry.OpenPantry.UserManagedFacility do
use Ecto.Migration
import Ecto.Query
alias OpenPantry.UserManagedFacility
def up do
create table(:user_managed_facilities) do
add :user_id, references(:users, on_delete: :nothing)
add :facility_id, reference... | defmodule OpenPantry.Repo.Migrations.CreateOpenPantry.OpenPantry.UserManagedFacility do
use Ecto.Migration
import Ecto.Query
alias OpenPantry.UserManagedFacility
def up do
create table(:user_managed_facilities) do
add :user_id, references(:users, on_delete: :nothing)
add :facility_id, reference... | Delete useless down migration for user_managed_facilities. | Delete useless down migration for user_managed_facilities.
| Elixir | mit | fcapovilla/open_pantry,fcapovilla/open_pantry,fcapovilla/open_pantry,openpantry/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,openpantry/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,fcapovilla/open_pantry,openpantry/open_pantry,openpantry/... |
a38702a9a1e223c381b889f14443a17efbbef598 | test/collections/collection_test.exs | test/collections/collection_test.exs | defmodule CollectionTest do
use ExUnit.Case
use Hound.Helpers
hound_session
defmodule IndexPage do
use PageObject
visitable :visit, "http://localhost:4000/index.html"
collection :things, item_scope: "ul .thing" do
text :title, "a.title"
attribute :special_attr, "data-special-attr", "... | defmodule CollectionTest do
use ExUnit.Case
use Hound.Helpers
hound_session
defmodule IndexPage do
use PageObject
visitable :visit, "http://localhost:4000/index.html"
collection :things, item_scope: "ul .thing" do
text :title, "a.title"
attribute :special_attr, "data-special-attr", "... | Add a couple more test cases for new functionality in collection. | Add a couple more test cases for new functionality in collection.
| Elixir | mit | samueljseay/page_object |
c011954a443e0148782a8a2bf590a44a1fdc9c34 | web/models/skill_level.ex | web/models/skill_level.ex | defmodule Academy.SkillLevel do
@moduledoc ~S"""
Defines a skill level model
Composition
-----------
A skill category is composed of a level, and an association with a
`Academy.User` and a `Academy.Skill`.
For getting the associations, see `Academy.User`.
"""
use Academy.Web, :model
schema "ski... | defmodule Academy.SkillLevel do
@moduledoc ~S"""
Defines a skill level model
Composition
-----------
A skill category is composed of a level, and an association with a
`Academy.User` and a `Academy.Skill`.
For getting the associations, see `Academy.User`.
"""
use Academy.Web, :model
schema "ski... | Allow 5 as a rating… (Too much checking) | Allow 5 as a rating… (Too much checking)
| Elixir | mit | ClubNix/academy,ClubNix/academy |
10fc1524ad06d3ed1808865820b1a0b47d4e253e | gherkin/elixir/mix.exs | gherkin/elixir/mix.exs | defmodule CucumberGherkin.MixProject do
use Mix.Project
@vsn "16.0.0"
@github "https://github.com/cucumber/cucumber/tree/master/gherkin/elixir"
@name "CucumberGherkin"
def project do
[
app: :cucumber_gherkin,
version: @vsn,
name: @name,
description: description(),
package: ... | defmodule CucumberGherkin.MixProject do
use Mix.Project
@vsn "16.0.0"
@github "https://github.com/cucumber/cucumber/tree/master/gherkin/elixir"
@name "CucumberGherkin"
def project do
[
app: :cucumber_gherkin,
version: @vsn,
name: @name,
description: description(),
package: ... | Update dependency cucumber_messages to v14 | Update dependency cucumber_messages to v14
| Elixir | mit | cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber |
b08016a245642cc6df3364d7e35a89f8f0c38613 | lib/database/crash.ex | lib/database/crash.ex | defmodule BorsNG.Database.Crash do
@moduledoc """
Crash dumps.
"""
use BorsNG.Database.Model
@type t :: %Crash{}
schema "crashes" do
belongs_to :project, Project
field :crash, :string
field :component, :string
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `... | defmodule BorsNG.Database.Crash do
@moduledoc """
A Crash Dump from a Bors Agent.
Allows an admin to see that a crash happened for a certain build thus
allowing it to be reacted upon.
"""
use BorsNG.Database.Model
@type t :: %__MODULE__{}
schema "crashes" do
belongs_to :project, Project
fiel... | Add types to Crash model | Add types to Crash model
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
71645e1ff4c8ea614ccc062211b89af5d462a611 | web/models/project.ex | web/models/project.ex | defmodule Aelita2.Project do
use Aelita2.Web, :model
alias Aelita2.LinkUserProject
alias Aelita2.User
schema "projects" do
field :repo_xref, :integer
field :name, :string
belongs_to :installation, Aelita2.Installation
many_to_many :users, User, join_through: LinkUserProject
timestamps()
... | defmodule Aelita2.Project do
use Aelita2.Web, :model
alias Aelita2.LinkUserProject
alias Aelita2.User
schema "projects" do
field :repo_xref, :integer
field :name, :string
belongs_to :installation, Aelita2.Installation
many_to_many :users, User, join_through: LinkUserProject
timestamps()
... | Update model to use the `many_to_many` relationship | Update model to use the `many_to_many` relationship
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
a944444bd1951b6b2f810b5471bfb745af86a15a | test/controllers/page_controller_test.exs | test/controllers/page_controller_test.exs | defmodule Gatekeeper.PageControllerTest do
use Gatekeeper.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
| defmodule Gatekeeper.PageControllerTest do
use Gatekeeper.ConnCase
test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Alkaloid Gatekeeper"
end
end
| Update test to match on this app | Update test to match on this app | Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
2efbd1f791b018d75cda17b84e4364ad99fbe582 | lib/gn_server/router/biodalliance/snp.ex | lib/gn_server/router/biodalliance/snp.ex | defmodule GnServer.Router.Biodalliance.SNP do
alias GnServer.Biodalliance.SNPDensity, as: SNPDensity
use Maru.Router
plug CORSPlug, headers: ["Range", "If-None-Match", "Accept-Ranges"], expose: ["Content-Range"]
namespace :snp do
namespace :features do
route_param :chr, type: String do
para... | defmodule GnServer.Router.Biodalliance.SNP do
alias GnServer.Biodalliance.SNPDensity
use Maru.Router
plug CORSPlug, headers: ["Range", "If-None-Match", "Accept-Ranges"], expose: ["Content-Range"]
namespace :snp do
namespace :features do
route_param :chr, type: String do
params do
... | Increase SNP density bin size | Increase SNP density bin size
| Elixir | agpl-3.0 | chfi/gn_server,genenetwork/gn_server |
99825ec664b43b322e3bb6a2b38148b6270f3f0a | web/router.ex | web/router.ex | defmodule Artprize.Router do
use Phoenix.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", Artprize do
pipe_through :browser # Use the default browser sta... | defmodule Artprize.Router do
use Phoenix.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
# plug :protect_from_forgery
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", Artprize do
pipe_through :browser # Use the default browser s... | Remove protect from forgery for easy demoing | Remove protect from forgery for easy demoing | Elixir | mit | andrewbredow/artprize-vote-phoenix |
9c6a61c495bc5fa500a4ef213a14621d00e812a2 | web/controllers/auth_controller.ex | web/controllers/auth_controller.ex | defmodule Tilex.AuthController do
use Tilex.Web, :controller
plug Ueberauth
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
case authenticate(auth) do
{:ok, developer} ->
conn = Guardian.Plug.sign_in(conn, developer)
conn
|> put_flash(:info, "Signed in with... | defmodule Tilex.AuthController do
use Tilex.Web, :controller
plug Ueberauth
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
case authenticate(auth) do
{:ok, developer} ->
conn = Guardian.Plug.sign_in(conn, developer)
conn
|> put_flash(:info, "Signed in with... | Copy change to match sign in message | Copy change to match sign in message
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
090a7c5f053b9350966bf364b8c14b1fe0e100d8 | web/controllers/auth_controller.ex | web/controllers/auth_controller.ex | defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user = Repo.... | defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user_params ... | Modify AuthController to use insert_or_update | Modify AuthController to use insert_or_update
Work on #136
| Elixir | mit | stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro |
8aa727c59359e246206662346cc69aaee819b680 | config/prod.secret.exs | config/prod.secret.exs | use Mix.Config
config :aelita2, Aelita2,
activation_phrase: "bors r+"
config :aelita2, Aelita2.Batcher,
run: true
config :aelita2, Aelita2.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: {:system, "PUBLIC_HOST"}, scheme: "https"],
check_origin: false,
cache_static_manifest: "priv/static/manifest.j... | use Mix.Config
config :aelita2, Aelita2,
activation_phrase: "bors r+"
config :aelita2, Aelita2.Batcher,
run: true
config :aelita2, Aelita2.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: {:system, "PUBLIC_HOST"}, scheme: "https", port: 443],
check_origin: false,
cache_static_manifest: "priv/static... | Add a port declaration, to fix redirects | Add a port declaration, to fix redirects
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
28b7f6eca045a4ec0ed65586879fa81fb22147c5 | web/router.ex | web/router.ex | defmodule MyApp_810758.Router do
use MyApp_810758.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", MyApp_810758 do... | defmodule MyApp_810758.Router do
use MyApp_810758.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", MyApp_810758 do... | Add users resource to browser scope | Add users resource to browser scope
| Elixir | mit | wsmoak/my_app_810758 |
710a16ec76956f2cbe398f3b30b8c791c8a0428e | apps/bors_frontend/web/views/layout_view.ex | apps/bors_frontend/web/views/layout_view.ex | defmodule BorsNG.LayoutView do
@moduledoc """
The common wrapper for all pages; namely,
the bar along the top and the disclaimer along the bottom.
"""
use BorsNG.Web, :view
def get_version do
hash = get_heroku_commit() || get_git_commit() || get_release_version()
{String.slice(hash, 0..6), hash}
... | defmodule BorsNG.LayoutView do
@moduledoc """
The common wrapper for all pages; namely,
the bar along the top and the disclaimer along the bottom.
"""
use BorsNG.Web, :view
def get_version do
get_commit() || get_tag()
end
def get_commit do
hash = get_heroku_commit() || get_git_commit()
if... | Use full-sized commit hash in the footer link | Use full-sized commit hash in the footer link
| Elixir | apache-2.0 | bors-ng/bors-ng,bors-ng/bors-ng,bors-ng/bors-ng |
3ffac8b1b6a06101918a5ed5598d0a604392c3f7 | priv/repo/migrations/20170419210307_create_user.exs | priv/repo/migrations/20170419210307_create_user.exs | defmodule RemoteRetro.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :email, :string, null: false
add :google_user_info, :jsonb, null: false
add :family_name, :string, null: false
add :given_name, :string, null: false
add :locale, :strin... | defmodule RemoteRetro.Repo.Migrations.CreateUser do
use Ecto.Migration
def change do
create table(:users) do
add :email, :string, null: false
add :google_user_info, :jsonb, null: false
add :family_name, :string, null: false
add :given_name, :string, null: false
add :locale, :strin... | Update deprecated ecto :datetime -> :naive_datetime | Update deprecated ecto :datetime -> :naive_datetime
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
1b634b78ff828779fc46c4404677eb2904f03f44 | examples/Elixir.HelloWorld1/lib/HelloWorld1.ex | examples/Elixir.HelloWorld1/lib/HelloWorld1.ex | defmodule HelloWorld1 do
def cloudi_service_init(_args, _prefix, dispatcher) do
:cloudi_service.subscribe(dispatcher, 'hello_world1/get')
{:ok, :undefined}
end
def cloudi_service_handle_request(_type, _name, _pattern,
_requestinfo, _request,
... | defmodule HelloWorld1 do
defmacro log_warn(format, args) do
quote do
:cloudi_logger_interface.warn(__MODULE__, __ENV__.line,
unquote(format), unquote(args))
end
end
def cloudi_service_init(_args, _prefix, dispatcher) do
:cloudi_... | Add logging macro for elixir example. | Add logging macro for elixir example.
| Elixir | mit | CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI |
8d0a8ebea342f2b4a6925bfcd09948509cc2e110 | test/metainspector_test.exs | test/metainspector_test.exs | defmodule MetaInspectorTest do
use ExUnit.Case
@html File.read! "test/html/utf8.html"
@shift_jis File.read! "test/html/shift_jis.html"
test "title" do
assert "MetaInspector" == MetaInspector.title(@html)
end
test "og_title" do
assert ["MetaInspector in Test"] == MetaInspector.og_title(@html)
e... | defmodule MetaInspectorTest do
use ExUnit.Case
@html File.read! "test/html/utf8.html"
@shift_jis File.read! "test/html/shift_jis.html"
test "title" do
assert MetaInspector.title(@html) == "MetaInspector"
end
test "og_title" do
assert MetaInspector.og_title(@html) == ["MetaInspector in Test"]
e... | Replace lhs with rhs in test | Replace lhs with rhs in test
| Elixir | mit | nekova/metainvestigator |
31f579bfe03b0bab339b9aa3723774ed62efb654 | web/services/repositories.ex | web/services/repositories.ex | defmodule Pullhub.RepositoriesService do
require Logger
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
end
def simplify_repositories(repositories) do
... | defmodule Pullhub.RepositoriesService 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
end
def simplify_repositor... | Rename key for storing remote id | Rename key for storing remote id
| Elixir | mit | substancelab/pullhub,substancelab/pullhub,substancelab/pullhub |
629780573ec2d160e567e985407c39a519093f10 | samples/issues/mix.exs | samples/issues/mix.exs | defmodule Issues.Mixfile do
use Mix.Project
def project do
[app: :issues,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more i... | defmodule Issues.Mixfile do
use Mix.Project
def project do
[app: :issues,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more i... | Make sure to start the httpoison application | Make sure to start the httpoison application
Otherwise HTTP calls won’t work at all: this really is a separate
process.
| Elixir | mit | thbar/elixir-playground |
f2b92b1dfd88419687ef832825ef081d85ba1dc3 | lib/tesla/middleware/json.ex | lib/tesla/middleware/json.ex | defmodule Tesla.Middleware.DecodeJson do
def call(env, run, opts \\ []) do
decode = opts[:decode] || &JSX.decode/1
env = run.(env)
content_type = to_string(env.headers['Content-Type'])
if String.starts_with?(content_type, "application/json") && (is_binary(env.body) || is_list(env.body)) do
{:... | defmodule Tesla.Middleware.DecodeJson do
def call(env, run, opts \\ []) do
decode = opts[:decode] || &JSX.decode/1
env = run.(env)
if is_json_content(env) do
{:ok, body} = decode.(to_string(env.body))
%{env | body: body}
else
env
end
end
def is_json_content(env) do
co... | Add content type used by Facebook's Graph API | Add content type used by Facebook's Graph API
Facebook's graph api uses 'text/javascript' rather than
"application/json".
It makes sense to guard against both of these types.
| Elixir | mit | monterail/tesla,teamon/tesla |
4a55caf910fdb29456ec367553db8d7afa358e75 | lib/gandalf.ex | lib/gandalf.ex | defmodule Gandalf do
import Plug.Conn
def init(options) do
options
end
def call(conn, options) do
case conn.method do
"POST" -> handle_form_submit(conn, options)
_ -> check_access(conn, options)
end
end
# TODO:
defp handle_form_submit(_conn, _options) do
end
defp check_acce... | defmodule Gandalf do
import Plug.Conn
def init(options) do
options
end
def call(conn, options) do
conn
|> check_access(options)
end
defp check_access(conn, options) do
case check_cookie(conn, options) do
true -> conn
false -> handle_unauthorized_access(conn, options)
end
... | Refactor to handle unauthorized access | Refactor to handle unauthorized access
| Elixir | mit | siepet/gandalf |
42f0abd7c718eef5cdee4243e36e57bb4d040cae | lib/hello_web/controllers/hello_controller.ex | lib/hello_web/controllers/hello_controller.ex | defmodule HelloWeb.HelloController do
use HelloWeb, :controller
plug :assign_welcome_message, "Hi!" when action in [:index, :show]
def index(conn, _params) do
conn
|> put_flash(:info, "Welcome to Phoenix, from flash info!")
|> put_flash(:error, "Let's pretend there's and error.")
|> assign(:welc... | defmodule HelloWeb.HelloController do
use HelloWeb, :controller
plug :assign_welcome_message, "Hi!" when action in [:index, :show]
def index(conn, _params) do
conn
|> put_flash(:info, "Welcome to Phoenix, from flash info!")
|> put_flash(:error, "Let's pretend there is an error.")
|> assign(:welc... | Fix typo in flash example | Channels: Fix typo in flash example
| Elixir | mit | smeade/hellophoenix,smeade/hellophoenix |
a94a88f18523d66f0a7e513abff10c3a197faeff | server/web/router.ex | server/web/router.ex | defmodule TrelloBurndown.Router do
use TrelloBurndown.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", TrelloBurnd... | defmodule TrelloBurndown.Router do
use TrelloBurndown.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/api", TrelloBu... | Add routing rewrites and add deploy.js | Add routing rewrites and add deploy.js
| Elixir | mit | MikaAK/trello-burndown,MikaAK/trello-burndown,MikaAK/trello-burndown,MikaAK/trello-burndown |
35a5bf1ba950680e01ee5be9ca2fc56f721f02c7 | .iex.exs | .iex.exs | alias Jumubase.Repo, warn: false
alias Jumubase.Foundation.{Category, Contest, ContestCategory, Host}, warn: false
alias Jumubase.Showtime.{Appearance, Participant, Performance, Piece}, warn: false
| alias Jumubase.Repo, warn: false
alias Jumubase.Accounts.User, warn: false
alias Jumubase.Foundation.{Category, Contest, ContestCategory, Host}, warn: false
alias Jumubase.Showtime.{Appearance, Participant, Performance, Piece}, warn: false
| Add User alias to IEx config | Add User alias to IEx config
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
4e1a23b950d4fde368e62f93efd102b08ee20b19 | test/funnel/transistor_test.exs | test/funnel/transistor_test.exs | defmodule Funnel.TransistorTest do
use Funnel.TestCase, async: true
use Dynamo.HTTP.Case
test "transistor is alive" do
conn = conn(:GET, "/?token=secrettoken")
conn = conn.fetch(:params)
{ conn, {:ok, transistor}} = Funnel.Transistor.start_link(conn)
assert Process.alive?(transistor)
end
end
| defmodule Funnel.TransistorTest do
use Funnel.TestCase, async: true
use Dynamo.HTTP.Case
test "transistor is alive" do
conn = conn(:GET, "/?token=secrettoken")
conn = conn.fetch(:params)
{ _, {:ok, transistor}} = Funnel.Transistor.start_link(conn)
assert Process.alive?(transistor)
end
end
| Fix warning variable conn is unused | Fix warning variable conn is unused
Signed-off-by: chatgris <f9469d12bf3d131e7aae80be27ccfe58aa9db1f1@af83.com>
| Elixir | mit | chatgris/funnel |
e35e1edc895b1e836e75b6237dcafd7d2dd58f4a | mix.exs | mix.exs | defmodule PactElixir.MixProject do
use Mix.Project
def project do
[
app: :pact_elixir,
version: "0.1.0",
elixir: "~> 1.6-dev",
start_permanent: Mix.env() == :prod,
deps: deps(),
compilers: [:rustler] ++ Mix.compilers(),
rustler_crates: rustler_crates()
]
end
#... | defmodule PactElixir.MixProject do
use Mix.Project
def project do
[
app: :pact_elixir,
version: "0.1.0",
elixir: "~> 1.5",
start_permanent: Mix.env() == :prod,
deps: deps(),
compilers: [:rustler] ++ Mix.compilers(),
rustler_crates: rustler_crates()
]
end
# Run... | Allow lower versions of elixir | Allow lower versions of elixir | Elixir | mit | elitau/pact_elixir |
833c442358525d3c33e112ae41176175007650dd | lib/phoenix/router/errors.ex | lib/phoenix/router/errors.ex | defmodule Phoenix.Router.Errors do
def ensure_valid_path!(path) do
message = """
Path must start with slash.
Change path from:
#{path}
to
/#{path}
"""
unless String.at(path, 0) == "/" do
raise(ArgumentError, message: message)
end
end
end
| defmodule Phoenix.Router.Errors do
def ensure_valid_path!(<<"/" <> _rest>>), do: nil
def ensure_valid_path!(path) do
raise ArgumentError, message: """
Path must start with slash.
Change path from:
#{path}
to
/#{path}
"""
end
end
| Use pattern matching for route validity. | Use pattern matching for route validity.
| Elixir | mit | CD1212/phoenix,michalmuskala/phoenix,justnoxx/phoenix,CultivateHQ/phoenix,lancehalvorsen/phoenix,nshafer/phoenix,andrewvy/phoenix,kidaa/phoenix,bsmr-erlang/phoenix,sadiqmmm/phoenix,Kosmas/phoenix,wsmoak/phoenix,vic/phoenix,michalmuskala/phoenix,rodrigues/phoenix,bsmr-erlang/phoenix,jwarwick/phoenix,Fluxuous/phoenix,eri... |
f9ef0ca50a42b102fccefc50cebb11533d8e6a8d | lib/battle_snake/game_result_snake.ex | lib/battle_snake/game_result_snake.ex | defmodule BattleSnake.GameResultSnake do
alias __MODULE__
require Record
@encoded_fields [
:created_at,
:game_id,
:snake_name,
:snake_url
]
@derive {Poison.Encoder, only: @encoded_fields}
@attributes [
id: nil,
created_at: nil,
game_id: nil,
snake_id: nil,
snake_name: ... | defmodule BattleSnake.GameResultSnake do
alias __MODULE__
require Record
@enforce_keys [:id]
@encoded_fields [
:created_at,
:game_id,
:snake_name,
:snake_url
]
@derive {Poison.Encoder, only: @encoded_fields}
@attributes [
id: nil,
created_at: nil,
game_id: nil,
snake_id... | Make sure the game results are being created with ids | Make sure the game results are being created with ids
| Elixir | agpl-3.0 | Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake,Dkendal/battle_snake |
7fb3f837c61a0b54de6b1e90c247803e1c81d1d4 | mix.exs | mix.exs | defmodule MealTracker.MixProject do
use Mix.Project
def project do
[
app: :meal_tracker,
version: "0.1.1",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
escript: escript()
]
end
def application do
[
extra_applicat... | defmodule MealTracker.MixProject do
use Mix.Project
def project do
[
app: :meal_tracker,
version: "0.1.1",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
docs: docs(),
escript: escript()
]
end
def application do
... | Add aliases to force update of version number | Add aliases to force update of version number
| Elixir | mit | lee-dohm/meal-tracker,lee-dohm/meal-tracker |
3b16b4f54ddb482b6e1dd72e9d848324dc5f240c | lib/hound/json_driver/response_parser_utils.ex | lib/hound/json_driver/response_parser_utils.ex | defmodule Hound.JsonDriver.ResponseParserUtils do
def is_error?(value) do
is_map(value) && Map.has_key?(value, "message")
end
def is_warning?(value) do
if is_map(value) && Map.has_key?(value, "message") do
Regex.match?(~r/#{Regex.escape("not clickable")}/, value["message"])
else
false
... | defmodule Hound.JsonDriver.ResponseParserUtils do
import Logger
def is_error?(value) do
is_map(value) && Map.has_key?(value, "message")
end
def is_warning?(value) do
if is_map(value) && Map.has_key?(value, "message") do
Regex.match?(~r/#{Regex.escape("not clickable")}/, value["message"])
el... | Use Logger to output warnings | Use Logger to output warnings
| Elixir | mit | manukall/hound,manukall/hound,esbullington/hound,lowks/hound,lowks/hound,HashNuke/hound,oivoodoo/hound,jontonsoup/hound,esbullington/hound,HashNuke/hound,jontonsoup/hound,oivoodoo/hound |
a1d24fc438c91d6d3a63d80557543b936d77bd28 | bench/lookup.exs | bench/lookup.exs | defmodule Geolix.Adapter.MMDB2.Benchmark.Lookup do
def run do
:ok =
Geolix.load_database(%{
id: :benchmark,
adapter: Geolix.Adapter.MMDB2,
source: Geolix.TestData.file(:mmdb2, "Benchmark.mmdb")
})
{:ok, lookup_ipv4} = :inet.parse_address('1.1.1.1')
{:ok, lookup_ipv4_in... | :ok =
Geolix.load_database(%{
id: :benchmark,
adapter: Geolix.Adapter.MMDB2,
source: Geolix.TestData.file(:mmdb2, "Benchmark.mmdb")
})
{:ok, lookup_ipv4} = :inet.parse_address('1.1.1.1')
{:ok, lookup_ipv4_in_ipv6} = :inet.parse_address('::1.1.1.1')
Benchee.run(
%{
"IPv4 in IPV6 lookup" => fn ->
... | Remove module wrapping from benchmark | Remove module wrapping from benchmark
| Elixir | apache-2.0 | elixir-geolix/adapter_mmdb2,elixir-geolix/adapter_mmdb2 |
0737381d228d43598b1a4d96e1c731500c040344 | installer/templates/new/mix.exs | installer/templates/new/mix.exs | defmodule <%= application_module %>.Mixfile do
use Mix.Project
def project do
[app: :<%= application_name %>,
version: "0.0.1",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application.
#
# T... | defmodule <%= application_module %>.Mixfile do
use Mix.Project
def project do
[app: :<%= application_name %>,
version: "0.0.1",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application.
#
#... | Fix Elixir compiler warning in new projects | Fix Elixir compiler warning in new projects
| Elixir | mit | kittoframework/kitto,kittoframework/kitto |
24ab6f63e4975dccf0299273275fc93a744966ed | exercises/binary-search/example.exs | exercises/binary-search/example.exs | defmodule BinarySearch do
@doc """
Searches for a key in the list using the binary search algorithm.
It returns :not_found if the key is not in the list.
Otherwise returns the tuple {:ok, index}.
## Examples
iex> BinarySearch.search([], 2)
:not_found
iex> BinarySearch.search([1, 3... | defmodule BinarySearch do
@doc """
Searches for a key in the list using the binary search algorithm.
It returns :not_found if the key is not in the list.
Otherwise returns the tuple {:ok, index}.
## Examples
iex> BinarySearch.search([], 2)
:not_found
iex> BinarySearch.search([1, 3... | Rename funcion _search to do_search following Elixir idioms. | Rename funcion _search to do_search following Elixir idioms.
| Elixir | mit | exercism/xelixir,cezarykosko/xelixir,parkerl/xelixir |
68c120cae296b54f3cef04ab33b7f1e3d7781931 | lib/gullintanni/providers/github.ex | lib/gullintanni/providers/github.ex | defmodule Gullintanni.Providers.GitHub do
@behaviour Gullintanni.Provider
def validate_config(config) do
unless config[:provider_auth_token] do
raise ArgumentError, "missing :provider_auth_token configuration"
end
:ok
end
def whoami(config) do
Tentacat.Users.me(client(config))["login"]
... | defmodule Gullintanni.Providers.GitHub do
@behaviour Gullintanni.Provider
@default_endpoint "https://api.github.com/"
def validate_config(config) do
unless config[:provider_auth_token] do
raise ArgumentError, "missing :provider_auth_token configuration"
end
:ok
end
def whoami(config) do
... | Allow configuration of the GitHub API endpoint URL | Allow configuration of the GitHub API endpoint URL
Defaults to the regular (non-enterprise) API endpoint.
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni |
c387e9441008ea94143b8b752e132c9e6645b254 | lib/serum/global_bindings.ex | lib/serum/global_bindings.ex | defmodule Serum.GlobalBindings do
@moduledoc false
_moduledocp = """
Provides an interface to an Agent which stores site-wide
template variable bindings.
"""
use Agent
def start_link(_args) do
Agent.start_link(fn -> {%{}, []} end, name: __MODULE__)
end
@spec load(map()) :: :ok
def load(%{} =... | defmodule Serum.GlobalBindings do
@moduledoc false
_moduledocp = """
Provides an interface to an Agent which stores site-wide
template variable bindings.
"""
use Agent
def start_link(_args) do
Agent.start_link(fn -> {%{args: []}, [args: []]} end, name: __MODULE__)
end
@spec load(map()) :: :ok
... | Set a empty list as a default render argument | Set a empty list as a default render argument
| Elixir | mit | Dalgona/Serum |
0410f65d15d1e9284cad88ee7083449bd9d247cf | lib/octokit/issue.ex | lib/octokit/issue.ex | defmodule Octokit.Issue do
@moduledoc """
Represents an [Issue](https://developer.github.com/v3/issues/#get-a-single-issue).
"""
@type t :: %__MODULE__{}
@fields [
:number, :state, :title, :body, :user, :labels, :assignee,
:milestone, :locked, :comments, :closed_at, :created_at,
... | defmodule Octokit.Issue do
@moduledoc """
Represents an [Issue](https://developer.github.com/v3/issues/#get-a-single-issue).
"""
@type t :: %__MODULE__{}
@fields [
:number, :state, :title, :body, :user, :labels, :assignee,
:milestone, :locked, :comments, :closed_at, :created_at,
... | Add a few more Issue fields | Add a few more Issue fields
| Elixir | mit | lee-dohm/octokit.ex,lee-dohm/octokit.ex |
9b349daa3581ff1faea9c659502a88b567d24f3a | lib/farmbot/celery_script/ast/node/factory_reset.ex | lib/farmbot/celery_script/ast/node/factory_reset.ex | defmodule Farmbot.CeleryScript.AST.Node.FactoryReset do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args [:package]
use Farmbot.Logger
def execute(%{package: :farmbot_os}, _, env) do
env = mutate_env(env)
Farmbot.BotState.set_sync_status(:maintenance)
Farmbot.BotState.force_state_pus... | defmodule Farmbot.CeleryScript.AST.Node.FactoryReset do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args [:package]
use Farmbot.Logger
def execute(%{package: :farmbot_os}, _, env) do
env = mutate_env(env)
Farmbot.BotState.set_sync_status(:maintenance)
Farmbot.BotState.force_state_pus... | Make cs node still able to factory reset bot | Make cs node still able to factory reset bot
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
9119faf78719a59216ed7a8731412e2a9aa9a8e7 | lib/open_mirego.ex | lib/open_mirego.ex | defmodule OpenMirego do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
# Define workers and child supervisors to be supervised
# worker(O... | defmodule OpenMirego do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies ... | Remove useless comments in supervisor | Remove useless comments in supervisor
| Elixir | bsd-3-clause | mirego/mirego-open-web,mirego/mirego-open-web |
49193328f57974bda71f9123ce6596929ef70c3e | lib/metainspector.ex | lib/metainspector.ex | defmodule MetaInspector do
defstruct status: nil
@type t :: %__MODULE__{status: String.t}
def new(url) do
document = HTTPoison.get!(url)
%MetaInspector{status: status(document)}
end
def status(document) do
document.status_code
end
end
| defmodule MetaInspector do
defstruct status: nil, title: nil
@type t :: %__MODULE__{status: integer, title: String.t}
def new(url) do
document = HTTPoison.get!(url)
body = document.body
%MetaInspector{status: status(document), title: title(body)}
end
def status(document) do
document.status_c... | Add title attribute to struct | Add title attribute to struct
| Elixir | mit | nekova/metainvestigator |
69c8d57552ac6c227237f7a1d98ac1f79a0ca094 | elixir/plug_socket/lib/plug_socket/socket_handler.ex | elixir/plug_socket/lib/plug_socket/socket_handler.ex | defmodule PlugSocket.SocketHandler do
@behaviour :cowboy_websocket_handler
def init(_, _req, _opts) do
{:upgrade, :protocol, :cowboy_websocket}
end
def websocket_init(_type, req, _opts) do
:gproc.reg({:p, :l, :plug_socket})
{:ok, req, %{}, 60_000_000}
end
def websocket_info({:send, message}, ... | defmodule PlugSocket.SocketHandler do
@behaviour :cowboy_websocket_handler
def init(_, _req, _opts) do
{:upgrade, :protocol, :cowboy_websocket}
end
def websocket_init(_type, req, _opts) do
:gproc.reg({:p, :l, :plug_socket})
{:ok, req, %{}, 60_000_000}
end
def websocket_info({:send, message}, ... | Fix Elixir / plug broadcast | Fix Elixir / plug broadcast
| Elixir | mit | palkan/websocket-shootout,palkan/websocket-shootout,palkan/websocket-shootout,palkan/websocket-shootout,palkan/websocket-shootout,palkan/websocket-shootout,palkan/websocket-shootout |
e3e784ee85936a0d19a077d0bd9ed6339ead8597 | lib/ale_rpi/gpio.ex | lib/ale_rpi/gpio.ex | defmodule AleRpi.Gpio do
@doc """
Switch the pins pullup to the given mode.
"""
@spec pullup_mode(integer, :up | :down | :off) :: :ok | {:error, term}
def pullup_mode(pin, :up) when is_integer(pin) do
set_pullup(pin, "up")
end
def pullup_mode(pin, :down) when is_integer(pin) do
set_pullup(pin, "d... | defmodule AleRpi.Gpio do
@doc """
Switch the pins pullup to the given mode.
"""
@spec pullup_mode(integer, :up | :down | :off) :: :ok | {:error, term}
def pullup_mode(pin, :up) when is_integer(pin) do
set_pullup(pin, "up")
end
def pullup_mode(pin, :down) when is_integer(pin) do
set_pullup(pin, "d... | Convert executable and pin to string | Convert executable and pin to string
| Elixir | apache-2.0 | Hermanverschooten/gpio_rpi |
d1dc637bdc9bc80fe9e5251dae0303132b6a9906 | installer/templates/new/config/config.exs | installer/templates/new/config/config.exs | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
<%= if namespaced? do %>
# Configures the namespace used by Phoenix generators
config ... | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
<%= if namespaced? do %>
# Configures the namespace used by Phoenix generators
config ... | Use Path.dirname which is clearer than Path.expand(..) | Use Path.dirname which is clearer than Path.expand(..)
| Elixir | mit | robhurring/phoenix,cas27/phoenix,gjaldon/phoenix,seejee/phoenix,michalmuskala/phoenix,Dahoon/phoenix,DavidAlphaFox/phoenix,lono-devices/phoenix,FND/phoenix,rafbgarcia/phoenix,Smulligan85/phoenix,arthurcolle/phoenix,GabrielNicolasAvellaneda/phoenix,javimolla/phoenix,0x00evil/phoenix,greyhwndz/phoenix,cas27/phoenix,ekspe... |
b3e4b58696c9819b37e8912f53ee2bff661a0eab | farmbot_core/test/asset_test.exs | farmbot_core/test/asset_test.exs | defmodule FarmbotCore.AssetTest do
use ExUnit.Case, async: true
alias FarmbotCore.Asset.RegimenInstance
alias FarmbotCore.Asset
import Farmbot.TestSupport.AssetFixtures
describe "regimen instances" do
test "creates a regimen instance" do
seq = sequence()
reg =
regimen(%{regimen_items... | defmodule FarmbotCore.AssetTest do
use ExUnit.Case, async: true
alias FarmbotCore.Asset.RegimenInstance
alias FarmbotCore.Asset
import Farmbot.TestSupport.AssetFixtures
describe "regimen instances" do
test "creates a regimen instance" do
seq = sequence()
reg =
regimen(%{regimen_items... | Remove test until SQLite issues can be fixed | Remove test until SQLite issues can be fixed
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
1e3851d71fbb74cd08a68e3e0395464323c9a1bf | lib/appsignal/span.ex | lib/appsignal/span.ex | defmodule Appsignal.Span do
alias Appsignal.Nif
def trace_id(reference) do
Nif.trace_id(reference)
end
def span_id(reference) do
Nif.span_id(reference)
end
def create(name) do
{:ok, reference} = Nif.create_root_span(name)
# TODO: Store the span reference in the process dictionary.
ref... | defmodule Appsignal.Span do
alias Appsignal.Nif
def trace_id(reference) do
Nif.trace_id(reference)
end
def span_id(reference) do
Nif.span_id(reference)
end
def create(name) do
{:ok, reference} = Nif.create_root_span(name)
# TODO: Store the span reference in the process dictionary.
ref... | Enforce string keys in Span.set_attribute/3 | Enforce string keys in Span.set_attribute/3
| Elixir | mit | appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir,appsignal/appsignal-elixir |
59e3fc1ce3e14ade44c26f5c85223902d98b6601 | lib/poxa/presence_channel.ex | lib/poxa/presence_channel.ex | defmodule Poxa.PresenceChannel do
@doc """
This function returns the user ids currently subscribed to a presence channel
More info at: http://pusher.com/docs/rest_api#method-get-users
"""
#@spec users(binary) :: [user_id]
def users(channel) do
match = {{:p, :l, {:pusher, channel}}, :_, :'$1'}
:gpro... | defmodule Poxa.PresenceChannel do
@doc """
This function returns the user ids currently subscribed to a presence channel
More info at: http://pusher.com/docs/rest_api#method-get-users
"""
@spec users(binary) :: [binary | integer]
def users(channel) do
match = {{:p, :l, {:pusher, channel}}, :_, :'$1'}
... | Fix type spec on PresenceChannel | Fix type spec on PresenceChannel
| Elixir | mit | edgurgel/poxa,waffleio/poxa,edgurgel/poxa,joshk/poxa,edgurgel/poxa,RobertoSchneiders/poxa,joshk/poxa,RobertoSchneiders/poxa,waffleio/poxa |
55e7615c18cf5d35f2ad0c2435a573a6f6d03696 | lib/geolix/server/worker.ex | lib/geolix/server/worker.ex | defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case ... | defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case ... | Use Task.async_stream/3 for parallel lookups | Use Task.async_stream/3 for parallel lookups
| Elixir | apache-2.0 | mneudert/geolix,mneudert/geolix |
3b79978b1b0807e48f54c0d789ce8f0a830a3d08 | day7/test/circuit_runner_test.exs | day7/test/circuit_runner_test.exs | defmodule CircuitRunnerTest do
use ExUnit.Case
use Bitwise
doctest CircuitRunner
import ExUnit.CaptureIO
defp run_test(filename, token, expected) do
assert capture_io(fn ->
CircuitRunner.main([filename, token,])
end) == "#{expected}\n"
end
test "CLI parsing acceptance test" do
filenam... | defmodule CircuitRunnerTest do
use ExUnit.Case
use Bitwise
doctest CircuitRunner
import ExUnit.CaptureIO
defp run_test(filename, token, expected) do
assert capture_io(fn ->
CircuitRunner.main([filename, token,])
end) == "#{expected}\n"
end
test "CLI parsing acceptance test" do
filenam... | Add tests based on actual advent of code input. | Add tests based on actual advent of code input.
| Elixir | unlicense | lauromoura/adventofcode |
9eed03d4a6c175459e48386f3accb674d9190a5b | mix.exs | mix.exs | defmodule Bamboo.Mixfile do
use Mix.Project
def project do
[app: :bamboo,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more i... | defmodule Bamboo.Mixfile do
use Mix.Project
def project do
[app: :bamboo,
version: "0.0.1",
elixir: "~> 1.1",
description: "Makes emails awesome",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
package: package,
deps: deps]
end
# Configuration for t... | Add description and package data | Add description and package data
| Elixir | mit | princemaple/bamboo,thoughtbot/bamboo,alekseenko/bamboo |
0bdad4a100f4be7adede9d75b41418798555637a | test/gatekeeper/door_lock_test.exs | test/gatekeeper/door_lock_test.exs | defmodule Gatekeeper.DoorLockTest do
use ExUnit.Case, async: true
import Gatekeeper.Factory
setup do
door_group = create_door_group()
door = create_door door_group: door_group
gpio_pin = 1
lock = case Gatekeeper.DoorLock.start_link(Gatekeeper.DoorLock.Dummy, door.id, gpio_pin) do
{:ok, loc... | defmodule Gatekeeper.DoorLockTest do
use ExUnit.Case, async: true
use Gatekeeper.ModelCase
import Gatekeeper.Factory
setup do
door_group = create_door_group()
door = create_door door_group: door_group
gpio_pin = 1
lock = case Gatekeeper.DoorLock.start_link(Gatekeeper.DoorLock.Dummy, door.id, g... | Fix tests broken by addition of door lookup | Fix tests broken by addition of door lookup
Since the test now creates models which are used in the GenServer, we need this to enable the access to the database
| Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
dccd604affca908a5cd7504711125b7cc4c060db | lib/espi_dni/slack_rtm.ex | lib/espi_dni/slack_rtm.ex | defmodule EspiDni.SlackRtm do
use Slack
require Logger
@token Application.get_env(:espi_dni, __MODULE__)[:slack_token]
def start_link, do: start_link(@token)
def handle_connect(slack) do
Logger.info "Connected as #{slack.me.name}"
end
def handle_message(message = %{type: "message"}, slack) do
... | defmodule EspiDni.SlackRtm do
use Slack
require Logger
@token Application.get_env(:espi_dni, __MODULE__)[:slack_token]
def start_link, do: start_link(@token)
def handle_connect(slack) do
Logger.info "Connected as #{slack.me.name}"
end
def handle_message(message = %{type: "message"}, slack) do
... | Change log level for slackbots | Change log level for slackbots
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni |
6e543e28a4927b058551471815466cca55c7aa05 | lib/hello_phoenix/repo.ex | lib/hello_phoenix/repo.ex | defmodule HelloPhoenix.Repo do
use Ecto.Repo, otp_app: :hello_phoenix
end
| defmodule HelloPhoenix.Repo do
# use Ecto.Repo, otp_app: :hello_phoenix
end
| Comment out Ecto call, ends up requiring a missing beam file | Comment out Ecto call, ends up requiring a missing beam file
| Elixir | mit | aatrostle/hazy.pw |
9c03068fe35a20ef959a1f5475be04b62b21d7ed | 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
| Fix weird behavior on migration. | Fix weird behavior on migration.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
ad5952c7ab06306f61f5fd6e3eda015762d3b82b | test/koans/map_sets_koans_test.exs | test/koans/map_sets_koans_test.exs | defmodule MapSetsTest do
use ExUnit.Case
import TestHarness
test "MapSets" do
answers = [
1,
3,
{:multiple, [false, true]},
true,
{:multiple, [true, false]},
true,
false,
false,
true,
7,
[1, 2, 3, 4, 5]
]
test_all(MapSets, answers)
... | defmodule MapSetsTest do
use ExUnit.Case
import TestHarness
test "MapSets" do
answers = [
3,
{:multiple, [false, true]},
true,
{:multiple, [true, false]},
true,
false,
false,
true,
7,
[1, 2, 3, 4, 5]
]
test_all(MapSets, answers)
end
end
| Remove extra, unneeded MapSets answer | Remove extra, unneeded MapSets answer
| Elixir | mit | elixirkoans/elixir-koans |
c2daf480a5c34564e0680ea4d338a7ae7f27c1dd | lib/phoenix/template/eex_engine.ex | lib/phoenix/template/eex_engine.ex | defmodule Phoenix.Template.EExEngine do
alias Phoenix.Template
@behaviour Phoenix.Template.Engine
@doc """
Precompiles the String file_path into a function defintion, using EEx Engine
For example, given "templates/show.html.eex", returns an AST def of the form:
def render("show.html", assigns \\ [])
... | defmodule Phoenix.Template.EExEngine do
alias Phoenix.Template
@behaviour Phoenix.Template.Engine
@doc """
Precompiles the String file_path into a function defintion, using EEx Engine
For example, given "templates/show.html.eex", returns an AST def of the form:
def render("show.html", assigns \\ [])
... | Fix unused assigns variable warning for eex templates | Fix unused assigns variable warning for eex templates
| Elixir | mit | milafrerichs/phoenix,doomspork/phoenix,GabrielNicolasAvellaneda/phoenix,DavidAlphaFox/phoenix,nickgartmann/phoenix,FND/phoenix,lono-devices/phoenix,vic/phoenix,Fluxuous/phoenix,phoenixframework/phoenix,nshafer/phoenix,evax/phoenix,ephe-meral/phoenix,robhurring/phoenix,bsodmike/phoenix,Rumel/phoenix,mobileoverlord/phoen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.