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
04b87a025694e03ad0b9f0cf5b7403edadf07263
1,551
[ 585454936 ]
[ "typespec", "documented" ]
defmodule Hftx.Zerodha.WebSocket.FrameParser do @moduledoc """ This module parses the market quote binary data packet into the MarketEvent struct """ require Logger alias Hftx.Data.MarketEvent alias Hftx.Zerodha.WebSocket.FrameParser.EquityFull alias Hftx.Zerodha.WebSocket.FrameParser.EquityQuote ali...
04b8cf843d493c505e96f4dbc5a50a3d54317295
1,555
[ 886954439 ]
[ "phoenix" ]
defmodule RetroBoardWeb.Router do use RetroBoardWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {RetroBoardWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api...
04b906c8d19d293dc8f13e976994a10b357e4a58
1,761
[ 334237763 ]
[]
defmodule Db do def new(), do: [] def write(deb_ref, key, element) do write_aux(deb_ref,key,element,deb_ref) end def write_aux(l, key, element, []), do: l ++ [{key, element}] def write_aux(l, key, element, [h|_] = laux) do {clave,elemento} = h update_key(clave, elemento, l, key, element, laux) end def ...
04b92bf11305340cc4c99941bcd26755a97d622d
1,697
[ 236028178 ]
[ "macro", "documented", "phoenix" ]
defmodule AlienDemoWeb 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 AlienDemoWeb, :controller use AlienDemoWeb, :view The definitions below will be executed for every view, contro...
04ba58f849d3e8871892b0c415686f77c02d0c07
4,193
[ 580901597 ]
[]
# encode the list of all atoms in a tuple priorities = Enum.with_index( [:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:o,:p,:q,:r,:s,:t,:u,:v,:w,:x,:y,:z, :A,:B,:C,:D,:E,:F,:G,:H,:I,:J,:K,:L,:M,:N,:O,:P,:Q,:R,:S,:T,:U,:V,:W,:X,:Y,:Z] ) # Read the file into memory {:ok, filecontents} = File.read("input/day3.txt") # S...
04bac006e86b1bb89f20d91e98b84f86d61cbeea
5,265
[ 129816247 ]
[ "test" ]
defmodule ShopifyAPI.Plugs.WebhookTest do use ExUnit.Case, async: true import Plug.Test import Plug.Conn import ShopifyAPI.Factory alias ShopifyAPI.{AppServer, ShopServer} alias ShopifyAPI.Plugs.Webhook @secret ShopifyAPI.Factory.shopify_app_secret() setup do app = build(:app) shop = build(:...
04baef9c90291d8eb5b13315ffa8a2f6e6377050
4,117
[ 930600936 ]
[ "macro" ]
#!/usr/bin/env elixir # Test script to verify force_refresh_images flag passing between jobs # Run with: mix run lib/debug/test_force_refresh_images_in_jobs.exs # Import required modules alias TriviaAdvisor.Scraping.Oban.QuizmeistersIndexJob alias TriviaAdvisor.Scraping.Oban.QuizmeistersDetailJob alias TriviaAdvisor....
04bb61618066f632f760f80dfba54352cd5c4b7a
2,430
[ 352816818 ]
[ "test", "phoenix" ]
defmodule BackendWeb.GuessControllerTest do use BackendWeb.ConnCase alias Backend.Guesses alias Backend.Guesses.Guess @create_attrs %{ correct: true } @update_attrs %{ correct: false } @invalid_attrs %{correct: nil} def fixture(:guess) do {:ok, guess} = Guesses.create_guess(@create_attr...
04bba9c682fd57bdac5b598b1ae2f9394d29124c
1,906
[ 213898933 ]
[ "typespec", "documented" ]
defmodule ProjectOperator.Resources.TriggerTemplates do @moduledoc false @spec from_project(Datapio.K8s.Resource.t()) :: [Datapio.K8s.Resource.t()] def from_project(project) do %{"metadata" => project_meta, "spec" => project_spec} = project %{"namespace" => namespace, "name" => name, "uid" => uid} = proj...
04bbc2046ebac9671c94501d39c0532638137bf3
21,215
[ 618378010 ]
[]
%{ "bamboo": {:hex, :bamboo, "2.2.0", "f10a406d2b7f5123eb1f02edfa043c259db04b47ab956041f279eaac776ef5ce", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4", [hex: :mime, repo: "hexpm", optional: false]}...
04bbc2b0d8f12e74f64a09809195c5edde145af2
2,263
[ 75036350 ]
[ "typespec", "documented" ]
defmodule Pummpcomm.Session.Exchange.ReadInsulinSensitivities do @moduledoc """ Reads insulin sensitivities throughout the day. """ use Bitwise alias Pummpcomm.Insulin alias Pummpcomm.Session.{Command, Response} # Constants @max_count 8 @mgdl 1 @mmol 2 @opcode 0x8B # Functions @doc """...
04bc10c7af5e84c4a61ef3c1da095e4b39937896
2,165
[ 816798871 ]
[ "liveview" ]
defmodule LiveViewStudioWeb.SandboxLive do use LiveViewStudioWeb, :live_view import Number.Currency alias LiveViewStudio.Sandbox def mount(_params, _session, socket) do socket = assign(socket, length: "0", width: "0", depth: "0", weight: 0.0, price: nil) {:ok, socket} end def render(assigns) do ...
04bc4bf276ca97ffd589b3915ac2ea8ed257225b
1,926
[ 131585522 ]
[ "test" ]
defmodule SnowplowTracker.Emitters.CacheTest do use ExUnit.Case alias SnowplowTracker.Emitters.Cache @table :snowplow_events_test setup_all do try do Cache.delete_table(@table) rescue _ -> :ok end Cache.init(@table) on_exit(fn -> Cache.delete_table(@table) end) ...
04bca1e6446d8b4dedd81caa8f99085ae1de69b0
5,363
[ 102402712 ]
[ "genserver" ]
defmodule Examplemix do # def main(args \\ []) do # actor =spawn(__MODULE__,:sha256spawn,[]); # send(actor,{:ok,to_string(1)}) # #actor=spawn_link(__MODULE__,:world,[]); # IO.inspect actor # #IO.puts "Hello world" # #IO.puts "Hello World #{args}" # #{:ok, ifs} = :inet.getif() # ...
04bca8ba8c7a5950781f3e8ba78df68e30b4782c
2,369
[ 195359112 ]
[ "test", "ecto" ]
defmodule ApiServer.RobConfigContextTest do use ApiServer.DataCase alias ApiServer.RobConfigContext describe "rob_config" do alias ApiServer.RobConfigContext.RobConfig @valid_attrs %{robnetid: "some robnetid"} @update_attrs %{robnetid: "some updated robnetid"} @invalid_attrs %{robnetid: nil} ...
04bd5ac46ddd54b15bfb1f4fe44b67a0cfc46fc3
3,982
[ 425210182 ]
[ "genserver", "phoenix" ]
defmodule Lurra.Triggers.Server do use GenServer alias LurraWeb.Endpoint alias Lurra.Triggers.Trigger alias Lurra.Triggers @events_topic "events" @five_minutes 1000*60*5 def start_link([]) do GenServer.start_link(__MODULE__, [], name: __MODULE__) end def init([]) do create_ets_tables() ...
04bd79de29e14e9c40665fa44205f6780c2d1ed4
6,834
[ 559744925, 744142491, 670103538, 681629586, 713860590, 734242561, 687446493, 688332642, 709785915, 718072585, 747581658, 710549260, 731178722, 869143224, 648118486, 682630311, 689993351, 718071371, 685399586, 632012290, 657606827, 669575169, 677687005, 712404127, 6743...
[ "documented", "ecto" ]
defmodule Swoosh.Adapters.SocketLabs do @moduledoc ~S""" An adapter that sends email using the SocketLabs Injection API. For reference: [SocketLabs API docs](https://inject.docs.socketlabs.com/v1/documentation/introduction) **This adapter requires an API Client.** Swoosh comes with Hackney and Finch out of th...
04bda847922c01099edd722978c3d272c078f580
1,503
[ 10641158 ]
[ "documented" ]
defmodule Ecto.Query.OrderByBuilder do @moduledoc false alias Ecto.Query.BuilderUtil # Escapes an order by query to a list of `{ direction, field }` pairs. See # `Ecto.Query.order_by for the allowed formats for the expression. def escape(list, vars) when is_list(list) do Enum.map(list, &escape_field(&1...
04be5c1e353c10341083c7349fc1f8011a55993c
1,631
[ 228650899 ]
[ "documented" ]
defmodule DSRCMessages do @moduledoc false def bsm_message() do %Kitt.Message.BSM{ coreData: %Kitt.Message.BSM.CoreData{ accelSet: %{lat: 2001, long: 2001, vert: -127, yaw: 0}, accuracy: %{orientation: 65_535, semiMajor: 255, semiMinor: 255}, angle: 127, brakes: %{ ...
04bea7d1be7e81cb09b22cb401726305202ec492
1,911
[ 256890478 ]
[ "phoenix" ]
defmodule WriteyDraweyWeb.GamesController do use WriteyDraweyWeb, :controller alias WriteyDrawey.{Game, Round} def create(conn, %{"initial_player_name" => initial_player_name}) do game = Game.initialize_with_player(initial_player_name) json(conn, %{ game_id: game.id, game_code: game.code, ...
04beb46bcb5f6e394c1f0a3a3d084824e7c86da1
13,258
[ 164143491 ]
[ "genserver", "documented" ]
defmodule Server do use GenServer @moduledoc """ This is the Server Module where the GenServers are created. Each genserver will work as a separate node(user or miner) in the bitcoin network and will have their own wallet (private/public key pair) and their own copy of the ledger. All the handle methods...
04bf37980ccc62c9b0ed9f346984a394a3bf931c
7,486
[ 725971743 ]
[ "typespec" ]
defmodule AdventOfCode.Day10 do def input(test? \\ false) do if test? do # """ # FS7 # |.| # L-J # """ # """ # FF7FSF7F7F7F7F7F---7 # L|LJ||||||||||||F--J # FL-7LJLJ||||||LJL-77 # F--JF--7||LJLJ7F7FJ- # L---JF-JLJ.||-FJLJJ7 # |F|F-JF---7F7-L...
04bf68f930a95afdcff3dd165f571cf17399ae35
2,076
[ 96352156 ]
[ "genserver" ]
defmodule ElhexDelivery.PostalCode.Navigator do use GenServer alias :math, as: Math alias ElhexDelivery.PostalCode.{Store, Cache} @radius 3959 def start_link do GenServer.start_link(__MODULE__, [], name: :postal_code_navigator) end def get_distance(from, to) do GenServer.call(:postal_code_navig...
04bf738da1ee164c6d75a81463ac2d7ced8b7087
2,325
[ 434213689 ]
[]
#filename = "input/day04-simple.txt" filename = "input/day04-real.txt" defmodule Day04 do def split_str_to_int(l, pattern) do String.split(l, pattern, trim: true) |> Enum.map(&(String.to_integer(&1))) end def convert_field(l) do l |> Enum.map(fn s -> split_str_to_int(s, " ") |> Enum.map(&({&1, false})) end) end def...
04bfc16031baf44e4d72713dd48016900d608d68
1,895
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudAsset.V1.Model.WindowsApplication do @moduledoc """ Contains information about a Windows application that is retrieved from the Windows Registry. For more information about these fields, see: https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key ## Attributes * `...
04bfda62034dd4d7e8cc4256052797140220586c
2,358
[ 735070915 ]
[ "liveview", "phoenix" ]
defmodule GistCloneWeb.Views.GistNav do use GistCloneWeb, :html attr :view, :any, default: "tab-your-gist" slot :inner_block, required: true def main(assigns) do ~H""" <div class="flex w-full px-20 em-gradient pt-8 items-end" style="padding-inline:clamp(80px, 15%, 15rem)" > <ul ...
04c02ab156372e273445d3514b4aaa9a7607ac44
1,981
[ 588296449 ]
[ "macro", "documented" ]
defmodule Boruta.Migrations.OpenidConnect do @moduledoc false defmacro __using__(_args) do quote do def change do # 20210720134116_add_default_to_scopes_name.exs alter table(:scopes) do modify(:name, :string, default: "") end # 20210720134125_add_default_to_toke...
04c0565486125875cd47b09b5a7b16f0c3c3392e
1,596
[ 180624005 ]
[]
defmodule Bumper.Router do use Plug.Router plug(:match) plug(:dispatch) get "/fdate/:ticker" do booger = crap(ticker) send_resp(conn, 200, "#{booger}") end get "/shazam/:ticker" do booger = shmap(ticker) send_resp(conn, 200, "#{booger}") end match _ do send_resp(conn, 200, "use /...
04c0b0104963ad3c6621de02a9dc6416b50f6c89
1,542
[ 828087786 ]
[ "documented" ]
defmodule AshPostgres.ResourceGenerator.SensitiveData do @moduledoc false # I got this from ChatGPT, but this is a best effort transformation # anyway. @sensitive_patterns [ # Password-related ~r/password/i, ~r/passwd/i, ~r/pass/i, ~r/pwd/i, ~r/hash(ed)?(_password)?/i, # Authenticat...
04c0c70ce8a5332245e8cff3a6a8967f702d341a
2,870
[ 105913697 ]
[ "phoenix" ]
defmodule SkollerWeb.Api.V1.SkollerJobs.CareerActivityController do use SkollerWeb, :controller alias Skoller.SkollerJobs.CareerActivity alias Skoller.SkollerJobs.CareerActivities alias SkollerWeb.SkollerJobs.CareerActivityView import SkollerWeb.Plugs.{Auth, JobsAuth} @student_role 100 # Require acces...
04c1e2a7d16792451c06e59647696fd55729326e
1,516
[ 219369117 ]
[ "documented" ]
defmodule ExDimensions.Area do @moduledoc """ Base units for area measurements in metric and imperial. """ @moduledoc since: "0.1.0" def square_inches(q), do: %ExDimensions.Quantity{ value: q, units: [ExDimensions.Spatial.Inches, ExDimensions.Spatial.Inches] } def square_feet(q), d...
04c1e75d12768c83e4ed676fd86fb307529fec02
1,555
[ 705891406 ]
[ "liveview", "phoenix" ]
defmodule ExMoexLiveWeb.Endpoint do use Phoenix.Endpoint, otp_app: :ex_moex_live # 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: "_e...
04c250461af004cc278eaee4ea7a4cdd9632833d
4,898
[ 171961091 ]
[ "liveview", "documented" ]
defmodule ArtemisWeb.ViewHelper.Navigation do use Phoenix.HTML import ArtemisWeb.Config.Navigation import ArtemisWeb.Guardian.Helpers @doc """ Lists all primary navigation items """ def render_primary_navigation_items(conn, user, options \\ []) do items = case Keyword.get(options, :items) do ...
04c3086f11a8f3f09d1e47170fa8f0f5ca874417
2,384
[ 558738790 ]
[ "documented" ]
defmodule OffBroadway.Defender365.Incident do @moduledoc """ This module contains `ExConstructor` modules for the various entities contained within an incident. """ defmodule Metadata do @moduledoc false @derive Jason.Encoder defstruct [ :assigned_to, :classification, :comments, ...
04c31b091fd9db9ba0792568d3db27c672626465
3,314
[ 988591862 ]
[ "genserver", "documented" ]
defmodule GenDOM.EventRegistry do @moduledoc false use GenServer defstruct [ window: nil, listeners: %{}, # %{node_pid => %{event_type => [listener_records]}} cleanup_refs: %{} # %{node_pid => monitor_ref} for cleanup ] def start_link(opts) do GenServer.start_link(__MODULE__, opts) end ...
04c35dc45fd86f720b1ab461ee33f238b65934a2
5,924
[ 99781302 ]
[ "documented", "ecto" ]
defmodule VinculiGraph.Repo do @moduledoc """ Emulates Ecto.Repo for common operation (Uses Bolt.Sips for query) """ alias VinculiGraph.Meta.Node @doc """ Inserts a changeset It returns `{:ok, Bolt.Sips.Node}` if successful, or `{:error, Bolt.Sips.Exception}` if an database/connection error occured, ...
04c3647bc78b43e418384693f908517d2f41211b
2,108
[ 238230407 ]
[ "macro", "documented" ]
defmodule Automata.Infrastructure.Config.WorldSchema do @moduledoc """ Schema for world configuration. """ use Automata.Infrastructure.Config.Schema, required_fields: [:name], schema_block: quote do field :id, :string field :name, :string field :description, :string field :versio...
04c3874bdf9d7f222987367671a011d377453a7d
1,618
[ 593097184 ]
[ "test" ]
defmodule NewsBite.BitesTest do use ExUnit.Case, async: true alias NewsBite.{Bite, Bites, BiteCache} test "create_bite/1 returns a new bite" do start_supervised(BiteCache) bite = Bites.create_bite(%{"country" => :sg, "category" => :business, "search_term" => "apple"}) inserted_bite = BiteCach...
04c3a0871007356d7caa2e7d8a88c48cc45b7108
4,052
[ 434422681 ]
[ "ecto" ]
defmodule Pollinatr.Models.User do @behaviour Bodyguard.Policy alias Pollinatr.Schema.Users, as: UserSchema alias Pollinatr.Repo defstruct validation_code: nil, id: nil, role: nil, email_address: nil @voter_codes [] def get_admin_codes() do [Application.get_env(:pollinatr, :admin_login_code)] end ...
04c4067529d8ced0f0b2dbe514c8c39f4810dffa
1,745
[ 806857258 ]
[ "documented", "ecto" ]
defmodule PriceMonitoring.Market do @moduledoc """ The Market context. """ import Ecto.Query, warn: false alias PriceMonitoring.Repo alias PriceMonitoring.Market.Price @doc """ Returns the list of prices. ## Examples iex> list_prices() [%Price{}, ...] """ def list_prices do R...
04c41fe89cf5b29eeda0893798967131b3f55985
1,972
[ 146077462 ]
[]
defmodule Battleship.Ship do alias Battleship.{Coordinate, Ship} @enforce_keys [:coordinates, :hit_coordinates] defstruct [:coordinates, :hit_coordinates] def new(type, %Coordinate{} = upper_left) do with [_|_] = offsets <- offsets(type), %MapSet{} = coordinates <- add_coordinate...
04c42ca34defa6731ac632be3f8c56a9110666ce
3,525
[ 193244709 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Integrations.V1.Model.GoogleCloudIntegrationsV1alphaClientConfig do @moduledoc """ The configuration information for the Client ## Attributes * `billingType` (*type:* `String.t`, *default:* `nil`) - Indicates the billing type of the client * `clientState` (*type:* `String.t`, *defaul...
04c4c01530b30f9a5cc7319440eaa46d2e32d8c5
2,968
[ 559085377 ]
[ "phoenix" ]
defmodule QuizyWeb.Router do use QuizyWeb, :router import QuizyWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {QuizyWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fe...
04c4ce24b45966eb2022e102c7446364267e686f
15,114
[ 660629754 ]
[ "test" ]
defmodule GenReportTest do use ExUnit.Case describe "build/1" do test "builds the report" do file_name = "gen_reports_test_complete.csv" response = GenReport.build(file_name) expected_response = %{ "all_hours" => %{ "Cleiton" => 13797, "Daniele" => 13264, ...
04c53657d8f072827c8daf1bd2c2c97b8f37be3a
4,350
[ 150138960 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]...
04c5463d7d85a63d3bfe71a1f6b1ca57ecfbdf77
1,599
[ 458810684 ]
[ "documented", "ecto" ]
defmodule Tictactoex.GameState.Game do @moduledoc """ Schema to save the current game state """ use Ecto.Schema import Ecto.Changeset @primary_key {:id, :binary_id, autogenerate: true} schema "game" do field :table, :map field :active?, :boolean field :current_player_turn, :string fiel...
04c6593ae97834b2876a0db17712989703177d5a
2,052
[ 701464070 ]
[ "test" ]
defmodule Dbz.CharacterTest do use ExUnit.Case import ExUnit.CaptureLog alias Dbz.Character setup do start_supervised!({Character, name: Piccolo, power_level: 100, power_increment: 5}) :ok end describe "start_link/1" do test "names the character" do assert Process.whereis(Piccolo) ...
04c66c1e09aee6d869b04a499d761d62f1007ade
2,678
[ 62505520 ]
[ "test" ]
defmodule InvertedIndexTest do use ExUnit.Case doctest InvertedIndex test "extracts terms from a string" do text = "Turtles love pizza" assert InvertedIndex.extract_terms(text) === ~w(Turtles love pizza) end test "lower_case_filter lower cases all terms" do terms = ~w(TurTleS LovE PiZzA) ass...
04c6dc361acd649718af959db752c4dbd8e813e7
3,369
[ 263599292 ]
[ "test", "phoenix" ]
defmodule UserApiWeb.UserControllerTest do use UserApiWeb.ConnCase alias UserApi.Directory alias UserApi.Directory.User @create_attrs %{ email: "some email", firstName: "some firstName", lastName: "some lastName", password: "some password", telephone: "some telephone", username: "some ...
04c6fc2914b52d0b0755f961a06cd66fd3607363
15,812
[ 59428665 ]
[ "test" ]
defmodule Benchee.Formatters.Console.MemoryTest do use ExUnit.Case, async: true alias Benchee.{CollectionData, Formatters.Console.Memory, Scenario, Statistics} @console_config %{ comparison: true, unit_scaling: :best, extended_statistics: false } describe ".format_scenarios" do test "adjust...
04c72cd0b0f9980efeed53ea2abaf3a28c420a64
1,547
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DFAReporting.V33.Model.Region do @moduledoc """ Contains information about a region that can be targeted by ads. ## Attributes * `countryCode` (*type:* `String.t`, *default:* `nil`) - Country code of the country to which this region belongs. * `countryDartId` (*type:* `String.t`, *de...
04c833ac06887bfc32fa273403649227c9c4b6d6
2,954
[ 171046539 ]
[ "test", "phoenix" ]
defmodule StreetPortraitsWeb.PortraitControllerTest do use StreetPortraitsWeb.ConnCase alias StreetPortraits.SP @create_attrs %{body: "some body", url: "some url"} @update_attrs %{body: "some updated body", url: "some updated url"} @invalid_attrs %{body: nil, url: nil} def fixture(:portrait) do {:ok,...
04c8b4f8b5d9d826ff8182cde6c919dc0f70e21e
6,364
[ 790788837 ]
[ "test" ]
defmodule CliOptions.DocsTest do use ExUnit.Case @test_schema [ verbose: [ type: :boolean ], project: [ type: :string, short: "p", required: true, doc: "The project to use", multiple: true ], mode: [ type: :string, default: "parallel", allow...
04c8c407a99150bf70e06ec980b9953fbd6f96b8
8,866
[ 292357636 ]
[ "test" ]
defmodule AsciicanvasTest do use ExUnit.Case doctest Asciicanvas describe "input parsing:" do test "invalid shape - circle" do assert_raise ArgumentError, fn -> Asciicanvas.parse_input( "Circle at [3,2] with radius: 5, outline character: `@`, fill character: `X`" ) end ...
04c9042b7850c48d32d99f25f2ae87ff1e5a45fa
3,609
[ 143937706 ]
[]
%{ "certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [...
04c92f61996139c3a8c749bfe809024e389aee9b
8,702
[ 15270935 ]
[ "ecto" ]
defmodule ApathyDrive.Commands.Craft do use ApathyDrive.Command alias ApathyDrive.{ Ability, Character, CharacterStyle, CraftingRecipe, Enchantment, Item, ItemInstance, ItemTrait, Match, Material, Mobile, Repo } require Ecto.Query def keywords, do: ["craft"] ...
04c930795652b06941c03d21e30e7b2d51450478
2,434
[ 135372171 ]
[ "macro", "documented" ]
defprotocol GatherContext.Field do @doc "Encodes the Field, ready for transmission to GatherContent" def encode(data) end defmodule GatherContext.Types.V2.Fields.Field do defmacro __using__(_opts) do quote do import GatherContext.Types.V2.Fields.Field @field_type :unknown @before_compile Ga...
04c96ebe57fab991b62c096ad45c74aeedb9d335
6,820
[ 39831827 ]
[ "test" ]
defmodule MockHttpServerRegistrationTest do use ExUnit.Case alias MockHttpServer.RegistrationService setup do if MockHttpServer.RegistrationService in Process.registered do RegistrationService.stop end :ok end test "starting and stopping the service" do assert { :ok, _ } = Registration...
04c974e5d11edcd81f8884a43f27f6decb30448f
2,651
[ 963846938 ]
[ "liveview", "documented" ]
defmodule Elemental.Support.Icons do @moduledoc false # SVGs in place for Heroicons used # # This omits the need to bundle Heroicons while allowing it's use use Elemental.Component attr :type, :string, values: ~w(info success warning error), required: true def alert_icon(%{type: "success"} = assigns) ...
04ca0f77c3d80b20f2505d2ee4f084c04df0ca91
12,757
[ 308457589 ]
[ "ecto", "liveview", "test" ]
defmodule Tq2Web.Store.CustomerLiveTest do use Tq2Web.ConnCase import Phoenix.LiveViewTest import Tq2.Fixtures, only: [default_store: 1] @create_attrs %{ token: "VsGF8ahAAkIku_fsKztDskgqV7yfUrcGAQsWmgY4B4c=", price_type: "promotional", visit_id: 1 } setup %{conn: conn} do {:ok, visit} = ...
04ca8f77557aa9523c2992c1b361828d21faa977
2,459
[ 815247978 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule VideosLiveviewWeb 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 VideosLiveviewWeb, :controller use VideosLiveviewWeb, :view The definitions below will be executed for every...
04cac5412599a4f0c8ca3aae1e994deb5573fece
1,633
[ 433800738 ]
[ "documented" ]
defmodule Aoc2021.D5 do @doc """ D5 p1 ## Examples iex> Aoc2021.D5.part_1([ iex> [{0,9},{5,9}], iex> [{8,0},{0,8}], iex> [{9,4},{3,4}], iex> [{2,2},{2,1}], iex> [{7,0},{7,4}], iex> [{6,4},{2,0}], iex> [{0,9},{2,9}], iex> [{3,4},{1,4}]...
04cb125a914a60ec6ea4cd32d2ee6f136807b17a
21,528
[ 931539969 ]
[]
%{ "bandit": {:hex, :bandit, "1.6.7", "42f30e37a1c89a2a12943c5dca76f731a2313e8a2e21c1a95dc8241893e922d1", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", option...
04cb1bba4573199608211bd6a1b940b76d0dd110
10,787
[ 1004571519 ]
[]
#!/usr/bin/env elixir # Advanced Validation Examples for Sinter # Demonstrates complex validation patterns, custom constraints, and edge cases IO.puts("=== Sinter Advanced Validation Examples ===") IO.puts("") # Add the compiled beam files to the path Code.append_path("../_build/dev/lib/sinter/ebin") # ============...
04cb44a9f489c9271e7ba648a1822ba526d31167
1,507
[ 869596303 ]
[ "liveview", "phoenix" ]
defmodule SomethingWeb.Endpoint do use Phoenix.Endpoint, otp_app: :piscineAPI # 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: "_pisc...
04cb6308edd3f46e7a71819bc1064f1f3693e313
14,673
[ 960596533 ]
[ "test" ]
defmodule PiiGuardian.NotionPiiDetectionTest do use PiiGuardian.DataCase, async: false import Mox alias PiiGuardian.MockAnthropix alias PiiGuardian.MockNotionApi alias PiiGuardian.NotionPiiDetection # Make sure mocks are verified when the test exits setup :verify_on_exit! # Allow mocks to be called ...
04cb9527b3ca3431285049420c8bcce13f4017c8
1,866
[ 390164410 ]
[ "typespec", "documented" ]
defmodule Wrench.Hex.Api do require Logger alias Wrench.Hex.Api.Requester @doc """ - get_release_etag: (pkg_name, release_version) -> binary - returns: Stream of {pkg_map, [{etag, release_map}, ...]} """ def full_packages_updated_since(since, get_release_etag) do packages_updated_since(since) ...
04cb99921fb85c53bc06148f3f1e14fac1e0b4c6
11,880
[ 48992649 ]
[ "test" ]
defmodule Tbot.MessageHandlerTest do use Tbot.LibCase alias Tbot.MessageHandler alias Tbot.RollCall alias Tbot.RollCallResponse defp count(query), do: Repo.one(from v in query, select: count(v.id)) @chat %{ id: 123 } @from %{ first_name: "Fred", id: 456 } @message %{ chat: @chat, from: @from, date: 14...
04cbe98cb181e5f1dc8d73bf0fd639a3ba19f35d
8,742
[ 725613728 ]
[]
defmodule Mix.Tasks.D05.P1 do use Mix.Task import AdventOfCode.Day05 @shortdoc "Day 05 Part 1" def run(args) do input = """ seeds: 4043382508 113348245 3817519559 177922221 3613573568 7600537 773371046 400582097 2054637767 162982133 2246524522 153824596 1662955672 121419555 2473628355 846370595 183049...
04cc05e4e1c903cd81e7f11bcab3636227f85717
5,451
[ 291510770 ]
[ "typespec", "documented" ]
case Code.ensure_compiled(Phoenix) do {:module, _module} -> defmodule DarkMatter.Namings.PhoenixNaming do @moduledoc """ Conveniences for inflecting and working with names in Phoenix. """ @doc """ Delegates to `Phoenix.Naming.resource_name/1`. """ @spec resource_name(any...
04cc7a7c1d4adc15c39fece17a40ad3b346b083a
1,503
[ 844324183 ]
[ "phoenix" ]
defmodule OneWeb.Router do use OneWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {OneWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do plug :accepts...
04cd14814e5175409575924bd31be236fb3228ec
2,248
[ 423313665 ]
[ "documented", "ecto" ]
defmodule RealTime.Desks do @moduledoc """ The Desks context. """ import Ecto.Query, warn: false alias RealTime.Repo alias RealTime.Desks.Desk @doc """ Returns the list of desks. ## Examples iex> list_desks() [%Desk{}, ...] """ def list_desks do Repo.all(from(d in Desk, order...
04cd545e6419b7f057f920c9a7d74919d837f587
3,870
[ 411722524 ]
[ "typespec", "documented" ]
defmodule Envoy.Config.Metrics.V4alpha.StatsSink do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ config_type: {atom, any}, name: String.t() } defstruct [:config_type, :name] oneof(:config_type, 0) field(:name, 1, type: :string) field(:typed_config, 3...
04cd89a1de774abbc82fa53da2107ccd7c74458f
1,749
[ 890838838 ]
[ "documented", "ecto" ]
defmodule Todoplace.Repo.Migrations.CreateJobStatusView do use Ecto.Migration @doc "TODO: have not handled case where there are more than one proposals for a job" def up do execute(""" create view job_statuses as ( with proposal_statuses as ( select job_id, case ...
04cddcfbf8b446f1d5ca0eb4128bdaff67d0af44
12,748
[ 49068825 ]
[ "test", "phoenix" ]
defmodule StatazApi.ListControllerTest do use StatazApi.ConnCase alias StatazApi.TestCommon @default_user %{username: "luke_skywalker", password: "rebellion", email: "<EMAIL>"} @status_1 %{description: "fighting", active: false} @status_2 %{description: "battling", active: true} @status_3 %{description: "...
04ce02877ea3b1ac00365e4c8874aed87c82312f
1,516
[ 370813738, 450993182 ]
[ "test" ]
defmodule StellarBase.XDR.OfferEntryFlagsTest do use ExUnit.Case alias StellarBase.XDR.OfferEntryFlags describe "OfferEntryFlags" do setup do %{ identifier: :PASSIVE_FLAG, offer_entry_type: OfferEntryFlags.new(:PASSIVE_FLAG), binary: <<0, 0, 0, 1>> } end test "ne...
04ce1558b78bc91a5fd2874041a79ae5f9807fbb
9,267
[ 376959663 ]
[ "liveview", "documented" ]
defmodule OliWeb.Projects.ProjectsLive do @moduledoc """ LiveView implementation of projects view. """ use OliWeb, :surface_view import Phoenix.HTML.Form import OliWeb.ErrorHelpers import OliWeb.DelegatedEvents import OliWeb.Common.Params alias Oli.Repo.{Paging, Sorting} alias OliWeb.Common.Bread...
04ce792b1117031c43bd447b9c662ed83888c79c
3,690
[ 75415851 ]
[]
defmodule AOCDay.Runner do alias AOCDay.Distance alias AOCDay.Map def run do calculate end def calculate(input \\ "") do {x, y, _} = AOCDay.Parser.parse(input) |> Enum.reduce({0,0, "N"}, &new_position/2) abs(x) + abs(y) end defp new_position(%Distance{direction: turning, length: len}, ...
04cea77a10d85b1dbe6b3453ad7f0c36a136b43b
1,849
[ 133189748 ]
[ "phoenix", "ecto" ]
defmodule TrelloCloneStimulusWeb.GroupController do use TrelloCloneStimulusWeb, :controller alias TrelloCloneStimulus.GroupAccounts alias TrelloCloneStimulus.GroupAccounts.Group def index(conn, _params) do groups = GroupAccounts.list_groups() render(conn, "index.html", groups: groups) end def new...
04ced53487f8c751371f39b16c122d91b6326259
1,912
[ 736127931 ]
[]
import Config # # RM # config :rm, ecto_repos: [RM.Repo], generators: [timestamp_type: :utc_datetime, binary_id: true] config :rm, RMWeb.Endpoint, url: [host: "localhost"], adapter: Bandit.PhoenixAdapter, render_errors: [ formats: [html: RMWeb.ErrorHTML, json: RMWeb.ErrorJSON], layout: false ], ...
04cf5efdd10772a9cbc1c32f63d08bf020bd57d5
15,965
[ 248702688 ]
[ "typespec", "documented", "ecto" ]
defmodule Core.Seeder.Updated.Contracts do @moduledoc """ An update are seeds whole the contracts. """ alias Core.{ Contracts, Contracts.Addon, Contracts.Offer, Contracts.PotentialClient, Contracts.Project, Contracts.ServiceReview, Repo } alias Faker.Lorem @spec start!() :: ...
04cf7aa2d05adc4193b1ffde6277045ba42813ec
1,973
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Migrations.BxEventsQnrAnswers do @moduledoc """ Migration para criar e remover a tabela bx_events_qnr_answers. """ alias DeeperHub.Core.Data.Repo alias DeeperHub.Core.Logger require DeeperHub.Core.Logger @doc """ Cria a tabela de bx_events_qnr_answers. """ def up do ...
04d09105a632e3c1b280bfaf5cdd17ae0dca4ab2
1,731
[ 1020181875 ]
[]
defmodule Identicon do def main(input) do input |> hash_input |> pick_color |> build_grid |> filter_odd_squares |> build_pixel_map |> draw_image |> save_image(input) end def hash_input(input) do seed = :crypto.hash(:md5, input) |> :binary.bin_to_list() %Identi...
04d0966de968f38d0b747e75a7fc828de9f7debc
3,205
[ 1008670264 ]
[ "liveview", "documented" ]
defmodule EveDmvWeb.Components.DataTableComponent do @moduledoc """ Reusable data table component with consistent dark theme styling. Provides sortable columns, responsive design, and hover effects. """ use Phoenix.Component @doc """ Renders a data table with configurable columns and rows. ## Exampl...
04d105aec230ec0c96b639ea834e0018e051653a
5,736
[ 827985656 ]
[ "test" ]
defmodule BitGraphTest.Algorithms.Kuhn do alias BitGraph.Algorithms.Matching.Kuhn use ExUnit.Case, async: false @three_vertices_instance [[1, 2], [1, 2], [1, 2, 3, 4]] @six_vertices_instance [ [1, 4, 5], [9, 10], [1, 4, 5, 8, 9], [1, 4, 5], [1, 4, 5, 8, 9], [1, 4, 5] ] @maximum_2_in...
04d15f7db33273647f2acbcc961facaf1fb53424
3,062
[ 224242811 ]
[ "test", "ecto" ]
defmodule TwitterUpnidApi.TwitterTest do use TwitterUpnidApi.DataCase alias TwitterUpnidApi.Twitter describe "tweets" do alias TwitterUpnidApi.Twitter.Tweet @valid_attrs %{body: "some body"} @invalid_attrs %{body: nil} def tweet_fixture(attrs \\ %{}) do {:ok, tweet} = attrs ...
04d1ba5a9cf952b3c0c4f859fc448ac459ab8a0f
1,783
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DFAReporting.V4.Model.SiteContact do @moduledoc """ Site Contact ## Attributes * `address` (*type:* `String.t`, *default:* `nil`) - Address of this site contact. * `contactType` (*type:* `String.t`, *default:* `nil`) - Site contact type. * `email` (*type:* `String.t`, *default:* ...
04d1df90e4609f4dc3ef8127f2a2ddefd4593283
2,212
[ 109245082 ]
[]
defmodule Day1 do def input() do File.read!("day1.csv") end def sample() do "1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 " end def task_a() do input = input() elfs = String.split(input, "\n\n") elfs = sum_each(elfs) most(elfs) end def task_b() do input = input(...
04d1eaad42152ca015b15e806b074d55cb5ed52a
4,860
[ 71096503 ]
[ "genserver" ]
defmodule Tracker.Manager do use GenServer require Logger @name __MODULE__ @default_interval 1800 defmodule Stats do defstruct event: nil, uploaded: 0, downloaded: 0, left: 0 end defmodule Entry do defstruct trackers: [], peer_id: <<>>, next_announce: nil, timer: nil def shuffle_trackers(...
04d27b2c692a89b477c9ae35f112006c74e844e4
3,062
[ 705240775 ]
[ "phoenix" ]
defmodule ShopWeb.Router do use ShopWeb, :router import ShopWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {ShopWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_cur...
04d2ee2f85b36379531390c0b3d164d4a51e0f5e
2,449
[ 770354813 ]
[ "test" ]
defmodule BookshelfEx.ReservationsTest do use BookshelfEx.DataCase import BookshelfEx.Factory alias BookshelfEx.Repo alias BookshelfEx.Reservations describe "list_reservations/0" do test "it lists all reservations" do user = insert(:account) reservations = insert_list(3, :reservation, user: u...
04d343a5089c3c6dae6ea93353655e39c6f83848
3,652
[ 942811655, 920024200 ]
[ "test" ]
defmodule Router.Trobleshoot.Workflow.Test do use ExUnit.Case alias Support.Stubs.{Pipeline, Workflow} setup do Support.Stubs.reset() Support.Stubs.grant_all_permissions() org = Support.Stubs.Organization.create_default() user = Support.Stubs.User.create_default() project = Support.Stubs.Pr...
04d36af8fc4a6f1dae922e29cc5e04c4af20399e
2,523
[ 72369556 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("wordy.exs", __DIR__) end ExUnit.start ExUnit.configure exclude: :pending, trace: true defmodule WordyTest do use ExUnit.Case test "addition" do assert Wordy.answer("What is 1 plus 1?") == 2 end # @tag :pending test "more addition" do ...
04d38b244907e92fa73e976f56e5fc06987164ac
3,959
[ 197746227 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "configparser_ex": {:hex, :configparser_ex, "2.0.1", "71a002cbb220ad8a2d31a9cbedd590ddcee30534fb1513fe4545c...
04d3b3374cde8bc52efb92eea5bb913ef9d5ff03
2,617
[ 50649492 ]
[ "phoenix" ]
defmodule Rumbl.VideoController do use Rumbl.Web, :controller alias Rumbl.Video alias Rumbl.Category plug :scrub_params, "video" when action in [:create, :update] plug :load_categories when action in ~w(new create edit update)a def action(conn, _) do apply(__MODULE__, action_name(conn), [conn,...
04d42e90105f6ac808e9b5bb24c59038faaf2c90
1,944
[ 101480343 ]
[ "typespec", "documented" ]
defmodule AskArea do @moduledoc """ calcluates the area of a shape """ @doc """ prompts the user for a shape, and it's dimensions and calculates the area of that shape """ @spec area() :: number() def area() do input = IO.gets("R)ectangle, T)riangle, or E)llipse: ") shape = char_to_shape(S...
04d443f1f8f84c9909b1b8928250e3e19256e5cf
4,814
[ 698789477 ]
[ "test", "phoenix" ]
defmodule CartWeb.UserSettingsControllerTest do use CartWeb.ConnCase, async: true alias Cart.Accounts import Cart.AccountsFixtures setup :register_and_log_in_user describe "GET /users/settings" do test "renders settings page", %{conn: conn} do conn = get(conn, ~p"/users/settings") response ...
04d49d620923ed471d52817aace784958368e8a6
2,218
[ 188616507 ]
[ "phoenix" ]
defmodule TodoAppWeb.TarefaController do use TodoAppWeb, :controller alias TodoApp.{Tarefa, Repo} plug TodoAppWeb.Plug.RequireAuth when action in [:create, :update, :edit, :delete, :new] plug :verifica_permissao when action in [:create, :update, :edit] def new(conn, _params) do changeset = Tarefa.ch...
04d4b79ebb800b2eff92c298cc6ee3930a63ccf9
3,362
[ 405450472 ]
[ "typespec", "documented", "ecto" ]
defmodule VtmWeb.Resolvers.HavenResolvers do @moduledoc false import VtmWeb.Resolvers.Helpers alias Vtm.Havens alias Vtm.Havens.Event alias Vtm.Characters def get_havens(_, _, _) do result = Havens.get_havens() |> Enum.sort(fn %{x: _, y: ya}, %{x: _, y: yb} when ya != yb -> ya - y...
04d4c665d7451a9415315290727cdb3a75b28945
1,797
[ 138291550 ]
[]
defmodule HelloPhoenix.Mixfile do use Mix.Project def project do [app: :hello_phoenix, version: "0.0.1", elixir: "~> 1.5", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix, :gettext] ++ Mix.compilers, build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, ...