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
0a6bdd5500206f13cde3214e75f613471199622e
8,113
[ 949664843 ]
[ "documented" ]
defmodule Raxol.Core.Plugins.Core.NotificationPlugin do import Raxol.Guards @moduledoc """ Core plugin responsible for handling notifications (:notify). Relies on an implementation of Raxol.System.Interaction for OS interactions. """ require Raxol.Core.Runtime.Log @behaviour Raxol.Core.Runtime.Plugins....
0a6c221e5f8ee90ae3d982a5a0cf658d4577d38c
15,131
[ 334387837 ]
[ "genserver", "typespec", "supervisor", "documented" ]
defmodule Teiserver.Battle.MatchMonitorServer do @moduledoc """ The server used to monitor the autohosts and get data from them """ use GenServer alias Teiserver.{Account, Room, Client, CacheUser, Battle, Telemetry} alias Teiserver.Lobby.ChatLib alias Phoenix.PubSub alias Teiserver.Account.CalculateSmur...
0a6d006eb6b40bca96aa3959861e5a94b0e2e02e
4,950
[ 795975375 ]
[ "typespec", "macro", "documented" ]
defmodule SagaWeaver.SagaBehaviour do @moduledoc false @callback entity_name() :: atom() @callback started_by() :: [module()] @callback identity_key_mapping() :: %{module() => (term() -> map())} @callback handle_message(SagaWeaver.SagaSchema.t(), any()) :: {:ok, SagaWeaver.SagaSchema.t()} | {:er...
0a6da98fa47c361502818ec39fbb0c7c0ea66497
6,361
[ 237314020 ]
[ "documented" ]
defmodule EllipticCurve.PublicKey do @moduledoc """ Used to convert public keys between struct and .der or .pem formats. Functions: - toPem() - toDer() - fromPem() - fromPem!() - fromDer() - fromDer!() """ alias __MODULE__, as: PublicKey alias EllipticCurve.Utils.{Der, BinaryAscii} alias Ell...
0a6daa6fccecec2f6bd295bb62f14e4b5c500d6c
2,110
[ 227685427 ]
[ "documented", "ecto" ]
defmodule Nordref.Clubs do @moduledoc """ The Clubs context. """ import Ecto.Query, warn: false alias Nordref.Repo alias Nordref.Clubs.Club alias Nordref.Users.User @doc """ Returns the list of clubs. ## Examples iex> list_clubs() [%Club{}, ...] """ def list_clubs do query ...
0a6e6aae0dd563305ae7b19546fd883b755de60d
2,849
[ 897380767 ]
[]
defmodule Resonance do def map_antennae_locations(matrix) do Enum.with_index(matrix) |> Enum.map(fn {row, y} -> Enum.with_index(row) |> Enum.map(fn {value, x} -> {value, {x, y}} end) end) |> List.flatten() |> Enum.filter(fn {value, _} -> value != "." end) |> Enum.reduce(%{}, fn {value, l...
0a6e99b364797c5ce744f5cdf1fddcbadc64a396
1,838
[ 442846406 ]
[ "macro", "documented", "phoenix" ]
defmodule ElixiveryWeb 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 ElixiveryWeb, :controller use ElixiveryWeb, :view The definitions below will be executed for every view, contro...
0a6ef4a973aa79afcebf35bd0965364560248357
1,625
[ 573490081 ]
[]
defmodule Day05.PartOne do def complete_rows(graph) do max_len = Enum.max_by(graph, &length(&1)) |> length() Enum.map(graph, fn g when length(g) < max_len -> g ++ List.duplicate(" ", max_len - length(g) + 1) g -> g end) end def run(crates, [[]]) do crates |> Enum.to_list() |>...
0a6f44bc11e354aec275752e57b788db75ee7fc5
11,735
[ 454414468, 441483209 ]
[]
defmodule Q19 do def read_and_parse(filename) do # read file {:ok, data_str} = File.read(filename) data_str |> String.split("\n\n", trim: true) |> Enum.with_index() |> Enum.map(fn {l, i} -> beacons = l |> String.split("\n", trim: true) # remove header |> ...
0a6ff0757b0587e14eaa914c5b8dd332abe0e3ca
6,555
[ 330273581 ]
[ "genserver", "typespec", "documented" ]
defmodule BMP280 do use GenServer require Logger alias BMP280.{Calc, Comm, Measurement, Transport} @sea_level_pa 100_000 @default_bmp280_bus_address 0x77 @polling_interval 1000 @typedoc """ The type of sensor in use If the sensor is unknown, then number in the parts ID register is used. """ @t...
0a70476ad0c5a39a665ad567b3603ce1bebd55c3
1,868
[ 578552110 ]
[ "typespec", "documented" ]
defmodule SmsRouter.RedisManager do @moduledoc false @spec get(binary) :: map()| list(map()) | {:error, binary} def get(key) when is_binary(key), do: command(["GET", key]) |> check_get(key) @spec check_get({:ok, nil} | {:ok, map()} | {:error, term()}, term()) :: {:error, :not_found} | map() | list(map()) | {:...
0a7079f8da9df092467ac9477a74851a7c5bc165
2,722
[ 134580831 ]
[ "test" ]
defmodule OwaygoWeb.Location.CreateTest do use OwaygoWeb.ConnCase alias Owaygo.User alias Owaygo.Location alias Owaygo.Test.VerifyEmail alias Owaygo.Tag alias Ecto.DateTime @username "nkaffine" @fname "Nick" @lname "Kaffine" @email "<EMAIL>" @name "Chicken Lou's" @lat 67.1292491 @lng 156.91...
0a710682e5c0a52c66e11b9fbe8aa0541aad6367
1,950
[ 979306895 ]
[ "genserver", "supervisor", "documented" ]
defmodule SupermarketsChain.CartsManagement.Manager do @moduledoc """ Server that's dedicated to managing shopping carts It deals with spawning shopping carts and managing the mapping between UUIDs and the PID """ use GenServer alias SupermarketsChain.CartsManagement.Cart defstruct supervisor_pid: nil...
0a71258c1df9e85ca2889dd64ffb0f316b399219
1,630
[ 329100729, 329102144 ]
[ "macro", "documented", "phoenix" ]
defmodule LandingWeb 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 LandingWeb, :controller use LandingWeb, :view The definitions below will be executed for every view, controller, ...
0a71479a3996e568de18659c3d99d6813a5c4e8d
2,180
[ 54816707 ]
[ "test" ]
defmodule AcceptanceTestRecord do defstruct accepts_terms: false use Vex.Struct validates :accepts_terms, acceptance: true end defmodule CustomAcceptanceTestRecord do defstruct accepts_terms: false use Vex.Struct validates :accepts_terms, acceptance: [as: "yes"] end defmodule AcceptanceTest do use ExU...
0a717db38f06e3378e40bd7a172a0552b06b8a0c
3,401
[ 607729034 ]
[ "ecto" ]
defmodule OperatelyEmail.Emails.GoalCheckInEmail do import OperatelyEmail.Mailers.ActivityMailer alias Operately.Goals.Update alias Operately.Goals.Update.Permissions alias OperatelyWeb.Paths alias __MODULE__.OverviewMsg def send(person, activity) do update_id = activity.content["update_id"] {:o...
0a719c7909bdda20bf68d1a19990f565d442df38
1,872
[ 383871014 ]
[ "documented" ]
defmodule Tutorial do @moduledoc """ Documentation for `Tutorial`. """ @doc """ Hello world. ## Examples iex> Tutorial.hello() :world """ def hello do :world end def formalisation(var) do if var == [] do var else [var] = var |> Floki.attribute("content") ...
0a71eb0cb9f93373d87c6d7dc8c1fd2f1c4a7983
2,012
[ 225468126 ]
[]
defmodule Day12 do def energy(positions, cycle) do moons = step(Enum.map(positions, fn(position) -> {position, {0,0,0}} end), cycle) Enum.sum(Enum.map(moons, fn({{x,y,z},{vx,vy,vz}}) -> (abs(x)+abs(y)+abs(z))*(abs(vx)+abs(vy)+abs(vz)) end)) end def step(moons, cycle \\ 1) def step(...
0a72986c0b54c8344ef9af5a0532f06dc894325d
12,374
[ 127458443 ]
[ "test" ]
defmodule CalendarRecurrence.RRULETest do use ExUnit.Case, async: true alias CalendarRecurrence.RRULE doctest CalendarRecurrence.RRULE test "parse/1" do {:ok, %RRULE{freq: :daily}} = RRULE.parse("FREQ=DAILY") {:ok, %RRULE{freq: :daily, until: ~U[2018-01-02 10:20:30Z]}} = RRULE.parse("FREQ=DAILY;...
0a734f1d779d2490fd5881450dda9761dcfb9e6e
3,091
[ 602525342 ]
[ "documented" ]
defmodule FileParser do @moduledoc """ A module that provides functions to parse job offers and job descriptions from CSV files. ## Public functions * `get_job_offers/0`: Reads the job offers from `technical-test-jobs.csv` and returns the job offers as a list of tuples. * `get_job_descriptions/0`: Re...
0a735e8cb0fc0d6fd965074f93b46fc4a8c7254b
19,046
[ 394290937 ]
[ "test" ]
defmodule Blockfrost.Cardano.TransactionsTest do use Blockfrost.Case alias Blockfrost.Cardano.Transactions alias Blockfrost.HTTPClientMock alias Blockfrost.Response.{ SpecificTransactionResponse, TransactionUTXOsResponse, TransactionStakeAddressCertificatesResponse, TransactionDelegationCertif...
0a737345325b0d1af27a94a4e687248c122050cb
1,940
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p2beta1_SpeechTranscription do @moduledoc """ A speech recognition result corresponding to a portion of the audio. ## Attributes * `alternatives` (*type:* `list(GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p2b...
0a741ac08d443637572f3c1b524628860463cba7
2,856
[ 666383352 ]
[ "typespec", "documented" ]
defmodule Pong.WireSchema.Json.Match do @moduledoc """ Contracts and marshaling of match state. """ @type xy() :: %{x: number(), y: number()} @type ball() :: %{ geometry: %{center: xy(), radius: number()}, velocity: xy() } @type pad() :: %{ geometry: %{center: xy(), ...
0a754c074081b777fdfceaf801a649977f9ea9c9
2,040
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Migrations.BxPersonsScoresTrack do @moduledoc """ Migration para criar e remover a tabela bx_persons_scores_track. """ alias DeeperHub.Core.Data.Repo alias DeeperHub.Core.Logger require DeeperHub.Core.Logger @doc """ Cria a tabela de bx_persons_scores_track. """ def u...
0a7605e45f24ba10e6e47e514e1842d2c6254072
1,614
[ 803220881 ]
[ "typespec", "documented" ]
defmodule RandomWord.RandomWordVectorFast do @moduledoc """ Solving like https://github.com/groovemonkey/go-elixir-benchmark/tree/master did. ``` Name ips average deviation median 99th % 5_words_vec 598807.57 1.67 μs ±1126.75% 1.51 μs 2....
0a7651c52a90fb6a3b815b18814d60294f4f7fbe
14,261
[ 738081083 ]
[ "test" ]
defmodule Telephony.ServerTest do use ExUnit.Case alias Telephony.Core.{Call, Postpaid, Prepaid, Recharge} alias Telephony.Server setup do process_name = :test {:ok, server_pid} = Server.start_link(process_name) payload = %{full_name: "John Doe", phone: "123456789", type: :prepaid} %{server_pid...
0a768c621dadfd66ce3918b801cd16416484ac37
7,291
[ 239495747 ]
[]
%{ "artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm", "514586f4312ef3709a3ccbd8e55f69455add235c1729656687bb781d10d0afdb"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "2.1.0", "84810266a9b5c6345624e335e4091556d45c876a5a1957b0d67800a1e8fd75...
0a772cd3e9aace6b5d15b85d883bc6724f2ca00f
1,901
[ 95790202 ]
[]
# 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 # Configures the endpoint config :askbywho, Askbywho.Endpoint, url: [host: "localho...
0a7778f4c060ca683e51ac38bed3fb79c86bfca1
2,122
[ 550796194 ]
[ "phoenix" ]
defmodule BorutaAdminWeb.ScopeController do use BorutaAdminWeb, :controller import BorutaAdminWeb.Authorization, only: [ authorize: 2 ] alias Boruta.Ecto.Admin alias Boruta.Ecto.Scope @protected_scopes [ "users:manage:all", "clients:manage:all", "identity-providers:manage:all", ...
0a779c559fb83cd77f5b6626476198164232c5ac
6,283
[ 384124160 ]
[]
#!/usr/bin/env elixir Mix.install([:yaml_elixir, :jason]) defmodule Script do @alines "exercises/answers.tex" @base_feedback_url "https://www.asjo.dk/teaching/oop/feedback?params=" def collect_common_data() do # hostname {:ok, cl} = :inet.gethostname() hostname = List.to_string(cl) # username ...
0a77bdc480cda04c3d50b6c866a954e375333b15
1,586
[ 143077854 ]
[ "documented" ]
defmodule ExLimiter.Storage.PG2Shard do @moduledoc """ Implements the leaky bucket using a fleet of GenServers discoverable via a pg2 group. To configure the pool size, do: ``` config :ex_limit, ExLimiter.Storage.PG2Shard, shard_count: 20 ``` You must also include the shard supervisor in your app...
0a7806aced76a0d12f09ee19f938e07cff1aa627
1,637
[ 176436777 ]
[ "macro", "documented", "phoenix" ]
defmodule MateriaChatWeb 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 MateriaChatWeb, :controller use MateriaChatWeb, :view The definitions below will be executed for every view, ...
0a783a28c2bcdeb08948640cbe5601b2e8428bc5
1,654
[ 144346276 ]
[]
defmodule CoAP.Phoenix.Conn do # @behaviour Plug.Conn.Adapter alias CoAP.Message def conn(req) do %{ path: path, host: host, port: port, method: method, headers: headers, qs: qs, peer: {remote_ip, _}, owner: owner } = req # Must be Plug.Conn for Phoen...
0a785a9d17f851e734b0b0f79c8e406edb99fcd2
1,911
[ 75117660 ]
[ "documented" ]
defmodule HedwigSimpleResponders.JonyIve do @moduledoc """ A random collection of Jony Ive words mashed together. Credit to @bloodyowl for the Jony Ive bullshit generator from which some phrases have been included. """ use Hedwig.Responder @usage """ `jony me` - Get some gold from Jony Ive `jony def...
0a79d005ef542550f028b51356de41badd9b73ea
2,506
[ 897959614 ]
[]
defmodule Year2024.Day21.Numpad do @numpad [ {"7", ["4", "8"]}, {"8", ["7", "5", "9"]}, {"9", ["6", "8"]}, {"4", ["1", "7", "5"]}, {"5", ["2", "4", "6", "8"]}, {"6", ["3", "5", "9"]}, {"1", ["2", "4"]}, {"2", ["0", "1", "3...
0a7a1ab8562e9067efee84e6e07452945ef457a0
2,252
[ 562772988 ]
[]
defmodule Y2022.Day12 do def part1(input) do state = init_state(input) state = move(state, MapSet.new([state.initial])) state.moves end def part2(input) do state = init_state(input) state.nodes |> Enum.filter(&(elem(&1, 1) == ?a)) |> Enum.map(&move(state, MapSet.new([&1]))) |> En...
0a7a384b0e897deb7850f708373f73b80cf55b57
2,061
[ 260359165 ]
[ "phoenix" ]
defmodule FaithfulWordApi.SignupController do import FaithfulWord.Mailer use FaithfulWordApi, :controller alias FaithfulWord.Accounts alias FaithfulWord.Accounts.Admin alias FaithfulWordApi.Guardian # require Ecto.Query # require Logger plug :scrub_params, "signup" when action in [:create] def ne...
0a7a84ae09559fa33ad93543083818ac2e1dade4
4,626
[ 840004582 ]
[ "test", "phoenix" ]
defmodule SyncTest do # We don't use Sync.DataCase because want to automatically manage connections. use Sync.DataCase alias Sync.Todo.Item @moduletag cleanup: ["items"] describe "items" do test "sets _snapmin on insertion" do item = Repo.insert!(%Item{name: "study"}) assert is_integer(item....
0a7abbc7e3ea1e1d91b1a2171e1a1eaaf9e1b4c5
5,081
[ 270220179 ]
[ "liveview" ]
defmodule TunezWeb.Albums.FormLive do use TunezWeb, :live_view def mount(%{"id" => album_id}, _session, socket) do album = Tunez.Music.get_album_by_id!( album_id, load: [:artist, :tracks], actor: socket.assigns.current_user ) form = Tunez.Music.form_to_update_albu...
0a7b5c2fa0246760eeda8c2b749467877676f765
2,075
[ 112161305 ]
[ "test" ]
defmodule Yacto.Migration.UtilTest do use PowerAssert test "マイグレーションディレクトリの確認" do expected = Path.join([File.cwd!(), "_build", "test", "lib", "yacto", "priv", "migrations"]) assert expected == Yacto.Migration.Util.get_migration_dir(:yacto) expected = Path.join(["priv", "migrations"]) assert expect...
0a7bbcdd6f40faaa4c861b94c696623e29af4520
1,540
[ 93142373 ]
[ "macro", "documented", "phoenix" ]
defmodule ChessApp.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use ChessApp.Web, :controller use ChessApp.Web, :view The definitions below will be executed for every view, controller, etc, so keep them ...
0a7bffdca4779902a846dc8892e3a5a2fbe2936f
2,439
[ 144164839 ]
[ "typespec" ]
defmodule Acceptor.Connection.Handshakes do def child_spec(_) do %{ id: __MODULE__, type: :supervisor, start: {Task.Supervisor, :start_link, [[name: __MODULE__, strategy: :one_for_one, max_restarts: 0]]} } end def recv(socket) do case start_task(fn -> do_recv(socket...
0a7d274329f299e3917d0e261fa87560ae5f649a
2,629
[ 524240907 ]
[]
defmodule Main do use Application def start(_, _) do run() {:ok, self()} end def run() do {:ok, arr} = load_data() {_, all_names} = List.keyfind(arr, :all_names, 0) {_, female_name_list} = List.keyfind(arr, :female_name_list, 0) {_, male_name_list} = List.keyfind(arr, :male_name_list,...
0a7d2d0444299b390e5ce2f508becc48e0e288d8
2,263
[ 897645950 ]
[]
defmodule Topography do def count_paths(input) do matrix = read_as_matrix(input) top_map = read_as_map(matrix) starts = find_starts(top_map) starts |> Enum.map(fn start -> move_up_in_all_directions(top_map, start) end) |> Enum.map(fn start -> length(start) end) |> IO.inspect() |> Enu...
0a7d65803abe3e0ddb40ef9ecc9ea9a1f2d85b5e
15,827
[ 564359760 ]
[ "liveview" ]
defmodule HydepwnsLiveviewWeb.HomeLive do use HydepwnsLiveviewWeb, :live_view alias HydepwnsLiveview.ThemeSystem alias HydepwnsLiveview.Content import HydepwnsLiveviewWeb.Components.Common.ThemeToggle, only: [theme_toggle: 1] import HydepwnsLiveviewWeb.Components.UI.DebugGrid, only: [debug_grid: 1] import ...
0a7df7ad2f6fc80550d744d1190b06a4e42c8b48
3,213
[ 899692779 ]
[ "typespec", "documented" ]
defmodule NervesFlutterSupport.BuildFlutterApp do @moduledoc """ A Mix release module that can be included into a parent mix project. This takes care of packing up all the flutter assets in a project. It also aids in compiling them into an AOT application for optimal perf on the target. """ alias NervesFlu...
0a7e20081d44889ba73d87e11d12a530ef5d0f1a
10,992
[ 50945543 ]
[]
%{ "calendar": {:hex, :calendar, "1.0.0", "f52073a708528482ec33d0a171954ca610fe2bd28f1e871f247dc7f1565fa807", [:mix], [{:tzdata, "~> 0.5.20 or ~> 0.1.201603 or ~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "990e9581920c82912a5ee50e62ff5ef96da6b15949a2ee4734f935fdef0f0a6f"}, "certifi": {:hex, :...
0a7e354b84e22c4677fe0d3768ab18691dfd5e47
2,002
[ 542493175 ]
[ "documented" ]
defmodule Kanta.Translations.Messages.Finders.GetMessage do @moduledoc """ Query module aka Finder responsible for finding gettext message """ use Kanta.Query, module: Kanta.Translations.Message, binding: :message alias Kanta.Cache alias Kanta.Repo alias Kanta.Translations.Message def find(pa...
0a7edf820e2ad95109cbeae554f9c2bc16ae089b
1,904
[ 266674164 ]
[ "macro", "documented", "phoenix" ]
defmodule IncomingWeb 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 IncomingWeb, :controller use IncomingWeb, :view The definitions below will be executed for every view, controlle...
0a7f2a1cc3fcb7b0eed23e0bb08a6f6653e47acc
4,419
[ 723942909 ]
[ "test", "documented" ]
defmodule CastingHandler do @moduledoc """ """ def handle_true(_original_binary, start_index, end_index, acc) when start_index <= end_index do update_acc(true, acc) end def handle_false(_original_binary, start_index, end_index, acc) when start_index <= end_index do update_acc(false, acc) end de...
0a7f397799b040df52c470cd16cc0751148eeaf1
2,744
[ 434375183, 475642215 ]
[ "typespec", "documented" ]
defmodule Lanyard.Gateway.Utility do @spec normalize_atom(atom) :: String.t() def normalize_atom(atom) do atom |> Atom.to_string() |> String.downcase() |> String.to_atom() end @doc "Build a binary payload for discord communication" @spec payload_build(number, map, number, String.t()) :: binary def payl...
0a7f598cb011d67c49ef9677e79dd5af761c0edc
1,763
[ 973282597, 912281404 ]
[ "liveview", "phoenix" ]
defmodule PhoenixmazeWeb.Endpoint do use Phoenix.Endpoint, otp_app: :phoenixmaze # Add this before the LiveView socket plug Plug.Static, at: "/", from: :phoenixmaze, gzip: false, only: ~w(assets fonts images videos favicon.ico robots.txt) @session_options [ store: :cookie, key: "_...
0a7fb205c603c29bbd95f9912196ff9c2961355f
2,581
[ 49213530 ]
[]
# 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 # Configures the endpoint config :field_publication, ...
0a802c2291274bea85c73c7b146e2a8505f19841
5,123
[ 917609177 ]
[ "test", "documented" ]
defmodule DialecticWeb.GraphCreationTest do use DialecticWeb.ConnCase, async: true alias Dialectic.DbActions.Graphs alias Dialectic.Repo alias DialecticWeb.FocusLive @moduledoc """ Tests for handling apostrophes in graph titles, particularly with titles like "Shakespeare's Macbeth". """ describe "grap...
0a80637b7c9b3a28469c59be18b0563b78c497a0
2,145
[ 118441647, 781779646, 50830234, 128190441, 148690769 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Nectar.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Nectar.Web, :controller use Nectar.Web, :view The definitions below will be executed for every view, controller, etc, so keep them short ...
0a80848c2bb2524ceddf6bd6bc5f5e665fea8d7e
6,200
[ 69476869 ]
[ "genserver", "typespec", "macro", "documented" ]
defmodule Bluex.DBusDiscovery do @dbus_name Application.get_env(:bluex, :dbus_name) || "org.bluez" @iface_dbus_name Application.get_env(:bluex, :iface_dbus_name) || "org.bluez.Adapter1" @device_dbus_name Application.get_env(:bluex, :device_dbus_name) || "org.bluez.Device1" @dbus_bluez_path Application.get_env(:...
0a80d38b000b641f2d5d10ed893aba881cbeec29
1,558
[ 744740332 ]
[ "phoenix", "ecto" ]
defmodule VolkoWeb.PageController do use VolkoWeb, :controller alias Volko.Pages.Page alias Volko.Pages def home(conn, _params) do # The home page is often custom made, # so skip the default app layout. pages = Pages.retrieve_pages() posts = [ %{title: "AEAEAEAS"}, %{title: "AEAE...
0a833afcb62a0e1f99404084dc7ca975cb7291ed
1,890
[ 892691198 ]
[]
# 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: # # Slax.Repo.insert!(%Slax.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail ...
0a83428388b814932bada22ce620563c7c443fe1
1,723
[ 104136333, 104136859 ]
[]
defmodule Server do # function to generate random string with gatorlink id appended def randomstr(length \\ 15) do Enum.join(["spahilwani;",:crypto.strong_rand_bytes(length) |> Base.encode64 |> binary_part(0, length)]) end # Generate hash for given string using SHA256 def hashfunction(str...
0a8361fb2a07790db54ebdcde0a1549b3ca25691
4,256
[ 204819707 ]
[ "test", "ecto" ]
defmodule BusiApi.AccountsTest do use BusiApi.DataCase alias BusiApi.Accounts describe "users" do alias BusiApi.Accounts.Users @valid_attrs %{email: "some email", encrypted_password: "some encrypted_password"} @update_attrs %{email: "some updated email", encrypted_password: "some updated encrypted_...
0a839098bc71b1854f0942f2776ee8f60aa2ee3e
2,688
[ 606310479, 472065292 ]
[ "test", "phoenix" ]
defmodule FarmWeb.Api.MilkControllerTest do use FarmWeb.ConnCase import Farm.ProductsFixtures alias Farm.Products.Milk @create_attrs %{ day: ~D[2022-02-28], milking_time: "some milking_time", volume: 120.5 } @update_attrs %{ day: ~D[2022-03-01], milking_time: "some updated milking_tim...
0a83e45dd10d80559e7c85e5a186e274d26c5d52
9,004
[ 57161303 ]
[ "genserver", "test", "supervisor", "phoenix" ]
Code.require_file "../../support/ranch_tcp_client.exs", __DIR__ defmodule PhoenixTCP.Integration.RanchTCPTest do use ExUnit.Case import ExUnit.CaptureLog alias PhoenixTCP.RanchTCPClient alias Phoenix.Socket.Message alias __MODULE__.Endpoint @port 5801 Application.put_env(:phoenix, Endpoint, [ tcp_...
0a84d96fa098894650c3f5b87024994eab08c19a
4,778
[ 605026076 ]
[]
#model with a list of publication types defmodule GupAdmin.Model.PublicationType do def publication_types do [ %{ "publication_type_code" => "other", "publication_type_id" => 21, "publication_type_label" => "Annan publikation" }, %{ "publication_type_code" => "pu...
0a850ceb1982e01f009f95f6e84496a46c03622d
4,286
[ 141355265 ]
[ "test" ]
defmodule PrettyPrintFormatter.Ecto.SqlTokenizerTest do use ExUnit.Case alias PrettyPrintFormatter.Ecto.SqlTokenizer doctest SqlTokenizer describe "tokenize/1" do test "basic select statement" do assert SqlTokenizer.tokenize("SELECT * FROM users AS u0 WHERE u0.id = 5 LIMIT 10 OFFSET 50") == ...
0a85116927afbded4fb05e26b979b380262920d9
2,648
[ 650700339 ]
[ "phoenix" ]
defmodule Jetzy.User.Session do use Noizu.DomainObject @vsn 1.0 @sref "user-session" @persistence_layer :mnesia @persistence_layer :ecto #@permissions [{[:edit, :view], :user}, {[:view,:index], :restricted}] defmodule Entity do @nmid_index 124 @universal_identifier true Noizu.DomainObject.noiz...
0a85619f17021b4c2f7ad884f51bdbbee49a3a53
5,176
[ 281731052 ]
[]
defmodule MyAwesomeList.Spider do use Crawly.Spider use TypedStruct alias MyAwesomeList.Parser alias MyAwesomeList.Model.Category, as: C alias MyAwesomeList.Model.Repository, as: R alias MyAwesomeList.Fetcher.GqlReq alias Crawly.ParsedItem alias Crawly.Request require Logger @github_api_domain "a...
0a8564622cbbf367e21b82c3081b6ad8ba9ed5f7
1,596
[ 319141874 ]
[]
defmodule Ui.MixProject do use Mix.Project def project do [ app: :ui, version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: d...
0a85a48182da95aec2e767fd12a3f1a2baadf5bf
1,789
[ 126816699 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Careernet.Web do import Careernet.Session, only: [current_user: 1, logged_in?: 1] @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 Careernet.Web, :controller use Careernet.Web, :...
0a85b66911a24ec3b1d96b7212772e71418c2047
1,595
[ 97278468 ]
[]
defmodule Chatty.Web.Mixfile do use Mix.Project def project do [app: :chatty_web, version: "0.0.1", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.4", elixirc_paths: elixirc_paths(Mix.env)...
0a85e4b87dcd86c952f818906c28ba03081c5834
6,359
[ 110256460 ]
[]
%{"cachex": {:hex, :cachex, "2.1.0", "fad49b4e78d11c6c314e75bd8c9408f5b78cb065c047442798caed10803ee3be", [:mix], [{:eternal, "~> 1.1", [hex: :eternal, optional: false]}]}, "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []}, "connection": {:hex, :c...
0a86fcf30a0b724c58bb60a4581b1ab63b64a3ed
1,527
[ 227215894 ]
[]
import AOC aoc 2022, 13 do def p1(input) do input |> parse() |> Enum.map(&verify_order/1) |> Enum.with_index(1) |> Enum.reduce(0, fn {result, i}, acc -> if result do acc + i else acc end end) end @dividers [[[2]], [[6]]] def p2(input) do input ...
0a8741e1e980f282032e36e163229e99fcce91d4
2,099
[ 301551323 ]
[ "genserver" ]
defmodule SupercolliderCubes.ScSynth do use GenServer require Logger @command Application.fetch_env!(:supercollider_cubes, :sclang_path) # Client def start_link do result = GenServer.start_link(__MODULE__, :ok, name: __MODULE__) case result do {:ok, pid} -> send_command(pid, sc_init_...
0a8752781153b10b9c02ac36cf73d2bdf84913e0
6,441
[ 220055365 ]
[ "test" ]
defmodule TWITTERTest do use ExUnit.Case, async: false doctest TWITTER describe "Tweet" do test "if user tweets it is in their tweets list" do IO.puts("\n \n testing if user tweets it is in their tweets list") # have user1 tweet something sender = "isabel" tweet = "test tweet for #te...
0a8767f4891d57c145d8b506003a93a31106073a
12,081
[ 294066420 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, "cowboy": {:hex, :cowboy, "2.7.0", "91e...
0a87884c91348615dd3433a9a96eee81f9f8acb8
11,264
[ 98162506 ]
[ "documented" ]
defmodule Rebel.Element do @moduledoc """ HTML element query and manipulation library. All functions are based on the CSS selectors. `query/3` runs `document.querySelector` and returns selected properties of found HTML elements. `set_prop/3` is a general function for update elements properties. There are al...
0a885cdcee9480a2eb2ca3e1d015579bf88f0c9d
7,271
[ 564960087 ]
[ "typespec", "documented" ]
defmodule Rivet.Auth.Signin.Google do @moduledoc """ Google login scheme """ alias Rivet.Ident alias Rivet.Auth # TODO: # - pull imageUrl (tiff?) and converts it / uploads it into user's profile ############################################################################## # note: this is different ...
0a886ade42a9f845c966f296b9e4e6d598b53cff
1,590
[ 495598746, 576439248, 647999027 ]
[]
defmodule Products.MixProject do use Mix.Project def project do [ app: :products, version: "0.1.0", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), ...
0a887bb49eb0aaa47ed318dda3d2eebaa59a5f69
2,031
[ 433851838 ]
[ "test" ]
defmodule AdventOfCode.Day11Test do use ExUnit.Case import AdventOfCode.Day11 @input """ Monkey 0: Starting items: 79, 98 Operation: new = old * 19 Test: divisible by 23 If true: throw to monkey 2 If false: throw to monkey 3 Monkey 1: Starting items: 54, 65, 75, 74 Operation...
0a88c07ec5c7c77d22cfe2cedb006b776308657e
5,825
[ 96678765 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.5.3", "70bdd7e7188c804f3a30ee0e7c99655bc35d8ac41c23e12325f36ab449b70651", [:rebar3], [{:parse...
0a89aedebd12cf512e869c5e5d82970c31b803c9
4,570
[ 807904878, 887377354 ]
[ "typespec", "documented" ]
defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do require Logger alias Pleroma.Config @moduledoc "Detect new emojis by their shortcode and steals them" @behaviour Pleroma.Web.ActivityPub.MRF.Policy defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], []) defp shortcode_mat...
0a89c5af98510831e85f232f8162d7b6095a933e
2,267
[ 680243261 ]
[ "phoenix" ]
defmodule BookclubWeb.Router do use BookclubWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {BookclubWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do p...
0a8a4573e7eee7ce4636c277ad03f5066559b640
1,604
[ 306996172 ]
[ "test" ]
defmodule Astoria.Github.Api.V3.Repos.PullsTest do alias Astoria.{Github, Github.Api.V3.Repos.Pulls} use Astoria.DataCase setup do client = Github.Api.Client.new("123", "bearer") %{client: client} end describe "read_single/4" do test "with options", %{client: client} do assert %Github.Api....
0a8a6d6ae6f4a3207052d27aea6a982794aa5388
6,273
[ 669316422 ]
[]
defmodule Scrabble.Scoring do @dictionary :code.priv_dir(:scrabble) |> Path.join("scrabble_dictionary.txt") |> File.read!() |> String.split("\n") |> Enum.reject(fn w -> String.length(w) < 3 end) |> MapSet.new() @wildcard {"?", 0.5} @tile_to_le...
0a8a9f66e720aba3b9c583042c43e867098674d3
1,535
[ 121777516 ]
[ "macro", "documented", "phoenix" ]
defmodule EphemeraWeb 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 EphemeraWeb, :controller use EphemeraWeb, :view The definitions below will be executed for every view, controlle...
0a8aba39f54dc57aa0ca0aeaed38b3d9635f6f06
2,761
[ 52060371 ]
[ "documented" ]
defmodule Ideatap.Plugs.Auth do @moduledoc """ This Plug is responsible for authenticating a user that tries to access API endpoints. When a user signs-in or creates an account, they are assigned a token generated by `Phoenix.Token.sign/3`. The goal is to allow other controllers/plugs access to the user maki...
0a8b26960445e6db1e2e48d4a32c026ca17c322d
1,837
[ 559808544 ]
[ "documented" ]
defmodule ExWorkerbook.Plugins.Unwrap do @moduledoc """ ## Examples # unwrap a list into list of tuples iex> ExWorkerbook.Plugins.Unwrap.call([:a, :b]) [{:value, nil, :a, []}, {:value, nil, :b, []}] # unwrap a map key value pairs into a list of key, value tuples iex> ExWorkerbook.Plugins.Unwr...
0a8b5a7696cecf1a97023921ff6097a48a005737
1,552
[ 318092656 ]
[]
defmodule AdventDay13InputReader do def read() do read_input_file() |> String.trim() |> String.split("\n\n") |> Enum.flat_map(fn pairs -> pairs |> String.split("\n") |> Enum.map(fn liststr -> {result, _} = Code.eval_string(liststr) result end) end) end ...
0a8bcc323a4e38fcb93979e4a8468c708c527c5e
3,030
[ 62259025 ]
[ "macro", "documented" ]
defmodule Eecrit.ViewModel.Macros do defmacro def_view_model(name, keys, do: body) do defstruct_body = Enum.zip(keys, List.duplicate(nil, length(keys))) quote do defmodule unquote(name) do Module.put_attribute unquote(name), :required_keys, unquote(keys) Module.put_attribute unquote(name...
0a8bed1be4b85c83ac8d362d0f17ae271e45c6c3
9,666
[ 1008670264 ]
[ "documented" ]
defmodule EveDmv.Intelligence.SystemInhabitant do @moduledoc """ Tracks pilots present in wormhole systems within a chain. Provides real-time inhabitant tracking with threat assessment and historical presence data for chain-wide intelligence. """ use Ash.Resource, domain: EveDmv.Domains.Intelligence, ...
0a8c1b8b295f9d23031cf2477a78988ce375988a
3,490
[ 606416306 ]
[ "test", "ecto" ]
defmodule UndiOnline.AthletesTest do use UndiOnline.DataCase alias UndiOnline.Athletes describe "athletes" do alias UndiOnline.Athletes.Athlete import UndiOnline.AthletesFixtures @invalid_attrs %{emoji: nil, name: nil, sport: nil, status: nil} test "list_athletes/0 returns all athletes" do ...
0a8c454493285f49392b527b85aba5a18087a80d
1,822
[ 37431996 ]
[ "test" ]
defmodule TimeMachine.ClockTest do use TimeMachine.ConnCase test "start_link starts a link with the default clock when no clock given" do {:ok, pid} = TimeMachine.Clock.start_link([]) {:ok, clock} = TimeMachine.Clock.get(pid) assert clock.clock === [] end test "start_link starts a link with the gi...
0a8d734dcadba494820296631eafc02a70398235
2,659
[ 293531471 ]
[ "test" ]
defmodule Bitpost.ECDSASigVerifyTest do use ExUnit.Case alias Operate.VM setup_all do %{ vm: VM.init, op: File.read!("src/bitpost/ecdsa_sig_verify.lua"), } end describe "simple example without signed content" do test "must set the correct attributes", ctx do res = %Operate.Cel...
0a8de5261aeecf5ef791f834a400f1294afdff7d
2,555
[ 996802329 ]
[]
#!/usr/bin/env elixir # Test the full GETBULK chain to identify where NULL values are coming from File.cd!("/Users/mcotner/Documents/elixir/snmp_sim") Code.append_path("_build/dev/lib/snmp_sim/ebin") # Load required modules Application.ensure_all_started(:snmp_sim) # Wait for SharedProfiles to start Process.sleep(1...
0a8e40e9b317d7b5b17aa5648c90f346dd8822e0
9,136
[ 118212478 ]
[ "test", "ecto" ]
defmodule Cadet.NotificationsTest do use Cadet.DataCase alias Cadet.Notifications alias Cadet.Notifications.{NotificationConfig, NotificationPreference, TimeOption} describe "notification_types" do test "get_notification_type!/1 returns the notification_type with given id" do ntype = insert(:notific...
0a8e646552a95b308371f51c5bb84e852d92f48e
2,379
[ 742986632 ]
[ "documented" ]
defmodule Drop7.Utils do @moduledoc """ Functions for checking row/column counts. """ def tile_should_pop?(game_objects, x, y) do value = game_objects |> Enum.at(y) |> Enum.at(x) |> Map.get("value") value in popping_tiles_for_coordinate(game_objects, x, y) end def popping_tiles_for_coordinate(gam...
0a8e6bd583618574831996320c17e173fedc5b10
2,787
[ 481076687, 57012814 ]
[ "typespec", "documented" ]
defmodule Topo.Cleaner do @moduledoc false import Topo.Util @type geometry :: {number, number} | %{type: String.t(), coordinates: list} | %Geo.Point{} | %Geo.MultiPoint{} | %Geo.LineString{} | %Geo.MultiLineString{} | %Geo.Polygon{} ...
0a8e722b0f57988d51151de39d0d7e495755bec7
3,623
[ 545163497 ]
[ "typespec", "documented" ]
defmodule Chalk.Query do alias Chalk.Client alias Chalk.Client.Request alias Chalk.Common.ChalkError alias Chalk.Common.ChalkException defmodule FeatureMeta do @derive Jason.Encoder defstruct cache_hit: nil, chosen_resolver_fqn: nil, primitive_type: nil, vers...
0a8e969e86150412243d08670f2599f3e40a9c9f
3,611
[ 79611723 ]
[ "test" ]
defmodule Peepchat.RoomControllerTest do use Peepchat.ConnCase alias Peepchat.Room @valid_attrs %{name: "some content"} @invalid_attrs %{} setup %{conn: conn} do user = Repo.insert! %Peepchat.User{} { :ok, jwt, _} = Guardian.encode_and_sign(user, :token) conn = conn |> put_req_header("cont...
0a8ee686bfdc2794231c0194038b0343fc8f5c01
1,974
[ 121542449 ]
[ "documented" ]
defmodule ComputerWithBadImplementation do @doc """ ## Examples iex> exec(:+, [2, 3]) 5 iex> exec(:++, [[2, 2, 2]]) 7 iex> exec(:-, [[10, 8]]) 2 ## Details This function makes several wrong assumptions about the behaviour implemented by its Calc. * `:+` - Wrong arity...
0a909d74862b6ad01d2581504deecade3355fe8e
12,792
[ 950711055 ]
[]
%{ "castore": {:hex, :castore, "1.0.12", "053f0e32700cbec356280c0e835df425a3be4bc1e0627b714330ad9d0f05497f", [:mix], [], "hexpm", "3dca286b2186055ba0c9449b4e95b97bf1b57b47c1f2644555879e659960c224"}, "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", ...