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 |
|---|---|---|---|---|---|---|---|---|---|
3138e5b7c94f3094d853f876185f703010861dd6 | web/oauth/fitbit.ex | web/oauth/fitbit.ex | defmodule Fitbit do
@moduledoc """
An OAuth2 strategy for Fitbit.
"""
use OAuth2.Strategy
alias OAuth2.Strategy.AuthCode
# Public API
def new do
OAuth2.new([
strategy: __MODULE__,
client_id: System.get_env("CLIENT_ID"),
client_secret: System.get_env("CLIENT_SECRET"),
redirec... | defmodule Fitbit do
@moduledoc """
An OAuth2 strategy for Fitbit.
Based on the OAuth2 strategy for GitHub by Sonny Scroggin
in https://github.com/scrogson/oauth2_example
"""
use OAuth2.Strategy
alias OAuth2.Strategy.AuthCode
# Public API
def new do
OAuth2.new([
strategy: __MODULE__,
... | Add attribution for oauth strategy | Add attribution for oauth strategy
| Elixir | mit | wsmoak/my_app_7191136 |
7492f4a09ebbfd2208ea2be98f618a97a5e1c804 | mix.exs | mix.exs | defmodule PhoenixSlim.Mixfile do
use Mix.Project
@version "0.4.0"
def project do
[
app: :phoenix_slim,
deps: deps,
description: """
Phoenix Template Engine for Slim
""",
elixir: "~> 1.0",
package: package,
version: @version]
end
def application do
[ap... | defmodule PhoenixSlim.Mixfile do
use Mix.Project
@version "0.4.0"
def project do
[
app: :phoenix_slim,
deps: deps,
description: """
Phoenix Template Engine for Slim
""",
elixir: "~> 1.0",
package: package,
version: @version]
end
def application do
[ap... | Allow phoenix version >= 0.16.0 and phoenix_html >= 2.1.0 | Allow phoenix version >= 0.16.0 and phoenix_html >= 2.1.0
| Elixir | mit | doomspork/phoenix_slim,slime-lang/phoenix_slime |
668e697e60927616c406e766a8b3bb4f5be98813 | lib/poxa/console.ex | lib/poxa/console.ex | defmodule Poxa.Console do
import JSEX, only: [encode!: 1]
def connected(socket_id, origin) do
message("Connection", socket_id, "Origin: #{origin}") |> send
end
def disconnected(socket_id, channels) when is_list(channels) do
message("Disconnection", socket_id, "Channels: #{inspect channels}") |> send
... | defmodule Poxa.Console do
import JSEX, only: [encode!: 1]
def connected(socket_id, origin) do
send_message("Connection", socket_id, "Origin: #{origin}")
end
def disconnected(socket_id, channels) when is_list(channels) do
send_message("Disconnection", socket_id, "Channels: #{inspect channels}")
end
... | Refactor Console code to send_message | Refactor Console code to send_message
| Elixir | mit | theinventor/rs-poxa,waffleio/poxa,joshk/poxa,RobertoSchneiders/poxa,edgurgel/poxa,RobertoSchneiders/poxa,waffleio/poxa,edgurgel/poxa,joshk/poxa,edgurgel/poxa |
3c2a8479086937a8ddcfbe33e459e874b8f19a53 | test/integration/posts_test.exs | test/integration/posts_test.exs | defmodule Integration.PostsTest do
use ExUnit.Case
use Hound.Helpers
alias ElixirFriends.Post
alias ElixirFriends.ImageTweetStreamer
hound_session
@post %Post{
image_url: "http://elixirsips.com/images/194_Interoperability_Ports_Screenshot.png",
content: "Fake content",
source_url: "http://elixi... | defmodule Integration.PostsTest do
use ExUnit.Case
use Hound.Helpers
alias ElixirFriends.Post
alias ElixirFriends.ImageTweetStreamer
hound_session
@post %Post{
image_url: "http://elixirsips.com/images/194_Interoperability_Ports_Screenshot.png",
content: "Fake content",
source_url: "http://elixi... | Add some sleeps to see if it fixes semaphore | Add some sleeps to see if it fixes semaphore
| Elixir | mit | knewter/elixir_friends,knewter/elixir_friends,knewter/elixir_friends |
f90a89eba64921e7de89bdb2131810d124228216 | lib/ex_twilio/resources/short_code.ex | lib/ex_twilio/resources/short_code.ex | defmodule ExTwilio.ShortCode do
@moduledoc """
Represents a ShortCode resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/short-codes)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
friendly_name: nil,
account_sid: n... | defmodule ExTwilio.ShortCode do
@moduledoc """
Represents a ShortCode resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/sms/api/short-code)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
friendly_name: nil,
account_sid: nil... | Update redirect to ShortCode API | Update redirect to ShortCode API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
64d17ee3e5cd0332afe051651c47ea44bf4d962b | web/models/user.ex | web/models/user.ex | defmodule Pullhub.User do
use Pullhub.Web, :model
alias Pullhub.Repo
schema "users" do
field :email, :string
field :uid, :string
field :github_token, :string
has_many :repositories, Pullhub.Repository
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
... | defmodule Pullhub.User do
use Pullhub.Web, :model
alias Pullhub.Repo
schema "users" do
field :email, :string
field :uid, :string
field :github_token, :string
has_many :repositories, Pullhub.Repository
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
... | Remove unised function since it's now in the UserFromAuth module | Remove unised function since it's now in the UserFromAuth module
| Elixir | mit | substancelab/pullhub,substancelab/pullhub,substancelab/pullhub |
2b260db5764481d086f98f18c88c6aaf699c344c | web/oauth/fitbit.ex | web/oauth/fitbit.ex | defmodule Fitbit do
@moduledoc """
An OAuth2 strategy for Fitbit
"""
end
| defmodule Fitbit do
@moduledoc """
An OAuth2 strategy for Fitbit.
"""
use OAuth2.Strategy
alias OAuth2.Strategy.AuthCode
# Public API
def new do
OAuth2.new([
strategy: __MODULE__,
client_id: System.get_env("CLIENT_ID"),
client_secret: System.get_env("CLIENT_SECRET"),
redirec... | Complete the Fitbit module for the OAuth2 strategy | Complete the Fitbit module for the OAuth2 strategy
| Elixir | mit | wsmoak/my_app_7191136 |
43d77e78f1af4f1677a699c0569ea3b1ed31b1cd | web/router.ex | web/router.ex | defmodule MyApp_808732.Router do
use MyApp_808732.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_808732 do... | defmodule MyApp_808732.Router do
use MyApp_808732.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_808732 do... | Add a route for /auth/callback | Add a route for /auth/callback
| Elixir | mit | wsmoak/my_app_808732 |
0adc55ec0a78303807cc89da3862869d64325184 | 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
# General application configuration
config :<%= application_name %>,
<%= if namespace... | # 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
# General application configuration
config :<%= application_name %>,<%= if namespaced... | Handle new lines on generated code | Handle new lines on generated code
| Elixir | mit | phoenixframework/phoenix,mobileoverlord/phoenix,jamilabreu/phoenix,gjaldon/phoenix,trarbr/phoenix,eksperimental/phoenix,nshafer/phoenix,keathley/phoenix,ybur-yug/phoenix,0x00evil/phoenix,wsmoak/phoenix,iStefo/phoenix,rafbgarcia/phoenix,phoenixframework/phoenix,ephe-meral/phoenix,mschae/phoenix,michalmuskala/phoenix,kea... |
546bc13243ba9ae9081e0ab0d20982a070837cfc | lib/hound/connection_server.ex | lib/hound/connection_server.ex | defmodule Hound.ConnectionServer do
@moduledoc false
use GenServer.Behaviour
def start_link(options // []) do
driver = options[:driver] || :selenium
{default_port, default_path_prefix, default_browser} = case driver do
:chrome_driver ->
{9515, nil, "chrome"}
:phantomjs ->
{8... | defmodule Hound.ConnectionServer do
@moduledoc false
use GenServer.Behaviour
def start_link(options // []) do
driver = options[:driver] || "selenium"
{default_port, default_path_prefix, default_browser} = case driver do
"chrome_driver" ->
{9515, nil, "chrome"}
"phantomjs" ->
... | Use strings for driver names | Use strings for driver names
| Elixir | mit | knewter/hound,HashNuke/hound,HashNuke/hound,manukall/hound,esbullington/hound,esbullington/hound,lowks/hound,jontonsoup/hound,manukall/hound,oivoodoo/hound,jontonsoup/hound,oivoodoo/hound,lowks/hound |
e924991ad214cc6fc10a093d413e7f1e4a79aeaa | test/swoosh/in_memory_mailbox_test.exs | test/swoosh/in_memory_mailbox_test.exs | defmodule Swoosh.InMemoryMailboxTest do
use ExUnit.Case, async: true
alias Swoosh.InMemoryMailbox
test "start_link/0 starts with an empty mailbox" do
{:ok, pid} = GenServer.start_link(InMemoryMailbox, [])
count = GenServer.call(pid, :all) |> Enum.count
assert count == 0
end
test "push an email ... | defmodule Swoosh.InMemoryMailboxTest do
use ExUnit.Case, async: true
alias Swoosh.InMemoryMailbox
setup do
InMemoryMailbox.delete_all()
:ok
end
test "start_link/0 starts with an empty mailbox" do
{:ok, pid} = GenServer.start_link(InMemoryMailbox, [])
count = GenServer.call(pid, :all) |> Enu... | Fix the race condition in InMemoryMailbox tests | Fix the race condition in InMemoryMailbox tests
| Elixir | mit | dighjd12/swoosh,dbulic/swoosh,swoosh/swoosh |
d384afd3f904589cc5ad50e15cbdb8ec2388ee24 | lib/course_planner/permissions.ex | lib/course_planner/permissions.ex | defimpl Canada.Can, for: CoursePlanner.User do
alias CoursePlanner.{
AttendanceController,
OfferedCourseController,
ScheduleController,
Tasks.Task,
User,
}
def can?(%User{role: "Coordinator"}, _action, _controller), do: true
def can?(%User{role: "Teacher"}, action, AttendanceController)
... | defimpl Canada.Can, for: CoursePlanner.User do
alias CoursePlanner.{
AttendanceController,
OfferedCourseController,
ScheduleController,
Tasks.Task,
User,
}
def can?(%User{role: "Coordinator"}, _action, _controller), do: true
def can?(%User{role: "Teacher"}, _action, AttendanceController), ... | Allow teachers to do all actions in AttendanceController | Allow teachers to do all actions in AttendanceController
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
0cf452756952362784d1e04558e92f14a15da165 | mix.exs | mix.exs | defmodule Diver.Mixfile do
use Mix.Project
@version File.read!("VERSION") |> String.strip()
def project do
[app: :diver,
name: "Diver",
version: @version,
source_url: "https://github.com/novabyte/diver",
homepage_url: "http://hexdocs.pm/diver/",
elixir: "~> 1.0",
deps: deps,
... | defmodule Diver.Mixfile do
use Mix.Project
@version File.read!("VERSION") |> String.strip()
def project do
[app: :diver,
name: "Diver",
version: @version,
source_url: "https://github.com/novabyte/diver",
homepage_url: "http://hexdocs.pm/diver/",
elixir: "~> 1.0",
deps: deps,
... | Update description in build script. | Update description in build script.
| Elixir | apache-2.0 | novabyte/diver |
05d839eecc1216d1984a422b35e606dd821932e5 | lib/meal_tracker/cli.ex | lib/meal_tracker/cli.ex | defmodule MealTracker.CLI do
@moduledoc """
Handles the command-line interface of the meal tracker application.
"""
alias MealTracker.Commands.{Add, Edit, Help, List, Status, Version}
def main(argv \\ []) do
case argv do
[] -> Help.run([])
[command | options] -> handle_command(command, optio... | defmodule MealTracker.CLI do
@moduledoc """
Handles the command-line interface of the meal tracker application.
"""
alias MealTracker.Command
alias MealTracker.Commands.Help
def main(argv \\ []) do
case argv do
[] -> Help.run([])
[command | options] -> handle_command(command, options)
... | Use introspection in the main CLI to discover all commands | Use introspection in the main CLI to discover all commands
| Elixir | mit | lee-dohm/meal-tracker,lee-dohm/meal-tracker |
8a15e1245400e6c7bcc8bd59bea19c12e10b613d | test/integration/cases_test.exs | test/integration/cases_test.exs | defmodule Solid.Integration.CasesTest do
use ExUnit.Case, async: true
import Solid.Helpers
@cases_dir "test/cases"
@test_cases File.ls! "test/cases"
for test_case <- @test_cases do
test "test case #{test_case}" do
input_liquid = File.read!("test/cases/#{unquote(test_case)}/input.liquid")
i... | defmodule Solid.Integration.CasesTest do
use ExUnit.Case, async: true
import Solid.Helpers
@cases_dir "test/cases"
@test_cases File.ls! "test/cases"
for test_case <- @test_cases do
for file <- File.ls! "test/cases/#{test_case}/" do
@external_resource "test/cases/#{test_case}/#{file}"
end
end... | Add @external_resource for every test case file | Add @external_resource for every test case file
| Elixir | mit | edgurgel/solid |
8503615927cbe1a7a6e3455dbdc4d7a77ee8d86d | mix.exs | mix.exs | defmodule PlugGraphql.Mixfile do
use Mix.Project
@version "0.0.2"
@description "A Plug integration for the Elixir implementation of Facebook's GraphQL"
@repo_url "https://github.com/joshprice/plug_graphql"
def project do
[app: :plug_graphql,
description: @description,
version: @version,
... | defmodule PlugGraphql.Mixfile do
use Mix.Project
@version "0.0.2"
@description "A Plug integration for the Elixir implementation of Facebook's GraphQL"
@repo_url "https://github.com/joshprice/plug_graphql"
def project do
[app: :plug_graphql,
description: @description,
version: @version,
... | Put doc tasks in docs env | Put doc tasks in docs env
| Elixir | bsd-3-clause | joshprice/plug_graphql |
fef451116137cdeaad1c8e61ae7d3ede9c66db9c | config/test.exs | config/test.exs | use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :gatekeeper, Gatekeeper.Endpoint,
http: [port: 4001],
server: false
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :gatekeeper, Gate... | use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :gatekeeper, Gatekeeper.Endpoint,
http: [port: 4001],
server: false
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :gatekeeper, Gate... | Work around Postgres encoding issue | Work around Postgres encoding issue | Elixir | mit | alkaloid/gatekeeper,alkaloid/gatekeeper,alkaloid/gatekeeper |
220e3bb00f56fd8758a6eb93d914cec0a8db4076 | lib/twitter_grapher/neo4j/utils.ex | lib/twitter_grapher/neo4j/utils.ex | defmodule Neo4j.Utils do
end
| defmodule Neo4j.Utils do
def exists(key: key, value: value) do
conn = Bolt.Sips.conn
query = "MATCH (n { #{key}: '#{value}' }) RETURN n"
result = Bolt.Sips.query!(conn, query)
length(result) != 0
end
end
| Add func to check if a node exists | Add func to check if a node exists
| Elixir | mit | obahareth/twitter-relations-grapher,obahareth/twitter-relations-grapher |
6986656c91c4a15d37cf3a6d441506a61d7d4a0c | mix.exs | mix.exs | defmodule Koans.Mixfile do
use Mix.Project
def project do
[app: :elixir_koans,
version: "0.0.1",
elixir: ">= 1.2.1 and <= 1.4.1",
elixirc_paths: elixirc_path(Mix.env),
deps: deps()]
end
def application do
[applications: [:exfswatch, :logger]]
end
defp deps do
[{:exfswatch,... | defmodule Koans.Mixfile do
use Mix.Project
def project do
[app: :elixir_koans,
version: "0.0.1",
elixir: ">= 1.2.1 and ~> 1.4",
elixirc_paths: elixirc_path(Mix.env),
deps: deps()]
end
def application do
[applications: [:exfswatch, :logger]]
end
defp deps do
[{:exfswatch, "... | Allow any 1.x minor version to run koans | Allow any 1.x minor version to run koans
See #167
| Elixir | mit | samstarling/elixir-koans,elixirkoans/elixir-koans |
996be0e5601897d78a496301de18d2a486b115a4 | mix.exs | mix.exs | defmodule HtmlSanitizeEx.Mixfile do
use Mix.Project
def project do
[
app: :html_sanitize_ex,
version: "0.3.0",
elixir: "~> 1.0",
description: "HTML sanitizer for Elixir",
source_url: "https://github.com/rrrene/html_sanitize_ex",
package: [
contributors: ["René Föhrin... | defmodule HtmlSanitizeEx.Mixfile do
use Mix.Project
def project do
[
app: :html_sanitize_ex,
version: "0.3.0",
elixir: "~> 1.0",
description: "HTML sanitizer for Elixir",
source_url: "https://github.com/rrrene/html_sanitize_ex",
package: [
contributors: ["René Föhrin... | Fix version requirement for inch_ex | Fix version requirement for inch_ex
| Elixir | mit | rrrene/html_sanitize_ex |
e036b9efb4d1adfba25887fdda95d98c5f94b50f | lib/mmdb2.ex | lib/mmdb2.ex | defmodule Geolix.Adapter.MMDB2 do
@moduledoc """
Adapter for Geolix to work with MMDB2 databases.
"""
alias Geolix.Adapter.MMDB2.Database
alias Geolix.Adapter.MMDB2.Loader
alias Geolix.Adapter.MMDB2.Storage
@behaviour Geolix.Adapter
@impl Geolix.Adapter
def database_workers do
import Supervisor... | defmodule Geolix.Adapter.MMDB2 do
@moduledoc """
Adapter for Geolix to work with MMDB2 databases.
## Adapter Configuration
To start using the adapter with a compatible database you need to add the
required configuration entry to your `:geolix` configuration:
config :geolix,
databases: [
... | Add inline adapter configuration documentation | Add inline adapter configuration documentation
| Elixir | apache-2.0 | elixir-geolix/adapter_mmdb2,elixir-geolix/adapter_mmdb2 |
85bb3d18fd30285592d2bf9766cfed600f47483e | lib/setuid.ex | lib/setuid.ex | defmodule Setuid do
@on_load :load_nifs
def load_nifs, do: :erlang.load_nif('./priv/setuid', 0)
def getuid, do: raise "NIF getuid/0 not implemented"
def setuid(_uid), do: raise "NIF setuid/1 not implemented"
def getgid, do: raise "NIF getgid/0 not implemented"
def setgid(_gid), do: raise "NIF ... | defmodule Setuid do
@on_load :load_nifs
def load_nifs do
path = :filename.join(:code.priv_dir(:setuid), 'setuid')
:erlang.load_nif(path, 0)
end
def getuid, do: raise "NIF getuid/0 not implemented"
def setuid(_uid), do: raise "NIF setuid/1 not implemented"
def getgid, do: raise "NIF get... | Fix path to maked lib | Fix path to maked lib
| Elixir | mit | plus3x/privilegex |
0dfb995a5d7eb196d47c10744403836db4b2c078 | lib/ex_twilio/resources/message.ex | lib/ex_twilio/resources/message.ex | defmodule ExTwilio.Message do
@moduledoc """
Represents an Message resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/messages)
Here is an example of sending an SMS message:
{target_number, twilio_number_you_own, body} = {"+12223334444", "+19223334444", "Hello World"}
E... | defmodule ExTwilio.Message do
@moduledoc """
Represents an Message resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/sms/api/message-resource)
Here is an example of sending an SMS message:
{target_number, twilio_number_you_own, body} = {"+12223334444", "+19223334444", "Hello World"}... | Update broken link to Message API | Update broken link to Message API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
85a0ed9ba46d78e7f9f95cef5f98069a694c1ccf | api/lib/worker/images/tiles_controller.ex | api/lib/worker/images/tiles_controller.ex | defmodule Worker.Images.TilesController do
alias Core.Config
alias Worker.Images.TilesCreator
def make_tiles do
projects = Config.get(:couchdb_databases)
make_tiles(projects)
end
def make_tiles(projects) do
entries = projects
|> Enum.flat_map(&tiles_for_project/1)
Enum.map(entries, &Tile... | defmodule Worker.Images.TilesController do
alias Core.Config
alias Worker.Images.TilesCreator
def make_tiles do
projects = Config.get(:couchdb_databases)
make_tiles(projects)
end
def make_tiles(projects) do
entries = projects
|> Enum.flat_map(&tiles_for_project/1)
Enum.map(entries, &Tile... | Fix call to Index.search in tiles controller | Fix call to Index.search in tiles controller
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
ca6d61fdfc93603cb764bf5045436d7d0fb72e22 | elixir/mix.exs | 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: ... | Use the local messages in gherkin-elixir | [gherkin] WIP: Use the local messages in gherkin-elixir
This make the CI build to use the local cucumber-messages version
instead of the released version, but this change cannot remaing when
releasing gherkin-elixir.
| Elixir | mit | cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin |
73e0298dab7c2318fe2c87766b6962ddb8d103a9 | lib/wallaby.ex | lib/wallaby.ex | defmodule Wallaby do
use Application
def start(_type, _args) do
pool_opts =
[name: {:local, Wallaby.ServerPool},
worker_module: Wallaby.Server,
size: pool_size,
max_overflow: 0]
:poolboy.start_link(pool_opts, [])
end
def start_session(opts \\ []) do
server = :poolboy.ch... | defmodule Wallaby do
@moduledoc """
A concurrent feature testing library.
## Configuration
Wallaby supports the following options:
* `:pool_size` - Maximum amount of phantoms to run. The default is `:erlang.system_info(:schedulers_online) * 2`.
* `:screenshot_dir` - The directory to store screenshots.
... | Add info on configuration values. | Add info on configuration values.
| Elixir | mit | keathley/wallaby,keathley/wallaby,aaronrenner/wallaby,aaronrenner/wallaby |
287850890a795ce98a6d9cfed33d5be11a74b18c | lib/kitto/job/dsl.ex | lib/kitto/job/dsl.ex | defmodule Kitto.Job.DSL do
defmacro __using__(_opts) do
quote do
import Kitto.Job.DSL
import Kitto.Notifier, only: [broadcast!: 2]
end
end
defmacro job(name, options, contents \\ []) do
quote do
Kitto.Job.register unquote(name),
unquote(options),
... | defmodule Kitto.Job.DSL do
@moduledoc """
A DSL to define jobs populating the widgets with data.
"""
@doc false
defmacro __using__(_opts) do
quote do
import Kitto.Job.DSL
import Kitto.Notifier, only: [broadcast!: 2]
end
end
@doc """
Main API to define jobs.
It accepts an express... | Add code doc for Kitto.Job.DSL | Add code doc for Kitto.Job.DSL
| Elixir | mit | kittoframework/kitto,kittoframework/kitto |
5da346027867b7465f69927c8e1b21470fc1032c | lib/sendgrid.ex | lib/sendgrid.ex | defmodule SendGrid do
@moduledoc """
Base module for interacting with SendGrid's API. A configured API key must
be provided in your applications project's configuration.
## Configuration
You must provide a configuration which includes your `api_key`.
```
config :sendgrid,
api_key: "sendgrid_api_key... | defmodule SendGrid do
@moduledoc """
Base module for interacting with SendGrid's API. A configured API key must
be provided in your applications project's configuration.
## Configuration
You must provide a configuration which includes your `api_key`.
```
config :sendgrid,
api_key: "sendgrid_api_key... | Remove raise when no key is provide at compile time | Remove raise when no key is provide at compile time
| Elixir | mit | alexgaribay/sendgrid_elixir |
650a20578d50cfdf1b065ae0ec1a86d218c69dc4 | mix.exs | mix.exs | defmodule SendGrid.Mixfile do
use Mix.Project
def project do
[app: :sendgrid,
version: "1.3.0",
elixir: "~> 1.2",
package: package,
description: description,
source_url: project_url,
homepage_url: project_url,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env ==... | defmodule SendGrid.Mixfile do
use Mix.Project
def project do
[app: :sendgrid,
version: "1.3.0",
elixir: "~> 1.2",
package: package(),
description: description(),
source_url: project_url(),
homepage_url: project_url(),
build_embedded: Mix.env == :prod,
start_permanent: Mi... | Use parentheses for methods, avoid warnings | Use parentheses for methods, avoid warnings
| Elixir | mit | alexgaribay/sendgrid_elixir |
53414eb1b3cd4d495ef27ff98d771aa9bcbe80f8 | api/lib/api/auth/readable_projects_plug.ex | api/lib/api/auth/readable_projects_plug.ex | defmodule Api.Auth.ReadableProjectsPlug do
import Plug.Conn
import RouterUtils, only: [get_rights: 1]
def init(options) do
options
end
def call(conn, _opts) do
{readable_projects, is_admin} = get_rights(conn)
conn
|> put_private(:readable_projects, readable_projects)
end
end
| defmodule Api.Auth.ReadableProjectsPlug do
import Plug.Conn
import RouterUtils, only: [get_rights: 1]
def init(options) do
options
end
def call(conn, _opts) do
{ readable_projects, _ } = get_rights(conn)
conn
|> put_private(:readable_projects, readable_projects)
end
end
| Replace unused variable with underscore | Replace unused variable with underscore
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
2762fc4c31edf43fca72112fc7c49a7da41195f6 | web/controllers/user_controller.ex | web/controllers/user_controller.ex | defmodule Goncord.UserController do
use Goncord.Web, :controller
alias Goncord.User
def create(conn, %{"user" => user_params}) do
changeset = User.changeset(%User{}, user_params)
case Repo.insert(changeset) do
{:ok, user} ->
conn
|> put_status(:created)
|> put_resp_header(... | defmodule Goncord.UserController do
use Goncord.Web, :controller
alias Goncord.User
def create(conn, user_params) do
changeset = User.changeset(%User{}, user_params)
case Repo.insert(changeset) do
{:ok, user} ->
conn
|> put_status(:created)
|> put_resp_header("location", u... | Delete show function. Update for new structure. | Delete show function.
Update for new structure.
| Elixir | mit | herald-it/goncord.ex |
9d5735b2a44111f2c5e8cc66201d1481571952eb | examples/Elixir.HelloWorld1/mix.exs | examples/Elixir.HelloWorld1/mix.exs | defmodule HelloWorld1.Mixfile do
use Mix.Project
def project do
[app: :'Elixir.HelloWorld1',
version: "1.5.4",
elixirc_paths: ["lib/",
"/usr/local/lib/cloudi-1.5.4/lib/cloudi_core-1.5.4/include/"],
deps: deps]
end
# Configuration for the OTP application
#
# Type `mi... | defmodule HelloWorld1.Mixfile do
use Mix.Project
def project do
[app: :'Elixir.HelloWorld1',
version: "1.5.4",
elixirc_paths: ["lib/",
"/usr/local/lib/cloudi-1.5.4/lib/cloudi_core-1.5.4/include/"],
deps: deps()]
end
# Configuration for the OTP application
#
# Type `... | Fix warning in Elixir.HelloWorld1 example. | Fix warning in Elixir.HelloWorld1 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 |
637e561703e21a940d53283e870d567db65e7806 | web/views/question_view.ex | web/views/question_view.ex | defmodule Core.QuestionView do
use Core.Web, :view
def render("index.json", %{questions: questions}) do
%{data: render_many(questions, Core.QuestionView, "question.json")}
end
def render("show.json", %{question: question}) do
%{data: render_one(question, Core.QuestionView, "question.json")}
end
d... | defmodule Core.QuestionView do
use Core.Web, :view
def render("index.json", %{questions: questions}) do
%{data: render_many(questions, Core.QuestionView, "question.json")}
end
def render("show.json", %{question: question}) do
%{data: render_one(question, Core.QuestionView, "question.json")}
end
d... | Fix view. Remove the "tags" field | Fix view. Remove the "tags" field
| Elixir | mit | exacs/liqen-core,exacs/liqen-core |
f88225bb8c738f8e878f2dfc359cd4165d97ab3b | priv/templates/views/password_view_template.ex | priv/templates/views/password_view_template.ex | defmodule <%= inspect module %> do
use Phoenix.View, root: "<%= templates_path %>"
use Phoenix.HTML
alias Sentinel.Config
end
| defmodule <%= module %> do
use Phoenix.View, root: "<%= templates_path %>"
use Phoenix.HTML
alias Sentinel.Config
end
| Fix typo for password view template | Fix typo for password view template
| Elixir | mit | britton-jb/sentinel,rrevanth/sentinel |
d44d55abab31c918010c659ed16318acd599c950 | test/lib/course_planner/notifier_test.exs | test/lib/course_planner/notifier_test.exs | defmodule CoursePlanner.NotifierTest do
use CoursePlanner.ModelCase
doctest CoursePlanner.Notifier
import CoursePlanner.Factory
import Swoosh.TestAssertions
alias CoursePlanner.{Notifier, Notifications, User}
test "save notification to send later" do
user = insert(:user)
notification = Notificati... | defmodule CoursePlanner.NotifierTest do
use CoursePlanner.ModelCase
doctest CoursePlanner.Notifier
import CoursePlanner.Factory
import Swoosh.TestAssertions
alias CoursePlanner.{Notifier, Notifications, User}
test "save notification to send later" do
user = insert(:user)
notification = Notificati... | Test if notifications were cleaned up. | Test if notifications were cleaned up.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
b56ab762ce6c5fd0780ea79b757cf4992bb8d3bd | assignments/elixir/grains/grains_test.exs | assignments/elixir/grains/grains_test.exs | Code.load_file("grains.exs")
ExUnit.start
defmodule GrainsTest do
use ExUnit.Case
test "square 1" do
assert 1 == Grains.square(1)
end
test "square 2" do
assert 2 == Grains.square(2)
end
test "square 3" do
assert 4 == Grains.square(3)
end
test "square 4" do
assert 8 == Grains.square(... | Code.load_file("grains.exs")
ExUnit.start
# NOTE: :math.pow/2 doesn't do what you'd expect:
# `:math.pow(2, 64) == :math.pow(2, 64) - 1` is true.
#
# It's best to avoid functions operating on floating point numbers for very
# large numbers.
defmodule GrainsTest do
use ExUnit.Case
test "square 1" do
assert 1 ... | Add warning about :math.pow to elixir grains | Add warning about :math.pow to elixir grains
| Elixir | agpl-3.0 | IanDCarroll/exercism.io,praveenpuglia/exercism.io,k4rtik/exercism.io,emilyforst/exercism.io,hanumakanthvvn/exercism.io,treiff/exercism.io,RaptorRCX/exercism.io,mscoutermarsh/exercism_coveralls,colinrubbert/exercism.io,Tonkpils/exercism.io,bmulvihill/exercism.io,RaptorRCX/exercism.io,exercistas/exercism.io,copiousfreeti... |
7eac0ba56cbd6cc12f0565c64ea1cfa0abaa6553 | web/channels/user_socket.ex | web/channels/user_socket.ex | defmodule Neoboard.UserSocket do
use Phoenix.Socket
## Channels
channel "*", Neoboard.BoardChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket
transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and can
# be used to verify and authenticate ... | defmodule Neoboard.UserSocket do
use Phoenix.Socket
## Channels
channel "*", Neoboard.BoardChannel
## Transports
transport :websocket, Phoenix.Transports.WebSocket,
check_origin: false
transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and can
# be used to... | Allow cross-origin socket connections for now | Allow cross-origin socket connections for now
| Elixir | mit | neopoly/neoboard,neopoly/neoboard,neopoly/neoboard |
43dacb6d623c4ece576a975ac1944d88c8f965a6 | lib/parse_logs.ex | lib/parse_logs.ex | defmodule ParseLogs do
use Application
def start(_type, _args) do
files = [
{"base64-video", ParseLogs.Base64Video},
{"base64-image", ParseLogs.Base64Image},
{"sent-200", ParseLogs.Sent200},
]
for {path, module} <- files, do: process(path, module)
wait(0)
end
defp process(lo... | defmodule ParseLogs do
use Application
def start(_type, _args) do
files = [
{"base64-video", ParseLogs.Base64Video},
{"base64-image", ParseLogs.Base64Image},
{"sent-200", ParseLogs.Sent200},
]
pids = Enum.map(files, fn({path, module}) ->
Task.async(fn ->
process(path, m... | Change async code to use Task | Change async code to use Task
| Elixir | mit | losvedir/ephemeral2-logs |
8887dbab1efa518f9fff7bbe9de3d0b121bb6cd0 | lib/koans/20_comprehensions.ex | lib/koans/20_comprehensions.ex | defmodule Comprehensions do
use Koans
@intro "A comprehension is made of three parts: generators, filters, and collectibles. We will look at how these interact with eachother"
koan "The generator, `n <- [1, 2, 3, 4]`, is providing the values for our comprehension" do
assert (for n <- [1, 2, 3, 4], do: n * n... | defmodule Comprehensions do
use Koans
@intro "A comprehension is made of three parts: generators, filters, and collectibles. We will look at how these interact with eachother"
koan "The generator, `n <- [1, 2, 3, 4]`, is providing the values for our comprehension" do
assert (for n <- [1, 2, 3, 4], do: n * n... | Use Collectable protocol with an empty map | Use Collectable protocol with an empty map
| Elixir | mit | elixirkoans/elixir-koans |
b0be7135265688dfc41d756e844a2655e0b8b31e | lib/ex_twilio/resources/authorized_connect_app.ex | lib/ex_twilio/resources/authorized_connect_app.ex | defmodule ExTwilio.AuthorizedConnectApp do
@moduledoc """
Represents an AuthorizedConnectApp resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/authorized-connect-apps)
"""
defstruct date_created: nil,
date_updated: nil,
account_sid: nil,
per... | defmodule ExTwilio.AuthorizedConnectApp do
@moduledoc """
Represents an AuthorizedConnectApp resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/iam/authorized-connect-apps/api)
"""
defstruct date_created: nil,
date_updated: nil,
account_sid: nil,
perm... | Update redirect to AuthorizedConnectApp API | Update redirect to AuthorizedConnectApp API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
0d858b6a1d8f4075110975794d41837c5f7822fe | test/integration/adapters/postmark_test.exs | test/integration/adapters/postmark_test.exs | defmodule Swoosh.Integration.Adapters.PostmarkTest do
use ExUnit.Case, async: true
import Swoosh.Email
@moduletag integration: true
setup_all do
config = [api_key: System.get_env("POSTMARK_API_KEY"), domain: System.get_env("POSTMARK_DOMAIN")]
{:ok, config: config}
end
test "simple deliver", %{co... | defmodule Swoosh.Integration.Adapters.PostmarkTest do
use ExUnit.Case, async: true
import Swoosh.Email
@moduletag integration: true
setup_all do
config = [api_key: System.get_env("POSTMARK_API_KEY"), domain: System.get_env("POSTMARK_DOMAIN")]
{:ok, config: config}
end
test "simple deliver", %{co... | Fix typos in Postmark integration tests | Fix typos in Postmark integration tests
| Elixir | mit | swoosh/swoosh,dbulic/swoosh |
d3ea335bf754752cce38b0291af4c26a600b9429 | lib/code_corps/github/jwt.ex | lib/code_corps/github/jwt.ex | defmodule CodeCorps.Github.JWT do
@moduledoc """
In charge of loading a a GitHub app .pem and generating a JSON Web Token from
it.
"""
@app_id Application.get_env(:code_corps, :github_app_id)
@doc """
Generates a JWT from the GitHub App's generated RSA private key using the
RS256 algo, where the issue... | defmodule CodeCorps.Github.JWT do
@moduledoc """
In charge of loading a a GitHub app .pem and generating a JSON Web Token from
it.
"""
@doc """
Generates a JWT from the GitHub App's generated RSA private key using the
RS256 algo, where the issuer is the GitHub App's ID.
Used to exchange the JWT for an... | Make JWT.generate/0 fetch github app id at runtime | Make JWT.generate/0 fetch github app id at runtime
- fetching at compile time was causing issues. this ought to be safer
| Elixir | mit | crodriguez1a/code-corps-api,code-corps/code-corps-api,code-corps/code-corps-api,crodriguez1a/code-corps-api |
2559456fbaea01cd661a2183063dba7b3c4147cf | elixir/lib/mal/printer.ex | elixir/lib/mal/printer.ex | defmodule Mal.Printer do
def print_str(mal, print_readably \\ true)
def print_str(mal, _) when is_atom(mal), do: Atom.to_string(mal)
def print_str(mal, _) when is_integer(mal), do: Integer.to_string(mal)
def print_str(mal, _) when is_function(mal), do: "#<function>"
def print_str({:closure, _function}, _), do... | defmodule Mal.Printer do
def print_str(mal, print_readably \\ true)
def print_str(mal, _) when is_atom(mal), do: Atom.to_string(mal)
def print_str(mal, _) when is_integer(mal), do: Integer.to_string(mal)
def print_str(mal, _) when is_function(mal), do: "#<function>"
def print_str({:closure, _function}, _), do... | Use print_readably correctly for lists | Use print_readably correctly for lists
| Elixir | mpl-2.0 | h3rald/mal,0gajun/mal,alantsev/mal,martinlschumann/mal,h3rald/mal,mpwillson/mal,enitihas/mal,outcastgeek/mal,tompko/mal,sleep/mal,0gajun/mal,martinlschumann/mal,profan/mal,0gajun/mal,jwalsh/mal,hterkelsen/mal,tompko/mal,enitihas/mal,enitihas/mal,h3rald/mal,martinlschumann/mal,foresterre/mal,fdserr/mal,sleep/mal,DomBlac... |
185e52670968720700ee1833dd88a2eed1ebeae7 | 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... | Add more logs to factory reset | Add more logs to factory reset
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
aeb0b7867a9e14061063e3cdc53ae45273485826 | web/controllers/api/page_controller.ex | web/controllers/api/page_controller.ex | defmodule FourOhFourFinderApp.Api.PageController do
use FourOhFourFinderApp.Web, :controller
plug :action
def fetch(conn, params) do
page_info = FourOhFourFinderApp.PageAnalyzer.analyze(params["url"])
render conn, page: page_info
end
end
| defmodule FourOhFourFinderApp.Api.PageController do
use FourOhFourFinderApp.Web, :controller
def fetch(conn, params) do
page_info = FourOhFourFinderApp.PageAnalyzer.analyze(params["url"])
render conn, page: page_info
end
end
| Remove action plug from API Controller | Remove action plug from API Controller
This was cargo coding apparently only applicable to older versions of
Phoenix: newer code does this automatically, so having this in was
causing "duplicate render"-type errors.
| Elixir | mit | wfleming/fourohfourfinder,wfleming/fourohfourfinder,wfleming/fourohfourfinder |
ba60a2ea26c26c9962abb6c4bd7b690c0594c480 | test/controllers/slugged_route_controller_test.exs | test/controllers/slugged_route_controller_test.exs | defmodule CodeCorps.SluggedRouteControllerTest do
use CodeCorps.ApiCase
@valid_attrs %{organization_id: 42, slug: "some content", user_id: 42}
@invalid_attrs %{}
test "shows chosen resource", %{conn: conn} do
slug = "test-slug"
slugged_route = insert(:slugged_route, slug: slug)
conn = get conn, "/... | defmodule CodeCorps.SluggedRouteControllerTest do
use CodeCorps.ApiCase, resource_name: :slugged_route
@valid_attrs %{organization_id: 42, slug: "some content", user_id: 42}
@invalid_attrs %{}
test "shows chosen resource", %{conn: conn} do
slug = "test-slug"
slugged_route = insert(:slugged_route, slug... | Refactor Slugged Routes Controller tests with helpers | Refactor Slugged Routes Controller tests with helpers
| Elixir | mit | crodriguez1a/code-corps-api,crodriguez1a/code-corps-api,code-corps/code-corps-api,code-corps/code-corps-api |
4f39016803f893961f1aaa68269e2e8218a7e63d | profile/get_usda_json.exs | profile/get_usda_json.exs | HTTPoison.start
case HTTPoison.get("http://www.usda.gov/data.json") do
{:ok, %HTTPoison.Response{body: body, status_code: 200}} -> File.write!("profile/usda.json", body)
end
case HTTPoison.get("https://edg.epa.gov/data.json") do
{:ok, %HTTPoison.Response{body: body, status_code: 200}} -> File.write!("profile/edg.js... | HTTPoison.start
case HTTPoison.get("https://www.usda.gov/data.json") do
{:ok, %HTTPoison.Response{body: body, status_code: 200}} -> File.write!("profile/usda.json", body)
end
case HTTPoison.get("https://edg.epa.gov/data.json") do
{:ok, %HTTPoison.Response{body: body, status_code: 200}} -> File.write!("profile/edg.j... | Update USDA url to https since http endpoint returns 301 now. | Update USDA url to https since http endpoint returns 301 now.
| Elixir | apache-2.0 | olafura/json_diff_ex,olafura/json_diff_ex |
6fdfd110ffa2d368675bbd648bda1117620966e7 | web/views/user_view.ex | web/views/user_view.ex | defmodule SlackCoder.UserView do
use SlackCoder.Web, :view
import Scrivener.HTML
def new_or_update_user_path(%Plug.Conn{path_info: ["admin" | _]} = conn, user) do
user_path(conn, :create_external, user.github)
end
def new_or_update_user_path(conn, %{id: nil}) do
user_path(conn, :create)
end
def n... | defmodule SlackCoder.UserView do
use SlackCoder.Web, :view
import Scrivener.HTML
def new_or_update_user_path(%Plug.Conn{path_info: ["admin" | _]} = conn, user) do
user_path(conn, :create_external, user.github)
end
def new_or_update_user_path(conn, %{id: nil}) do
user_path(conn, :create)
end
def n... | Add open to front end config. | Add open to front end config.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
7204aabfc9e96bff6e2c4cf6e76b11731753ad62 | lib/kitto/view.ex | lib/kitto/view.ex | defmodule Kitto.View do
@moduledoc """
HTML rendering facility.
This module defines functions to deal with EEx templates used to provide markup
for the dashboards.
## Configuration Options
* `templates_dir` - Where to look for templates, defaults to "dashboards".
* `default_layout` - The layout in which... | defmodule Kitto.View do
@moduledoc """
HTML rendering facility.
This module defines functions to deal with EEx templates used to provide markup
for the dashboards.
## Configuration Options
* `templates_dir` - Where to look for templates, defaults to "dashboards".
* `default_layout` - The layout in which... | Move Kitto.View.render_template to public interface | Move Kitto.View.render_template to public interface
| Elixir | mit | kittoframework/kitto,kittoframework/kitto |
514e09eebdfba0befa88e5b23212e917ec11c8e1 | 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-credential-resource)
"""
defstruct sid: nil,
account_sid: nil,
friendly_name: nil,
ip_address: nil,
... | Update redirect to SipCredential API | Update redirect to SipCredential API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
9dbe86d9191a7b327ca85a5c36708f6d33311576 | priv/repo/seeds.exs | priv/repo/seeds.exs | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Argo.Repo.insert!(%Argo.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail i... | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
pass = System.get_env "ADMIN_PASSWORD"
Argo.Repo.insert! %Argo.User{
name: "admin",
email: System.get_env("ADMIN_EMAIL"),
admin: tru... | Create seed for admin user | Create seed for admin user
| Elixir | mit | ne1ro/argo,ne1ro/argo |
a91cd2ab32d1183efdb8058ded23b440b8bd621f | grade-school/school.exs | grade-school/school.exs | defmodule School do
@moduledoc """
Simulate students in a school.
Each student is in a grade.
"""
@doc """
Add a student to a particular grade in school.
"""
@spec add(Dict.t, string, pos_integer) :: Dict.t
def add(db, name, grade) do
end
@doc """
Return the names of the students in a partic... | defmodule School do
@moduledoc """
Simulate students in a school.
Each student is in a grade.
"""
@doc """
Add a student to a particular grade in school.
"""
@spec add(Dict.t, String.t, pos_integer) :: Dict.t
def add(db, name, grade) do
end
@doc """
Return the names of the students in a part... | Fix compiler warning for grade-test's add/3 spec | Fix compiler warning for grade-test's add/3 spec
school.exs:11: warning: string() type use is discouraged. For character lists, use char_list() type, for strings, String.t()
school.exs:11: School (module)
| Elixir | mit | parkerl/xelixir,cezarykosko/xelixir,Egogre/xelixir,tjcelaya/xelixir,elasticdog/xelixir,wobh/xelixir,victorlcampos/xelixir,montague/xelixir,exercism/xelixir |
22e03e15a64f391580f7e9a40d93b4121abfa8be | lib/remote_retro_web/services/user_management.ex | lib/remote_retro_web/services/user_management.ex | defmodule RemoteRetroWeb.UserManagement do
alias RemoteRetro.{User, Mailer, Emails}
def handle_google_oauth(oauth_info) do
if Application.get_env(:remote_retro, :env) !== :test do
IO.inspect oauth_info
end
case User.upsert_record_from(oauth_info: oauth_info) do
{:ok, user, :inserted} ->
... | defmodule RemoteRetroWeb.UserManagement do
alias RemoteRetro.{User, Mailer, Emails}
def handle_google_oauth(oauth_info) do
case User.upsert_record_from(oauth_info: oauth_info) do
{:ok, user, :inserted} ->
Emails.welcome_email(user) |> Mailer.deliver_now()
{:ok, user}
{:ok, user, :u... | Remove temporary production logging used to identify problematic data | Remove temporary production logging used to identify problematic data
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
52d5cce01cc42d9b42f0abba2190ae7f38255205 | 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 mix on dev mode | Fix mix on dev mode
| Elixir | mit | ueberauth/guardian_db |
fc8b9b97f950359269830835f22965250fea4ff6 | api/lib/core/config.ex | api/lib/core/config.ex | defmodule Core.Config do
require Logger
def get(key), do: get(nil, key)
def get(module, key) do
if Mix.env() == :test do
get_test module, key
else
with {:ok, val} <- Application.fetch_env(:api, key) do
val
else
_ -> Logger.error "#{key} not set in config!"
nil
... | defmodule Core.Config do
require Logger
def get(key), do: get(nil, key)
def get(module, key) do
if Mix.env() == :test do
get_test module, key
else
get_default module, key
end
end
def get_default module, key do
with {:ok, val} <- Application.fetch_env(:api, key) do
val
e... | Use default method to find key in test if otherwise not found | Use default method to find key in test if otherwise not found
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
0e5b4ea136212ec209a7de0bed9a9b459185231e | web/admin/food_group.ex | web/admin/food_group.ex | defmodule OpenPantry.ExAdmin.FoodGroup do
use ExAdmin.Register
register_resource OpenPantry.FoodGroup do
end
end
| defmodule OpenPantry.ExAdmin.FoodGroup do
use ExAdmin.Register
register_resource OpenPantry.FoodGroup do
end
def display_name(food_group) do
food_group.foodgroup_desc
end
end
| Fix food group display in admin | Fix food group display in admin | Elixir | mit | fcapovilla/open_pantry,openpantry/open_pantry,openpantry/open_pantry,fcapovilla/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,bglusman/open_pantry,fcapovilla/open_pantry,openpantry/open_pantry,bglusman/open_pantry,fcapovilla/open_pantry,MasbiaSoupKitchenNetwork/open_pantry,bglusm... |
61fe9a201af1b54da9eb4d2c748698c9e1f1ef38 | lib/ex_twilio/resources/notification.ex | lib/ex_twilio/resources/notification.ex | defmodule ExTwilio.Notification do
@moduledoc """
Represents an Notification resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/notifications)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
call_si... | defmodule ExTwilio.Notification do
@moduledoc """
Represents an Notification resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/notify/api/notification-resource)
"""
defstruct sid: nil,
date_created: nil,
date_updated: nil,
account_sid: nil,
... | Update broken link to Notification API | Update broken link to Notification API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
b1a60925b30c6c8fd65e7dfa66315da3e1745dd3 | lib/tilex/slack.ex | lib/tilex/slack.ex | defmodule Tilex.Slack do
def notify(post, developer, channel, url) do
"#{developer.username} created a new post <#{url}|#{post.title}> ##{channel.name}"
|> send_slack_message
end
def notify_of_awards(post = %Tilex.Post{max_likes: max_likes, title: title}, developer, url) do
appropriate_emoji = [ "🎉"... | defmodule Tilex.Slack do
def notify(post, developer, channel, url) do
"#{developer.username} created a new post <#{url}|#{post.title}> ##{channel.name}"
|> send_slack_message
end
def notify_of_awards(%Tilex.Post{max_likes: max_likes, title: title}, developer, url) do
appropriate_emoji = [ "🎉", "🎂",... | Remove unused post assignment from Slack integration | Remove unused post assignment from Slack integration
| Elixir | mit | hashrocket/tilex,hashrocket/tilex,hashrocket/tilex |
db6e780a1fe86ec74725c5d907a7fb30a559c609 | rzl-xkeyscore.yml.ex | rzl-xkeyscore.yml.ex | Database: {
dsn: 'DBI:mysql:database=xkeyscore;host=db.rzl',
user: 'xkeyscore',
passwd: '0000'
}
MQTT: {
host: 'localhost',
timeout: 3,
keepalive: 10,
cleansession: 1,
clientid: 'xkeyscore',
blacklist: [
'/service/status/presence'
]
}
| Database: {
dsn: 'DBI:mysql:database=xkeyscore;host=db.rzl',
user: 'xkeyscore',
passwd: '0000'
}
MQTT: {
host: 'localhost',
timeout: 3,
keepalive: 10,
cleansession: 1,
clientid: 'xkeyscore',
blacklist: [
'/service/status/presence'
'/service/fnordcredit'
]
}
| Add fnordcredit to topic blacklist | Add fnordcredit to topic blacklist
| Elixir | bsd-3-clause | raumzeitlabor/rzl-xkeyscore |
42b23b788c74617ae7507472e081dfd3a35fa90b | lib/slack_coder/endpoint.ex | lib/slack_coder/endpoint.ex | defmodule SlackCoder.Endpoint do
use Phoenix.Endpoint, otp_app: :slack_coder
socket "/socket", SlackCoder.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... | defmodule SlackCoder.Endpoint do
use Phoenix.Endpoint, otp_app: :slack_coder
socket "/socket", SlackCoder.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... | Enable favicon as a static asset. | Enable favicon as a static asset.
| Elixir | mit | mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder,mgwidmann/slack_coder |
b8ab29d9b87e5b2aa09b190c0b2d6e253f96e99e | web/views/user_view.ex | web/views/user_view.ex | defmodule Goncord.UserView do
use Goncord.Web, :view
def render("index.json", %{users: users}) do
%{data: render_many(users, Goncord.UserView, "user.json")}
end
def render("show.json", %{user: user}) do
%{data: render_one(user, Goncord.UserView, "user.json")}
end
def render("user.json", %{user: u... | defmodule Goncord.UserView do
use Goncord.Web, :view
def render("index.json", %{users: users}) do
render_many(users, Goncord.UserView, "user.json")
end
def render("show.json", %{user: user}) do
render_one(user, Goncord.UserView, "user.json")
end
def render("user.json", %{user: user}) do
%{log... | Delete data key from user render. | Delete data key from user render.
| Elixir | mit | herald-it/goncord.ex |
6570cf9f6169818713ce654ccd49105bdd2bd88d | lib/serum/dev_server.ex | lib/serum/dev_server.ex | defmodule Serum.DevServer do
@moduledoc """
The Serum development server.
"""
alias Serum.DevServer.{Looper, Service}
alias Serum.Result
alias Serum.SiteBuilder
@doc """
Starts the Serum development server.
"""
@spec run(binary, pos_integer) :: no_return()
def run(dir, port) do
import Superv... | defmodule Serum.DevServer do
@moduledoc """
The Serum development server.
"""
alias Serum.DevServer.{Looper, Service}
alias Serum.Project
alias Serum.Project.Loader, as: ProjectLoader
alias Serum.Result
alias Serum.SiteBuilder
@doc """
Starts the Serum development server.
"""
@spec run(binary,... | Use Project.Loader to load serum.exs | [DevServer] Use Project.Loader to load serum.exs
| Elixir | mit | Dalgona/Serum |
333dc3efdd2ce3cc95eacd78d922fb784cbcca46 | 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
remove :user_id
add :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
modify :user_id, references(:users, on_delete: :nilify_all)
end
end
end
| Revert "Fix weird behavior on migration." | Revert "Fix weird behavior on migration."
This reverts commit 9c03068fe35a20ef959a1f5475be04b62b21d7ed.
| Elixir | mit | digitalnatives/course_planner,digitalnatives/course_planner,digitalnatives/course_planner |
c835dc62b2266e7d7158ac7eab37304e6718fa60 | web/controllers/page_controller.ex | web/controllers/page_controller.ex | defmodule FdlMessengerBot.PageController do
use FdlMessengerBot.Web, :controller
def index(conn, _params) do
render conn, "index.html"
end
def webhook(conn, %{
"hub.verify_token" => verify_token,
"hub.challenge" => challenge
}) do
text conn, challenge
end
def webhook(conn, %{"entry" => ... | defmodule FdlMessengerBot.PageController do
use FdlMessengerBot.Web, :controller
def index(conn, _params) do
render conn, "index.html"
end
def webhook(conn, %{
"hub.verify_token" => verify_token,
"hub.challenge" => challenge
}) do
text conn, challenge
end
def webhook(conn, %{"entry" => ... | Comment out some random stuff | Comment out some random stuff
| Elixir | mit | ukisami/fdl-messenger-bot,ukisami/fdl-messenger-bot |
fc18901d3a6a9fb5a6e419e414041e0955d26f65 | lib/who/google_maps_api/google_maps_api.ex | lib/who/google_maps_api/google_maps_api.ex | defmodule Who.GoogleMapsAPI.Base do
@moduledoc """
Functions and variables associated with using the Google Maps API.
"""
@api_key "AIzaSyAFwzUpWUl5mp_z3mnWvhfuYKh8Fg55iXU"
@doc """
Returns the API key for the Google Maps API as a string.
EX:
Who.GoogleMapsAPI.Base.get_api_key()
"""
@spec get_a... | defmodule Who.GoogleMapsAPI.Base do
@moduledoc """
Functions and variables associated with using the Google Maps API.
"""
@api_key "AIzaSyAFwzUpWUl5mp_z3mnWvhfuYKh8Fg55iXU"
@doc """
Returns the API key for the Google Maps API as a string.
EX:
Who.GoogleMapsAPI.Base.get_api_key()
"""
@spec get_a... | Change Google Map embed default zoom level | Change Google Map embed default zoom level
| Elixir | mit | ryancharris/who,ryancharris/who |
5dc0a855e3f75c328012d8c9e4f920fc0f92ebdb | lib/mytwitter/timeline.ex | lib/mytwitter/timeline.ex | defmodule Mytwitter.Timeline do
use GenServer
require Logger
def start_link do
GenServer.start_link(__MODULE__, name: __MODULE__)
end
def init(_opts) do
stream = ExTwitter.stream_user
pid = self()
spawn_link fn ->
for message <- stream do
send pid, message
end
exit ... | defmodule Mytwitter.Timeline do
use GenServer
require Logger
def start_link do
GenServer.start_link(__MODULE__, name: __MODULE__)
end
def init(_opts) do
stream = ExTwitter.stream_user
pid = self()
spawn_link fn ->
for message <- stream do
send pid, message
end
exit ... | Fix not to ignore RT | Fix not to ignore RT
| Elixir | agpl-3.0 | ryo33/mytwitter,ryo33/mytwitter |
a43975910557b300db3e1971b81537ef92f14456 | lib/credo/execution/task.ex | lib/credo/execution/task.ex | defmodule Credo.Execution.Task do
@type t :: module
@callback call(exec :: Credo.Execution.t, opts :: Keyword.t) :: Credo.Execution.t
defmacro __using__(_opts \\ []) do
quote do
@behaviour Credo.Execution.Task
import Credo.Execution
alias Credo.Execution
def call(%Execution{halted: ... | defmodule Credo.Execution.Task do
@type t :: module
@callback call(exec :: Credo.Execution.t, opts :: Keyword.t) :: Credo.Execution.t
defmacro __using__(_opts \\ []) do
quote do
@behaviour Credo.Execution.Task
import Credo.Execution
alias Credo.Execution
def call(%Execution{halted: ... | Use new comment syntax to disable Credo | Use new comment syntax to disable Credo
| Elixir | mit | rrrene/credo,rrrene/credo |
89d3610940a8b4e2044bd18ffe13a822449b556b | farmbot_os/test/farmbot_os/lua_test.exs | farmbot_os/test/farmbot_os/lua_test.exs | defmodule FarmbotOS.LuaTest do
use ExUnit.Case
use Mimic
setup :verify_on_exit!
alias FarmbotOS.Lua
@tag :capture_log
test "evaluates Lua" do
assert Lua.eval_assertion("Returns 'true'", "return true")
{:error, message1} = Lua.eval_assertion("Returns 'true'", "-1")
assert message1 ==
... | defmodule FarmbotOS.LuaTest do
use ExUnit.Case
use Mimic
setup :verify_on_exit!
alias FarmbotOS.Lua
@tag :capture_log
test "evaluates Lua" do
assert Lua.eval_assertion("Returns 'true'", "return true")
{:error, message1} = Lua.eval_assertion("Returns 'true'", "-1")
assert message1 == "bad retur... | Update tests (implicit `return` statement) | Update tests (implicit `return` statement)
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
7cfc860bdf73967f7b79b94ab7b062157704088f | priv/repo/migrations/20151026144440_create_membership.exs | priv/repo/migrations/20151026144440_create_membership.exs | defmodule Officetournament.Repo.Migrations.CreateMembership do
use Ecto.Migration
def change do
create table(:memberships) do
add :user_id, references(:users)
add :league_id, references(:leagues)
timestamps
end
create unique_index(:memberships, [:user_id, :league_id])
end
end
| defmodule Officetournament.Repo.Migrations.CreateMembership do
use Ecto.Migration
def change do
create table(:memberships) do
add :user_id, references(:users, on_delete: :delete_all)
add :league_id, references(:leagues, on_delete: :delete_all)
timestamps
end
create unique_index(:mem... | Remove memberships when a user is deleted | Remove memberships when a user is deleted
| Elixir | mit | X0nic/officetournament,X0nic/officetournament |
f7b0e26fdc2ccc4333e25e971f6f7f1bb2d250ea | web/models/user_day.ex | web/models/user_day.ex | defmodule Broccoli.UserDay do
use Broccoli.Web, :model
alias Broccoli.UserDay
@derive {Poison.Encoder, only: [:uid, :day, :note, :level]}
schema "user_day" do
field :day, Ecto.Date
field :level, Level
field :note, :string
field :uid, :string
timestamps()
end
def changeset(struct, pa... | defmodule Broccoli.UserDay do
use Broccoli.Web, :model
alias Broccoli.UserDay
@derive {Poison.Encoder, only: [:uid, :day, :note, :level]}
schema "user_day" do
field :day, Ecto.Date
field :level, :integer
field :note, :string
field :uid, :string
timestamps()
end
def changeset(struct,... | Validate that :level is within 1..7 | Validate that :level is within 1..7
| Elixir | mit | NunoAlexandre/broccoli,NunoAlexandre/broccoli |
8107bb3e09f493790b1dd62fb6932817f7414af0 | 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: struct.user_id,
last_notification_time: struct.last_notification_time,
}
]
end
end
| 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),... | Mark notifications as read - correct sidekiq json. | Mark notifications as read - correct sidekiq json.
| Elixir | mit | ello/apex,ello/apex,ello/apex |
898811e2527ed91ce9b25ceb25594eb38eeb6229 | lib/atom_style_tweaks_web/open_graph.ex | lib/atom_style_tweaks_web/open_graph.ex | defmodule AtomStyleTweaksWeb.OpenGraph do
@moduledoc """
Functions for handling Facebook Open Graph data and inserting the appropriate tags into pages.
"""
import Plug.Conn, only: [assign: 3]
require Logger
use Phoenix.HTML
def render_metadata(conn) do
case conn.assigns[:open_graph_metadata] do
... | defmodule AtomStyleTweaksWeb.OpenGraph do
@moduledoc """
Functions for handling Facebook Open Graph data and inserting the appropriate tags into pages.
"""
alias AtomStyleTweaksWeb.Router
alias Phoenix.Controller
import Plug.Conn, only: [assign: 3]
require Logger
use Phoenix.HTML
def render_metada... | Simplify code to get current URL | Simplify code to get current URL
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
02a14c42461207520239925ae4a242ef7037f3cc | lib/farmbot/celery_script/ast/node/install_first_party_farmware.ex | lib/farmbot/celery_script/ast/node/install_first_party_farmware.ex | defmodule Farmbot.CeleryScript.AST.Node.InstallFirstPartyFarmware do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args []
@fpf_url "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/manifest.json"
def execute(_, _, env) do
env = mutate_env(env)
case Farmbot.Farmwar... | defmodule Farmbot.CeleryScript.AST.Node.InstallFirstPartyFarmware do
@moduledoc false
use Farmbot.CeleryScript.AST.Node
allow_args []
@fpf_url "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/manifest.json"
def execute(_, _, env) do
env = mutate_env(env)
case Farmbot.Farmwar... | Fix bad pattern for first party farmware installer | Fix bad pattern for first party farmware installer
| Elixir | mit | FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os,FarmBot/farmbot_os |
525694c08dd8dff1f04fb9a6e7a6b6b1ca9053fd | test/jumubase_web/views/internal/user_view_test.exs | test/jumubase_web/views/internal/user_view_test.exs | defmodule JumubaseWeb.Internal.UserViewTest do
use JumubaseWeb.ConnCase, async: true
alias Jumubase.JumuParams
alias JumubaseWeb.Internal.UserView
test "returns a user's full name" do
user = build(:user, first_name: "First", last_name: "Last")
assert UserView.full_name(user) == "First Last"
end
de... | defmodule JumubaseWeb.Internal.UserViewTest do
use JumubaseWeb.ConnCase, async: true
alias Jumubase.JumuParams
alias JumubaseWeb.Internal.UserView
test "returns a user's full name" do
user = build(:user, first_name: "First", last_name: "Last")
assert UserView.full_name(user) == "First Last"
end
te... | Add some tests for Internal.UserView | Add some tests for Internal.UserView
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix |
ff9b4f5ac1619aa542d5b2dc401100559b0c4363 | mix.exs | mix.exs | defmodule Tesla.Mixfile do
use Mix.Project
def project do
[app: :tesla,
version: "0.2.1",
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.2.1",
description: description,
package: package,
source_url: "https://github.com/monterail/tesla",
elixir: "~> 1.0",
deps: deps,
test_coverage: [tool: ExCoveralls]]
end
# Configuration f... | Remove obsolete link from hex | Remove obsolete link from hex | Elixir | mit | monterail/tesla,teamon/tesla |
b1379fe73291beb2db3d09a5f55dfdc38fb67a24 | mix.exs | mix.exs | defmodule Mix.Tasks.Compile.ElixirAle do
@shortdoc "Compiles elixir_ale port binaries"
def run(_) do
0=Mix.Shell.IO.cmd("make priv/ale")
Mix.Project.build_structure
:ok
end
end
defmodule ElixirAle.Mixfile do
use Mix.Project
def project do
[
app: :elixir_ale,
version: "0.4.0",
... | defmodule Mix.Tasks.Compile.ElixirAle do
@shortdoc "Compiles elixir_ale port binaries"
def run(_) do
0=Mix.Shell.IO.cmd("make priv/ale")
Mix.Project.build_structure
:ok
end
end
defmodule ElixirAle.Mixfile do
use Mix.Project
def project do
[
app: :elixir_ale,
version: "0.4.0",
... | Remove priv/.do-not-remove from package description | Remove priv/.do-not-remove from package description
See https://github.com/fhunleth/elixir_ale/pull/7
| Elixir | apache-2.0 | fhunleth/elixir_ale |
d65edbe68749a106ea494bcee70728898f313d74 | 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... | use Mix.Config
config :logger,
utc_log: true
config :logger, :console,
format: "$date $time $metadata[$level] $levelpad$message\n"
| Add the date to Logger lines and force UTC timestamps | Add the date to Logger lines and force UTC timestamps
This is otherwise a copy of the default format.
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni |
8ecb08d36980eb7d8a49d28dffb0c35b641c9ac2 | apps/unshortening_pool/lib/unshortening_pool/worker.ex | apps/unshortening_pool/lib/unshortening_pool/worker.ex | defmodule UnshorteningPool.Worker do
use ExActor.GenServer
defstart start_link(_), do: initial_state(0)
defcast work(url) do
result = url
|> check_cache(fn url ->
UnshorteningPool.Unshortener.expand(url)
end)
BlockingQueue.push(UnshorteningPool.output_queue, {self, result})
new_state(... | defmodule UnshorteningPool.Worker do
use ExActor.GenServer
defstart start_link(_), do: initial_state(0)
defcast work(url) do
result = url
|> check_cache(fn url ->
UnshorteningPool.Unshortener.expand(url)
end)
BlockingQueue.push(UnshorteningPool.output_queue, {self, result})
new_state(... | Clean up the updating of the cache a little | Clean up the updating of the cache a little
| Elixir | mit | joekain/ds_p9 |
f8f634e8b624af51c703aa3ce5f0cfe4d3390ea7 | api/lib/core/project_config_loader.ex | api/lib/core/project_config_loader.ex | defmodule Core.ProjectConfigLoader do
require Logger
use Agent
def start_link({project_config_dir_name, projects}) do
projects = (projects || Core.Config.get(:projects)) ++ ["default"]
configs = for project <- projects, into: %{} do
{
project,
load(project_config_dir_name,... | defmodule Core.ProjectConfigLoader do
require Logger
use Agent
def start_link({project_config_dir_name, projects}) do
projects = (projects || Core.Config.get(:projects)) ++ ["default"]
configs = for project <- projects, into: %{} do
{
project,
load(project_config_dir_name,... | Use default configuration for projects without custom configuration | Use default configuration for projects without custom configuration
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
919ec2a6816f384eb777e4422fcc335c85ce4eb2 | lib/code_corps_web/channels/conversation_channel.ex | lib/code_corps_web/channels/conversation_channel.ex | defmodule CodeCorpsWeb.ConversationChannel do
use Phoenix.Channel
alias CodeCorps.{Conversation, Policy, Repo, User}
alias Phoenix.Socket
@spec join(String.t, map, Socket.t) :: {:ok, Socket.t} | {:error, map}
def join("conversation:" <> id, %{}, %Socket{} = socket) do
with %Conversation{} = conversation... | defmodule CodeCorpsWeb.ConversationChannel do
use Phoenix.Channel
alias CodeCorps.{Conversation, Policy, Repo, User}
alias Phoenix.Socket
@spec join(String.t, map, Socket.t) :: {:ok, Socket.t} | {:error, map}
def join("conversation:" <> id, %{}, %Socket{} = socket) do
with %Conversation{} = conversation... | Add author_id to response from new:message in conversation channel | Add author_id to response from new:message in conversation channel
| Elixir | mit | code-corps/code-corps-api,code-corps/code-corps-api |
60bd628f378ff3340a2ea3cb86aa2a3d70500d2a | mix.exs | mix.exs | defmodule ParallelStream.Mixfile do
use Mix.Project
def project do
[
app: :parallel_stream,
version: "1.1.0",
elixir: "~> 1.5",
deps: deps(),
package: package(),
docs: &docs/0,
name: "Parallel Stream",
consolidate_protocols: true,
source_url: "https://githu... | defmodule ParallelStream.Mixfile do
use Mix.Project
def project do
[
app: :parallel_stream,
version: "1.1.0",
elixir: "~> 1.5",
deps: deps(),
package: package(),
docs: &docs/0,
name: "Parallel Stream",
consolidate_protocols: true,
source_url: "https://githu... | Use README as docs start page | Use README as docs start page
| Elixir | mit | beatrichartz/parallel_stream |
a96bebaa58d3e5e84b8c5ddb6c12efc706cc67b0 | test/features/voting_test.exs | test/features/voting_test.exs | defmodule VotingTest do
use RemoteRetro.IntegrationCase, async: false
alias RemoteRetro.Idea
import ShorterMaps
describe "voting for an idea" do
setup [:persist_idea_for_retro]
@tag [
retro_stage: "voting",
idea: %Idea{category: "happy", body: "pacing well"},
]
test "increments t... | defmodule VotingTest do
use RemoteRetro.IntegrationCase, async: false
alias RemoteRetro.Idea
import ShorterMaps
describe "voting for an idea" do
setup [:persist_idea_for_retro]
@tag [
retro_stage: "voting",
idea: %Idea{category: "happy", body: "pacing well"},
]
test "increments t... | Add assertion for before state in voting end-to-end test | Add assertion for before state in voting end-to-end test
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
272933c2a3f99c4a5c159aca4b0dcaf04d488aaa | priv/repo/migrations/20171001195406_add_summary_to_offers.exs | priv/repo/migrations/20171001195406_add_summary_to_offers.exs | defmodule ElixirJobs.Repo.Migrations.AddSummaryToOffers do
use Ecto.Migration
def change do
alter table(:offers) do
add :summary, :string
end
end
end
| defmodule ElixirJobs.Repo.Migrations.AddSummaryToOffers do
use Ecto.Migration
def change do
alter table(:offers) do
add :summary, :string, size: 200
end
end
end
| Add character limit to summary | Add character limit to summary
| Elixir | mit | odarriba/elixir_jobs,odarriba/elixir_jobs |
436075f0052a285371e9c2be60f061f4755b0633 | priv/repo/migrations/20200508035201_add_email_opt_in.exs | priv/repo/migrations/20200508035201_add_email_opt_in.exs | defmodule RemoteRetro.Repo.Migrations.AddEmailOptIn do
use Ecto.Migration
def change do
alter table(:users) do
add :email_opt_in, :boolean, default: false, null: false
end
end
end
| defmodule RemoteRetro.Repo.Migrations.AddEmailOptIn do
use Ecto.Migration
def change do
alter table(:users) do
add :email_opt_in, :boolean
end
end
end
| Update migration for adding email_opt_in such that it allows NULLs | Update migration for adding email_opt_in such that it allows NULLs
| Elixir | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro |
65102534d66dcc375d412581a5bc89de2b96b34c | lib/atom_tweaks_web/views/error_view.ex | lib/atom_tweaks_web/views/error_view.ex | 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... | 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("400.html", _assigns), do: "B... | Add 400 Bad request handler | Add 400 Bad request handler
| Elixir | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks |
5d5c9c22c0914db3352efbbe70cd4ca87a1fa954 | lib/ex_twilio/resources/incoming_phone_number.ex | lib/ex_twilio/resources/incoming_phone_number.ex | defmodule ExTwilio.IncomingPhoneNumber do
@moduledoc """
Represents an IncomingPhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/api/rest/incoming-phone-numbers)
"""
defstruct sid: nil,
account_sid: nil,
address_sid: nil,
address_requirem... | defmodule ExTwilio.IncomingPhoneNumber do
@moduledoc """
Represents an IncomingPhoneNumber resource in the Twilio API.
- [Twilio docs](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource)
"""
defstruct sid: nil,
account_sid: nil,
address_sid: nil,
a... | Update redirect to IncomingPhoneNumber API | Update redirect to IncomingPhoneNumber API
| Elixir | mit | danielberkompas/ex_twilio,danielberkompas/ex_twilio |
67ff5d13b74f08051a3875fe6c6975c7c7d2cd9a | test/credo/check/consistency/tabs_or_spaces_test.exs | test/credo/check/consistency/tabs_or_spaces_test.exs | defmodule Credo.Check.Consistency.TabsOrSpacesTest do
use Credo.TestHelper
@described_check Credo.Check.Consistency.TabsOrSpaces
@with_tabs """
defmodule Credo.Sample do
\t@test_attribute :foo
\tdef foobar(parameter1, parameter2) do
\t\tString.split(parameter1) + parameter2
\tend
end
"""
@with_spaces """
def... | defmodule Credo.Check.Consistency.TabsOrSpacesTest do
use Credo.TestHelper
@described_check Credo.Check.Consistency.TabsOrSpaces
@with_tabs """
defmodule Credo.Sample do
\t@test_attribute :foo
\tdef foobar(parameter1, parameter2) do
\t\tString.split(parameter1) + parameter2
\tend
end
"""
@with_spaces """
def... | Fix failing test for TabsOrSpaces | Fix failing test for TabsOrSpaces
| Elixir | mit | rrrene/credo,rrrene/credo |
8e4cf298a98a4ac47be2684f56e9b2d0998299be | priv/repo/migrations/20171106045740_add_done_to_task_list.exs | priv/repo/migrations/20171106045740_add_done_to_task_list.exs | defmodule CodeCorps.Repo.Migrations.AddDoneToTaskList do
use Ecto.Migration
import Ecto.Query
alias CodeCorps.Repo
def up do
alter table(:task_lists) do
add :done, :boolean, default: false
end
flush()
from(tl in "task_lists", where: [name: "Done"], update: [set: [done: true]])
|> ... | defmodule CodeCorps.Repo.Migrations.AddDoneToTaskList do
use Ecto.Migration
import Ecto.Query
alias CodeCorps.Repo
def up do
alter table(:task_lists) do
add :done, :boolean, default: false
end
flush()
from(tl in "task_lists", where: [name: "Done"], update: [set: [done: true]])
|> ... | Fix migration for adding done to task lists | Fix migration for adding done to task lists
| Elixir | mit | code-corps/code-corps-api,code-corps/code-corps-api |
abca917112a170f0b03ad197f75d93f3d7ee0367 | lib/elixir_status/publisher/shared_urls.ex | lib/elixir_status/publisher/shared_urls.ex | defmodule ElixirStatus.Publisher.SharedUrls do
def for_posting(posting) do
# TODO: follow redirects
collect_and_expand_urls(posting.text)
end
def collect_and_expand_urls(text) do
text = Earmark.to_html(text)
~r/href=\"([^\"]+?)\"/
|> Regex.scan(text)
|> Enum.flat_map(fn([_, url]) ->
... | defmodule ElixirStatus.Publisher.SharedUrls do
def for_posting(posting) do
# TODO: follow redirects
collect_and_expand_urls(posting.text)
end
def collect_and_expand_urls(text) do
text = Earmark.to_html(text)
~r/href=\"([^\"]+?)\"/
|> Regex.scan(text)
|> Enum.flat_map(fn([_, url]) ->
... | Add failing urls to SharedUrls for posting | Add failing urls to SharedUrls for posting
| Elixir | mit | rrrene/elixirstatus-web,rrrene/elixirstatus-web |
7919b3100fefea81f1fbb1fbc741acda74bad535 | lib/tesla/middleware/path_params.ex | lib/tesla/middleware/path_params.ex | defmodule Tesla.Middleware.PathParams do
@moduledoc """
Use templated URLs with separate params.
Useful when logging or reporting metric per URL.
## Example usage
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.BaseURl, "https://api.example.com"
plug Tesla.Middleware.Logger # or so... | defmodule Tesla.Middleware.PathParams do
@moduledoc """
Use templated URLs with separate params.
Useful when logging or reporting metric per URL.
## Example usage
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.BaseURl, "https://api.example.com"
plug Tesla.Middleware.Logger # or so... | Improve fix of regular expression in PathParams middleware | Improve fix of regular expression in PathParams middleware
| Elixir | mit | monterail/tesla,teamon/tesla |
97283994d193d7f87d373663132048b269065b47 | api/lib/worker/enricher/relations.ex | api/lib/worker/enricher/relations.ex | defmodule Enricher.Relations do
require Logger
@result_document_properties [:shortDescription, :id, :type, :category, :identifier]
def expand(change = %{ doc: %{ resource: %{ relations: relations }}}, get_for_id) do
put_in(change.doc.resource.relations, Enum.map(relations, &(expand_relation(&1, get_for_id))... | defmodule Enricher.Relations do
require Logger
@result_document_properties [:shortDescription, :id, :type, :category, :identifier]
def expand(change = %{ doc: %{ resource: %{ relations: relations }}}, get_for_id) do
put_in(change.doc.resource.relations, Enum.map(relations, &(expand_relation(&1, get_for_id))... | Change structure of deleted objects a bit | Change structure of deleted objects a bit
| Elixir | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web |
3a492902b58ba9a2e761db4f2d7759eeae8182be | priv/template/mix.exs | priv/template/mix.exs | defmodule <%= application_module %>.Mixfile do
use Mix.Project
def project do
[app: :<%= application_name %>,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: ["lib", "web"],
compilers: [:phoenix] ++ Mix.compilers,
deps: deps]
end
# Configuration for the OTP application
#
# ... | defmodule <%= application_module %>.Mixfile do
use Mix.Project
def project do
[app: :<%= application_name %>,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: ["lib", "web"],
compilers: [:phoenix] ++ Mix.compilers,
deps: deps]
end
# Configuration for the OTP application
#
# ... | Use cm-brunch branch for now for phoenix dep | Use cm-brunch branch for now for phoenix dep
| Elixir | mit | GabrielNicolasAvellaneda/phoenix,CD1212/phoenix,yoavlt/phoenix,thegrubbsian/phoenix,rafbgarcia/phoenix,ahmetabdi/phoenix,kevinold/phoenix,iguberman/phoenix,arthurcolle/phoenix,dmarkow/phoenix,begleynk/phoenix,CultivateHQ/phoenix,jxs/phoenix,nicrioux/phoenix,mvidaurre/phoenix,ericmj/phoenix,michalmuskala/phoenix,nshafer... |
a488d64993791c7411eba6d2f281a20f27a656e3 | assignments/elixir/word-count/word_count_test.exs | assignments/elixir/word-count/word_count_test.exs | Code.load_file("word-count.exs")
ExUnit.start
defmodule WordsTest do
use ExUnit.Case
test "count one word" do
assert Words.count("word") == HashDict.new [{ "word", 1 }]
end
test "count one of each" do
expected = HashDict.new [{ "one", 1 }, { "of", 1 }, { "each", 1 }]
assert Words.count("one of ea... | Code.load_file("word_count.exs")
ExUnit.start
defmodule WordsTest do
use ExUnit.Case
test "count one word" do
assert Words.count("word") == HashDict.new [{ "word", 1 }]
end
test "count one of each" do
expected = HashDict.new [{ "one", 1 }, { "of", 1 }, { "each", 1 }]
assert Words.count("one of ea... | Use underscore to require file in elixir/word-count | Use underscore to require file in elixir/word-count
| Elixir | agpl-3.0 | IanDCarroll/exercism.io,nathanbwright/exercism.io,beni55/exercism.io,hanumakanthvvn/exercism.io,mhelmetag/exercism.io,Tonkpils/exercism.io,RaptorRCX/exercism.io,exercistas/exercism.io,k4rtik/exercism.io,bmulvihill/exercism.io,emilyforst/exercism.io,Tonkpils/exercism.io,mscoutermarsh/exercism_coveralls,treiff/exercism.i... |
1912556b6a4c580bef6931b28eee8222ed631cf3 | apps/baumeister_web/lib/baumeister_web/project_bridge.ex | apps/baumeister_web/lib/baumeister_web/project_bridge.ex | defmodule BaumeisterWeb.ProjectBridge do
@moduledoc """
The ProjectBridge connects the `BaumeisterWeb.Project` model with the
project management from `:baumeister_core`. In particular, it translates
between the project's plugins and the settable metadata from the Web UI.
"""
alias Baumeister.Observer.DelayP... | Connect the Web database with the Baumeister Coordinator | Connect the Web database with the Baumeister Coordinator
| Elixir | apache-2.0 | alfert/baumeister,alfert/baumeister,alfert/baumeister | |
29545f5652df8ac85dddcdbb2a2508dd04afe94a | priv/repo/migrations/20171028011642_update_null_task_values_from_github_integration.exs | priv/repo/migrations/20171028011642_update_null_task_values_from_github_integration.exs | defmodule CodeCorps.Repo.Migrations.UpdateNullTaskValuesFromGithubIntegration do
use Ecto.Migration
@consecutive_whitespace_regex ~r/\s+/
def up do
execute created_at_update()
execute created_from_update()
execute modified_at_update()
execute modified_from_update()
end
def down do
# no... | Update existing task timestamps/*_from values | Update existing task timestamps/*_from values
| Elixir | mit | code-corps/code-corps-api,code-corps/code-corps-api | |
d6607e72f8519f5438d8b1e659797369e5fe1516 | test/phoenix/transports/long_poll_serializer_test.exs | test/phoenix/transports/long_poll_serializer_test.exs | defmodule Phoenix.Tranports.LongPollSerializerTest do
use ExUnit.Case, async: true
alias Phoenix.Transports.LongPollSerializer
alias Phoenix.Socket.Message
alias Phoenix.Socket.Broadcast
alias Phoenix.Socket.Reply
@msg_json [123, [[34, ["topic"], 34], 58, [34, ["t"], 34], 44, [34, ["ref"], 34], 58, "null"... | Add test for long poll serializer | Add test for long poll serializer
(cherry picked from commit 86d52ec918ebad546f746e30db7745c3c06f0361)
| Elixir | mit | keathley/phoenix,optikfluffel/phoenix,ericmj/phoenix,iStefo/phoenix,mschae/phoenix,optikfluffel/phoenix,eksperimental/phoenix,iStefo/phoenix,evax/phoenix,wsmoak/phoenix,CultivateHQ/phoenix,0x00evil/phoenix,jwarwick/phoenix,korobkov/phoenix,0x00evil/phoenix,rafbgarcia/phoenix,pap/phoenix,pap/phoenix,gjaldon/phoenix,nsha... | |
7a72a21ad6d82d1a40f4b6b8b35e64419e36df98 | priv/repo/migrations/20161108170722_change_users_all_null_email.exs | priv/repo/migrations/20161108170722_change_users_all_null_email.exs | defmodule EspiDni.Repo.Migrations.ChangeUsersAllNullEmail do
use Ecto.Migration
def change do
alter table(:users) do
modify :email, :string, null: true
end
end
end
| Remove not null restriction on user email | Remove not null restriction on user email
| Elixir | mit | edenspiekermann/espi-dni,edenspiekermann/espi-dni | |
a35d666da9ca70203586a827d81df42ddfb3fff0 | test/jumubase_web/controllers/performance_controller_test.exs | test/jumubase_web/controllers/performance_controller_test.exs | defmodule JumubaseWeb.PerformanceControllerTest do
use JumubaseWeb.ConnCase
alias Jumubase.Repo
alias Jumubase.Showtime.Performance
test "shows the registration form", %{conn: conn} do
%{id: id} = insert(:contest)
conn = get(conn, "/contests/#{id}/performances/new")
assert html_response(conn, 200) ... | Add basic tests for registration form | Add basic tests for registration form
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix | |
a9a8a01f6fb968325c35c8ed75901eede3e3f5a7 | priv/repo/migrations/20200111204328_add_groups_accompanists_flag_to_contest_categories.exs | priv/repo/migrations/20200111204328_add_groups_accompanists_flag_to_contest_categories.exs | defmodule Jumubase.Repo.Migrations.AddGroupsAccompanistsFlagToContestCategories do
use Ecto.Migration
def change do
alter table(:contest_categories) do
add :groups_accompanists, :boolean, null: false, default: false
end
end
end
| Add "groups accompanists" flag to ContestCategory | Add "groups accompanists" flag to ContestCategory
| Elixir | mit | richeterre/jumubase-phoenix,richeterre/jumubase-phoenix | |
8778fc39e2948926540958bb8d5537cf4b43fd7f | priv/repo/migrations/20170615182008_add_unique_index_to_invites.exs | priv/repo/migrations/20170615182008_add_unique_index_to_invites.exs | defmodule Api.Repo.Migrations.AddUniqueIndexToInvites do
use Ecto.Migration
def change do
create unique_index(:invites, [:team_id, :invitee_id])
end
end
| Add unique index to invites table | Add unique index to invites table
| Elixir | mit | portosummerofcode/psc-api |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.