content_id
large_stringlengths
40
40
size_bytes
int64
1.5k
25k
repo_ids
large listlengths
1
410
tags
large listlengths
0
7
content
large_stringlengths
681
25k
0bc07b7c90bb4a90809900b7d390dacd5b8bf88b
2,412
[ 1019355063 ]
[]
defmodule Inherit.MixProject do use Mix.Project @source_url "https://github.com/dockyard/inherit" @version "0.1.0" def project do [ app: :inherit, version: @version, elixir: "~> 1.18", start_permanent: Mix.env() == :prod, package: package(), elixirc_paths: elixirc_paths...
0bc0b568781c1f2921d89f2b19c618f915b4be59
21,345
[ 436940871 ]
[]
# 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: # # Mehungry.Repo.insert!(%Mehungry.SomeSchema{}) # require Logger {:ok, language_gr} = Mehungry.Repo.insert(%Mehungry.Languages.Languag...
0bc0d406b9f68f756d99a549f98d229727f70e88
8,043
[ 289263866 ]
[ "test", "documented" ]
defmodule OMG.BlockTest do @moduledoc """ Simple unit test of part of `OMG.Block`. """ use ExUnitFixtures use ExUnit.Case, async: true alias OMG.Block alias OMG.TestHelper defp eth(), do: OMG.Eth.zero_address() describe "hashed_txs_at/2" do @tag fixtures: [:stable_alice, :stable_bob] test ...
0bc0da3f0739c409d2da0149f001c74971665949
1,715
[ 42599158 ]
[ "genserver", "typespec" ]
defmodule MyBotEx.Client.Github do use GenServer alias Tentacat, as: TC alias MyBotEx.Client.Github.PullRequest @token Application.get_env :my_bot_ex, :token @endpoint Application.get_env :my_bot_ex, :endpoint @type auth :: %{access_token: binary} @type t :: %Tentacat.Client{auth: auth, endpoint: binar...
0bc0ead5afd59dd3487c4adc05598905bde1a123
5,149
[ 323545428 ]
[ "test" ]
defmodule InteractionsControllerTest.Claim.Approve do use VirtualCryptoWeb.InteractionsCase, async: true import Enum, only: [at: 2] use InteractionsControllerTest.Claim.Helper alias VirtualCrypto.Exterior.User.Discord, as: DiscordUser setup :setup_claim test "approve pending claim by payer", %{ conn: c...
0bc113ed3856e880188fd1ceddd07da1f8603306
5,846
[ 454489180 ]
[ "genserver", "liveview" ]
defmodule BoatVisualizerWeb.MapLive do use Phoenix.LiveView alias Phoenix.PubSub alias BoatVisualizer.Animation alias BoatVisualizer.Coordinates require Logger def mount(_params, _session, socket) do if connected?(socket), do: PubSub.subscribe(BoatVisualizer.PubSub, "leaflet") [initial_coordinate...
0bc24eb08354707cb60258755f3e2175d28c1c66
10,630
[ 135299115 ]
[ "typespec", "documented" ]
defmodule Raytracer.Geometry.Matrix4x4 do @moduledoc """ This module provides a set of functions for working with 4x4 matrices. The matrix elements for the defined struct are stored in row-major order. """ alias __MODULE__ defstruct elements: { 0.0, 0.0, 0.0, ...
0bc265331844c7049d4b3f0663fe2e011a8ab7ff
3,333
[ 533537020, 180672647, 294427908, 121001913 ]
[ "typespec", "documented", "ecto" ]
defmodule Snitch.Data.Model.StockItem do @moduledoc """ This module provides methods or utils for Stock Item (alias Inventory at a location) by interacting with DB. """ use Snitch.Data.Model alias Snitch.Data.Schema.StockItem, as: StockItemSchema alias Snitch.Data.Schema.StockLocation, as: StockLocatio...
0bc280a938d2b006620b476d474dfe38791d8f39
2,993
[ 439465711 ]
[ "typespec", "phoenix", "ecto", "documented" ]
defmodule StrdWeb.LinkController do use StrdWeb, :controller import Ecto.Query, warn: false import Ecto.Changeset alias __MODULE__.UserInput alias Strd.Links def index(conn, _params) do render(conn, "index.html", changeset: UserInput.changeset()) end def mylinks_index(conn, _params) do %{assi...
0bc28a82083cd16f9f0f15f589b5235e685b051d
1,779
[ 270023324 ]
[ "typespec", "macro" ]
defmodule Teitoku.Command.Registry do alias Teitoku.Token alias Teitoku.Command.Parser @spec resolve_command(module(), String.t()) :: {:ok, module(), String.t(), list(module)} | {:error, any()} def resolve_command(registry, text) do resolve_inner(registry, text, []) |> case do {^registr...
0bc2c733d413ae70403f66f0eb3d04e6fbb52543
1,860
[ 76085208 ]
[ "typespec" ]
defmodule Noizu.SimplePool.MonitoringFramework.MonitorBehaviour do @type job_handle :: pid | function | mfa | {:ref, module, any} @type job_status :: {:error, details :: any} | {:completed, integer} | {:started, integer} | {:queued, integer} @type job_response :: {:ok, job_handle} | {:error, details :: any} @ty...
0bc3cb1308bae23a86b9dd2c5154e679d37aa2bf
2,715
[ 98602422 ]
[ "test", "supervisor" ]
defmodule Tai.Venues.Start.SuccessTest do use Tai.TestSupport.DataCase, async: false import Tai.TestSupport.Assertions.Event defmodule TestVenueAdapter do use Support.StartVenueAdapter @product_a struct( Tai.Venues.Product, venue_id: :venue_a, symbol: :...
0bc53b1cec01c6ebb6fe10ada1e74412750a212a
3,984
[ 138809123 ]
[ "phoenix", "documented" ]
defmodule Web.FormView do use Web, :view @doc """ Label helper to optionally override the label text """ def field_label(form, field, opts) do case Keyword.get(opts, :label) do nil -> label(form, field, class: "col-md-3") text -> label(form, field, text, class: "col-md-3") ...
0bc55d451406b1968e6dc815fd402dc3f8571aea
5,397
[ 158033799 ]
[]
num_requests = 10_000 {:ok, pool_1_50} = Cables.new("https://localhost:4001", :http2_1_50) {:ok, pool_50_1} = Cables.new("https://localhost:4001", :http2_50_1) {:ok, pool_5_10} = Cables.new("https://localhost:4001", :http2_5_10) {:ok, pool_10_5} = Cables.new("https://localhost:4001", :http2_10_5) {:ok, pool_2_25} = Ca...
0bc58c0f8b381fac7b7f27d5c86e09d2dcefcba1
2,489
[ 457942243 ]
[ "test", "ecto" ]
defmodule FlameOn.Component.CaptureSchemaTest do use ExUnit.Case alias FlameOn.Component.CaptureSchema alias Ecto.Changeset setup do Code.ensure_loaded!(FlameOnTest.ExampleModule) :ok end describe "Elixir module" do @valid_attrs %{ module: "FlameOnTest.ExampleModule", function: "f...
0bc60895eefef301f5a5c26431da7eb77ac89811
6,198
[ 62457363 ]
[ "documented" ]
defmodule Mayo.String do # http://stackoverflow.com/a/13653180 @uuid_pattern ~r/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/ # https://github.com/hapijs/joi/blob/v8.4.2/lib/string.js#L375 @hex_pattern ~r/^[a-f0-9]+$/i # https://github.com/hapijs/joi/blob/v8.4.2/lib/string.js#L1...
0bc6970171a032663e1b39d0af51b068517d914b
10,004
[ 766744301 ]
[ "macro", "documented" ]
defmodule Qol.Drops.Contract do @moduledoc """ Drops.Contract can be used to extend your module with data validation capabilities. """ @moduledoc since: "0.1.0" alias Drops.Types alias Drops.Validator.Messages @doc ~S""" Validates the given `data` against the schema defined in the module. Returns `...
0bc6aadfa712954893b38df2314e3aa7e62a9a1b
6,586
[ 856381637 ]
[ "test", "ecto" ]
defmodule RestaurantAppPlatform.OrdersTest do use RestaurantAppPlatform.DataCase alias RestaurantAppPlatform.Orders describe "orders" do alias RestaurantAppPlatform.Orders.Order import RestaurantAppPlatform.OrdersFixtures @invalid_attrs %{ordered_at: nil, payed_at: nil, total_amount: nil} tes...
0bc6b32ed27ed8ca5c6b7ca20d5f33d90c8ca6d3
16,775
[ 498675807 ]
[ "documented", "ecto" ]
defmodule AppCount.Leasing.Utils.RenewalPeriods do import Ecto.Query import AppCount.EctoExtensions alias AppCount.Repo alias AppCount.Admins alias AppCount.Properties alias AppCount.Tenants alias AppCount.Leasing.RenewalPeriod alias AppCount.Leasing.RenewalPackage alias AppCount.Leasing.CustomPackage...
0bc72fc48f07aa6277ec55dd4f424a5a05a8b4e2
16,737
[ 728762449 ]
[]
defmodule GruppieWeb.Repo.TeamSettingsRepo do import GruppieWeb.Repo.RepoHelper alias GruppieWeb.Repo.TeamRepo import GruppieWeb.Handler.TimeNow @conn :mongo @group_team_members_col "group_team_members" @team_col "teams" @groups_coll "groups" def allowTeamPostAll(groupObjectId, teamObjectId, login...
0bc8380d69d9ea7b65b84411d01fb04f39f2a8ee
2,143
[ 143549748 ]
[ "genserver" ]
defmodule BackendWeb.RoomChannel do use BackendWeb, :channel alias BackendWeb.Presence alias BackendWeb.{UserView, MessageView, PaginationView} alias Backend.Discussions def join("room:" <> category_id, _payload, socket) do page = Discussions.list_category_messages(category_id) response = %{ mess...
0bc8725abc5d1975aca7c10a019f4ec220fc415d
5,338
[ 480482813 ]
[ "test" ]
defmodule Test.PrismEx.IntegrationTest do use ExUnit.Case, async: false alias PrismEx.Util alias PrismEx.Option setup_all do opts = Application.get_all_env(:prism_ex) |> Option.validate!() {:ok, _pid} = PrismEx.start_link(opts) :ok end describe "prism locking with process exit c...
0bc8a6827dcf3579d7b014ad2570a8ecadff6561
2,028
[ 726666681 ]
[ "documented", "ecto" ]
defmodule Matrix do alias __MODULE__ defstruct [ :data, :w, :h, ] @doc """ Create a new matrix with given dimensions. """ def make(width, height, default \\ nil) do from( for _ <- 1..height do for _ <- 1..width do default end end ) end def from(list) w...
0bc8f5087081cfd743615ab4a4cfdb6016c8bd10
6,880
[ 535043177 ]
[]
%{ "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2f...
0bc95013b98b216707033420b3f4f6fd3b921011
1,837
[ 172985378 ]
[]
# Import all plugins from `rel/plugins` # They can then be used by adding `plugin MyPlugin` to # either an environment, or release definition, where # `MyPlugin` is the name of the plugin module. ~w(rel plugins *.exs) |> Path.join() |> Path.wildcard() |> Enum.map(&Code.eval_file(&1)) use Distillery.Releases.Config, ...
0bc9a21248d59f4c8f727bea88ea77056696b260
1,875
[ 576977600 ]
[ "test" ]
defmodule SuperPoker.IrcDataset.IrcTableTest do use SuperPoker.DataCase alias SuperPoker.Repo alias SuperPoker.IrcDataset.Table alias SuperPoker.IrcDataset.IrcTable describe "写入" do test "将hdb文件内容写入PostgreSQL数据库" do table = %Table{ game_id: 5001, blind: 10, pot_after_preflo...
0bc9a84e0d903c245f46f780dc0af56d17300676
2,095
[ 63124020 ]
[ "genserver" ]
defmodule HansAndFranz.SlackServer do use GenServer require Logger ## public api def start_link do GenServer.start_link(__MODULE__, self, name: __MODULE__) end def schedule_next_exercise(channel_id, milliseconds) do Logger.debug("slack_server schedule_next_exercise #{inspect channel_id} : #{inspe...
0bc9b6af21829fe2b33462735e7840be031effa4
6,395
[ 225182698 ]
[]
defmodule Advent.Y2020.Day20.Part2 do alias Advent.Y2020.Day20.Part1 @max_xy 11 @monster_regexes [ ~r/(?=(..................#.))/, ~r/(?=(#....##....##....###))/, ~r/(?=(.#..#..#..#..#..#...))/ ] @monster_size 15 def run(puzzle) do sorted_tiles = puzzle |> Part1.parse_puzzle() |> Part1.til...
0bc9e166a3cc4f3f1f39024d5e2126669c3d3e4e
7,192
[ 775906384 ]
[ "typespec", "macro", "documented" ]
defmodule ExSepa.PaymentInformation do alias ExSepa.Validation @moduledoc false # """ # Payment Information: Set of characteristics that apply to the credit side of the payment transactions included in the direct debit transaction initiation. # """ @type sequence_type3_code_atom :: :OneOff | :First | :Rec...
0bca15e787a17ca12f338de34c444676dac3187a
1,655
[ 433959528 ]
[]
defmodule AdventOfCode.Solution.Year2023.Day04 do import Bitwise def part1(input) do input |> parse_input |> Enum.map(fn [have, winning] -> have &&& winning end) |> Enum.map(&bitcount(&1)) |> Enum.map(&calc_card_score(&1)) |> Enum.sum end def part2(input) do input |> parse_inpu...
0bca4bf8e1940a395464b2099a102c15c6a1edc0
2,527
[ 163432407 ]
[ "liveview" ]
defmodule CoffeeFsm do @behaviour :gen_statem use Hw @name :coffee_fsm def start do :gen_statem.start({:local, @name}, __MODULE__, [], []) end def stop do :gen_statem.stop(@name) end def init([]) do Hw.reboot Hw.display "Make Your Selection", [] {:ok, :selection, []} end def ...
0bcaea81be85e073991aefc4ea668e4c6dad4922
5,776
[ 236577113, 244483266 ]
[]
%{ # # You can have as many configs as you like in the `configs:` field. configs: [ %{ # # Run any exec using `mix credo -C <name>`. If no exec name is given # "default" is used. # name: "default", # # These are the files included in the analysis: files: %{ ...
0bcb64d3c7d866aeacaf698468ff6aa0f604b657
3,768
[ 512116215 ]
[ "documented" ]
defmodule Game do @moduledoc """ Excercise: Note: 1. Use only Conditional Flows to control the game 2. To ask and receive inputs to and from the terminal, research on the IO module in Elixir Documentation 3. To generate random thing, explore the Enum module 5. To process input entered by user, e...
0bcb7d03f3beaa1aa8412a36a09fafe158f4f4a4
2,672
[ 198546741, 184531181, 190730445, 230659468, 189624457, 191000630, 184910444, 349082708, 184338071, 294468145, 192243128, 183450017 ]
[ "macro", "documented" ]
defmodule Postgrex.Extensions.HStore do @moduledoc false import Postgrex.BinaryUtils, warn: false use Postgrex.BinaryExtension, type: "hstore" def init(opts), do: Keyword.fetch!(opts, :decode_binary) def encode(_) do quote location: :keep do %{} = map -> data = unquote(__MODULE__).encode_h...
0bcc406dbebf10e8393fb06dd0f687cfc3d231bf
2,059
[ 758170972 ]
[ "test", "ecto" ]
defmodule Beans.AccountsTest do use Beans.DataCase alias Beans.Accounts describe "accounts" do alias Beans.Accounts.Account import Beans.AccountsFixtures @invalid_attrs %{name: nil, balance: nil} test "list_accounts/0 returns all accounts" do account = account_fixture() assert Acc...
0bcc7f89375901ea0ea52617f70d81a8bb9d97d1
2,199
[ 950857277 ]
[ "phoenix" ]
defmodule RealDealApiWeb.AccountController do use RealDealApiWeb, :controller alias RealDealApiWeb.{Auth.Guardian, Auth.ErrorResponse} alias RealDealApi.{Accounts, Accounts.Account, Users, Users.User} plug :is_authorized_account when action in [:update, :delete] action_fallback RealDealApiWeb.FallbackContr...
0bcd02450464b0748c77015362f24e5431f57049
3,208
[ 719422627, 151107094 ]
[ "test" ]
defmodule H2Integration.TokenBasedAuthorisationTest do use ExUnit.Case import Mox setup :set_mox_global setup :verify_on_exit! alias H2Integration.Helpers.TokenHelper alias Helpers.SetupHelper, as: Setup alias Sparrow.H2Worker.Request, as: OuterRequest @path "/AuthenticateHandler" @pool_name :wname ...
0bcd7503f8f31c7abee70bcfbeb5e3516cb90251
3,878
[ 759246320 ]
[ "test", "ecto" ]
defmodule Phos.MessageTest do use Phos.DataCase alias Phos.Message describe "memories" do alias Phos.Message.Memory import Phos.MessageFixtures @invalid_attrs %{media: nil, message: nil} test "list_memories/0 returns all memories" do memory = memory_fixture() assert Message.list_m...
0bcda62d0301d4917954fda441f7699b93f5c5c1
2,115
[ 714386071 ]
[ "typespec", "documented" ]
defmodule AllYourBase do @doc """ Given a number in input base, represented as a sequence of digits, converts it to output base, or returns an error tuple if either of the bases are less than 2 """ @spec convert(list, integer, integer) :: {:ok, list} | {:error, String.t()} def convert(_digits, input_base, ...
0bcda8024328026f49fbdc7967ba1c00a460a52e
2,192
[ 219851918 ]
[ "test", "ecto" ]
defmodule Time2.ManagersTest do use Time2.DataCase alias Time2.Managers describe "managers" do alias Time2.Managers.Manager @valid_attrs %{email: "some email", name: "some name"} @update_attrs %{email: "some updated email", name: "some updated name"} @invalid_attrs %{email: nil, name: nil} ...
0bce0a3d48c9b9b5ed74873dbbb9364a46f9a80f
2,562
[ 289239889 ]
[ "documented" ]
defmodule GraphConn.Mock do def get_capabilities do Application.get_env(:graph_conn, :mock, [])[:capabilities] || %{} end def put_capabilities(new_capabilities) when is_binary(new_capabilities) do capabilities = Map.merge(get_capabilities(), convert_capabilities_from_json(new_capabilities)) mock = ...
0bce64fb1f051dd2a0fc821afd5e6bd36477d93d
1,957
[ 175193877 ]
[ "ecto" ]
defmodule GuessTheLanguage.Game.YoutubeVideo do use Ecto.Schema import Ecto.Changeset alias GuessTheLanguage.{Game, Repo} alias GuessTheLanguage.Game.{Video, YoutubeChannel, YoutubeVideo} @derive {Jason.Encoder, only: [:youtube_uuid, :title, :description, :published_at]} schema "youtube_video" do fi...
0bce714f77d2c508f50e508c1b4a0b45c67ad5c1
1,598
[ 352510691 ]
[ "liveview", "phoenix" ]
defmodule PhoenixGlimmerWeb.Endpoint do use Phoenix.Endpoint, otp_app: :phoenix_glimmer # The session will be stored in the cookie and signed, # this means its contents can be read but not tampered with. # Set :encryption_salt if you would also like to encrypt it. @session_options [ store: :cookie, k...
0bcef3a60da066752b3a2090e10e90b320819dd8
1,728
[ 99598346 ]
[ "documented" ]
import Input alias Decimal, as: D defmodule CompoundInterest do @moduledoc """ Write a program to compute the value of an investment compounded over time. The program should ask for the starting amount, the number of years to invest, the interest rate, and the number of periods per year to compound. The fo...
0bcf1e7e73663f1e7433f938ba0f3f13fff9916e
13,814
[ 994404603 ]
[ "test", "documented" ]
defmodule WandererKills.Integration.CacheSystemFunctionsTest do @moduledoc """ Integration tests for Cache.system_* functions. Tests the coordination between system tracking, killmail caching, fetch timestamps, and active system management to ensure all components work together correctly. """ use ExUnit...
0bcf2a99c041de9fb9cebd986a5911bd4c6ae365
1,658
[ 704927098 ]
[ "documented" ]
defmodule WechatPayDemo do @moduledoc """ WechatPayDemo keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others. """ alias WeChat.Pay.Transactions @client WechatPayDemo.PayC...
0bcfd2e814240b3dc5142e4bf085dd72d0dccf72
3,154
[ 913995146, 915448704, 934044764, 962529983, 1017248001, 1019465249, 939645202, 1010134902, 924963573, 1018026088, 936927438, 973282597, 994710780, 1008064659, 1011149314, 1013128869, 983213709, 981784524, 982459127, 1011444481, 981152162, 148402802, 993081259, 922960360...
[ "liveview", "documented" ]
defmodule Phoenix.LiveView.UploadWriter do @moduledoc ~S""" Provide a behavior for writing uploaded chunks to a final destination. By default, uploads are written to a temporary file on the server and consumed by the LiveView by reading the temporary file or copying it to durable location. Some usecases requ...
0bd0603fb1c445a96b0abcbd5b0bd09742c75fbe
4,565
[ 904399333 ]
[ "test", "documented" ]
# credo:disable-for-this-file Credo.Check.Readability.LargeNumbers # credo:disable-for-this-file Credo.Check.Readability.StringSigils defmodule JSV.Generated.Draft202012.BinaryKeys.MaxContainsTest do alias JSV.Test.JsonSchemaSuite use ExUnit.Case, async: true @moduledoc """ Test generated from deps/json_schem...
0bd108336de24f5f65bb6f024ae2b9c8ecba2e81
8,763
[ 121471220 ]
[ "test" ]
defmodule RepeaterTest do use ExUnit.Case alias Goals.Repeater, as: Repeater @card_other %{ "name" => "other task" } @card_parsed_other %{ "card" => @card_other, "date" => nil } @card_old_daily_goal %{ "name" => "Daily Goals - January 29, 2018" } @card_current_daily_goal %{ "name"...
0bd14abce4257f44f2ecae04996ad45bd1f775c7
4,530
[ 828561447 ]
[ "typespec" ]
defmodule MyOwnRedis.Manager do alias MyOwnRedis.Models.{ Table, RelationalTable, RelationalTableRef } alias MyOwnRedis.MemoryManagerUtils @spec create_table(list(%Table{} | %RelationalTable{}), String.t, list(String.t) | %RelationalTableRef{}) :: list(%Table{} | %RelationalTable{}) def create_table(state, nam...
0bd24b161833a9f093204f9dfd1d775f0ac338b6
2,282
[ 830200371 ]
[ "genserver", "typespec", "supervisor", "documented" ]
defmodule Senzing.G2.ConfigUpdater do @moduledoc """ Worker to update config from file. Can be added to your supervision tree. ## Example ```elixir Supervisor.start_link([ {Senzing.G2.ConfigUpdater, [config_path: "path/to/g2config.json"]} ]) ``` """ use GenServer alias Senzing.G2.ConfigManag...
0bd256189ce6215ea7bf68fe09417abf02921b46
1,582
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudDebugger.V2.Model.ListActiveBreakpointsResponse do @moduledoc """ Response for listing active breakpoints. ## Attributes * `breakpoints` (*type:* `list(GoogleApi.CloudDebugger.V2.Model.Breakpoint.t)`, *default:* `nil`) - List of all active breakpoints. The fields `id` and `location`...
0bd333623b02a4c6448a9679b15bdf1b16b5482c
2,724
[ 408218722 ]
[ "test" ]
defmodule ZaisteWeb.TransactionItemControllerTest do use ZaisteWeb.ConnCase @create_attrs %{ amount: "120.5", name: "some name" } @invalid_attrs %{amount: nil, name: nil} setup %{conn: conn} do user = insert(:user) transaction = insert(:transaction, user_id: user.id) conn = conn ...
0bd43d3811bec01d170c0834f5478e6ec1999f6e
1,617
[ 76579942 ]
[ "phoenix" ]
defmodule Server.ContractController do use Server.Web, :controller alias Server.Contract def index(conn, _params) do contracts = Repo.all(Contract) render(conn, "index.json", contracts: contracts) end def create(conn, %{"contract" => contract_params}) do changeset = Contract.changeset(%Contract...
0bd47ed7c9671dc78c9cd6833782f6486fdf0e04
1,884
[ 896305225 ]
[ "macro", "documented" ]
defmodule ExTalib.Macros do @moduledoc false # MODULES AVAILABLE? @explorer_available Code.ensure_loaded?(Explorer.DataFrame) and Code.ensure_loaded?(Explorer.Series) @nx_available Code.ensure_loaded?(Nx) @decimal_available Code.ensure_loaded?(Decimal) @vegalite_available Code.ensure_loaded?(VegaLite) de...
0bd5f9469bdcf5f47212737c76a3201633db25a6
7,553
[ 1020226413 ]
[]
defmodule SqlclWrapper.Router do use Plug.Router require Logger plug Plug.Parsers, parsers: [:json], pass: ["application/json", "text/plain"], json_decoder: Jason plug Plug.Logger, log: :info plug :match plug :dispatch post "/tool" do Logger.info("[#{DateTime.utc_now()}] R...
0bd60d3ee179a3faf3fd0a96581b5c36cb08492f
7,446
[ 559744925, 610034669, 599689212, 670103538, 681629586, 704658418, 713860590, 578540600, 712071186, 566619089, 645931572, 687446493, 837319868, 603517341, 688332642, 694781452, 709785915, 718072585, 616640391, 653792222, 710549260, 869143224, 609637217, 613567989, 6481...
[ "test", "ecto" ]
Code.require_file "../support/file_helpers.exs", __DIR__ defmodule Ecto.Integration.MigratorTest do use Ecto.Integration.Case import Support.FileHelpers import ExUnit.CaptureLog import Ecto.Migrator alias Ecto.Integration.{TestRepo, PoolRepo} alias Ecto.Migration.SchemaMigration setup config do Pr...
0bd64188f374ed6aaf70f298ef03bb4ae9de57d3
23,622
[ 196200304 ]
[ "test" ]
Code.require_file("../test_helper.exs", __DIR__) defmodule Mix.ReleaseTest do use MixTest.Case import Mix.Release doctest Mix.Release _ = Application.ensure_started(:eex) _ = Application.ensure_started(:runtime_tools) @erts_version :erlang.system_info(:version) @erts_source Path.join(:code.root_dir(),...
0bd702fa8e4c08abfa5b8a391c65eeb9546d9957
4,807
[ 235827005 ]
[ "test" ]
defmodule Graph.NestingGraphTest do use GraphCase use TreeCase alias Graph.ClusteredLevelGraph alias Graph.NestingGraph describe "Graph.NestingGraph" do @tag vertices: [:a, :b, :c, :d, 1, 2, 3, 4] @tag tree: [a: [b: [1, 2], c: [d: [3, 4]]]] @tag edges: [{1, 2}, {:b, 1}, {:c, 1}, {3, :c}, {4, :b}...
0bd87f058ae99093d21fa00c180df178e22c2957
2,978
[ 85833787 ]
[ "genserver", "macro", "documented" ]
defmodule Advanced do defmodule Example do def timed(fun, args) do {time, result} = :timer.tc(fun, args) IO.puts "Time: #{time}ms" IO.puts "Result: #{result}" end # Concurrency - Processes def add(a, b) do IO.puts(a + b) end # Concurrency - Message Passing def lis...
0bd8976967a60a61cdc824bd826b599dff9445eb
8,267
[ 185558207, 213229236, 1000104078, 982054619, 882572863, 217320195, 174991383, 540729553, 771023416 ]
[ "documented" ]
defmodule Pleroma.Web.ActivityPub.MRF.EmojiPolicy do require Pleroma.Constants alias Pleroma.Object.Updater alias Pleroma.Web.ActivityPub.MRF.Utils @moduledoc "Reject or force-unlisted emojis with certain URLs or names" @behaviour Pleroma.Web.ActivityPub.MRF.Policy defp config_remove_url do Pleroma....
0bd8ef7cb56bd90f108e0adbf9b0f3611db26f1c
21,504
[ 305961260 ]
[ "typespec", "documented" ]
defmodule AcqdatCore.Widgets.Schema.Vendors.HighCharts do alias AcqdatCore.Model.EntityManagement.SensorData @moduledoc """ Embedded Schema of the settings of the widget with it keys and subkeys """ @data_types ~w(string color object list integer boolean)a defstruct chart: %{ data_type: :o...
0bd90463f1aaa1b27a9150805b14da9ee1c7d0fe
1,644
[ 126800827 ]
[ "test" ]
defmodule Hoplon.CLI.ToolsTest do use ExUnit.Case alias Hoplon.CLI.Tools import Support.Utils describe "bootstrap_hoplon_env/2" do test "will create an empty environment in a deeply nested non-existing directory" do path = "/tmp/#{random_string()}/#{random_string()}/" env_name = random_string(6...
0bd927a32031b04a258dd825777bec056607f103
1,561
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DisplayVideo.V1.Model.BulkListLineItemAssignedTargetingOptionsResponse do @moduledoc """ ## Attributes * `assignedTargetingOptions` (*type:* `list(GoogleApi.DisplayVideo.V1.Model.AssignedTargetingOption.t)`, *default:* `nil`) - The list of assigned targeting options. This list will be abs...
0bd9a2b085cd87be253fe5ac0d8dfa70f1bb11c2
1,979
[ 363419449, 123528600 ]
[ "documented" ]
defmodule OMG.WatcherRPC.ReleaseTasks.SetTracer do @moduledoc false @behaviour Config.Provider alias OMG.WatcherRPC.Tracer require Logger @app :omg_watcher_rpc def init(args) do args end def load(config, args) do _ = on_load() adapter = Keyword.get(args, :system_adapter, System) _ = P...
0bd9a54fbcf8a791c6b8f0470138965b1142c369
2,302
[ 111415024 ]
[ "documented" ]
defmodule GroupherServer.CMS.Delegate.PassportCURD do @moduledoc """ passport curd """ import Helper.Utils, only: [done: 1, deep_merge: 2] import Ecto.Query, warn: false import ShortMaps alias Helper.{NestedFilter, ORM} alias GroupherServer.{Accounts, CMS, Repo} alias Accounts.Model.User alias CMS...
0bd9b11eaf0006a64518ed0e18d55f380fad8ab7
1,561
[ 72312544 ]
[ "genserver", "documented" ]
defmodule EctoCrash.Server do use GenServer import Ecto.Query alias EctoCrash.Repo alias EctoCrash.User ################################################################ ### INITIALIZATION ################################################################ def start_link(args, _opts) do ...
0bda0e0a393db5493b8de1b4a6e3fa49b0e5939a
2,097
[ 811272395 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration import Config config :product_pagination, ecto_repos: [ProductPag...
0bda192e8c7642468a14a1e1f0970cba5e8f0ea9
2,259
[ 144412136 ]
[]
defmodule JobBot.Crawler.SimplyHired do use JobBot.Crawler import JobBot.Crawler.Helper alias HTTPoison.{Error, Response} alias JobBot.JobSearches.Listing alias JobBot.Source @base_url "https://www.simplyhired.com" @source_name "Simply Hired" def get_job_urls(job_search) do %{terms: terms, locat...
0bda5d869accea6957e764d1fe95597e6845eedf
4,101
[ 81313495 ]
[ "typespec", "supervisor", "documented" ]
defmodule RaSStaggregator do @moduledoc """ The RSS aggregator for Elixir. The RaSStaggregator will read the list of feeds from the configuration value: config :rasstaggregator, feeds: [ %RaSStaggregator.Feed{id: :example_feed, url: "http://example.com/feed"}, %RaSStaggregator.Feed{id: :an...
0bdb7a38bd57b6385ccbbdfe0d9ebfd970f8d545
2,214
[ 870043211 ]
[]
defmodule LunarFrontiers.App.Projectors.Building do alias LunarFrontiers.App.Events.BuildingSpawned alias LunarFrontiers.App.Events.SiteSpawned alias LunarFrontiers.App.Events.ConstructionProgressed use Commanded.Event.Handler, application: LunarFrontiers.App.Application, name: __MODULE__ def init(c...
0bdb86590edbae0523d0ef6939aa17f5417a08cb
2,047
[ 141313360 ]
[ "genserver", "typespec", "documented" ]
defmodule Aurorex.Client do use Connection require Logger @socket_opts [mode: :binary, active: false, packet: :raw] @timeout 5000 defmodule State do defstruct socket: nil, pid: nil, username: nil, password: nil, address: %{host: nil, port: nil} ...
0bdbcf434b85dc75b7d12791b26e1cde514f0839
1,519
[ 55286260 ]
[]
use Mix.Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with brunch.io to recompile .js and .css sources. config :loc_im, LocIm.Endpoint, http: [port: 4000], ...
0bdbd55c85793892266b94281ecce945c5e7df00
1,884
[ 44663110 ]
[]
defmodule StackMachine do def execute(code) do {:ok, _pid} = Agent.start_link(fn -> %{subroutines: extract_subroutines(code)} end, name: __MODULE__) _execute(code, []) end def extract_subroutines(code) do _extract_subroutines(code, %{}) end defp _extract_subroutines([], subroutines), do: subrout...
0bdc25ca1df6082aee0e546f2ec3b6b39ef6d84a
1,917
[ 48782260 ]
[ "test" ]
defmodule AdventDay5Test do use ExUnit.Case, async: true doctest AdventDay5 describe "New and improved version" do alias AdventDay5.Improved test "find nice names in one long name" do count = Improved.count_nice_names("qjhvhtzxzqqjkmpb") assert count == 1 end test "finds nice names ...
0bdc611c35b0a9123cda55649f717cbbb2d7602c
1,986
[ 93777129 ]
[ "typespec", "test", "documented" ]
defmodule Sue.Commands.Shell do Module.register_attribute(__MODULE__, :is_persisted, persist: true) @is_persisted "is persisted" alias Sue.Models.{Response, Message, Account} defmodule DevNull do @moduledoc """ A struct that implements Collectable to be akin to redirecting output to /dev/null. http...
0bdc99b51be72ad92cf9e1afe26c81a06e165ac4
6,986
[ 98875797 ]
[ "macro", "documented" ]
defmodule Expander.Expand do @moduledoc ~S""" Defines an Expander. An expander is a wrapper around an adapter that makes it easy for you to swap the cache adapter without having to change your code. It is also responsible for doing some sanity checks before handing down the url to the adapter. When us...
0bdd143a7b21a89ea88d50a56e27145b9f9a0964
2,527
[ 150026803, 377041131, 200856268, 127785883, 124493217, 131518347 ]
[ "test" ]
defmodule BingoHallWeb.GameChannelTest do use BingoHallWeb.ChannelCase alias BingoHallWeb.GameChannel alias Bingo.{GameServer, GameSupervisor, Player} setup do game_name = "test-game-123" topic = "games:#{game_name}" GameSupervisor.start_game(game_name, 3) player = Player.new("nicole", "gree...
0bdd2dc2919e603e5fc2c852aae21728be969bd5
2,607
[ 676414070 ]
[ "test", "ecto" ]
defmodule Schematic.ConstraintsTest do use Schematic.DataCase alias Schematic.Constraints describe "constraints" do alias Schematic.Constraints.Constraint import Schematic.ConstraintsFixtures @invalid_attrs %{name: nil, description: nil, check_expression: nil} test "list_constraints/0 returns...
0bddbf515eeb124c2dbaaf7282598ff7772b7082
2,212
[ 239822890, 419435907, 376959663, 459291087 ]
[ "test" ]
defmodule Oli.Activities.ConditionsTest do use ExUnit.Case, async: true alias Oli.Activities.Realizer.Logic alias Oli.TestHelpers test "parsing conditions with just an expression" do {:ok, contents} = TestHelpers.read_json_file("./test/oli/activities/realizer/valid1.json") assert {:ok, parsed} = Logi...
0bde43ad3b889c2127fd8686f55bbaa5fc5c33cb
5,386
[ 457342394 ]
[ "test", "ecto" ]
defmodule ClimateCoolers.Profiles.CompanyTest do use ClimateCoolers.DataCase alias ClimateCoolers.Profiles.Company describe "companies" do alias ClimateCoolers.Profiles.Company.Company import ClimateCoolers.Profiles.CompanyFixtures @invalid_attrs %{description: nil, established_in: nil, name: nil,...
0bde88197a61db4579d96fb4baa8600e8435056f
1,606
[ 15847080 ]
[ "test" ]
defmodule Charlotte.Views.CompilerTest do use ExUnit.Case use ExSpec # Existing views: fake_controller/new.eex, test_controller/new.eex, text_controller/create.eex describe "Production" do it "renders the view" do Charlotte.Views.Compiler.compile :prod assert Charlotte.Views.FakeController.n...
0bdeaadc1e331b3a90847de0e4605164de4846c4
2,062
[ 753925517 ]
[ "supervisor" ]
defmodule TournamentsBrackets do use Application def start(_type, _args) do players = IO.gets("Please inform the name of the players separated by comma: ") |> String.trim() |> String.split(",") |> Enum.map(fn name -> String.trim(name) end) Enum.with_index(players) |> Enum.each(...
0bdeed92167eab40aa9e2d2199bfac31e6b82600
11,170
[ 642801477 ]
[ "liveview", "phoenix", "test" ]
defmodule AriakeWeb.AdminUserAuthTest do use AriakeWeb.ConnCase, async: true alias Phoenix.LiveView alias Ariake.Admin alias AriakeWeb.AdminUserAuth import Ariake.AdminFixtures @remember_me_cookie "_ariake_web_admin_user_remember_me" setup %{conn: conn} do conn = conn |> Map.replace!(:s...
0bdef4d6ffdc4d9db9c751db39e7164a423bbeb0
3,014
[ 585290156 ]
[ "test" ]
defmodule Buckets.Adapters.S3DigitalOceanTest do use ExUnit.Case alias Buckets.Adapters.S3 import Buckets.Setup import Buckets.UploadFixtures @digitalocean_opts TestCloud.DigitalOcean.config() setup :setup_scope @tag :live @tag :live_digitalocean test "digitalocean put", context do %{data: {...
0bdf825574e3f60be5af47f1102c451cf8a35731
4,393
[ 439448765 ]
[ "genserver", "liveview" ]
defmodule Aoc2021Web.ExerciseLive.ExerciseComponent do use Aoc2021Web, :live_view alias Aoc2021.Exercise alias Aoc2021.Exercise.Input @impl true def mount(_params, session, socket) do exercise = session["exercise"] socket = socket |> assign(:name, Exercise.name(exercise)) |> assig...
0bdffa6e23ed77d395c4aa786ce531a692066b20
1,912
[ 185963858 ]
[]
defmodule ElixWeb.Resolvers.Vacation do alias Elix.Vacation alias ElixWeb.Schema.ChangesetErrors def places(_, args, _) do {:ok, Vacation.list_places(args)} end def place(_, %{slug: slug}, _) do {:ok, Vacation.get_place_by_slug!(slug)} end def bookings_for_place(place,_,_) do {:ok, Vacation...
0be01d670f017d05ac99178266beac1d3209c920
1,602
[ 143978488 ]
[ "macro", "documented", "phoenix" ]
defmodule EosMealWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: use EosMealWeb, :controller use EosMealWeb, :view The definitions below will be executed for every view, controller, ...
0be032fffdc047a71d2f818ed24b73cbbb381847
4,632
[ 78935299 ]
[]
%{"calendar": {:hex, :calendar, "0.17.0", "9079d42ed4b3e1e5ac2a994deaa63f51835682d98548feee338a829f0326d2eb", [:mix], [{:tzdata, "~> 0.5.8 or ~> 0.1.201603", [hex: :tzdata, optional: false]}]}, "certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []}, "...
0be0b59a75cb55bc8dba8de3620eeb2e83c2c967
1,743
[ 797509324 ]
[ "typespec", "documented", "ecto" ]
defmodule Paypal.Order.PurchaseUnit do @moduledoc """ The purchase unit is the information for each unit purchased (or to purchase) included in an order. """ use TypedEctoSchema import Ecto.Changeset alias Paypal.Common.CurrencyValue alias Paypal.Order.PurchaseUnit.Item alias Paypal.Order.PurchaseUn...
0be0bf15e93924bda9f025ff4c17aa7ea179a9fa
1,678
[ 776099054 ]
[]
Mix.install([:jason]) discovery_path = "build_lib/kubernetes/api/discovery/" out_path = "build/discovery.ex" format_api_resource_list = fn api_resource_list_file -> api_resource_list = api_resource_list_file |> File.read!() |> Jason.decode!() for main_resource <- Enum.reject(api_resource_list["resources"], &Strin...
0be0dcbb8e7fadb597f3cc368fbd8a70f35e3bc3
3,987
[ 567095376 ]
[ "documented" ]
defmodule Dice.Matchmaking.Actor do @moduledoc """ Defines matchmaking actor iteractions """ use SpawnSdk.Actor, kind: :unamed, stateful: true, state_type: Dice.Matchmaking.MatchmakingState require Logger alias Dice.Game alias Dice.Matchmaking.StateHelper alias Dice.Matchmaking.{ Matc...
0be1138c8cb813ac8df8dcb14b02f71422c0186b
5,166
[ 782027129 ]
[]
%{ "aws_signature": {:hex, :aws_signature, "0.3.2", "adf33bc4af00b2089b7708bf20e3246f09c639a905a619b3689f0a0a22c3ef8f", [:rebar3], [], "hexpm", "b0daf61feb4250a8ab0adea60db3e336af732ff71dd3fb22e45ae3dcbd071e44"}, "castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727"...
0be120abac880a81b6601ebfd2c5b75a822fba6d
9,815
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.ConvertRowtypeExpr do @moduledoc false if function_exported?(Protox, :check_generator_version, 1) do Protox.check_generator_version(1) else raise "This code was generated with protox 2 but the runtime is using an older...
0be17b46cb2232dc33508915b06a7eb9123e41da
9,677
[ 1014133905 ]
[ "test" ]
defmodule Exdantic.RootSchemaTest do use ExUnit.Case, async: true alias Exdantic.TypeAdapter.Instance alias Exdantic.ValidationError describe "basic RootSchema usage" do defmodule IntegerListSchema do use Exdantic.RootSchema, root: {:array, :integer} end defmodule StringSchema do use ...
0be19804b86cfc7a8683cbba29f0fde50eb8772d
2,563
[ 744421640 ]
[ "test" ]
defmodule BlockScoutWeb.ChainTest do use Explorer.DataCase alias Explorer.Chain.{Address, Block, Transaction} alias BlockScoutWeb.Chain describe "current_filter/1" do test "sets direction based on to filter" do assert [direction: :to] = Chain.current_filter(%{"filter" => "to"}) end test "se...
0be1b30a3a40018f8f769f92dff6c6207cc2a099
2,375
[ 404109548 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule TodoLiveWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: use TodoLiveWeb, :controller use TodoLiveWeb, :view The definitions below will be executed for every view, controlle...
0be1c8045c083f04f1b1c50d1acd802f12941761
2,259
[ 65562446 ]
[]
%{"comeonin": {:hex, :comeonin, "2.5.2", "bbad773af30a7632a63053014d5cfebf6df2c1ad114167b4db02f05b5c60901b", [:mix, :make, :make], []}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []}, "db_connection": {:hex, :db_connection, "1.0.0-rc.4", "f...
0be224d4cb86635ed85485b4eb71f8031b6ce2d5
3,478
[ 237772351 ]
[ "test" ]
defmodule SpiderWeb.TransporterControllerTest do use SpiderWeb.ConnCase alias Spider.Transporters alias Spider.Transporters.Transporter @create_attrs %{latitude_from: "some latitude_from", latitude_to: "some latitude_to", logitude_from: "some logitude_from", longitude_to: "some longitude_to", status: 42, tran...
0be25b0266b1431b71d8a5089d03a2ecbdf59632
2,555
[ 554970039 ]
[]
defmodule Learn do def main do is_subset("1-5,7-9","1-9") end def expand(intervals) do if intervals == "" do [] else list_intervals = String.split(intervals, ",") intervals_list = Enum.map(list_intervals, fn interval -> if String.contains?(interval, "-") do [first,...