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 |
|---|---|---|---|---|
016346a6d8fa4353c481cb43046b7e811c682da7 | 2,542 | [
569034208
] | [
"liveview",
"ecto"
] | defmodule MalarkeyWeb.PostLive.FormComponent do
use MalarkeyWeb, :live_component
require Logger
alias Malarkey.Timeline
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Dazzle us, <%= @user.fullname %>!!</:subtitle>
</.header>
<.simp... |
016366d729aaa6a7840804d3f93ebbca6a0cc2c4 | 7,235 | [
87006016
] | [] | %{
"certifi": {:hex, :certifi, "2.15.0", "0e6e882fcdaaa0a5a9f2b3db55b1394dba07e8d6d9bcad08318fb604c6839712", [:rebar3], [], "hexpm", "b147ed22ce71d72eafdad94f055165c1c182f61a2ff49df28bcc71d1d5b94a60"},
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix],... |
0164f9f664a75944114abd4c2dc32c6b83c412aa | 1,628 | [
689188134
] | [
"liveview",
"documented"
] | if Code.ensure_loaded?(Saxy) do
defmodule Saxaboom.Adapters.Saxy do
@moduledoc false
@behaviour Saxy.Handler
@behaviour Saxaboom.Adapters.Adapter
alias Saxaboom.State
def parse(xml, into, parser_options) when is_binary(xml) do
state = State.initialize(into)
case Saxy.parse_string(
... |
016568b86826dadee27aaf7d575d01bd0dd219a1 | 1,972 | [
31425068
] | [
"genserver",
"documented"
] | defmodule KV.Registry do
use GenServer
## Client API
@doc """
Starts the registry
"""
def start_link(event_manager, opts \\ []) do
GenServer.start_link(__MODULE__, event_manager, opts)
end
@doc """
Looks up the bucket PID for 'name' stored in 'server'.
Returns '{:ok, ... |
0165a300076817ee112c03a0539bec94c7650efa | 3,503 | [
334387837
] | [
"typespec",
"documented"
] | defmodule Teiserver.Account.PlayerCountExport do
@moduledoc """
Can be manually run with:
Teiserver.Game.MatchRatingsExport.show_form(nil, %{
"date_preset" => "All time",
"end_date" => "",
"rating_type" => "Large Team",
"start_date" => ""
})
"""
alias Teiserver.Helper.DatePresets
alias Tei... |
0166597e1129466320a7276d784f422a4282f22a | 10,706 | [
99117528
] | [
"test",
"ecto"
] | defmodule LofiPlay.ContentTest do
use LofiPlay.DataCase
alias LofiPlay.Content
describe "screens" do
alias LofiPlay.Content.Screen
@valid_attrs %{body: "some body", name: "some name"}
@update_attrs %{body: "some updated body", name: "some updated name"}
@invalid_attrs %{body: nil, name: nil}
... |
0166aed3d09ebb6249c59e155a8d087fb6ec13de | 3,080 | [
865915193
] | [] | defmodule Nubium.MixProject do
use Mix.Project
def project do
[
app: :nubium,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls],
... |
0166de7c1a50c240d6ddf2f2d690cc5d6f15ccdf | 13,105 | [
312937106
] | [
"typespec",
"documented"
] | defmodule PenguinMemories.Database.Search do
@moduledoc """
Provide text based filtering for objects.
"""
import Ecto.Query
alias PenguinMemories.Database
alias PenguinMemories.Database.Fields
alias PenguinMemories.Database.Types
alias PenguinMemories.Photos
@type object_type :: Database.object_type... |
01671e887669f4ac4162b41f5a9cab32e8838040 | 2,340 | [
585158640,
156148118
] | [
"documented"
] | defmodule Helpers.CircularInterval do
@moduledoc """
Helpers.CircularInterval
Has some utility functios to check whether the node lies in the circular list
Half open interval (a, b] -> includes range of numbers from a+1 to b
Full open interval (a, b) -> includes range of numbers from a+1 to b-1
The rang... |
01672f9e8a70ac62cf8d622215c8fcfba41fe0cf | 1,855 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudDeploy.V1.Model.SkaffoldModules do
@moduledoc """
Skaffold Config modules and their remote source.
## Attributes
* `configs` (*type:* `list(String.t)`, *default:* `nil`) - Optional. The Skaffold Config modules to use from the specified source.
* `git` (*type:* `GoogleApi.CloudDe... |
016795ad47d1a1b08213edfc2864291f895b9831 | 4,085 | [
223698462
] | [] | defmodule Collabiq.UUID do
alias Collabiq.Error
def base64_in(list) when is_list(list) do
list
|> Enum.map(&base64_in/1)
end
def base64_in(struct) when is_map(struct) do
struct
|> Enum.reduce(%{errors: []}, fn
{key, id}, %{errors: errors} = acc when key in ["id", :id, "proxy_id", :proxy_... |
01679dabad4f2a622f1d7924b898674546516ed8 | 3,180 | [
287277097
] | [
"documented",
"ecto"
] | defmodule CesiumLink.Redirects do
@moduledoc """
The Redirects context.
"""
import Ecto.Query, warn: false
alias CesiumLink.Repo
alias CesiumLink.Redirects.Redirect
@doc """
Returns the list of redirects.
## Examples
iex> list_redirects()
[%Redirect{}, ...]
"""
def list_redirects... |
0167d96469441c81cb4b5d72ce0d4e23e1a8d2e7 | 7,348 | [
211781131
] | [
"typespec",
"phoenix",
"ecto",
"macro",
"documented"
] | defmodule Coherence.Config do
@moduledoc """
Coherence Configuration Module.
Provides a small wrapper around `Application.get_env :coherence`, providing an accessor function for each configuration items.
Configuration items can be defined as either a single atom or {name, default} tuple. Each of the items can... |
0167e13f0a5570dd937c0ca3464374f0cfda890a | 1,731 | [
957365647
] | [
"liveview"
] | defmodule EveIndustrexWeb.Market.Showcase do
alias EveIndustrex.Types
use EveIndustrexWeb, :live_component
@image_url "https://images.evetech.net/types/"
def update_component(cid, assigns) do
send_update(__MODULE__, id: cid, update: %{:type_id => assigns})
end
def update(%{:update => %{:type_id => type_id}}... |
0168643270bc3ddb3806692bc57327fee99c255c | 4,510 | [
313251054,
559360912
] | [
"phoenix"
] | defmodule KiraBijouxWeb.CreatePageController do
use KiraBijouxWeb, :controller
# get all pages
swagger_path :index do
get("/pages")
summary("Get all pages")
description("List of pages")
response(code(:ok), "Success")
end
def index(conn, _) do
pages = Repo.all(from p in Page, ... |
0168bc9ddcd25b9e742d2f84395199d83884ae10 | 11,052 | [
995944955
] | [
"liveview",
"documented"
] | defmodule ShopUxPhoenixWeb.Components.Table.BatchOperations do
@moduledoc """
表格批量操作功能模块
提供选择状态管理和批量操作相关的辅助函数
"""
use Phoenix.Component
alias Phoenix.LiveView.JS
import ShopUxPhoenixWeb.CoreComponents, only: [icon: 1]
@doc """
处理选择状态管理
"""
def process_selection_state(assigns) do
selected_i... |
01690fc5e0e522c91942d88e85c9c9b3bb8fcadb | 2,537 | [
41299685
] | [
"test"
] | defmodule EctoFixtures.Conditioners.PrimaryKeyTest do
use ExUnit.Case
test "generates primary key value if not present for each row" do
data = %{foo: [
owners: %{
model: Owner,
repo: Base,
rows: [
brian: %{data: %{name: "Brian"}},
stephanie: %{data: %{name: "St... |
01697eb5859585b7490e79fc0a5da94c9a70354c | 1,880 | [
274838619
] | [] | defmodule Bakery.MixProject do
use Mix.Project
def project do
[
app: :bakery,
version: "0.5.0",
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
e... |
016a16201cc068eb4e1b0b3df4c13fc1192ffc67 | 2,144 | [
435374761
] | [
"documented"
] | defmodule Aoc2021.Day13 do
@input "day13.txt"
def part1(input \\ @input) do
{points, [axis | _]} = input(input)
fold(points, axis, [])
|> Enum.uniq()
|> Enum.count()
end
def part2(input \\ @input) do
{points, instructions} = input(input)
instructions
|> Enum.reduce(points, fn axi... |
016aa513899ccf113d51b640f2fdb274fa623fad | 2,207 | [
101364852
] | [] | defmodule Ttl.KintoPlugProxy do
import Plug.Conn
use HTTPoison.Base
# TODO - persistent connection pool
def init(opts), do: opts
# copied from phx
defp ensure_resp_content_type(%{resp_headers: resp_headers} = conn, content_type) do
if List.keyfind(resp_headers, "content-type", 0) do
conn
el... |
016ba1f35b1b29f1356b280456b9741779b4f2d6 | 1,924 | [
83754351
] | [] |
defmodule HugeDigit do
defp nextDigit() do
chr = IO.read(1)
if chr != :eof do
num = Integer.parse(chr)
if num != :error do
elem(num, 0)
else
nextDigit()
end
else
:eof
end
end
defp readAllDigit(numDigits, digits, largestProduct, largestSequence) do
... |
016bda8aa172764636cfde8dd5ffadbc26203d92 | 21,644 | [
884036561
] | [] | %{
"acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"},
"bandit": {:hex, :bandit, "1.5.7", "6856b1e1df4f2b0cb3df1377eab7891bec2da6a7fd69dc78594ad3e152363a50", ... |
016c44031bc37e1e2d61806969ff3ce2412decf2 | 2,287 | [
414982360
] | [] | %{
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
"hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3]... |
016c63d5b3604382282353865dcc76830cdc61f4 | 1,936 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableSource do
@moduledoc """
The Cloud Bigtable source for importing data.
## Attributes
* `bigtableOptions` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableOptions.t`, *default:* `nil`) - Required.... |
016caa5ac51f690f18d4004849bb4684904aa16d | 3,385 | [
108326795
] | [] | %{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []},
"cowboy": {:git, "https://github.com/ninenines/cowboy.git", "debaecd49ae3efab4c319f3ec67677c82fe9e9a5", []},
"cowlib": {:git, "https://github.com/ninenines/cowlib.git", "11e07d3c2b164d06ad35188... |
016cd29af799b571701d56b3e5d5325707bfe357 | 2,164 | [
63054310
] | [] | use Mix.Config
defmodule Blitzy.CLI do
require Logger
def main(args) do
Application.get_env(:blitzy, :master_node)
|> Node.start
Application.get_env(:blitzy, :slave_nodes)
|> Enum.each(&Node.connect(&1))
args
|> parse_args
|> process_options([node|Node.list])
end
defp parse_args... |
016d0864059b6afd0e7cf3ed5b1c3cc54c0e35ff | 11,895 | [
691199358
] | [
"typespec",
"documented",
"ecto"
] | defmodule Pleroma.Activity do
use Ecto.Schema
alias Pleroma.Activity
alias Pleroma.Activity.Queries
alias Pleroma.Bookmark
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.ReportNote
alias Pleroma.ThreadMute
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Activity... |
016d46448654e269c29e53b7bcacad17d28c2411 | 4,771 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Fulfillment do
@moduledoc """
A fulfillment can do one or more of the following actions at the same time: * Generate rich message responses. * Set parameter values. * Call the webhook. Fulfillments can be called at various stages in the Page or Form l... |
016d567d192c28b0b128b4e292459d4192b08142 | 1,675 | [
685068530
] | [
"typespec"
] | defmodule Droplet.Docs.Expense do
alias Droplet.Docs.Expense
defstruct(
title: "",
date: nil,
amount: 0,
store: ""
)
@type t :: %Expense{
title: String.t(),
date: Date.t() | nil,
amount: number(),
store: String.t()
}
@spec sample :: [t()]
def sample do
[ # Initiate d... |
016dc066d9a25ca813946fb66cbacbb10b2cd30c | 8,507 | [
574598133
] | [
"documented"
] | defmodule AOC2022.DistressSignal do
@moduledoc """
--- Day 13: Distress Signal ---
You climb the hill and again try contacting the Elves. However, you instead receive a signal you weren't expecting: a distress signal.
Your handheld device must still not be working properly; the packets from the distress signal... |
016df0c8a0198b86d2c353e7b58c27cc7d094ec3 | 3,932 | [
342624329
] | [
"genserver",
"typespec",
"documented"
] | defmodule Zoneinfo.Cache do
use GenServer
@moduledoc false
@table __MODULE__
@ttl_seconds 60 * 60 * 24
@spec start_link(keyword()) :: GenServer.on_start()
def start_link(args) do
GenServer.start_link(__MODULE__, args, name: __MODULE__)
end
@doc """
Return the information for a time zone
"""
... |
016fc78f202c17cc74e0ec003a9cf2039f95505a | 2,895 | [
896977074
] | [] | {:ok, contents} = File.read("input.txt")
defmodule Diagonals do
def get_main_diagonals(puzzle_graphemes) do
num_rows = length(puzzle_graphemes)
num_columns = length(List.first(puzzle_graphemes))
highest_row_index = num_rows - 1
highest_column_index = num_columns - 1
index_diff_range = -highest_c... |
016fe2a366534fb663fc4d8340533021feb39534 | 2,119 | [
806318156
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :work_api,
ecto_repos: [WorkApi.Repo],
gen... |
016fe2cfea0aa43128522c1817e9f52cc12d5826 | 11,359 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DFAReporting.V4.Api.CreativeAssets do
@moduledoc """
API calls for all endpoints tagged `CreativeAssets`.
"""
alias GoogleApi.DFAReporting.V4.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Inserts a ne... |
016ff9532e35633f8eaacc79fe5291ccf4dc2d39 | 1,839 | [
389488514
] | [
"macro",
"documented",
"phoenix"
] | defmodule EventLensWeb 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 EventLensWeb, :controller
use EventLensWeb, :view
The definitions below will be executed for every view,
contro... |
01703dd62ec124d20be9305c2f7e73faa11435b6 | 3,222 | [
650698680
] | [
"test",
"phoenix"
] | defmodule CoreWeb.UserScheduleControllerTest do
use CoreWeb.ConnCase
alias Core.Schedules
@create_attrs %{schedule: %{}}
@update_attrs %{schedule: %{}}
@invalid_attrs %{schedule: nil}
def fixture(:user_schedule) do
{:ok, user_schedule} = Schedules.create_user_schedule(@create_attrs)
user_schedule... |
017053ae9bb7a36df64d5820ea03a37d55f192cb | 2,911 | [
796813230
] | [] | defmodule GrassFarm.MixProject do
use Mix.Project
@app :grassFarm
@version "0.1.0"
@all_targets [
:rpi,
:rpi0,
:rpi2,
:rpi3,
:rpi3a,
:rpi4,
:bbb,
:osd32mp1,
:x86_64,
:grisp2,
:mangopi_mq_pro
]
def project do
[
app: @app,
version: @version,
... |
0170bca6433190b7e1c0b787d61c4e3cc2372613 | 3,477 | [
244421451
] | [
"documented",
"ecto"
] | defmodule Elen.Content do
@moduledoc """
The Content context.
"""
import Ecto.Query, warn: false
alias Elen.Repo
alias Elen.Auth
alias Elen.Content.Item
@doc """
Returns the list of items.
## Examples
iex> list_items()
[%Item{}, ...]
"""
def list_items(user) do
query = from... |
01710be99bad193cab35e33029f54c25a8c587f5 | 2,470 | [
541360331
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule HelloWeb 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 HelloWeb, :controller
use HelloWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
0171264443722918c2649da7c76531524f6a9f1f | 1,905 | [
203781103
] | [
"documented"
] | defmodule Reelmagic.CLI do
require Logger
@moduledoc """
Usage: `reelmagic_dl.ex --playlist 78hpp7h24y --to 'Focus on Rings' --concurrency 3`
Options:
--help -h -- show this help
--playlist -p [string] -- required, Wistia playlist ID
--to -t [path] -- required, directory to save videos into
-... |
01716f0c7d3b95eeaefc46e4f5ac238322fb9671 | 2,306 | [
908661355
] | [
"phoenix",
"ecto"
] | defmodule TimeTrackerWeb.TeamMemberController do
use TimeTrackerWeb, :controller
alias TimeTracker.Accounts
alias TimeTracker.Accounts.TeamMember
action_fallback TimeTrackerWeb.FallbackController
def create(conn, %{"team_member" => team_member_params}) do
with {:ok, %TeamMember{} = team_member} <- Acco... |
017170484f9bcf48d9202c16e3cf1b9fcf87ceb9 | 9,014 | [
572015410
] | [
"genserver",
"documented",
"ecto"
] | defmodule AuDoc.ModuledocGenerator do
@moduledoc """
Write what is the responsibility of this module.
Write what problem this module solves.
Write important notions from this module
Write down a full list of the module dependencies
Write down all the functional requirements of the module.
Write a detaile... |
01718753dc024c2953f0371a181ae8ad2b168fbf | 1,936 | [
332933100
] | [
"macro",
"documented",
"phoenix"
] | defmodule TaskTrackerServerWeb 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 TaskTrackerServerWeb, :controller
use TaskTrackerServerWeb, :view
The definitions below will be executed ... |
017198b72d78ff0963c2c506267bba2db5e25413 | 24,375 | [
618709291
] | [
"typespec",
"macro",
"documented"
] | defmodule Nexus.CLI do
@moduledoc """
Nexus.CLI provides a macro-based DSL for defining command-line interfaces with commands,
flags, and positional arguments using structured ASTs with structs.
## Overview
The `Nexus.CLI` module allows you to build robust command-line applications by defining commands, sub... |
0171a24da5e1ca52e248d177f8e0502f55c7f8fc | 1,628 | [
500956713
] | [
"phoenix"
] | defmodule BackendWeb.TransactionController do
use BackendWeb, :controller
alias Backend.Transactions
alias Backend.Transactions.Transaction
action_fallback BackendWeb.FallbackController
def index(conn, _params) do
transactions = Transactions.list_transactions()
render(conn, "index.json", transactio... |
0172889a5d9fea52752d0a45557028ad6f57ab31 | 1,874 | [
87629855
] | [
"test",
"ecto"
] | defmodule Mechat.DialogTest do
use Mechat.DataCase
alias Mechat.Dialog
alias Mechat.Dialog.Message
@create_attrs %{body: "some body"}
@update_attrs %{body: "some updated body"}
@invalid_attrs %{body: nil}
def fixture(:message, attrs \\ @create_attrs) do
{:ok, message} = Dialog.create_message(attrs)... |
0172d0a722f9d27e9e77ea837e0cd5b78fb4abf3 | 2,440 | [
370451040
] | [
"phoenix"
] | defmodule PrepayAndUseWeb.Router do
use PrepayAndUseWeb, :router
import PrepayAndUseWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch_current_user
end
pipeline :api ... |
0173a536392c769b53510a7ba3a9f3c7ae467093 | 2,671 | [
637154755
] | [] | defmodule Game do
defstruct player1: nil, player2: nil, current_player: nil, winner: nil, board: %Board{}
def new(p1, p2) do
%Game{
player1: p1,
player2: p2,
current_player: p1,
board: Board.new(),
winner: nil
}
end
def get_current_player(game), do: game.cu... |
0173d5f86178a177ea4e3738c71d94a212f204b0 | 1,994 | [
86721519
] | [] | defmodule MeeseeksHtml5everParse do
@html File.read! "data/github.html"
@tuples (case Html5ever.parse(@html) do
{:ok, result} -> result
{:error, err} -> {:error, err}
end)
def run do
IO.puts "Running tests..."
html5ever_async = time(&html5ever_parse_async/0)
html5e... |
017410a1cc61feaaab13da435bea1c8aa6be7198 | 12,943 | [
272824166
] | [
"genserver",
"phoenix",
"ecto",
"documented"
] | defmodule MatxWeb.Channels.RestaurantChannel do
use Phoenix.Channel
require Logger
import MatxWeb.UserAuth
alias Db.Feeders
@doc """
Authorize socket to subscribe and broadcast events on this channel & topic
Possible Return Values
`{:ok, socket}` to authorize subscription for channel for requested top... |
01742a49b36e54e27e58298e76055030c9f710ec | 1,746 | [
520932989
] | [
"phoenix"
] | defmodule UberphoenixWeb.Router do
use UberphoenixWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {UberphoenixWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api... |
0174d0fc011c0580c3043fdbe1fea91bfc8b857b | 2,148 | [
340564274
] | [] | defmodule Bulls.Game do
# Credit to Nat Tuck's 07 Lecture notes
#https://github.com/NatTuck/scratch-2021-01/blob/master/notes-4550/07-phoenix/notes.md
def new do
%{
secret: generateSecretCode(),
guesses: [],
results: [],
status: "",
playing: true,
}
end
def make_guess(... |
0174fc558f2dab5ca2e2a567da5da9078cab4957 | 1,588 | [
966323867
] | [
"phoenix",
"ecto"
] | defmodule TopTenWeb.ItemController do
use TopTenWeb, :controller
alias TopTen.Items
alias TopTen.Items.Item
def index(conn, _params) do
items = Items.list_items()
render(conn, :index, items: items)
end
def new(conn, _params) do
changeset = Items.change_item(%Item{})
render(conn, :new, cha... |
01757fe0a1bf5417e946d4a2bea9a08a0de607a3 | 1,802 | [
945276765
] | [] | defmodule Liveview.Repo.Seeds.DonationSeeder do
alias Liveview.Donations.Donation
alias Liveview.Repo
def run do
Repo.delete_all(Donation)
food_items = [
{"Apples", "🍎"}, {"Bananas", "🍌"}, {"Bread", "🍞"}, {"Carrots", "🥕"},
{"Corn", "🌽"}, {"Cucumber", "🥒"}, {"Eggs", "🥚"}, {"Grapes", "�... |
0175ae663651b8fb940d7517e9d6a522541cdd36 | 6,566 | [
992721621
] | [
"typespec",
"documented"
] | defmodule ExStreamClient.Operations.Chat.Threads do
@moduledoc ~S"""
Modules for interacting with the `chat/threads` group of Stream APIs
API Reference: https://getstream.github.io/protocol/?urls.primaryName=Chat%20v2
### Shared options
All functions in this module accept the following optional parameters:... |
017606075cf05d4b90c7346b880f4517a9c6cb11 | 3,440 | [
50442271
] | [
"documented"
] | defmodule Animu.Media.Kitsu do
@moduledoc """
Interface for Kitsu's web API
"""
alias HTTPoison.Response
alias Animu.Media.{Series, Episode}
require Logger
@url "https://kitsu.io/api/edge/"
@timeout 30 * 1000 # 30 seconds
defp handle_error(type, id, error) do
msg = "http request for kitsu data f... |
01760ef69a3180fa821d1f23e2cefd2b04ebbff5 | 1,872 | [
579888327,
338998314
] | [] | defmodule VernemqIoTPlugin.MixProject do
use Mix.Project
def project do
[
app: :vernemq_iot_plugin,
version: "0.1.0",
build_path: "./_build",
config_path: "./config/config.exs",
deps_path: "./deps",
lockfile: "./mix.lock",
elixir: "~> 1.9",
start_permanent: Mix.e... |
0176c104e9c811640b4d132ce05a96fe1de23c85 | 1,993 | [
459182862,
407445450,
452852184,
566770189,
183581270,
574493719,
453189145,
460571400,
564035765,
606310479,
443168471,
508667916,
453162461,
472065292
] | [] | defmodule JOSE.Mixfile do
use Mix.Project
def project() do
[
app: :jose,
version: "1.11.2",
elixir: "~> 1.4",
erlc_options: erlc_options(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
name: "JOSE",
source_url: "htt... |
0176e9905e29f289c69256dbc30e3a06c7c42961 | 4,245 | [
77752240
] | [
"macro",
"documented"
] | defmodule Synacor.Token do
@moduledoc """
Tokenize binary data into instructions
"""
@doc """
Get the value at the given memory address
"""
def get_value(offset, bin) do
skip = offset * 2
<<_skip::binary-size(skip), value::little-integer-size(16), _rest::binary>> = bin
value
end
@doc """... |
0176eb82efd08eec74614b8c036d2aab67c0e619 | 3,751 | [
637427149
] | [] | %{
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"floki": {:hex, :floki, "0.34.2", "5fad07ef153b3b8ec110b6b155ec3780c4b2c4906297d0b4be1a7162d04a7e02", [:mix], [], "... |
0177078d21002350bfd0d128574009474cee1b08 | 1,871 | [
695444944
] | [
"documented",
"ecto"
] | defmodule Grey.Retailers do
@moduledoc """
The Retailers context.
"""
import Ecto.Query, warn: false
alias Grey.Repo
alias Grey.Retailers.Retailer
@doc """
Returns the list of retailers.
## Examples
iex> list_retailers()
[%Retailer{}, ...]
"""
def list_retailers do
Repo.all(R... |
017738da0319369a986eb804bdd92bf6b7455ef7 | 1,865 | [
510519336
] | [
"documented",
"ecto"
] | defmodule Quizium.Quiz do
@moduledoc """
The Quiz context.
"""
import Ecto.Query, warn: false
alias Quizium.Repo
alias Quizium.Quiz.Question
@doc """
Returns the list of questions.
## Examples
iex> list_questions()
[%Question{}, ...]
"""
def list_questions do
Repo.all(Questio... |
017751b1b8a3e475d124185c76a2f2117bfc3712 | 1,692 | [
49168656
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Ectofun.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Ectofun.Web, :controller
use Ectofun.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them sho... |
017772599b0b4326b1969538f2ebf8587fd6a7a9 | 1,923 | [
824775390
] | [
"documented",
"ecto"
] | defmodule Scoregoblin.Games.Game do
use Ecto.Schema
import Ecto.Changeset
schema "games" do
field :winner_score, :integer
field :loser_score, :integer
field :winner_pre_game_elo, :integer
field :loser_pre_game_elo, :integer
belongs_to :winner, Scoregoblin.Accounts.User
belongs_to :loser... |
0177ac6e787568780bb649914df0800237e5b090 | 2,497 | [
564359760
] | [
"test"
] | defmodule HydepwnsLiveview.Events.ReminderDeliveryTest do
use HydepwnsLiveview.DataCase
alias HydepwnsLiveview.Events
alias HydepwnsLiveview.Events.ReminderDelivery
alias HydepwnsLiveview.Events.Event
alias HydepwnsLiveview.Repo
describe "send_reminder/1" do
setup do
# Create a calendar event (n... |
0177c56932703972ae5a2e1fe0adb7f875c09fbf | 1,912 | [
467612083
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :pokemon, Pokemon.Repo,
database: "pokemon_r... |
0177d9db20d366456ff4125fbe99a157d1c95234 | 3,264 | [
687257001
] | [
"liveview"
] | defmodule LiveViewStudioWeb.BookingsLive do
use LiveViewStudioWeb, :surface_live_view
alias LiveViewStudio.Bookings
import Number.Currency
def mount(_params, _session, socket) do
{:ok,
assign(socket,
bookings: Bookings.list_bookings(),
selected_dates: nil
)}
end
def render(ass... |
0178217c8efb55576b794ba44eb9b8f2e874ef9f | 8,036 | [
144409835,
149154480,
155456471,
64800920,
151543773,
134849423,
145566106,
350811664,
164171143
] | [
"typespec",
"documented"
] | defmodule Earmark.Helpers.LookaheadHelpers do
use Earmark.Types
alias Earmark.Line
import Earmark.Helpers.LineHelpers
import Earmark.Helpers.LeexHelpers
@doc """
Indicates if the _numbered_line_ passed in leaves an inline code block open.
If so returns a tuple whre the first element is the opening seq... |
017864873fec0b8a8f93b5d566cb5d9a0fd3891a | 2,870 | [
879029882
] | [
"phoenix"
] | defmodule LiveviewDemoWeb.Router do
use LiveviewDemoWeb, :router
import LiveviewDemoWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {LiveviewDemoWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secu... |
01786ea9fe66a53efaae214bd81db5ee71daba28 | 22,768 | [
712041013
] | [
"test"
] | defmodule A11yAudit.FormatterTest do
use ExUnit.Case
alias A11yAudit.Assertions
alias A11yAudit.Formatter
alias A11yAudit.Results
alias A11yAudit.Results.Violation
alias A11yAudit.Results.Node
def opts(overrides \\ []) do
Keyword.merge(Assertions.default_opts(), overrides)
end
describe "format_... |
01786f28f02fd8b4c3d7dcd58d130928d46c1376 | 14,157 | [
833405597
] | [
"ecto"
] | # Limpar dados existentes
BatchEcommerce.Repo.delete_all(BatchEcommerce.Catalog.Product)
BatchEcommerce.Repo.delete_all(BatchEcommerce.Catalog.Category)
BatchEcommerce.Repo.delete_all(BatchEcommerce.Accounts.Company)
BatchEcommerce.Repo.delete_all(BatchEcommerce.Accounts.User)
# Insere User
users = [
%{
cpf: "123... |
01792c332508f0c4d2a0e208148795acd1668075 | 1,638 | [
592451428
] | [
"typespec",
"documented",
"ecto"
] | defmodule Onvif.PTZ.Schemas.PTZStatus do
@moduledoc """
Module describing PTZ Status schema
"""
use Ecto.Schema
import Ecto.Changeset
import SweetXml
alias Onvif.PTZ.Schemas.PTZVector
@type t :: %__MODULE__{}
@primary_key false
@derive Jason.Encoder
embedded_schema do
embeds_one(:position... |
01792f2496be77e87925f64656b24984a518412b | 5,877 | [
272691232
] | [
"test",
"ecto"
] | defmodule Acorn.WikiTest do
use Acorn.DataCase
alias Acorn.Wiki
describe "pages" do
alias Acorn.Wiki.Page
@valid_attrs %{content: "some content", related: %{}, tags: %{}, title: "some title"}
@update_attrs %{content: "some updated content", related: %{}, tags: %{}, title: "some updated title"}
... |
0179d87cc91012142a79e2be3a720e3c14e4a722 | 4,374 | [
805673811
] | [
"documented"
] | defmodule TripTallyWeb.Expenses.ExpenseController do
use TripTallyWeb.AuthController
alias TripTally.Expenses
@doc """
Purpose: Fetches all expenses for the currently logged-in user, or expenses for a specific trip if 'trip_id' is provided.
1. Endpoint: GET /api/expenses
2. Endpoint: GET /api/expenses/:t... |
017a2c0c2f1b8dd85062976d7c3d851794a6fc6e | 5,054 | [
276023881
] | [
"phoenix"
] | defmodule Pleroma.Web.MastodonAPI.SearchController do
use Pleroma.Web, :controller
alias Pleroma.Activity
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web
alias Pleroma.Web.ControllerHelper
alias Pleroma.Web.MastodonAPI.Accoun... |
017a6948623f9915d9a1f94c520762f883f5528e | 1,768 | [
869596303
] | [
"documented",
"ecto"
] | defmodule Something.Clock do
@moduledoc """
The Clock context.
"""
import Ecto.Query, warn: false
alias Something.Repo
alias Something.Clock.Clocks
@doc """
Returns the list of clock.
## Examples
iex> list_clock()
[%Clocks{}, ...]
"""
def list_clock do
Repo.all(Clocks)
end
... |
017acb6f076d31bb8a903ee29eb216bac74af692 | 6,577 | [
39546321
] | [] | defmodule Combine.Bench.DateTimes do
use Benchfella
use Combine
@chars "sdfgjakghvnlkasjlghavsdjlkfhgvaskljmtvmslkdgfdaskl"
@bytes <<43, 63, 54, 134, 43, 64, 78, 43, 254, 65, 124, 186, 43, 56>>
@datetime "2014-07-22T12:30:05.0002Z"
@datetime_zoned "2014-07-22T12:30:05.0002+0200"
bench "pa... |
017b4d2891b047a5da15b4121dfc8725f806abef | 2,970 | [
434464829
] | [] | defmodule Day3 do
def solve(input) do
normalized =
input
|> String.trim()
|> String.split("\n")
|> normalize([], [])
[first | _] = normalized
Enum.reduce(0..(Enum.count(first) - 1), [], fn position, acc ->
[count(normalized, position, {0, 0}) | acc]
end)
|> Enum.rev... |
017b6a125a5c60a166433b7fd7d7fce14f0b7954 | 6,635 | [
276901189
] | [
"typespec",
"documented"
] | defmodule Battleship.Core.Board do
@moduledoc """
A module that contains the board operations as well as the board struct.
This board is where a player places their ship places and retains all the
effects that were applied to it. These effects are generated by player actions.
"""
defstruct [:grid, :positio... |
017b9d767979e3d8edd35fe08df83cc6bf849d63 | 3,654 | [
420231020
] | [] | Application.put_env(:exla, :clients,
default: [platform: :host],
cuda: [platform: :cuda]
)
defmodule Mono do
import Nx.Defn
@defn_compiler EXLA
defn host32(n), do: MonochromeFilter.monochrome_filter_32(n)
@defn_compiler EXLA
defn host16(n), do: MonochromeFilter.monochrome_filter_16(n)
@defn_compiler... |
017c431314a9083589c98c49ef082c59f1a2cd73 | 2,243 | [
160404187,
161182964,
405865710
] | [
"test",
"ecto"
] | defmodule Mango.AdministrationTest do
use Mango.DataCase
alias Mango.Administration
describe "users" do
alias Mango.Administration.User
@valid_attrs %{email: "some email", name: "some name", phone: "some phone"}
@update_attrs %{email: "some updated email", name: "some updated name", phone: "some up... |
017c67c7452d9b8cf04c0090c67fa62f75c62060 | 1,715 | [
155284546
] | [
"macro",
"documented",
"phoenix"
] | defmodule MicrosoftGraphApiWeb 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 MicrosoftGraphApiWeb, :controller
use MicrosoftGraphApiWeb, :view
The definitions below will be executed ... |
017ca450b36fb7eb44864985bf2d4e6be99ae088 | 4,551 | [
646535677
] | [
"typespec",
"documented",
"ecto"
] | defmodule Rawwater.Tickets do
@moduledoc """
The Tickets context.
"""
import Ecto.Query, warn: false
alias Rawwater.Repo
alias Rawwater.Tickets.Ticket
@doc """
Returns the list of tickets.
## Examples
iex> list_tickets()
[%Ticket{}, ...]
"""
def list_tickets do
Repo.all(Ticke... |
017cc2ee376f66f07cf3be70f2d936937eae4fc6 | 5,168 | [
102414376
] | [
"documented"
] | defmodule Sengoku.AI.Smart do
@moduledoc """
An AI that chooses moves procedurally, more-or-less as a human would.
"""
@behaviour Sengoku.AI
alias Sengoku.{Game, Tile}
def take_action(state) do
cond do
has_unplaced_units?(state) -> place_unit(state)
has_pending_move?(state) -> make_pendin... |
017cdf6d2ada8ebe2eaff0da91ef784a4cf717a3 | 1,530 | [
343898546
] | [
"phoenix"
] | defmodule EventsWeb.SessionController do
# declaring import of our macros and Phoenix.Controller's macros
use EventsWeb, :controller
require Logger
# Here we need actions that dispatch based on requests (typically func name atoms)
# If this is called, someone wants to set a `current_user` cookie for a sess... |
017ce721eb373cb83d32e8a07ce44009b808c1f5 | 6,484 | [
320817971
] | [
"test"
] | defmodule Since.MediaTest do
use ExUnit.Case, async: true
alias Since.Media
doctest Media, import: true
test "known_stickers" do
assert Media.known_stickers() == %{
"Facebook" =>
"https://d4321.cloudfront.net/Facebook?d=844419fe2fb3d50a71eb8f2adaefcfbc",
"Instagram"... |
017d4b8a45daca19a86d9a4918bbfcbc4640aeab | 3,378 | [
342470437
] | [
"test"
] | defmodule BobTest do
use ExUnit.Case
test "stating something" do
assert Bob.hey("Tom-ay-to, tom-aaaah-to.") == "Whatever."
end
#@tag :pending
test "shouting" do
assert Bob.hey("WATCH OUT!") == "Whoa, chill out!"
end
#@tag :pending
test "shouting gibberish" do
assert Bob.hey("FCECDFCAAB") ... |
017df7427da4106229ab8d6b54dd4597cf1236b9 | 10,583 | [
757436604
] | [] | %{
"axon": {:hex, :axon, "0.6.0", "fd7560079581e4cedebaf0cd5f741d6ac3516d06f204ebaf1283b1093bf66ff6", [:mix], [{:kino, "~> 0.7", [hex: :kino, repo: "hexpm", optional: true]}, {:kino_vega_lite, "~> 0.1.7", [hex: :kino_vega_lite, repo: "hexpm", optional: true]}, {:nx, "~> 0.6.0", [hex: :nx, repo: "hexpm", optional: fal... |
017e22b90164b6fc2ace1508579eb5324ca80415 | 1,591 | [
455384589
] | [
"phoenix"
] | defmodule CurrencyConverterWeb.SessionController do
use CurrencyConverterWeb, :controller
alias CurrencyConverter.Accounts
alias CurrencyConverter.Guardian
action_fallback CurrencyConverterWeb.FallbackController
def new(conn, %{"email" => email, "password" => password}) do
case Accounts.authenticate_us... |
017ee30661f958b3c99b4cc8a93a62dfec999ec1 | 9,280 | [
381626782
] | [
"genserver",
"macro"
] | defmodule PioneerRpc.PioneerRpcClient do
require Logger
use AMQP
defmacro __using__(opts) do
target_module = __CALLER__.module
name = Access.get(opts, :name, target_module)
timeout = Access.get(opts, :timeout, 5000)
reconnect_interval = Access.get(opts, :reconnect_interval, 10000)
connection... |
017f2fc1e6fa4daeed8f4f0062ce015b2f19e971 | 13,719 | [
915001862
] | [
"test"
] | defmodule PPlusFireStore.DecoderTest do
use ExUnit.Case
alias GoogleApi.Firestore.V1.Model.ArrayValue
alias GoogleApi.Firestore.V1.Model.Document
alias GoogleApi.Firestore.V1.Model.Empty
alias GoogleApi.Firestore.V1.Model.LatLng
alias GoogleApi.Firestore.V1.Model.ListDocumentsResponse
alias GoogleApi.Fir... |
017f90432c809830639c96c142087d04fd762c48 | 4,879 | [
646916091
] | [] | defmodule Train.OpenAI.StreamReducer do
def reduce(stream) do
stream
|> Enum.to_list()
|> Enum.reduce(%{}, fn message, acc ->
merge(acc, message)
end)
end
# Stream chunks
defp merge(
map,
%{
"choices" => [
%{
"delta" => %{
... |
017f96134b4a5dec723f1734a2ffd34cf2f1e91f | 4,072 | [
738846074
] | [
"liveview",
"test"
] | defmodule ClashOfClansFplWeb.FixtureLiveTest do
use ClashOfClansFplWeb.ConnCase
import Phoenix.LiveViewTest
import ClashOfClansFpl.FixturesFixtures
@create_attrs %{team_home_id: 42, team_home_score: 42, team_home_name: "some team_home_name", team_away_id: 42, team_away_score: 42, team_away_name: "some team_aw... |
017fc135771495aaeb214d04b319f6b14eba7f1c | 2,648 | [
815481642
] | [
"documented"
] | defmodule Envoy.Config.Endpoint.V3.ClusterLoadAssignment.Policy.DropOverload do
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :category, 1, type: :string, deprecated: false
field :drop_percentage, 2, type: Envoy.Type.V3.FractionalPercent, json_name: "dropPercentage"
end
defmodule Envo... |
017fd35354f7f598060faeb7e67fdb5d9a7d5f26 | 8,156 | [
842851827
] | [] | %{
"bandit": {:hex, :bandit, "1.5.7", "6856b1e1df4f2b0cb3df1377eab7891bec2da6a7fd69dc78594ad3e152363a50", [:mix], [{:hpax, "~> 1.0.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", opti... |
018001003102b741b9aa9cceb550f78e598ec153 | 7,917 | [
902327418
] | [
"typespec",
"documented",
"phoenix"
] | defmodule ElixirLS.LanguageServer.Providers.Definition.Locator do
@moduledoc """
Provides a function to find out where symbols are defined.
Currently finds definition of modules, functions and macros,
typespecs, variables and attributes.
"""
alias ElixirSense.Core.Binding
alias ElixirSense.Core.Introspe... |
018005555ef3d0d8d50d8be76210f3ece4d06595 | 2,643 | [
31404445
] | [
"test",
"ecto"
] | defmodule Hello.QuestionTest do
use Hello.DataCase
alias Hello.Question
describe "question_templates" do
alias Hello.Question.QuestionTemplate
import Hello.QuestionFixtures
@invalid_attrs %{tmpl: nil, formula: nil}
test "list_question_templates/0 returns all question_templates" do
quest... |
01800801c8d57508a0afa737116bd94b6dd12d75 | 1,925 | [
47211907
] | [
"typespec",
"documented"
] | defmodule Phone do
@invalid_number "0000000000"
@doc """
Remove formatting from a phone number.
Returns "0000000000" if phone number is not valid
(10 digits or "1" followed by 10 digits)
## Examples
iex> Phone.number("123-456-7890")
"1234567890"
iex> Phone.number("+1 (303) 555-1212")
"303555121... |
0180c01cc302b6c471b017f04358562a52236240 | 1,814 | [
898550802
] | [
"test"
] | defmodule Aoc24.Solutions.Y24.Day04Test do
alias AoC.Input, warn: false
alias Aoc24.Solutions.Y24.Day04, as: Solution, warn: false
use ExUnit.Case, async: true
# To run the test, run one of the following commands:
#
# mix AoC.test --year 2024 --day 4
#
# mix test test/2024/day04_test.exs
#
... |
0180cee506ff9057d1df54cf88e989972fc3d055 | 5,729 | [
356016587
] | [] | defmodule NdflDividents do
use Hound.Helpers
alias NimbleCSV.RFC4180, as: CSV
@login_url "https://lkfl2.nalog.ru/lkfl/login"
@country_to_code %{
"США" => "840",
"Ирландия" => "372",
"Кипр" => "196",
"Нидерланды" => "528",
"Гонконг" => "344",
"Швейцарская Конфедерация" => "756",
"Ки... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.