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
0a2c0dd92ff6dbf5b3351358431e9602ee738743
3,257
[ 547925897 ]
[ "typespec", "macro", "documented" ]
defmodule Interval.Support.EctoType do @moduledoc """ Implements support for auto-implementing Ecto.Type. ## Example use Interval.Support.EctoType, ecto_type: :numrange """ @supported? Code.ensure_loaded?(Ecto) @doc """ Returns if Interval was compiled with support for `Ecto.Type` """ @spec ...
0a2c489abdc89820357a5d540b36eaf07aff6614
2,212
[ 92799451 ]
[ "genserver", "documented" ]
defmodule Scheduler.Worker do use GenServer # API def start_link do GenServer.start_link(__MODULE__, [], name: __MODULE__) end @doc """ Creates a new schedule. """ def schedule do GenServer.call(__MODULE__, :schedule) end @doc """ Retrieves the existing schedule. """ def get_schedu...
0a2cc9c0fb969e6be6b1b56518f99e3e93ad8e67
2,505
[ 326433191 ]
[ "test", "phoenix" ]
defmodule UapiWeb.FoodControllerTest do use UapiWeb.ConnCase alias Uapi.Accounts alias Uapi.Accounts.Food @create_attrs %{ name: "some name", price: 42 } @update_attrs %{ name: "some updated name", price: 43 } @invalid_attrs %{name: nil, price: nil} def fixture(:food) do {:ok, f...
0a2d79f21bd1c2c5475803197efb94c3be0ca677
19,687
[ 111415024, 563322590 ]
[ "documented" ]
defmodule GroupherServer.Support.GeoData do @moduledoc """ return geo data """ def all do [ %{ city: "海门", long: 121.15, lant: 31.89, value: 0 }, %{ city: "鄂尔多斯", long: 109.781327, lant: 39.608266, value: 0 }, %{ ...
0a2df12ffe9c540e0d0b69bc240f1a0e2f7bd196
3,539
[ 121670826 ]
[ "macro", "documented", "phoenix" ]
defmodule MultiFormat do @moduledoc """ `MultiFormat` is a helper for `Phoenix.Router` when working with multi format routes. It allows routes to match for one or more extensions (or none) without having to manually define all of them and assigning pipelines with the matching `plug :accepts, …`. ## Ex...
0a2f01aab8d83914d7158d4f40a30ed8280cf29d
2,788
[ 242206007 ]
[]
# distributed algorithms, n.dulay, 4 feb 2020 # coursework, raft consensus, v1 defmodule State do # *** short-names: s for 'server', m for 'message' def initialise(config, server_id, servers, databaseP) do %{ config: config, # system configuration parameters (from DAC) selfP: self(), ...
0a2f91af6381dfeb5a4a776c917857a4d16cd7d5
2,245
[ 75963823 ]
[]
defmodule Aoc12 do @input "R4, R3, R5, L3, L5, R2, L2, R5, L2, R5, R5, R5, R1, R3, L2, L2, L1, R5, L3, R1, L2, R1, L3, L5, L1, R3, L4, R2, R4, L3, L1, R4, L4, R3, L5, L3, R188, R4, L1, R48, L5, R4, R71, R3, L2, R188, L3, R2, L3, R3, L5, L1, R1, L2, L4, L2, R5, L3, R3, R3, R4, L3, L4, R5, L4, L4, R3, R4, L4, R1, L3, L1...
0a2fb5ec44376c11133f2a4143bdf9bddcbd3ba7
8,200
[ 573744708 ]
[ "liveview", "documented" ]
defmodule LiveViewPatternsWeb.CoreComponents do @moduledoc """ Provides core UI components. The components in this module use Tailwind CSS, a utility-first CSS framework. See the [Tailwind CSS documentation](https://tailwindcss.com) to learn how to customize the generated components in this module. Icons ...
0a2ff5c83879f8cfab08ca3735f96a59c6a11ebf
1,983
[ 429258170 ]
[]
# Erlang libraries # The binary module IO.puts(inspect(String.to_charlist("Ø"))) # Formatted text output IO.puts(:io.format("Pi is approximately given by:~10.3f~n", [:math.pi()])) # The crypto module IO.puts(Base.encode16(:crypto.hash(:sha256, "Hello world!"))) # The digraph module digraph = :digraph.new() coords =...
0a3031631062b0bc044c2fbede58ca995c293dee
5,266
[ 96756156 ]
[]
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], [], "hexpm"}, "certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], [], "hexpm"}, "cf": {:hex, :cf, "0.2.2", "7f2913fff90abcabd0f48...
0a3069f576448c95aff6b6efa589a7a7f4ff4755
1,726
[ 735229411 ]
[]
defmodule AdventOfCode.Day4.ScratchCard do defstruct [:id, :winning_numbers, :numbers] def score(scratch_card) do tabulate(scratch_card.winning_numbers, scratch_card.numbers, 0) end def tabulate(winning_numbers, numbers, score) when winning_numbers == [] or numbers == [] do if score == 0, do: 0,...
0a3088cf0dd20dde85615a729b114eb0a9683337
3,125
[ 757463973 ]
[]
defmodule ChatApi.MixProject do use Mix.Project def project do [ app: :chat_api, version: "0.1.0", elixir: "~> 1.10", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers() ++ [:phoenix_swagger], start_permanent: Mix.env() == :prod, ...
0a30cd306b493804692b330353814eb64a4d363e
2,551
[ 480623773 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule MailveProjectWeb 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 MailveProjectWeb, :controller use MailveProjectWeb, :view The definitions below will be executed for every vi...
0a310c2c52c0750030f577f505bc13439072ddd2
1,921
[ 127679817 ]
[ "phoenix", "ecto" ]
defmodule ToyAppWeb.MicropostController do use ToyAppWeb, :controller alias ToyApp.Articles alias ToyApp.Articles.Micropost def index(conn, _params) do microposts = Articles.list_microposts() render(conn, "index.html", microposts: microposts) end def new(conn, _params) do changeset = Articles...
0a31777360e8ef1f6b4f4e1d8f73b04adff52f81
2,589
[ 151157199 ]
[ "test" ]
defmodule Indy.WalletTest do use ExUnit.Case setup_all do :ok end test "create wallet with config and credentials" do {return, _} = Wallet.delete(%Wallet.Config{id: "2"}, %Wallet.Credentials{key: "thasedrvj44oierglkerv'ijrijrgjerb"}) {return, _} = Wallet.create(%Wallet.Config{id: "2"}, %Wallet.Cre...
0a31a9e02c7d523a6ff1a2c6853f63c2f1cfb24f
4,371
[ 82918073 ]
[ "macro", "documented" ]
defmodule Extatus.Metric.Counter do @moduledoc """ This module defines a wrapper over `Prometheus.Metric.Counter` functions to be compatible with `Extatus` way of handling metrics. """ alias Extatus.Settings @metric Settings.extatus_counter_mod() @doc """ Creates a counter using the `name` of a metric...
0a3220b99b49e46b728023a0491d5055d7fc391a
1,837
[ 288371782 ]
[ "genserver" ]
defmodule ProlinkConnect.Rekordbox do use GenServer alias ProlinkConnect.Network def start_link(_) do GenServer.start_link( __MODULE__, %{ requests: [] }, name: __MODULE__ ) end @impl true def init(state) do {:ok, state} end @impl true def handle_cast({:e...
0a3233d0fcdc70405436c084f1cad1063b1afde0
2,721
[ 82127834 ]
[ "documented" ]
defmodule AbsintheBenchmark do @moduledoc """ Documentation for AbsintheBenchmark. """ @root_value Map.new([ %{ id: 0, name: "Adam", friend_ids: [1] }, %{ id: 1, name: "Bertha", friend_ids: [2, 4] }, %{ id: 2, name: "Charlie", friend_ids...
0a323de0e476f2cc2349e565fe830d1fc8af6ef5
2,490
[ 67804760 ]
[ "phoenix" ]
defmodule PhoenixSocial.PostController do use PhoenixSocial.Web, :controller use PhoenixSocial.SharedPlugs alias PhoenixSocial.{Repo, Post, PostView, PostChannel} alias PhoenixSocial.Params.Pagination alias PhoenixSocial.Queries.Wall alias PhoenixSocial.Operations.CreatePost plug Guardian.Plug.EnsureAut...
0a3282b5addf10a4f83a99f6b942604144d0ba48
8,203
[ 46789076 ]
[ "documented" ]
defmodule Api.Utils do require Logger # alias Porcelain.Result import Elins ########## SIDE-EFFECTS ############################### @doc "for arrays of URLs and options, posts each pair to the fetching queue." def post_urls(urls, opts \\ []) do Logger.debug "post_urls" Api.Utils.zip_duplicate(urls...
0a329c65fe4312e5cc68a358424e5d692871d4f1
4,845
[ 724993458 ]
[ "typespec", "macro", "documented", "ecto" ]
defmodule EctoInterface.Write.Create do @moduledoc false defmacro __using__(options) when is_list(options) do source = Keyword.get(options, :source) || raise "Missing :source key in use(EctoInterface) call" singular = Keyword.get(options, :singular) || raise "Missing :singular k...
0a32e0fe027def7a4a1696ddc6d4246ba315a445
2,195
[ 161037236 ]
[]
defmodule Mix.Nerves.Utils do @fwup_semver "~> 0.8" def shell(cmd, args, opts \\ []) do stream = opts[:stream] || IO.binstream(:standard_io, :line) std_err = opts[:stderr_to_stdout] || true opts = Keyword.drop(opts, [:into, :stderr_to_stdout, :stream]) System.cmd(cmd, args, [into: stream, stderr_to...
0a331aa2460bd343748b20c4d4e811bee1106d0c
3,344
[ 170630032 ]
[ "macro", "documented" ]
defmodule Fulib.MockRequestUtilAble do @moduledoc """ 用途是,假定一个假的请求,这样只走内部,而不走外部 ## Examples ``` defmodule Hello.MockRequestUtil do use Fulib.MockRequestUtilAble, endpoint: Hello.Endpoint end # then Hello.MockRequestUtil.get("/") ``` """ defmacro __using__(opts \\ []) do quote do ...
0a33668804b5aef6bb03c6011e49f9032bcc3daf
5,009
[ 351897406 ]
[ "typespec", "documented" ]
defmodule OwoifyEx.Word do @moduledoc false defstruct [ :word, :replaced_words ] @type word :: String.t() @type replaced_words :: [String.t()] @type t :: %__MODULE__{ word: word, replaced_words: replaced_words } @spec search_value_contains_replaced_words(t(), Regex....
0a339c63e5ad843ee828c592e1e756a4ba8b250c
1,851
[ 660807464 ]
[ "test" ]
defmodule JcsFixturesTest do use ExUnit.Case, async: true @input_dir "./test/fixtures/input" @output_dir "./test/fixtures/output" def fixture_test(file_name) do input_path = "#{@input_dir}/#{file_name}" encoded = File.read!(input_path) |> Jason.decode!() |> Jcs.encode() output_path = "#{@output_d...
0a33bb8fc2ec89025aa64045529e743d2a0485d5
5,259
[ 433117149 ]
[]
Mix.install([ {:benchee, "~> 1.0"}, {:benchee_html, "~> 1.0"}, {:benchee_json, "~> 1.0"} ]) defmodule Tester do def patterned("0" = pattern), do: pattern <> "patterned" def patterned("1" = pattern), do: pattern <> "patterned" def patterned("2" = pattern), do: pattern <> "patterned" def patterned("3" = pa...
0a33f99b402087afc6f42a6b39c2bfb32c14720f
5,249
[ 155636113 ]
[ "test", "ecto" ]
defmodule AstroPlayground.BodiesTest do use AstroPlayground.DataCase alias AstroPlayground.Bodies describe "languages" do alias AstroPlayground.Bodies.Language @valid_attrs %{name: "some name", proverb: "some proverb"} @update_attrs %{name: "some updated name", proverb: "some updated proverb"} ...
0a34306b04abc77843e3da9ae38abe4cc69f1f4c
2,674
[ 97097732 ]
[ "test" ]
defmodule MoviesWeb.MovieControllerTest do use MoviesWeb.ConnCase alias Movies.Web @create_attrs %{box_office: 42, budget: 42, name: "some name"} @update_attrs %{box_office: 43, budget: 43, name: "some updated name"} @invalid_attrs %{box_office: nil, budget: nil, name: nil} def fixture(:movie) do {:o...
0a3474ac9b3f93e1d812d068f7a4a82811cb3fcc
2,081
[ 243129821, 273085190, 343209812, 356964182, 357334716, 373662789, 379507262, 406732766, 425222664, 433464550, 239182752, 341577165, 343815695, 384108404, 207503388, 231666876, 238344742, 248292846, 286403536, 305857545, 341934035, 380045621, 423405342, 424070340, 2291...
[ "macro", "documented" ]
defmodule Postgrex.Extensions.TSVector do @moduledoc false import Postgrex.BinaryUtils, warn: false use Bitwise use Postgrex.BinaryExtension, send: "tsvectorsend" def encode(_) do quote location: :keep do values when is_list(values) -> encoded_tsvectors = unquote(__MODULE__).encode_tsvecto...
0a34bc323a2325c295e7b07f32241d2f3d2d4467
2,005
[ 277610860 ]
[]
defmodule DirectAsyncGateway do @direct_exchange "directMessages" def request_reply(%AsyncQuery{}, nil), do: raise("nil target") def request_reply(query = %AsyncQuery{}, target_name) do correlation_id = NameGenerator.generate() msg = OutMessage.new( headers: headers(query, correlation_id), e...
0a34be489e31e9f1401a1b49e10a5fd292c8f0ab
2,038
[ 145774355 ]
[ "macro", "documented", "ecto" ]
defmodule DB.Stats.OutputActivation do @moduledoc false use DB.Stats.Data, module: __MODULE__, owner_id_field: :port_id defmodule Schema do defmacro __using__(name) do quote do use Ecto.Schema @name unquote(name) @derive {Poison.Encoder, except: [:__meta__]} schema @nam...
0a34c849b250757890ba8d41804300ce53f4e103
3,778
[ 129441349 ]
[ "typespec", "documented" ]
defmodule BinTree do import Inspect.Algebra @moduledoc """ A node in a binary tree. `value` is the value of a node. `left` is the left subtree (nil if no subtree). `right` is the right subtree (nil if no subtree). """ @type t :: %BinTree{value: any, left: BinTree.t() | nil, right: BinTree.t() | nil} ...
0a34ff83cd542b7a0e46bc4e6a4a30e613198900
3,129
[ 324455047 ]
[ "documented", "ecto" ]
defmodule Deftype.EctoUtil do @moduledoc false alias Ecto.Changeset def is_schema?(module) when is_atom(module) do loaded? = Code.ensure_loaded?(module) loaded? && function_exported?(module, :__schema__, 1) end def is_schema?(_) do false end def is_type?(module) when is_atom(module) do ...
0a3510bf27aa82ed4069649baccb9a9b9e5010a4
2,470
[ 187382823 ]
[]
defmodule Umbrella.MixProject do use Mix.Project def project do [ apps_path: "apps", start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases() ] end # Dependencies listed here are available only for this # project and cannot be accessed from applications inside ...
0a35700116e0cb8e6d3b925e84320d8fdd71eb8d
2,024
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Dataflow.V1b3.Model.StreamLocation do @moduledoc """ Describes a stream of data, either as input to be processed or as output of a streaming Dataflow job. ## Attributes * `customSourceLocation` (*type:* `GoogleApi.Dataflow.V1b3.Model.CustomSourceLocation.t`, *default:* `nil`) - The strea...
0a3571afd080e482704bea71408a6badfda12766
3,512
[ 342930694 ]
[ "liveview" ]
defmodule CovidTweetsWeb.TweetsLive do use CovidTweetsWeb, :live_view use Timex import Ecto.Query, only: [from: 2] Application.ensure_all_started :timex @tz Timezone.get("America/Denver", Timex.now()) # Get tweet data on initial page load def mount(_params, _session, socket) do ...
0a36f1b26871528d5d97d2d332400a48e5f16119
2,434
[ 651155880 ]
[ "phoenix" ]
defmodule GradeInatorWeb.Router do use GradeInatorWeb, :router pipeline :browser do plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_live_flash) plug(:put_root_layout, {GradeInatorWeb.Layouts, :root}) plug(:protect_from_forgery) plug(:put_secure_browser_headers) end pipeline :...
0a371a98ba636286220cbafd6fe860a1835c4548
2,168
[ 77654631 ]
[ "phoenix" ]
defmodule Blog.CategoryController do use Blog.Web, :controller alias Blog.Category def index(conn, _params) do categories = Repo.all(Category) render conn, "index.html", categories: categories, layout: {Blog.LayoutView, "admin.html"} end def new(conn, _params) do changeset = Category.changeset(...
0a3842e9358e739a9617b58e33eaddf7633855d4
3,107
[ 781127328 ]
[ "typespec", "documented" ]
defmodule WeatherGraphqlGateway.OpenMeteoAPI.GraphqlSerializer do @moduledoc """ Provides functions to serialize weather data received from OpenMeteoAPI responses. This module offers functionalities to transform weather data obtained from the OpenMeteoAPI into a format suitable for GraphQL responses. It includes...
0a386f04d54e5e6486b99a0b20ee38e36fe0d0db
2,772
[ 373903251 ]
[ "documented", "ecto" ]
defmodule FrClone.CostingRequestLineItems do @moduledoc """ The CostingRequestLineItems context. """ import Ecto.Query, warn: false alias FrClone.Repo alias FrClone.CostingRequestLineItems.CostingRequestLineItem @doc """ Returns the list of costing_request_line_items. ## Examples iex> list_...
0a3921d8be1c0fa827ee61c8ab1b3d7f527bcec5
2,517
[ 172127066 ]
[ "typespec", "documented" ]
defmodule RobotSimulator do @valid_directions [:north, :east, :south, :west] defstruct direction: :north, position: {0, 0} defguardp is_unvalid_position(position) when not is_tuple(position) or tuple_size(position) != 2 or not is_number(elem(position, 0)) or not is_number(elem(pos...
0a3937363bb3a6ac50419c025a1d1692a7f25ffb
1,540
[ 254278453, 252769141, 129607070 ]
[]
stream = File.read!("test/fixtures/blank_description.ics") {:ok, decoded} = ICalendar.Decoder.decode(stream) ICalendar.Encoder.encode(decoded) IO.inspect decoded #:eflame.apply(ICalendar.Decoder, :decode, [stream]) # Benchee.run(%{ "decode" => fn -> ICalendar.Decoder.decode(stream) end, "encode" => fn -> IC...
0a39635d94f9001d22b53a4ef5d6cb487ea7906c
2,588
[ 125938964 ]
[ "documented" ]
defmodule Langue.Formatter.GoI18nJson.Serializer do @moduledoc """ The serializer needs to nest the plurals form inside the parent key. This is done by looping over every key and keeping a `plurals` state. When the current key is a plural we don’t append it to the entries list, but we keep it in the `plurals...
0a396ee9c3abde42b0e1e340ae6e8ca16ff5b313
2,287
[ 125888515 ]
[]
%{ "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm"}, "gettext": {:hex, :gettext, "0.15.0", "40a2b8ce33a80c...
0a39d9487bd08131b6aa8a67a3709d1db0527e38
16,000
[ 872091867, 828087786, 1017741371, 929037144, 870390283, 997457369, 1006623189, 949528067, 1014978820, 1018310553, 1015639508, 825443197, 857708817 ]
[ "liveview", "documented" ]
defmodule Phoenix.LiveView.HTMLAlgebra do @moduledoc false import Inspect.Algebra, except: [format: 2] @languages ~w(style script) # The formatter has two modes: # # * :normal # * :preserve - for preserving text in <pre>, <script>, <style> and HTML Comment tags # def build(tree, opts) when is_list(...
0a3a16d970cfa61e3d372d6ddc5b9b538e896257
1,852
[ 834525009 ]
[ "documented", "ecto" ]
defmodule Grapher.Users do @moduledoc """ The Users context. """ import Ecto.Query, warn: false alias Grapher.Repo alias Grapher.Users.EndUser @doc """ Returns the list of end_users. ## Examples iex> list_end_users() [%EndUser{}, ...] """ def list_end_users do Repo.all(EndUse...
0a3a7f1ac6d2d2ba65924253acfaa18efb94eea5
1,893
[ 351172958 ]
[ "phoenix" ]
defmodule EventsServerWeb.EventController do use EventsServerWeb, :controller alias EventsServer.Events alias EventsServer.Events.Event alias EventsServer.Comments alias EventsServer.Invites alias EventsServerWeb.Plugs plug Plugs.RequireAuth plug Plugs.RequireAccess when action not in [:create, :index...
0a3ae64f1bb5e88f9cf76876dcbab81d05b6717f
4,310
[ 571736697 ]
[ "genserver", "documented" ]
defmodule HnAggregator.DataPoller do @moduledoc """ Module responsible to poll data from HN api and store it into the given Schema. Available configurations are: - `poll_interval` interval in seconds to poll the data from HN, defaults to 300. - `hn_endpoint` HN endpoint to poll the data from, defaults to `h...
0a3b68f1764cef4fcdd1691aa102fd927264fcd3
1,527
[ 994989852 ]
[]
defmodule Garch do import Nx.Defn defn compute_vols(arr, vols, alpha, beta) do # total number of points n = Nx.axis_size(arr, 0) {filled, _} = while {filledidx}, Nx.less(idx, n) do prev_vol = Nx.slice(filled, [idx - 1], [1]) {} end # # while {vols_tensor, idx}, idx < ...
0a3b74f9cf0f98fbeeb40d7a1c3d3a7943c36666
5,011
[ 367278931 ]
[ "documented" ]
defmodule Google.Cloud.Discoveryengine.V1alpha.CreateDataStoreRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :parent, 1, type: :string, deprecated: false field :data_store, 2, type: Google.Cloud.Discoveryengine.V1alpha.DataStore, json_name: "dataS...
0a3bba053ce2262ecb1858e2565ee0e7e2adeb9a
5,268
[ 153550303 ]
[ "typespec", "macro", "documented", "ecto" ]
defmodule DomainLogic.Domain.SortLib do @moduledoc false import Ecto.Query alias DomainLogic.Domain.SortLib @type sort_field :: {atom, true} @type sort :: {atom | String.t(), :asc | :desc | String.t()} @callback sort_fields() :: list(sort_field) @callback sort_by(Ecto.Schema.t(), sort | list(sort)) ::...
0a3bdb00e8f93afbc3aee96ad61cdb9029fcbbcb
2,879
[ 508774942 ]
[ "phoenix", "ecto" ]
defmodule LunchbotWeb.Admin.ItemOptionHeadingsController do use LunchbotWeb, :controller alias Lunchbot.LunchbotData alias Lunchbot.LunchbotData.ItemOptionHeadings plug(:put_root_layout, {LunchbotWeb.LayoutView, "torch.html"}) plug(:put_layout, false) def index(conn, params) do case LunchbotData.pagi...
0a3c160599e935230382557f4bad5350d6f7f64d
2,064
[ 192133727 ]
[]
defmodule Servy.Handler do alias Servy.Conv alias Servy.BearController @pages_path Path.expand("../../pages", __DIR__) import Servy.Plugins, only: [rewrite_path: 1, log: 1, track: 1] import Servy.Parser def handle(request) do request |> parse |> rewrite_path() |> log() |> route |> ...
0a3c37f75848460ab3c382e5a9ab2b83c7053ddd
2,450
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ArtifactRegistry.V1.Model.Version do @moduledoc """ The body of a version resource. A version resource represents a collection of components, such as files and other data. This may correspond to a version in many package management schemes. ## Attributes * `annotations` (*type:* `map()`,...
0a3c65744a3444fd983c6f35b8bc1c6091548a52
5,224
[ 193244709 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Composer.V1.Model.PrivateEnvironmentConfig do @moduledoc """ The configuration information for configuring a Private IP Cloud Composer environment. ## Attributes * `cloudComposerConnectionSubnetwork` (*type:* `String.t`, *default:* `nil`) - Optional. When specified, the environment will ...
0a3cfba026b2976efeeb1be3b4a8af2eb1da2741
2,628
[ 320399087, 499371229 ]
[]
defmodule Alphax do def main(args) do # Compiler options case args do # help ["-h"] -> IO.puts("Available options:\n -c <filename.c> Compile program (check the same folder for [filename].exe). -t <filename.c> Show token list. -a <filename.c> Show AST. -...
0a3d18935df8ba3ecc057256612c94a980dcfdec
2,558
[ 317967458 ]
[]
defmodule AdventOfCode.Day13 do alias AdventOfCode.Util @day_number 13 def process() do notes = load_data() IO.puts("Part 1: #{part1(notes)}, Part 2: #{part2(notes)}") end def find_first_multiple_gte_helper(value, target, n) do product = value * n if product >= target do {product, n...
0a3ddf65bca1148cb514399f7fdfc60cf84424d5
8,711
[ 728692619 ]
[ "typespec", "documented" ]
defmodule FwdClient.Device do @moduledoc """ Provides struct and type for a Device """ use FwdClient.Encoder @type t :: %__MODULE__{ __info__: map, collectionError: String.t() | nil, displayName: String.t() | nil, managementIps: [String.t()] | nil, model: Str...
0a3e299cec97378de4438102fc2343de79013e30
4,941
[ 319931397 ]
[]
defmodule Crawlers.Spiders.Immobiliare do use Crawly.Spider alias Crawlers.UrlsManagers @impl Crawly.Spider def base_url(), do: "https://www.immobiliare.it/" @impl Crawly.Spider def init() do [ start_urls: UrlsManagers.Immobiliare.generate_urls() ] end @impl Crawly.Spider def parse_it...
0a3e7d0bca1fa21810ef5ec67e058f835b56a2c8
1,853
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudControlsPartner.V1.Model.Customer do @moduledoc """ Contains metadata around a Cloud Controls Partner Customer ## Attributes * `customerOnboardingState` (*type:* `GoogleApi.CloudControlsPartner.V1.Model.CustomerOnboardingState.t`, *default:* `nil`) - Output only. Container for custo...
0a3eb6cf278f8c5253f1bdbe7415ee1affe8dab6
1,620
[ 248702688 ]
[ "test" ]
defmodule Stripy.BankAccountTest do use Stripy.StripeCase, async: true describe "create/2" do test "creates a bank account for a customer" do assert {:ok, _} = Stripe.BankAccount.create(%{customer: "cus_123", source: "tok_amex"}) assert_stripe_requested(:post, "/v1/customers/cus_123/sources") e...
0a3ecb1b7eff08c9dfebf986ad7fc003bd6704e4
8,182
[ 165517500 ]
[ "typespec", "documented", "phoenix" ]
defmodule Ratatouille.Renderer.Element do @moduledoc false alias __MODULE__, as: Element alias Ratatouille.Renderer.Element.{ Bar, Canvas, Chart, Column, Label, Overlay, Panel, ProgressBar, Row, Sparkline, Table, Tree, View, Viewport } @type t :: %Ele...
0a3f062b74a5e1e35e8c01d9b2c334fc660b3921
2,673
[ 173319533 ]
[ "phoenix", "ecto" ]
defmodule CheerlandReservasWeb.UserController do use CheerlandReservasWeb, :controller # use CheerlandReservasWeb.BaseController alias CheerlandReservas.Authentication alias CheerlandReservas.Authentication.User plug(:scrub_params, "user" when action in [:create]) def index(conn, _params) do users = ...
0a3f3170b53e9fd3e17c8503e77f1912cf8a627e
2,988
[ 138809123 ]
[ "test", "ecto" ]
defmodule Grapevine.AccountsTest do use Grapevine.DataCase use Bamboo.Test alias Grapevine.Accounts alias Grapevine.Emails alias GrapevineData.Accounts.User describe "registration" do test "sends an email to verify the email" do {:ok, user} = Accounts.register(%{ username: "adm...
0a3fc2d7e85742f916c6ef1460d4a2a2f22b6c5a
2,919
[ 124139772 ]
[ "test", "phoenix", "ecto" ]
defmodule Api.Web.ChannelControllerTest do use Api.Web.ConnCase alias Api.Chats alias Ecto.Changeset test "list channels", %{users: [user, _], channel: channel, conn: conn} do Changeset.change(channel, %{type: :private}) |> Repo.update!() resp = get(conn, "/api/channels/") assert json_respons...
0a3fe22b763d211cd11bda43ba1c7087cf24a27d
1,540
[ 722317464 ]
[ "liveview", "phoenix" ]
defmodule PetfinderWeb.Endpoint do use Phoenix.Endpoint, otp_app: :petfinder # 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, key: "_petfi...
0a3ffc3282d5198024e32f5ff445ee8d02a4e897
2,064
[ 484208970 ]
[]
defmodule SntxGraph.Mutations.Users.Auth do use Absinthe.Schema.Notation import SntxWeb.Payload alias Sntx.Guardian alias Sntx.Models.User.{Auth, Activations, Mail} object :user_auth_mutations do field :user_login, type: :user_session_payload do arg :email, non_null(:string) arg :password, ...
0a409d99de984422dfdd951a0eb0af0c7acca985
2,039
[ 182903070 ]
[ "test", "ecto" ]
defmodule Banamex.CuentasTest do use Banamex.DataCase alias Banamex.Cuentas describe "cuentas" do alias Banamex.Cuentas.Cuenta @valid_attrs %{no_cta: 42, saldo: 120.5} @update_attrs %{no_cta: 43, saldo: 456.7} @invalid_attrs %{no_cta: nil, saldo: nil} def cuenta_fixture(attrs \\ %{}) do ...
0a40f9dd551e7a4ae686afc4f275269c42fa8c41
1,928
[ 149341770 ]
[ "typespec" ]
defmodule Ibento.GraphQL.Core.Schema.Types do use Absinthe.Schema.Notation scalar(:json, name: "JSON") do description(""" The `JSON` scalar type represents a JSON Object as defined in [RFC 7159](https://tools.ietf.org/html/rfc7159). """) serialize(&serialize_json/1) parse(&parse_json/1) end ...
0a416f2a1ccdbdc264a3ae122808362395afdfa6
3,392
[ 890838838 ]
[ "genserver", "liveview", "documented" ]
defmodule TodoplaceWeb.GalleryLive.ProductPreview.Index do @moduledoc false use TodoplaceWeb, live_view: [ layout: "live_photographer" ] import TodoplaceWeb.GalleryLive.Shared import TodoplaceWeb.Shared.StickyUpload, only: [sticky_upload: 1] alias Todoplace.{Galleries, Repo} alias TodoplaceW...
0a420a58a749adf5537cf64530208fb1fec73ba1
2,547
[ 417301519 ]
[ "test" ]
defmodule WebScraperTest do alias Floki alias Services.WebScraper import Tesla.Mock use ExUnit.Case @url_with_no_tags "http://no-tags-here.com" @valid_url "http://example.com/" @invalid_url "this not is an html" @invalid_url_domain "http://this-just-is-a-failed-example.com" @valid_html """ <html>...
0a422ba9b614d122203f24c62580ca211fa6080e
4,167
[ 117152883 ]
[]
## Examples # iex> Calc.eval("5 * 1") # 5 ## The loop to repeatedly print a prompt, read one line, eval it, and print the result comes from Professor Nat's notes: ## http://www.ccs.neu.edu/home/ntuck/courses/2018/01/cs4550/notes/07-elixir/rw.exs ## The basic idea of how to implement the calculator comes from: ## h...
0a4248ee6cfb1d0a4170ba9819325b8faec1e048
2,519
[ 588226575, 980529497, 930000513 ]
[]
import Config # Configure your database config :supavisor, Supavisor.Repo, username: "postgres", password: "postgres", hostname: "localhost", database: "supavisor_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache and enable # debu...
0a424e6e6bb4fa2dc968eae34536cb79393e1eac
2,157
[ 949664843 ]
[ "genserver", "typespec", "documented" ]
defmodule Raxol.Terminal.Capabilities.Manager do @moduledoc """ Manages terminal capabilities including detection, negotiation, and caching. """ use GenServer alias Raxol.Terminal.Capabilities.Types @type state :: Types.t() @doc """ Starts the capabilities manager. """ @spec start_link(keyword()...
0a42cb1766bc64503bea54b0d123a50ce0251805
1,555
[ 723282504 ]
[ "genserver", "documented" ]
defmodule Esad.HttpPollerEndpoint do @moduledoc """ Get value from remote endpoint on a fixed interval """ use GenServer require Logger def start_link(opts) do {name, arg} = Keyword.pop(opts, :name, __MODULE__) GenServer.start_link(__MODULE__, arg, name: name) end @doc """ Trigger an imme...
0a42e04932c04cd1dd7134c14bbcffcf33785552
2,581
[ 451076019 ]
[ "typespec", "documented" ]
defmodule AppGen.InputArguments.Utils do @moduledoc false require Logger @spec crud_fields_from_opts(keyword) :: [String.t()] def crud_fields_from_opts(crud_options) do crud_options |> Keyword.values() |> Enum.flat_map(&Keyword.keys(&1)) |> Enum.map(&to_string/1) |> Enum.uniq() end @s...
0a440d685b6e0f4942131610b36e17e437177b07
1,738
[ 498675807 ]
[ "typespec" ]
defmodule Payscape do alias Payscape.CreateTransaction alias Payscape.Request import SweetXml @spec process_payment(float, map, map) :: {:ok, String.t()} | {:error, map} def process_payment(amount, source, processor) do req = CreateTransaction.request(amount, source, processor) |> XmlBuilder....
0a44559295989434b3b95320c3e36462185ab848
3,306
[ 388016034 ]
[ "test", "phoenix" ]
defmodule EmployeesApiWeb.EmployeeControllerTest do use EmployeesApiWeb.ConnCase import EmployeesApi.ManagementFixtures alias EmployeesApi.Management.Employee @create_attrs %{ dob: ~D[2023-04-12], email: "some email", first_name: "some first_name", last_name: "some last_name", permanent: ...
0a457dcc7d53a67fef160d3ef5485c8b1e6f263d
1,597
[ 165997818 ]
[]
# Import ontology data into the database # # Usage: # mix run import_ontology.exs <json-file-ontology> # # where <json-file-ontology> is a JSON file containing ontology data # with the following structure: # { # "<endpoint-name>": { # { # "description": "some text description.", # "<ontology-name>...
0a45bd22b0fc05c08ad59dca8569cfc15c82469f
1,869
[ 829367455 ]
[ "test", "ecto" ]
defmodule Chat.ContentTest do use Chat.DataCase alias Chat.Content describe "posts" do alias Chat.Content.Post import Chat.ContentFixtures @invalid_attrs %{title: nil, body: nil} test "list_posts/0 returns all posts" do post = post_fixture() assert Content.list_posts() == [post] ...
0a463519782351a75907ba17c798e75351a95aae
2,755
[ 441600743 ]
[ "test", "phoenix" ]
defmodule MsWeb.ProductControllerTest do use MsWeb.ConnCase import Ms.InventoryFixtures alias Ms.Inventory.Product @create_attrs %{ name: "some name", price: 120.5, stock: 42, tax: 120.5 } @update_attrs %{ name: "some updated name", price: 456.7, stock: 43, tax: 456.7 } ...
0a46bee392cb9561fa02491b664b735df05fc4cc
3,889
[ 15270935 ]
[]
defmodule ApathyDrive.Match do def all(list, match_level, string) do case string_number(string) do {string, nil} -> case match_all(list, match_level, string) do [] -> nil [match] -> match matches -> matches end {strin...
0a474903ed9b44910449454027e3daed2ebb0360
18,968
[ 69304319 ]
[ "phoenix" ]
defmodule Sas.OrderController do use Sas.Web, :controller alias Sas.Order alias Sas.LineOrder alias Sas.Category alias Sas.Product alias Sas.Table alias Sas.User alias Sas.OrderChannel alias Sas.DeliveryOrderChannel alias Sas.DeliveryOrder alias Sas.Transaction def index(conn, _params) do ...
0a47f5d1b07c28c1e3a76122205a0cb45e8da6d0
10,158
[ 922960360 ]
[ "typespec", "documented" ]
defmodule KafkaEx.Protocol.Metadata do alias KafkaEx.Protocol import KafkaEx.Protocol.Common @supported_versions_range {0, 1} @default_api_version 0 @moduledoc """ Implementation of the Kafka Heartbeat request and response APIs """ defmodule Request do @moduledoc false defstruct topic: nil ...
0a4824f959519c4e2095d768ec566c3c63a5cc7c
3,414
[ 123435156 ]
[]
defmodule Huffman do def sample do 'the quick brown fox jumps over the lazy dog this is a sample text that we will use when we build up a table we will only handle lower case letters and no punctuation symbols the frequency will of course not represent english but it is probably not that far off' end def text...
0a4829e6107543843376a7b03097c2b9383d8ce8
7,379
[ 92519184 ]
[]
defmodule Routemaster.Drain.ExampleAppSpec do use ESpec use Plug.Test import Routemaster.TestUtils alias Routemaster.Drain.ExampleApp, as: App alias Routemaster.Drain.Event alias Routemaster.Config alias Routemaster.Cache alias Plug.Conn @opts App.init([]) # Use this as the URL of the events, so ...
0a483bea006a79fc128f922ffe3fc3d8ec261f55
2,104
[ 589055635 ]
[]
defmodule SSBU.Ability do require SSBU.Constants, as: Constants @ability_file Path.join(__DIR__, "../../ability.csv") @external_resource @ability_file @ability_map @ability_file |> File.read!() |> String.split("\n") |> Stream.reject(&match?("#" <> _, &1)) ...
0a48614e418f2a84a6b5df19556f701cf950ec83
1,827
[ 122956972 ]
[ "test" ]
defmodule OAuth2.Strategy.ClientCredentialsTest do use ExUnit.Case, async: true use Plug.Test alias OAuth2.Strategy.ClientCredentials alias OAuth2.Client import OAuth2.TestHelpers setup do server = Bypass.open client = build_client(strategy: ClientCredentials, site: bypass_server(server)) {:ok...
0a48ae00748747a6ef2f48fb9ca4e2d2131f3955
2,793
[ 220381759 ]
[]
defmodule Day12 do def real_input do Utils.get_input(12, 1) end def sample_input do """ cpy 41 a inc a inc a dec a jnz a 2 dec a """ end def sample_input2 do """ """ end def sample do sample_input |> parse_input1 |> solve1 end def part1 do ...
0a48ae0d85bcd898ab7cc9c4b1e17cb80cbe2b76
4,164
[ 108429706 ]
[ "documented", "ecto" ]
defmodule QuizSite.Questions do @moduledoc """ The Questions context. """ import Ecto.Query, warn: false alias QuizSite.Repo alias QuizSite.Questions.Choice @doc """ Returns the list of choices. ## Examples iex> list_choices() [%Choice{}, ...] """ def list_choices do Repo.all...
0a49036a245a394842e069b0207c71be7f42ae56
4,062
[ 992714284 ]
[ "typespec", "macro", "documented" ]
defmodule Vancouver.Tool do @moduledoc """ Tools enable LLMs to perform actions. You can implement a tool as follows: defmodule MyApp.Tools.CalculateSum do use Vancouver.Tool def name, do: "calculate_sum" def description, do: "Add two numbers together" def input_schema do...
0a49185e167806ba1717164d26801c1e7395967e
1,529
[ 192265045 ]
[ "test" ]
defmodule BankingAppWeb.API.UserControllerTest do use BankingAppWeb.ConnCase alias BankingApp.Accounts import BankingApp.Factory setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end describe "register user" do @tag :web test "should create and return use...
0a4a13485a4450ecdff22f1a1ba48e5ae13579b3
4,843
[ 40983173 ]
[]
defmodule NifNotLoadedError do defexception message: "nif not loaded" end defmodule RustlerTest do defmodule Helper do @nif_version Version.parse!("#{:erlang.system_info(:nif_version)}.0") def nif_feature_from_running_version() do "nif_version_#{@nif_version.major}_#{@nif_version.minor}" end ...
0a4af4ecaec2541eaa1f08b09346203916583469
2,450
[ 988634206 ]
[ "documented" ]
defmodule NBA.Stats.TeamGameLog do @moduledoc """ Provides functions to interact with the NBA stats API for TeamGameLog. See `get/2` for parameter and usage details. """ @moduledoc since: "0.1.0" require NBA.Utils NBA.Utils.def_get_bang(__MODULE__) @endpoint "teamgamelog" @accepted_types %{ S...
0a4b61c50a360d31c090394a412c0774e40c7d7d
2,762
[ 885191011 ]
[ "genserver" ]
defmodule Brainworms.Knob do use GenServer alias Circuits.GPIO require Logger def start_link(opts \\ []) do GenServer.start_link(__MODULE__, opts, name: __MODULE__) end @impl true def init(_opts) do case {GPIO.open("GPIO17", :input), GPIO.open("GPIO18", :input)} do {{:ok, pin_a}, {:ok, pi...
0a4c66a5db527fdffd0be06bc206aa7c6d00c012
2,501
[ 691044038 ]
[ "test", "phoenix" ]
defmodule AppphoenixWeb.PessoaControllerTest do use AppphoenixWeb.ConnCase import Appphoenix.PessoasFixtures alias Appphoenix.Pessoas.Pessoa @create_attrs %{ name: "some name", description: "some description" } @update_attrs %{ name: "some updated name", description: "some updated descrip...
0a4c9a0faba1b4f61552fabea89de299fb14ac13
4,244
[ 102583023 ]
[]
defmodule TrendFollowingData.Sina.Decode do @javascript "var xh5_S_KLC_D=function(t){var e,n,i,r,o,a,s,l=86400000,c=7657,u=[],h=[],d=~(3<<30),f=1<<30,p=[0,3,5,6,9,10,12,15,17,18,20,23,24,27,29,30],g=Math,v=function(){var l,c;for(l=0;64>l;l++){h[l]=g.pow(2,l),26>l&&(u[l]=m(l+65),u[l+26]=m(l+97),10>l&&(u[l+52]=m(l+48))...
0a4d237e4712a597bb42ffec69afee2a244aac7a
20,075
[ 792989159 ]
[ "test" ]
defmodule CompilerTest do alias Monkex.Parser alias Monkex.Compiler alias Monkex.Lexer alias Monkex.Opcode alias Monkex.Instructions alias Monkex.Object.CompiledFunction alias Monkex.Container.ArrayList use ExUnit.Case, async: true def assert_instructions(actual, expected_list) do concatted = In...
0a4d79d4637b1e889d90e832693140aaa19ae681
2,970
[ 95421027 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # defmodule Cryptofolio.Seeder.CoinList do def extract_coins_from_coinlist(%{ "Response" => "Success", "Data" => data }) do coins = data |> Enum.map(fn { _, coin } -> %{ id: ...
0a4da144b32d9ed07e9a66de4f9688d64d79511d
4,295
[ 91157211 ]
[ "macro", "documented" ]
defmodule Credo.Code.Strings do @moduledoc """ This module let's you strip strings from source code. """ @sigil_delimiters [{"(", ")"}, {"[", "]"}, {"{", "}"}, {"<", ">"}, {"|", "|"}, {"\"", "\""}, {"'", "'"}] @all_string_sigils Enum.flat_map(@sigil_delimiters, fn({b, e}) -> ...