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 |
|---|---|---|---|---|
00be378825af542189a61ae047cfa3b6b5e6300c | 20,416 | [
608798932
] | [
"documented",
"ecto"
] | defmodule TurnStile.Staff do
@moduledoc """
The Staff context.
"""
import Ecto.Query, only: [from: 2], warn: false
alias TurnStile.Repo
alias TurnStile.Roles
alias TurnStile.Company
alias TurnStile.Staff.{Employee, EmployeeToken, EmployeeNotifier}
## Database getters
@doc """
Gets a employee by... |
00bf0f927e5e804350463bd08a377ed5e6d74814 | 1,794 | [
339694223
] | [] | # 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.
# General application configuration
import Config
config :ircois,
ecto_repos: [Ircois.Repo]
# Co... |
00bf3c9f8e035332058cd63a0c445131700ddf36 | 2,981 | [
344689872
] | [] | %{
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
"db_connection": {:hex, :db_connection, "2.0.6", "bde2f85d047969c5b5800cb8f4b3ed6316c8cb11487afedac4aa5f93fd39ab... |
00bfb0867e8c5adb70717186c55afded7d1e5a33 | 3,497 | [
189251630
] | [
"test"
] | defmodule Dotcom.ContentRewriters.ResponsiveTablesTest do
use ExUnit.Case
import Dotcom.ContentRewriters.ResponsiveTables
describe "rewrite_table" do
test "works with a full table" do
{:ok, [html]} =
"""
<table>
This is the caption
#{thead()}
#{tbo... |
00bfe8537cb74ed2c06a409cf1c8cd6ef535c5b6 | 13,169 | [
99126072,
109620344,
86063602,
112052265
] | [
"macro",
"documented"
] | defmodule Mariaex.RowParser do
@moduledoc """
Parse a row of the MySQL protocol
This parser makes extensive use of binary pattern matching and recursion to take advantage
of Erlang's optimizer that will not create sub binaries when called recusively.
"""
use Bitwise
alias Mariaex.Column
alias Mariaex.M... |
00c02e307306a3aa9e147a59087965403e92b023 | 1,791 | [
38493005
] | [] | defmodule TwitchDiscovery.Mixfile do
use Mix.Project
def project do
[app: :twitch_discovery,
version: "0.0.1",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
... |
00c06341f031d7509758216adda445a7b5202b70 | 3,463 | [
72556503
] | [
"test"
] | defmodule Pomerol.OrganizationSalesCategoryPolicyTest do
use Pomerol.PolicyCase
import Pomerol.OrganizationSalesCategoryPolicy, only: [create?: 2, update?: 2]
import Pomerol.OrganizationSalesCategory, only: [create_changeset: 2, update_changeset: 2]
alias Pomerol.OrganizationSalesCategory
describe "create"... |
00c080c63e9873ad4a719f1bd901627dce7123be | 4,915 | [
417908987,
148905093,
603266979,
34983055,
612949543
] | [
"test"
] | defmodule ProteinTranslationTest do
use ExUnit.Case
describe "of_codon" do
# @tag :pending
test "AUG translates to methionine" do
assert ProteinTranslation.of_codon("AUG") == {:ok, "Methionine"}
end
test "identifies Phenylalanine codons" do
assert ProteinTranslation.of_codon("UUU") == ... |
00c106bdd69a955a9496f50e3566066569b60279 | 3,470 | [
627662195
] | [
"typespec",
"macro",
"documented"
] | defmodule BetterNumber.SI do
@moduledoc """
Provides functions for formatting numbers using SI notation.
"""
@prefixes [
# yotta
{8, "Y"},
# zetta
{7, "Z"},
# exa
{6, "E"},
# peta
{5, "P"},
# tera
{4, "T"},
# giga
{3, "G"},
# mega
{2, "M"},
# kilo
... |
00c14e78e0686794282d006e03d6d1dde1f26bb9 | 1,579 | [
212379681,
542604765
] | [
"genserver",
"supervisor"
] | workers = [A, B, C]
supervisor = SUP
defmodule Employee do
use GenServer
def start_link(name: n), do: GenServer.start_link(__MODULE__, 0, name: n)
def init(work) when is_integer(work), do: {:ok, %{work: 0}, {:continue, :start}}
def add_work(emp, amount), do: GenServer.cast(emp, {:addwork, amount})
def hand... |
00c1963767a65c04cd560d59d517596a0b09d72e | 6,743 | [
213888437
] | [
"phoenix"
] | defmodule Ginga.Router do
use Ginga.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
plug Guardian.Plug.VerifyHeader
plug Guar... |
00c1a5d9f72d2b9f3a54c4526c5e2a3c042450b5 | 7,890 | [
19643959
] | [
"typespec",
"documented"
] | defmodule Node do
@moduledoc """
Functions related to VM nodes.
Some of the functions in this module are inlined by the compiler,
similar to functions in the `Kernel` module and they are explicitly
marked in their docs as "inlined by the compiler". For more information
about inlined functions, check out th... |
00c1b8046add2cc908fbf1266563bdd67818d4b5 | 1,603 | [
93777129
] | [
"test"
] | defmodule Sue.Commands.Images.MotivateTest do
use ExUnit.Case
alias Sue.Commands.Images.Motivate
@media_path Path.join(:code.priv_dir(:sue), "media/")
describe "motivate/3" do
test "generates a demotivational with top and bottom text" do
image_path = Path.join(@media_path, "korone.JPG")
top_te... |
00c1defc8d74a142e3fa8d24d8daaa393f5bc8d8 | 2,046 | [
159918207
] | [
"documented"
] | defmodule Advent.DayThree do
use Advent, file: "03.txt"
import NimbleParsec
defparsec(
:parse_date,
ignore(string("#"))
|> integer(min: 1)
|> ignore(string(" @ "))
|> integer(min: 1)
|> ignore(string(","))
|> integer(min: 1)
|> ignore(string(": "))
|> integer(min: 1)
|> ig... |
00c1eaaa7b6e2224c0ae2bf3fef705b37b6d0034 | 1,924 | [
281158280
] | [
"documented",
"ecto"
] | defmodule Linear.Data.SharedIssueLock do
use Ecto.Schema
import Ecto.Changeset
alias Linear.Repo
alias Linear.Data.SharedIssue
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "shared_issue_locks" do
field :expires_at, :utc_datetime
belongs_to :shared_issue... |
00c1f120f2c23c09abf1ac33174e50c3204c9e8b | 1,777 | [
726459148
] | [] | #!/bin/elixir
# {:ok, text} = File.read("test.txt")
{:ok, text} = File.read("input.txt")
defmodule Cards do
def parseType(hand) do
card_map = hand |> String.graphemes |> Enum.frequencies
{pairs, trips, quads, five} = for {card, num} <- card_map, reduce: {0, 0, 0, 0} do {p, t, q, f} ->
case num do
... |
00c232d376c329304643984584a8abeeed35c107 | 7,813 | [
30349767
] | [
"genserver",
"typespec",
"documented"
] | defmodule LindaEx do
@moduledoc """
GenServer implementation of Linda-style tuple spaces.
Uses an ETS table internally.
"""
@type space :: :ets.tab
@type template :: tuple | :ets.match_spec | :'_'
use GenServer
@spec start_link(atom) :: GenServer.on_start
def start_link(name) do
GenServer.star... |
00c2587bb6b3393aeda8d24300f22053648d0f1d | 1,781 | [
551707730
] | [
"typespec",
"documented"
] | defmodule TripBookingsParser.Segments do
@moduledoc false
alias TripBookingsParser.Segments.Hotel
alias TripBookingsParser.Segments.Travel
@type segment :: Hotel.t() | Travel.t()
@spec from_raw_segment({:ok, [term], binary, map, term, pos_integer}) :: segment
def from_raw_segment({:ok, [hotel: attributes... |
00c2740d2a49e21da309f85fdcffaf28d53cf814 | 3,824 | [
388666039
] | [
"ecto"
] | defmodule Faqcheck.Sources.Strategies do
require Logger
alias Faqcheck.Repo
alias Faqcheck.Sources.Microsoft.API.Sharepoint
@strategy_list [
Faqcheck.Sources.Strategies.NMCommunityResourceGuideXLSX,
Faqcheck.Sources.Strategies.RRFB.ClientResources,
Faqcheck.Sources.Strategies.RRFB.FoodFinder,
]
... |
00c27c4083288a7018559d2f9d40a956473dccc7 | 4,996 | [
62898132
] | [
"typespec",
"documented"
] | defmodule Lisp.Reader do
@moduledoc """
Contains functions that read and evaluate Lisp code.
"""
alias Lisp.Types
alias Lisp.Reader.Eval
alias Lisp.Lambda
@spec tokenise(String.t) :: [String.t]
def tokenise(expr) do
expr
|> String.replace(~r/([\{\}\(\)])/, " \\1 ")
|> String.split
end
... |
00c2987f42023e549ddd07560157d1b58241e6b7 | 2,508 | [
230262000
] | [
"test",
"phoenix"
] | # test/banking_api_web/controllers/account_controller_test.exs
defmodule BankingApiWeb.AccountControllerTest do
use BankingApiWeb.ConnCase
@account_model %{name: "Regular user", email: "<EMAIL>", document: "000.000.000-00", password: "12345678"}
describe "registration" do
test "renders created account when... |
00c2e6b27e5572440619e1c1c11443c2d72f30d5 | 1,919 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DFAReporting.V4.Model.ClickThroughUrl do
@moduledoc """
Click-through URL
## Attributes
* `computedClickThroughUrl` (*type:* `String.t`, *default:* `nil`) - Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: -... |
00c337bcb0dfa7ce2445769e73b1378706a9d881 | 4,304 | [
896792314
] | [
"typespec",
"documented"
] | defmodule AdventOfCode.Twenty do
@moduledoc false
@typep world :: Types.tuple_matrix(String.t())
@typep position :: {non_neg_integer(), non_neg_integer()}
@doc false
def main() do
IO.puts("Part one:")
Input.read_file_into_matrix(20) |> part_one(100) |> IO.puts()
IO.puts("Part two:")
Input.re... |
00c374b91cda331c894e9a29eec2622284a4e9a6 | 2,064 | [
897858822
] | [] | defmodule AdventOfElixir2024.Day4_2 do
def test() do
{:ok, input} = File.read("4_test_input.txt")
solution(input) |> IO.inspect()
end
def prod() do
{:ok, input} = File.read("4_input.txt")
solution(input) |> IO.inspect()
end
def solution(input) do
matrix =
String.split(input, "\r\n"... |
00c38b6222eeef1b7c4bfcf8f271f9ffab5125f8 | 2,902 | [
770650574
] | [
"liveview"
] | defmodule MycoBot.Instrumenter do
require Logger
alias MycoBot.Environment
def setup do
events = [
# [:myco_bot, :started],
[:myco_bot, :si7021, :read],
# [:myco_bot, :si7021, :error],
[:myco_bot, :sht30, :read],
# [:myco_bot, :sht30, :error],
# [:myco_bot, :veml7700,... |
00c3c653e88bef0ec0d374da8aae52429812a280 | 2,212 | [
282066598
] | [
"liveview",
"ecto"
] | defmodule GlimeshWeb.NotificationsLive do
use GlimeshWeb, :live_view
alias Glimesh.Accounts
alias Glimesh.ChannelLookups
@impl true
def mount(_params, session, socket) do
if session["locale"], do: Gettext.put_locale(session["locale"])
user = Accounts.get_user_by_session_token(session["user_token"])... |
00c3cde9443a0da1e2fef10d6c5fc71f00fa8f8c | 4,035 | [
249482393
] | [] | %{
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
"earmark": {:hex, :earmark, "1.4.3", "3... |
00c3f29b937395789abd742bce58bbfd66842485 | 2,762 | [
860453781
] | [
"test"
] | defmodule MyAshBlog.Blog.UserTest do
use ExUnit.Case
alias MyAshBlog.Blog.User
setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(MyAshBlog.Repo)
:ok
end
test "criar um usuário com hash de senha" do
changeset =
User
|> Ash.Changeset.for_create(:create, %{
username: "TestUser"... |
00c4f7fe8e5e4fc4509b5a9f4a40f8212dda3dcf | 8,745 | [
436317855
] | [
"test",
"ecto"
] | defmodule Siwapp.InvoicesTest do
use Siwapp.DataCase
import Siwapp.InvoicesFixtures
import Siwapp.SettingsFixtures
import Siwapp.CommonsFixtures
alias Siwapp.InvoiceHelper
alias Siwapp.Invoices
alias Siwapp.Invoices.Invoice
alias Siwapp.Settings
setup do
series = series_fixture(%{name: "A-Serie... |
00c51ae82fbf99e098089ad0836998db867f209f | 3,791 | [
790788837
] | [
"test"
] | defmodule Workspace.Checks.EnforceBoundariesTest do
use Workspace.CheckCase
alias Workspace.Checks.EnforceBoundaries
setup do
project_a =
Workspace.Test.project_fixture(:foo, "foo",
deps: [{:bar, path: "../bar"}],
workspace: [tags: [:foo]]
)
project_b =
Workspace.Test.p... |
00c56b112b2699ef0937e3cfe0fb4b387e83162a | 14,913 | [
191614124
] | [] | %{
"artificery": {:hex, :artificery, "0.2.6", "f602909757263f7897130cbd006b0e40514a541b148d366ad65b89236b93497a", [:mix], [], "hexpm"},
"brod": {:hex, :brod, "3.4.0", "34664713baaa60aed3b560c6a679cf90ace8dde8672732e730218db57440e37a", [:make, :rebar, :rebar3], [{:kafka_protocol, "1.1.2", [hex: :kafka_protocol, repo... |
00c5ce6a54d687bf015a58c228f90690a7abea59 | 1,594 | [
47189293
] | [
"phoenix"
] | defmodule ElixirVsCrystal.PostController do
use ElixirVsCrystal.Web, :controller
alias ElixirVsCrystal.Post
plug :scrub_params, "post" when action in [:create, :update]
def index(conn, _params) do
posts = Repo.all(Post)
render(conn, "index.json", posts: posts)
end
def create(conn, %{"post" => po... |
00c5ea5974b362da1ddc1107ca5c501c0b36e9d9 | 1,535 | [
92092485
] | [
"typespec",
"documented"
] | defmodule LinkedList do
@opaque t :: tuple()
@doc """
Construct a new LinkedList
"""
@spec new() :: t
def new() do
[]
end
@doc """
Push an item onto a LinkedList
"""
@spec push(t, any()) :: t
def push(list, elem) do
[elem | list]
end
@doc """
Calculate the length of a LinkedList... |
00c61ecb29e36ed304d3e075ff9984dd695af114 | 2,802 | [
776324136
] | [] | import Config
# Configure your database
config :cen, Cen.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "cen_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache and enable
# debugging and code re... |
00c6a50b3823118faac230b93810b161681512a4 | 2,549 | [
850114862
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule FoodTruckHeatmapWeb 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 FoodTruckHeatmapWeb, :controller
use FoodTruckHeatmapWeb, :view
The definitions below will be executed for... |
00c6e3d951250d720ea279c3de915fad336de724 | 3,716 | [
156490834
] | [
"genserver",
"typespec"
] | defmodule Classroom.Whiteboard do
use GenServer
require Logger
# API
def start_link({owner}) do
# , debug: [:trace])
GenServer.start_link(__MODULE__, [{owner}], name: via_tuple(owner))
end
def connect(owner) do
GenServer.call(via_tuple(owner), {:connect, self()})
end
def disconnect(owner... |
00c7149e96e7714f58fafc53a9b3acbd71f5f111 | 6,623 | [
924911936
] | [
"liveview"
] | defmodule PintelierWeb.UserSettingsLive do
use PintelierWeb, :live_view
alias Pintelier.Accounts
def render(assigns) do
~H"""
<.header class="text-center">
Account Settings
<:subtitle>Manage your account email address and password settings</:subtitle>
</.header>
<div class="space-y-... |
00c71ae7017c31bfd5d561dd16947616d5229d3f | 14,457 | [
633251977
] | [] | %{
"absinthe": {:hex, :absinthe, "1.7.5", "a15054f05738e766f7cc7fd352887dfd5e61cec371fb4741cca37c3359ff74ac", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~... |
00c77263c11d8df480b13a045d9a54e6ea677c32 | 2,201 | [
134554593
] | [
"phoenix"
] | defmodule Discuss.TopicController do
use Discuss.Web, :controller
alias Discuss.Topic
plug Discuss.Plugs.RequireAuth when action in [:create,:new, :edit,:update,:delete]
plug :check_topic_owner when action in [:edit,:update,:delete]
def index(conn, _params) do
topics = Repo.all(Topic)
render(conn,... |
00c7c2bb9582886647c7c0b5e226b14dc1f4a81c | 2,662 | [
158341092
] | [
"test",
"phoenix"
] | defmodule PetbookWeb.PostControllerTest do
use PetbookWeb.ConnCase
alias Petbook.Posts
@create_attrs %{content: "some content"}
@update_attrs %{content: "some updated content"}
@invalid_attrs %{content: nil}
def fixture(:post) do
{:ok, post} = Posts.create_post(@create_attrs)
post
end
descri... |
00c7e996d2e2d4c8c36c136b949962850bfbc6ba | 13,535 | [
498675807
] | [
"test"
] | defmodule AppCount.Adapters.SoftLedgerAdapterTest do
use AppCount.Case
alias AppCount.Adapters.SoftLedgerAdapter
alias AppCount.Core.Ports.RequestSpec
use AppCount.Core.Ports.SoftLedgerBehaviour, :alias_requests_and_responses
@parent_id AppCount.Adapters.SoftLedger.Config.load().parent_id
# TODO move some... |
00c85237cbc32e39e802a7ac5492dccdad099da6 | 2,313 | [
893419692
] | [
"documented"
] | defmodule KVServer.Command do
@doc ~S"""
Parses the given 'line' into a command.
## Examples
iex> KVServer.Command.parse "CREATE shopping\r\n"
{:ok, {:create, "shopping"}}
iex> KVServer.Command.parse "CREATE shopping \r\n"
{:ok, {:create, "shopping"}}
iex> KVServer.Command.parse "PUT... |
00c868df0d617ae4f9c9968842fe5ccafcb2dbe0 | 1,724 | [
539667795
] | [
"documented",
"ecto"
] | defmodule Ticketed.Events do
@moduledoc """
The Events context.
"""
import Ecto.Query, warn: false
alias Ticketed.Repo
alias Ticketed.Events.Event
@doc """
Returns the list of events.
## Examples
iex> list_events()
[%Event{}, ...]
"""
def list_events do
Repo.all(Event)
end
... |
00c887ebcb923f0b93995ebf9926586e806b244c | 9,567 | [
1002277727
] | [
"phoenix",
"ecto"
] | defmodule SelfSustainingWeb.TaskController do
use SelfSustainingWeb, :controller
require Logger
alias SelfSustaining.Task
# GET /api/tasks - List all tasks with optional filtering
def index(conn, params) do
trace_id = get_trace_id(conn)
start_time = System.monotonic_time(:millisecond)
Logger... |
00c8929a1bf6bb944434d9225837cc62fa360d14 | 1,791 | [
37360779
] | [] | defmodule Alkyl.PadData.Textrange do
# very similar to Changeset...
defstruct len: 0, lfs: 0, opc: "", attribs: [], text: ""
alias Alkyl.PadData.Textrange
import Alkyl.Utils.Base36
import Alkyl.Utils.Common
def parse(str, text) do
Regex.scan(~r/
# \w+ matches for base... |
00c8cb0258297dfb37c69b799d602c6f99746a87 | 23,423 | [
1014340631
] | [
"documented"
] | defmodule Thundercore.Thunderchief.Divinity.Uranus do
@moduledoc """
Uranus - The Innovator Divinity
Domain: Innovation and Adaptation
Uranus represents the spirit of innovation, experimentation, and adaptive
change within the Thunder ecosystem. As the god of the sky and sudden
change, Uranus identifi... |
00c8e005b91a74c315fafe6f42ef92cd6e7eea04 | 2,284 | [
259042911
] | [
"test",
"documented"
] | defmodule Hive.Test do
@moduledoc false
use ExUnit.Case
use Hive.Base
describe "hive :: 🌈 " do
test "can infleet vehicles" do
vehicle = %Vehicle{id: "api-vehicle"}
assert {:ok, _pid} = Hive.infleet(vehicle)
assert {:ok, _pid} = Hive.infleet("456")
end
test "can defleet vehicles"... |
00c8eef9f8c94681be15fcce71359011799ef1bb | 2,529 | [
922541428
] | [
"liveview",
"phoenix",
"test"
] | defmodule SimpletaskWeb.UserRegistrationLiveTest do
use SimpletaskWeb.ConnCase, async: true
import Phoenix.LiveViewTest
import Simpletask.AccountsFixtures
describe "Registration page" do
test "renders registration page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/register")
asse... |
00c92c82be20713f389193bd9ef32608ce3fc093 | 20,144 | [
935778085
] | [
"documented"
] | defmodule WandererNotifier.MockESI do
@moduledoc """
Mock implementation of the ESI service for testing.
"""
# Test data for ESI.ServiceTest
@character_data %{
"character_id" => 123_456,
"name" => "Test Character",
"corporation_id" => 789_012,
"alliance_id" => 345_678,
"security_status" =... |
00ca9969510ff16eadcc42f5dcc279f367f8edb1 | 4,035 | [
249046343
] | [
"test"
] | defmodule NanoRepo.CLITest do
use ExUnit.Case, async: true
alias NanoRepo.CLI
test "nanorepo" do
Logger.configure(level: :warn)
File.rm_rf!("tmp")
File.mkdir_p!("tmp")
File.cd!("tmp", fn ->
# init
CLI.main(~w(init acme))
# server
{:ok, _} = start_server(port: 4001)
... |
00cabe733a7a164a07f49656959e509ed8490315 | 2,397 | [
83160782
] | [
"test"
] | defmodule Rumblr.VideoControllerTest do
use Rumblr.ConnCase
alias Rumblr.Video
@valid_attrs %{" url": "some content", description: "some content", title: "some content"}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, video_path(conn, :index)
assert html_respo... |
00cb28d826b618af1f3469eb1b38142f8a48003b | 3,500 | [
67077446
] | [
"test"
] | defmodule TrackingServiceApi.DeliveryManControllerTest do
use TrackingServiceApi.ConnCase
alias TrackingServiceApi.DeliveryMan
alias TrackingServiceApi.Repo
@valid_attrs %{username: "some content"}
@invalid_attrs %{}
setup do
conn = build_conn()
|> put_req_header("accept", "application/vnd.api+... |
00cb6620a155dfa50e611ee8d31499b50b6d0e9b | 2,600 | [
432524514
] | [
"documented",
"ecto"
] | defmodule Userdocs.S3Provider do
@moduledoc "The Step Types context."
require Logger
# alias Userdocs.Teams
# alias Schemas.Screenshots.Screenshot
# alias Schemas.Screenshots.PresignedURLs
# @placeholder_path Path.join([:code.priv_dir(:userdocs), "static", "images", "userdocs_placeholder.png"])
alias S... |
00cb89b896bc7c03307f9dbcd813d662fc3fff26 | 2,161 | [
573607277
] | [
"documented"
] | defmodule AdventOfCode.Year2022.Day10 do
@moduledoc """
--- Day 10: Cathode-Ray Tube ---
https://adventofcode.com/2022/day/10
"""
alias AdventOfCode.OCR
defp parse_input(input) do
input
|> String.split("\n", trim: true)
|> Stream.flat_map(fn instruction ->
cond do
instruction == ... |
00cb91bdb7830e6931c8308ecfe61c0fcc8d8e0e | 4,876 | [
304092719
] | [
"documented"
] | defmodule Support.Randoms do
@moduledoc """
Generates randomized fields.
"""
# credo:disable-for-this-file
alias DarkMatter.Decimals
alias Faker.Address, as: FakerAddress
# alias Faker.Address.En, as: FakerAddressEn
alias Faker.Date, as: FakerDate
alias Faker.DateTime, as: FakerDateTime
alias Fak... |
00cbf798500925ae091d7579fe830cc7fa3e86dd | 2,480 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance do
@moduledoc """
Instance conceptually encapsulates all Remote Build Execution resources for remote builds. An instance consists of storage and compute resources (for example, `ContentAddressableStorage`, `Acti... |
00cc27acec7d006804c9e1ff2b8308f1d333691a | 2,207 | [
228256015
] | [
"test"
] | defmodule DornachWeb.SelectHelpersTest do
use Dornach.CalendarCase, async: false
alias Dornach.{Calendar, Event}
alias DornachWeb.SelectHelpers
describe "from_options" do
test "returns options for the given date" do
changeset = Event.changeset(%Event{}, %{})
options = SelectHelpers.from_options... |
00cc6950dd9494a7cc801bce626bc21f648a105a | 4,058 | [
142666144
] | [
"test",
"phoenix"
] | defmodule CSysWeb.UserControllerTest do
use CSysWeb.ConnCase
alias CSys.Auth
alias CSys.Auth.User
alias Plug.Test
@create_attrs %{is_active: true, password: "some password", uid: "some uid"}
@update_attrs %{is_active: false, password: "some updated password", uid: "some updated uid"}
@invalid_attrs %{is... |
00cca6c23ff56159d73d584ca644b5e21e4acdf6 | 2,135 | [
762131773,
970389734,
746798402,
385691311,
820624395,
682357176,
719664534,
394023530,
675225385,
823014073,
424400274,
739033590,
565246607
] | [] | defmodule Pleroma.Activity.Ir.Topics do
alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Visibility
def get_activity_topics(activity) do
activity
|> Object.normalize(fetch: false)
|> generate_topics(activity)
|> List.flatten()
end
defp generate_topics(%{data: %{"type" => "Answer"}}, _) do
... |
00ccd920ee237d336885f2a62a0890a0974b7804 | 1,642 | [
165277810
] | [
"macro",
"documented",
"phoenix"
] | defmodule PhremarkWeb 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 PhremarkWeb, :controller
use PhremarkWeb, :view
The definitions below will be executed for every view,
controlle... |
00cd2182e99252c4660d01be78c03cc576a422b0 | 3,194 | [
493575925
] | [
"typespec",
"documented"
] | defmodule Yousign.Request do
@moduledoc """
A module for handling the internal requests to the Yousign API
"""
alias Yousign.Config
@doc """
Makes a request to the Yousign API
## Examples
iex> Yousign.Request.make_request(:get, "signature_requests")
{:ok, %{"data" => [], "meta" => %{"pagin... |
00cdca1bfffae63043df13dd8b0dfa3bee9ae414 | 1,708 | [
123452666
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :canboard,
ecto_repos: [Canboard.Repo]
... |
00cdce34d28714a68ba16b1ef0a2a19cb260d3fa | 1,799 | [
179240038
] | [
"documented"
] | defmodule Imcon.Time do
@second_ms 1_000_000
@doc """
Examples
iex> Imcon.Time.to_timestamp(%DateTime{calendar: Calendar.ISO, day: 7, hour: 16, microsecond: {321, 6}, minute: 13, month: 11, second: 19, std_offset: 0, time_zone: "Etc/UTC", utc_offset: 0, year: 2015, zone_abbr: "UTC"})
1446912799.000321
... |
00ce4031c7fa2a573d34c5c3a84c289e61ea8692 | 2,223 | [
330404542
] | [] | defmodule Zip.Compiler.ModuleCompiler do
require Logger
alias Zip.Compiler.{
Parser,
TypeChecker.ParallelTypeChecker,
ErlTranslate,
CodeServer
}
# Returns {:ok, module_name, file, binary} | {:error, message}
def compile(module_name) do
Logger.debug("Compiling #{module_name}")
result... |
00ce576879aee601ac44036d1ddb336e9658868a | 1,658 | [
69116317
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Freezerburn.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Freezerburn.Web, :controller
use Freezerburn.Web, :view
The definitions below will be executed for every view,
controller, etc, so k... |
00cebc7bb0390bfca8698ac47d10dc80eadec4b6 | 6,904 | [
616868442
] | [
"liveview"
] | defmodule FullCircleWeb.HolidayLive.Form do
use FullCircleWeb, :live_view
alias FullCircle.HR.Holiday
alias FullCircle.StdInterface
@impl true
def mount(params, _session, socket) do
id = params["holiday_id"]
socket =
case socket.assigns.live_action do
:new -> mount_new(socket)
... |
00cfa802d6eae9e3654de86a1a536d27e6ad89fa | 1,748 | [
54934888
] | [
"phoenix"
] | defmodule Locorum.Auth do
import Plug.Conn
import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0]
import Phoenix.Controller
alias Locorum.Router.Helpers
def init(opts) do
Keyword.fetch!(opts, :repo)
end
def call(conn, repo) do
user_id = get_session(conn, :user_id)
cond do
user =... |
00d0025e1c0a01dc752588cebb70ef2a2d825939 | 1,606 | [
219851918
] | [
"phoenix"
] | defmodule Time2Web.Router do
use Time2Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :ajax do
plug :accepts, ["json"]
plug :fetch_session
plug :protect_from... |
00d09c4660567c596ba1666d6efc252d8d7d65c0 | 11,203 | [
728633818
] | [
"genserver",
"typespec",
"supervisor",
"documented"
] | defmodule ExWal.Manager.Failover do
@moduledoc false
use GenServer, restart: :transient
alias ExWal.FS
alias ExWal.LogWriter
alias ExWal.Manager.Options
alias ExWal.Models
alias ExWal.Monitor
alias ExWal.Monitor.DirAndFile
alias ExWal.Recycler
require Logger
@type t :: %__MODULE__{
n... |
00d0e5adf8e4c9e6c9e393597b4afb6b653cfbc4 | 5,317 | [
107365920
] | [
"phoenix",
"documented"
] | defmodule MehrSchulferienWeb.VacationView do
use MehrSchulferienWeb, :view
import MehrSchulferienWeb.Shared.GenericPaginationComponent
import MehrSchulferienWeb.FederalState.PeriodsTableComponent
import MehrSchulferienWeb.FederalState.CalendarLegendComponent
import MehrSchulferienWeb.FederalState.MonthCalend... |
00d109ca478345a9f60bc30ac59da8728c6f33a7 | 12,467 | [
997178529
] | [
"test",
"documented"
] | defmodule DSPEx.TeleprompterIntegrationTest do
use ExUnit.Case, async: true
@moduletag :group_1
alias DSPEx.{Evaluate, Example, Teleprompter}
alias DSPEx.Teleprompter.BootstrapFewShot
# Mock signature for testing
defmodule QASignature do
@moduledoc "Answer questions"
use DSPEx.Signature, "questio... |
00d1f44c49f076d314aa8efb3001604cf23d4407 | 1,747 | [
751267046
] | [
"phoenix"
] | defmodule NikoSafeWeb.Router do
use NikoSafeWeb, :router
pipeline :browser do
plug :accepts, ["json"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {NikoSafeWeb.Layouts, :root}
# plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
... |
00d21aa91a3ef422ec5c986d7d4c5479781f3f38 | 2,008 | [
974438920
] | [] | # 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:
#
# LivexDemo.Repo.insert!(%LivexDemo.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they ... |
00d243180316de805ad9bebc2f2c47446e992cad | 14,798 | [
997265890
] | [
"typespec",
"liveview",
"documented"
] | defmodule VeasytDashboardWeb.CoreComponents do
@moduledoc """
Provides core UI components.
At first glance, this module may seem daunting, but its goal is to provide
core building blocks for your application, such as tables, forms, and
inputs. The components consist mostly of markup and are well-documented
... |
00d26fd2465b4c9a4c7a1462fce08fef6292454c | 6,821 | [
670103538,
681629586,
704658418,
713860590,
712071186,
687446493,
837319868,
688332642,
709785915,
718072585,
653792222,
710549260,
869143224,
648118486,
651155880,
689993351,
718071371,
631076437,
668462511,
685399586,
657606827,
669575169,
677687005,
712404127,
6743... | [
"typespec",
"macro",
"documented"
] | defmodule Ecto.Query.Builder.From do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Handles from expressions.
The expressions may either contain an `in` expression or not.
The right side is always expected to Queryable.
## Examples
iex> escape(quote(do: MySchema), __ENV__)
{MySchema, ... |
00d2bed007a632524b095c3deb91a7f98795852e | 2,384 | [
160132117
] | [
"typespec",
"documented"
] | defmodule Advent.Day2 do
@moduledoc """
# Day 2: Inventory Management System
See: https://adventofcode.com/2018/day/2
"""
@doc """
A rudimentary checksum of string IDs.
## Examples
iex(1)> Advent.Day2.checksum([
...(1)> "abcdef",
...(1)> "bababc",
...(1)> "abbcde",
... |
00d36c2619d70b6cb908e7a55cbf52a4aad4a561 | 2,541 | [
632569682
] | [] | defmodule Testly.Mixfile do
use Mix.Project
def project do
[
app: :testly,
version: "0.0.1",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mi... |
00d3e96fb4cfa1c2035ba25099f28233d386194f | 8,295 | [
669267682
] | [
"liveview"
] | Mix.install([:jason, :finch, :nimble_csv])
defmodule Height do
alias NimbleCSV.RFC4180, as: CSV
require Logger
def run do
Finch.start_link(name: Height)
:telemetry.attach(__MODULE__, [:finch, :request, :stop], &__MODULE__.handle_event/4, nil)
{opts, _argv} = OptionParser.parse!(System.argv(), stric... |
00d4cc34b1ff72d736627530e0a768ff6c104501 | 3,592 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V8Availabilities.Services.GetFeedItemTargetRequest do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
resource_name: String.t()
}
defstruct [:resource_name]
field :resource_name, 1, type: :string
end
defmodule Google.Ads.Googleads.V8A... |
00d5542dcbb58887f244a43e0b020c126144a6db | 4,733 | [
218984102
] | [
"test"
] | defmodule AuthShield.Credentials.PublicKeyTest do
use AuthShield.DataCase, async: true
alias AuthShield.Credentials.PublicKey
alias AuthShield.Credentials.Schemas.PublicKey, as: Key
setup do
{:ok, application: insert(:application)}
end
describe "insert/1" do
setup ctx do
{:ok, params: %{par... |
00d5b0f3bb55ea07b5c31c3423c910bc14502d35 | 1,827 | [
163085982
] | [
"typespec"
] | defmodule ListOps do
# Please don't use any external modules (especially List or Enum) in your
# implementation. The point of this exercise is to create these basic
# functions yourself. You may use basic Kernel functions (like `Kernel.+/2`
# for adding numbers), but please do not use Kernel functions for Lists... |
00d66fee28dca5c388da812e9067eca25886dc12 | 2,504 | [
493669750
] | [
"documented",
"ecto"
] | defmodule StockApp.UserSubscriptions do
@moduledoc """
The UserSubscriptions context.
"""
import Ecto.Query, warn: false
alias StockApp.Repo
alias StockApp.UserSubscriptions.UserSubscription
@doc """
Returns the list of user_subscriptions.
## Examples
iex> list_user_subscriptions()
[%... |
00d6fa34580c1a5b0151a5988c4b3a3d4cd81661 | 1,652 | [
491683978
] | [
"liveview"
] | defmodule CalendexWeb.Admin.Components.Modal do
use Phoenix.Component
def content(assigns) do
~H"""
<div class="fixed inset-0 z-20 overflow-y-auto"
phx-window-keydown="close_modal"
phx-key="escape">
<div class="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:bloc... |
00d7329ac02d97d5403f5b233bd1551afeef0c0c | 2,790 | [
218465592
] | [
"phoenix",
"ecto"
] | defmodule TimesheetWeb.TaskController do
use TimesheetWeb, :controller
alias Timesheet.Tasks
alias Timesheet.Tasks.Task
def index(conn, %{"id" => id}) do
tasks = Tasks.get_task_by_job_id!(id)
render(conn, "index.html", tasks: tasks)
end
def index(conn, %{"job" => job, "sheet" => sheet}) do
IO... |
00d7db160868e8342b19bb94c21ff5d842e566d4 | 3,583 | [
916648378,
581462452
] | [
"documented"
] | defmodule Task1bNumberDetection do
@moduledoc """
A module that implements functions for detecting numbers present in a grid in provided image
"""
alias Evision, as: OpenCV
@doc """
#Function name:
identifyCellNumbers
#Inputs:
... |
00d87295e259475b719cac7fcdcc34396f44e7ae | 3,632 | [
650447659
] | [
"test",
"ecto"
] | defmodule CourtPiece.AccountsTest do
use CourtPiece.DataCase, async: true
alias CourtPiece.Accounts
alias CourtPiece.Factory
import CourtPiece.AccountsFixtures
setup do
valid_attrs = %{name: "test", email: "<EMAIL>", user_role: "social"}
invalid_attrs = %{name: "test"}
{:ok, valid_attrs: valid_... |
00d93b209fbb237d18231bf21a6da2779b96578a | 16,247 | [
531252724
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm... |
00d940fe56aaa1e72a8f58ffddbb237411bb707d | 1,571 | [
432424658
] | [
"phoenix"
] | defmodule CryptoDashboardWeb.Router do
use CryptoDashboardWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {CryptoDashboardWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
p... |
00d980286cc1a4acaa0a19e286afcb1a7fca7211 | 4,992 | [
703143319
] | [] | defmodule PostgresqlAdapters.Task.QueryBuilder do
alias Core.Shared.Types.Pagination
alias Core.Task.Types.Filter
alias Core.Task.Types.Sort
alias Core.User.Entity, as: User
@query "
SELECT
tasks.id AS task_id,
tasks.name AS task_nm,
tasks.type AS task_tp,
tasks.day AS task_da... |
00d9e5586344c6b6d8900453ef9c9e7af271f380 | 1,949 | [
119747156
] | [
"typespec",
"ecto"
] | defmodule NervesHub.Accounts.Org do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias NervesHub.Accounts.OrgKey
alias NervesHub.Accounts.OrgUser
alias NervesHub.Devices.CACertificate
alias NervesHub.Devices.Device
alias NervesHub.Products.Product
alias NervesHub.Repo
alias __MODULE__
... |
00da1202727e06a2862ebee52f26791a9150ce23 | 15,614 | [
106712767
] | [
"liveview"
] | defmodule SanbaseWeb.MetricDisplayOrderNewLive do
use SanbaseWeb, :live_view
import SanbaseWeb.CoreComponents
alias Sanbase.Metric.UIMetadata.DisplayOrder
alias Sanbase.Metric.Registry
alias SanbaseWeb.AvailableMetricsComponents
@impl true
def mount(_params, _session, socket) do
# Get the available ... |
00da636f1309f08f320823a451f6f798673e3642 | 3,034 | [
412187647
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule Cn23Web 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 Cn23Web, :controller
use Cn23Web, :view
The definitions below will be executed for every view,
controller, etc, so k... |
00daa726029a43c98ed3f297c6143a0e0f823c4e | 1,711 | [
471811566
] | [
"test"
] | defmodule FactEngine.Boundary.FactManagerTest do
use ExUnit.Case, async: false
alias FactEngine.Boundary.FactManager
alias FactEngine.Core.Fact
test "new/0 creates a new Manager" do
FactManager.new()
assert GenServer.whereis(FactManager) |> is_pid()
end
test "add_fact/1 adds a fact" do
FactMa... |
00dab2fb957d0583f81e8d0c5b1452ea3787f7c6 | 3,429 | [
364038679
] | [
"typespec",
"documented",
"ecto"
] | # THIS(+1)
defmodule Playwright.Request do
@moduledoc """
`Playwright.Request` represents a request for a network resource.
Whenever the page sends a request for a network resource, the following sequence of events are emitted by
`Playwright.Page`:
- `Playwright.Page.on/3` for "request":
emitted when th... |
00dad9a07e256c7237c4e7fb47c346f281ca2e70 | 3,678 | [
497253251
] | [] | defmodule VDiverse.Service.RecommendationService do
import Ecto.Query
alias VDiverse.Schemas.ParameterGroup
alias VDiverse.Schemas.Parameter
alias VDiverse.Repo
alias VDiverse.RestClients.ProfileClient
alias VDiverse.Service.AdminService
def get_recommendations(role) do
# get eligible resources fo... |
00daf3aac046b5dfbc88d0cddbccfa65def1d1bc | 1,582 | [
434016715
] | [] | defmodule Aoc2023.Day02 do
@day "day02"
@rules %{red: 12, green: 13, blue: 14}
def part1() do
Aoc2023.process_input(@day, :split)
|> Enum.map(&parse_game/1)
|> Enum.filter(fn {game_id, game} ->
!Enum.any?(game, fn {color, num} ->
num > Map.get(@rules, color)
end)
end)
|> E... |
00db3ee3109fd4e5a5a4fe59bf5a9e2a2a26fc0e | 2,286 | [
92990480
] | [
"test"
] | defmodule Nabo.Parser.FrontTest do
use ExUnit.Case, async: true
import Nabo.Parser.Front, only: [parse: 2]
test "parse/2 with successful case" do
json = """
{
"title": "Title",
"slug": "slug",
"published_at": "2017-01-01T01:02:03Z",
"draft": false,
"categories": ["cat-1", "... |
00dbefae35278efc0b59d0460abceb8567cf8359 | 2,727 | [
559744925
] | [
"typespec",
"macro",
"documented"
] | defmodule Credo.Check.Warning.OperationOnSameValues do
use Credo.Check,
id: "EX5011",
base_priority: :high,
explanations: [
check: """
Operations on the same values always yield the same result and therefore make
little sense in production code.
Examples:
x == x # alwa... |
00dc7fcd7254ebcacbc272be154ede3bb5810afe | 2,708 | [
69849650
] | [] | defmodule RoadDisruptions.DisruptionsStreamParser do
import SweetXml
require Logger
@endpoint "https://data.tfl.gov.uk/tfl/syndication/feeds/tims_feed.xml"
@uri "#{@endpoint}?app_id=#{Application.get_env(:road_disruptions, RoadDisruptions.Endpoint)[:tims_app_id]}&app_key=#{Application.get_env(:road_disruptions... |
00dcd00899f8f91f2fecef7b0431cd180ef8ec3b | 2,823 | [
715303936
] | [
"documented",
"ecto"
] | defmodule Mix.Tasks.Ecto.Gen.Migrate do
@moduledoc """
Migraions create and modify the database tables needed to function.
## Usage
To use migrations in your application you'll need to generate an `Ecto.Migration`
```elixir
mix ecto.gen.migration
```
This will copy all versioned migrations for your ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.