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 |
|---|---|---|---|---|
09a872bd8c097fcc31f40c8d97921a9ef5443084 | 5,904 | [
60716862,
66467062,
63931406,
63643631,
71519558,
68463570,
63304973,
63885140,
67626331,
61923005,
63335915
] | [
"genserver",
"typespec",
"documented"
] | defmodule Postgrex.TypeServer do
@moduledoc false
use GenServer
@name __MODULE__
@type table :: :ets.tab
@doc """
Starts the type server.
"""
@spec start_link :: GenServer.on_start
def start_link do
GenServer.start_link(__MODULE__, [], name: @name)
end
@doc """
Fetches the cached type en... |
09a8af2aa4c4ba9d4ab4e4e50254649e6d45b71f | 5,609 | [
317894942
] | [] | %{
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
"circuits_gpio": {:hex, :circuits_gpio,... |
09a92f57e0b416e6f5f62b7f53fb6f4f1374d09b | 1,871 | [
286140738
] | [
"genserver"
] | defmodule NodePushsumActor do
use GenServer
def start_link(__MODULE__,state) do
GenServer.start_link(__MODULE__,state,[])
end
def init(state) do
{:ok, state}
end
def push_sum(pid,other_main,topology) do
GenServer.cast(pid,{:push_sum,other_main,topology})
end
def handle_cast({:push_sum,other_main,topology} ,s... |
09aa549484901e6f0eb3e0c1fb8b6e627964e4b4 | 3,849 | [
841810394
] | [
"macro",
"test",
"documented"
] | defmodule Reactor.Req.Dsl.NewTest do
@moduledoc false
use ExUnit.Case, async: true
@options [
adapter: Req.Request,
auth: {:basic, "marty:outatime"},
aws_sigv4: [region: "hill-valley"],
base_url: "http://harton.dev/james/reactor_req",
body: "Roads. Where we're going we don't need roads",
... |
09aa68bf3c31b6d14f9da4db54bc7727bb06d5ef | 3,024 | [
385044306
] | [
"macro",
"documented"
] | defmodule App.Query do
@moduledoc """
Helper for composable query services.
Provides wrappers for Repo calls with automatic parameter decomposition.
Each parameter should be handled by a `compose/3` callback.
List parameters may be further decomposed if they are signalled as composite fields:
```
@com... |
09aa833af2e3764eae95022be444f002002c9a29 | 17,759 | [
676499436
] | [
"documented"
] | defmodule TwelveEx.Fundamentals do
@logo_path "/logo"
@profile_path "/profile"
@dividends_path "/dividends"
@splits_path "/splits"
@earnings_path "/earnings"
@earnings_calendar_path "/earnings_calendar"
@ipo_calendar_path "/ipo_calendar"
@statistics_path "/statistics"
@insider_transactions_path "insid... |
09ab6441794ad00ad6d7d36e872a0e0ec6b0c7a7 | 3,005 | [
432524514
] | [
"test"
] | defmodule Client.LoadersTest do
use Client.LocalCase
use Client.RemoteCase
use Client.Case
alias Client.Loaders
alias Client.StateSupport
defp put_remote_data(%{data: data} = state, context) do
data =
data
|> Map.put(:users, [context.user])
|> Map.put(:team_users, [context.remote_team... |
09ab8e1fc2cb2cab5b200351d645208ecbcad341 | 2,150 | [
108414369
] | [] | # 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 :victor,
ecto_repos: [Victor.Repo]
# Co... |
09abba9a5c90fad7b6983ab7a1f45d125c47dd59 | 1,528 | [
62494706
] | [
"genserver"
] | defmodule Dashclock.Facts.SensorServer do
use GenServer
@cmd Path.expand("dht")
defmodule Data do
@derive [Poison.Encoder]
defstruct [:humidity_pc, :temp_c, :temp_f]
end
def start_link(opts \\ []) do
{:ok, pid} = GenServer.start_link(__MODULE__, opts, [name: :sensor_server])
pid
end
de... |
09abc6b517bf548d856635ebf123bc2012b7c6af | 2,201 | [
474769282
] | [
"documented"
] | defmodule Viable.Release do
@moduledoc """
Houses tasks that need to be executed in the released application (because mix is not present in releases).
"""
@app :viable
def migrate do
load_app()
for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: t... |
09abc8ad4f1ff0e304c82a3741c5ee2b1e2b9063 | 1,621 | [
883553451
] | [
"liveview",
"phoenix"
] | defmodule LandingPageWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :landing_page
# 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: "_... |
09abe4010b0bc3e148b2e56f3f5bf39b24b96fd0 | 2,962 | [
435374761
] | [] | defmodule Aoc2021.Day10 do
@input "day10.txt"
def part1(input \\ @input) do
input
|> input()
|> Enum.map(fn line -> check_syntax(line, []) end)
|> Enum.filter(fn {status, _} -> status == :error end)
|> Enum.map(fn {_, {error, _, _}} -> score_error(error) end)
|> Enum.sum()
end
def part... |
09ac4d3c36cdc96b4dce036cc4c98950da162f34 | 6,591 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3Flow do
@moduledoc """
Flows represents the conversation flows when you build your chatbot agent. A flow consists of many pages connected by the transition routes. Conversations always start with the built-in Start Flow (with an all-0 ID). Transition ... |
09ac63e4d3a15a614c556c9244d618f7fa377ca5 | 3,633 | [
65549267
] | [
"typespec",
"documented"
] | defmodule Abacus do
@moduledoc """
A math-expression parser, evaluator and formatter for Elixir.
## Features
### Supported operators
- `+`, `-`, `/`, `*`
- Exponentials with `^`
- Factorial (`n!`)
- Bitwise operators
* `<<` `>>` bitshift
* `&` bitwise and
* `|` bitwise or
* `|... |
09acfdac4f314cede7700d9a99e60d1e93bd1d4f | 2,642 | [
164084093
] | [
"phoenix",
"ecto"
] | defmodule EdsWeb.Admin.SectionController do
use EdsWeb, :controller
alias Eds.{Core, Repo}
alias Eds.Core.{Section, Course, Chapter}
def new(conn, params) do
changeset = Section.change_section(%Section{})
render(
conn,
"new.html",
changeset: changeset,
course_id: params["cours... |
09ad397e1fe76a76e507834818b39e14db23a6b7 | 3,434 | [
263526221
] | [
"test",
"phoenix"
] | defmodule TutopointWeb.ClassControllerTest do
use TutopointWeb.ConnCase
alias Tutopoint.Course
@create_attrs %{comments: "some comments", course_type: "some course_type", date: ~N[2010-04-17 14:00:00], description: "some description", instructor: 42, max_student: 42, min: 42, pay_upfront: true, price: 42, struc... |
09ada811dfdf8e1ef59f69b114120e53e749e3d3 | 2,787 | [
149154480,
97959122,
98229759,
240457680,
91951005,
95606261
] | [
"documented"
] | defmodule Credo.Check.Warning.LazyLogging do
@moduledoc """
Ensures laziness of Logger calls.
You will want to wrap expensive logger calls into a zero argument
function (`fn -> "string that gets logged" end`).
Example:
# preferred
Logger.debug fn ->
"This happened: \#{expensive_calcula... |
09adec13366c5fa4cf4baddf44d79fd3bd9fc357 | 1,749 | [
631648512
] | [
"genserver",
"liveview"
] | defmodule Octopus.Apps.Snake do
use Octopus.App, category: :game
require Logger
alias Octopus.Sprite
alias Octopus.Apps.Snake
alias Octopus.ButtonState
alias Octopus.Events.Event.Input, as: InputEvent
alias Snake.Game
@frame_rate 60
@frame_time_ms trunc(1000 / @frame_rate)
defmodule State do
... |
09ae76a1b80b5463f5ac60f500dd5c8723453c23 | 1,894 | [
471467114
] | [] | # 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 :liveview_pubsub_demo,
ecto_repos: [Liveview... |
09af7a8338e97c82a39c95087057e7ce94927ca3 | 5,679 | [
519855981,
904533394
] | [
"liveview",
"documented",
"ecto"
] | defmodule Hyacinth.Labeling.LabelJobType.ComparisonExhaustive do
alias Hyacinth.Labeling.LabelJobType
alias Hyacinth.Labeling.{LabelJob, LabelSession, LabelElement}
alias Hyacinth.Warehouse.Object
defmodule ComparisonExhaustiveOptions do
use Ecto.Schema
import Ecto.Changeset
import Hyacinth.Valida... |
09afea882898693ee5ab7a6209c3bf59fd46f3c2 | 2,407 | [
115302761
] | [
"test"
] | defmodule PmApiWeb.ChannelControllerTest do
use PmApiWeb.ConnCase
alias PmApi.Projectmode
alias PmApi.Projectmode.Channel
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def fixture(:channel) do
{:ok, channel} = Projectmode.create_channel(@c... |
09b00fa073a1ec1424b6e5577301046f2fe311d1 | 6,113 | [
861432872,
601542502
] | [] | # Modified by Szymon Kubica (sk4520) 18 Feb 2023
# distributed algorithms, n.dulay 31 jan 2023
# coursework, paxos made moderately complex
defmodule Monitor do
# _______________________________________________________________________ Setters
def clock(self, v) do
Map.put(self, :clock, v)
end
def seen(sel... |
09b016abbea5afc88aa1cb786e3ecf38708d55f2 | 5,038 | [
858628983
] | [
"liveview"
] | defmodule LeastCostFeedWeb.FormulaLive.FormulaPrint do
use LeastCostFeedWeb, :live_view
alias LeastCostFeed.Entities
@impl true
def mount(%{"ids" => ids}, _, socket) do
ids = String.split(ids, ",")
{:ok,
socket
|> assign(page_title: gettext("Print"))
|> set_page_defaults()
|> fill... |
09b169b6de89b1c97a81caa3c878a0e317894693 | 3,002 | [
178201124
] | [
"documented",
"ecto"
] | defmodule Eazip.Commands do
@moduledoc """
The Commands context.
"""
import Ecto.Query, warn: false
alias Ecto.Multi
alias Eazip.Repo
alias Eazip.Commands.{Command, CommandService}
@doc """
Returns the list of commands.
## Examples
iex> list_commands()
[%Command{}, ...]
"""
def... |
09b1b54caead376b2348469c9df7ae12a2486147 | 2,657 | [
129961127
] | [
"phoenix"
] | defmodule CreditAppWeb.SessionController do
use CreditAppWeb, :controller
import Comeonin.Bcrypt, only: [checkpw: 2]
plug :scrub_params, "session" when action in [:create]
alias CreditApp.{User, Repo}
def create(%{assigns: %{version: :v1}}=conn, %{"session" => %{"identity_document" => identity_document, "p... |
09b204f59898bf6a3d6bd04bc4fdc1aa14b0ea0e | 1,605 | [
175438572
] | [] | # 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
use Mix.Config
config :ticket_api,
ecto_repos: [TicketApi.Rep... |
09b2266f8f04889c234c2513520312597f3b7439 | 1,771 | [
130749740
] | [
"documented",
"ecto"
] | defmodule Api.User do
@moduledoc """
The User context.
"""
import Ecto.Query, warn: false
alias Api.Repo
alias Api.User.Author
@doc """
Returns the list of authors.
## Examples
iex> list_authors()
[%Author{}, ...]
"""
def list_authors do
Repo.all(Author)
end
@doc """
G... |
09b2d0a3596173d5c8127566af7eef57266abbd1 | 1,554 | [
790788837
] | [
"test"
] | defmodule Workspace.Checks.ValidateTagsTest do
use Workspace.CheckCase
alias Workspace.Checks.ValidateTags
setup do
{:ok, check} =
Workspace.Check.validate(
id: :test_check,
module: ValidateTags,
opts: [
allowed: [:foo, {:foo, :bar}]
]
)
%{check: che... |
09b2e112c840a718a06ca26bdd88168a7bbbba55 | 2,261 | [
526961568
] | [
"genserver",
"supervisor"
] | defmodule BasicHotStuff.Node do
use GenServer
alias BasicHotStuff.Role.{Replica, Leader}
require Logger
@next_view_timeout 100
def start_link(
%{
cur_view: _cur_view,
locked_qc: _locked_qc,
prepare_qc: _prepare_qc,
config: %{
n: _n,
f: _... |
09b2fc831fb5e557e51560f9b6785982b0b7c9be | 8,248 | [
316165371
] | [
"documented"
] | defmodule Mix.Tasks.Quenya.New do
@moduledoc """
Creates a new Quenya project.
It expects the path of the project as an argument.
mix quenya.new SPEC PATH [--module MODULE] [--app APP]
A project at the given PATH will be created based on the spec.
The application name and module name will be retrieve... |
09b2fdb8c785f7b5254a3f8d7dd6081f91cb6d0e | 22,275 | [
1014133905
] | [
"typespec",
"macro",
"documented",
"ecto"
] | defmodule Exdantic do
@moduledoc """
Exdantic is a schema definition and validation library for Elixir.
It provides a DSL for defining schemas with rich metadata, validation rules,
and JSON Schema generation capabilities.
For validating non-dictionary types at the root level (similar to Pydantic's RootModel... |
09b30ecf634d51b657c7770d936b1f1c6bb0506c | 1,889 | [
736052744
] | [
"genserver"
] | defmodule Servy.PledgeServer do
defmodule State do
defstruct cache_size: 3, pledges: []
end
require Logger
use GenServer
@name :pledge_server
def start do
GenServer.start(__MODULE__, %State{}, name: @name)
end
def init(%State{} = args) do
pledges = fetch_recent_pledges_from_service()
... |
09b328359e0b3e99aeb115774458e6cfe8a815ce | 4,676 | [
988491572
] | [
"liveview",
"documented"
] | defmodule DemoPhoenixWeb.Layouts do
@moduledoc """
This module holds different layouts used by your application.
See the `layouts` directory for all templates available.
The "root" layout is a skeleton rendered as part of the
application router. The "app" layout is rendered as component
in regular views an... |
09b33a0d94fb6648ed207301f1838887109c20f2 | 1,861 | [
160402001
] | [] | defmodule Bingo do
def subsystem(file \\ "system.txt") do
[numbers | cards] =
file
|> File.read!()
|> String.split("\n\n")
cards =
cards
|> Enum.map(fn card ->
card
|> String.split("\n", trim: true)
|> Enum.map(&String.split/1)
end)
{String.spl... |
09b352473cea105b50db51be5d9a265006f5fdb1 | 2,422 | [
760888954
] | [
"liveview",
"phoenix",
"ecto"
] | defmodule PentoWeb.FAQLive.FormComponent do
use PentoWeb, :live_component
alias Pento.Institutional
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage faq records in your database.</:subtitle>
</.header>
<.simple_... |
09b3a2953f6f228814b8b15117cc98ff4e96dc5c | 1,689 | [
388872058
] | [
"typespec",
"documented"
] | defmodule LemonMarketsEx.Instrument do
@moduledoc """
See: https://docs.lemon.markets/market-data/instruments-tradingvenues#finding-a-stock
"""
defstruct [:isin, :wkn, :name, :title, :symbol, :type, :venues]
use ExConstructor
@type t() :: %__MODULE__{
isin: String.t(),
wkn: String.t(),... |
09b3fc5336b8147e46936994eca369e2e873d8b1 | 2,962 | [
733633430
] | [] | defmodule DayOne do
defmodule PartOne do
def execute(inputs) when is_list(inputs) do
Enum.reduce(inputs, 0, fn input, sum ->
sum + parse(input)
end)
end
def execute(file_path) do
{:ok, content} = File.read(file_path)
content
|> String.split("\n")
|> execute()
... |
09b4c3f1497c3495c9f5b8f412c4dcec7eab5b90 | 2,943 | [
262900980
] | [
"typespec",
"documented",
"ecto"
] | defmodule HX.Builder do
alias HX.Builder.{Class, ClassIdentifier, Property, SqlDefinition}
import Ecto.Changeset, only: [apply_action: 2]
alias Ecto.Multi
alias HX.Repo
@moduledoc """
Context module grouping functionality related to `Class` and `Property` in the system
"""
@spec validate_class(map())... |
09b4e3116870e0ac8bc69f96e0d5bb5efce262f6 | 3,923 | [
130748338
] | [
"documented",
"ecto"
] | defmodule Mix.Tasks.Pleroma.LoadTesting do
use Mix.Task
use Pleroma.LoadTesting.Helper
import Mix.Pleroma
import Pleroma.LoadTesting.Generator
import Pleroma.LoadTesting.Fetcher
@shortdoc "Factory for generation data"
@moduledoc """
Generates data like:
- local/remote users
- local/remote activitie... |
09b4e7e4c844a46b175a9d36e23106009f754c36 | 14,442 | [
452852184,
688332642,
397255799,
460571400,
514687923
] | [
"macro",
"test",
"documented"
] | defmodule Bamboo.Test do
import ExUnit.Assertions
@moduledoc """
Helpers for testing email delivery.
Use these helpers with `Bamboo.TestAdapter` to test email delivery. Typically
you'll want to **unit test emails first**. Then, in integration tests, use
helpers from this module to test whether that email ... |
09b55a664042966e8a2b8bbb7cdad7e0d12ba13a | 1,681 | [
56934375
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Places.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Places.Web, :controller
use Places.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short ... |
09b561e5fa1278cb0d7a2574187605c98d7d97e0 | 1,937 | [
913981294
] | [
"test",
"documented"
] | defmodule Soundboard.Sounds.UploadTest do
@moduledoc """
Tests the Sound.Upload module.
"""
use Soundboard.DataCase
alias Soundboard.Accounts.User
alias Soundboard.Repo
alias Soundboard.Sound
setup do
user = insert_user()
%{user: user}
end
describe "upload" do
test "upload creates sou... |
09b5a47f507d853b7ed2d1128808aa12fbb83f44 | 2,862 | [
238012926
] | [
"genserver",
"documented"
] | defmodule TaskKeeper do
@moduledoc """
Manages executing tasks up to a certain limit. Accepts requests to start a new tasks.
Requests that cannot be processed immediately (due to exceeding max_tasks limit) are stored in a queue and are processed, as soon as any task exits, in a FIFO order.
"""
use GenServer
... |
09b61ad143ce73a929309696b9d949af7b141c4f | 3,589 | [
609644268
] | [
"liveview",
"test"
] | defmodule WebsiteWeb.ProjectLiveTest do
use WebsiteWeb.ConnCase
import Phoenix.LiveViewTest
import Website.Website.ProjectsFixtures
@create_attrs %{description: "some description", name: "some name", url: "some url"}
@update_attrs %{description: "some updated description", name: "some updated name", url: "s... |
09b65623c4b1b3c7e4bdcbeb412f261d8a938c71 | 1,831 | [
461834992
] | [] | defmodule MyEnum do
def all?([]), do: true
def all?([], fun), do: true
def all?([head | tail], fun) do
cond do
Regex.match?(~r/^\d+$/, "#{head}") == false or fun.(head) == false ->
false
true ->
fun.(head)
all?(tail, fun)
end
end
def each([], fun), do: :ok
def... |
09b67db2357bc8842ce9372c6367a6ef3d70dd48 | 1,639 | [
296295613
] | [
"liveview",
"documented"
] | defmodule MoonWeb.Components.ShowRoomPage.Sidebar.Generic do
@moduledoc false
use Moon.StatefulComponent
alias Moon.Parts.Sidebar
alias Moon.Icon
prop(menu_items, :list, default: MoonWeb.Schema.Link.menu())
prop(editable_menu_items, :list, default: [])
prop(light_theme, :boolean, default: false)
pro... |
09b6c3648a052fa9dfbe17091dacdfd9616f566c | 3,465 | [
553940200
] | [
"documented"
] | defmodule ProductFilters do
@moduledoc """
Documentation for `ProductFilters`
"""
@doc """
Filter products by name, category, and price.
## Examples
Filter by name
iex> ProductFilters.filter([%{name: "Laptop", category: :tech, price: 100}], name: "Laptop")
[%{name: "Laptop", cate... |
09b6e194619c848d09208480fed3f9de90a42547 | 2,777 | [
668251219
] | [
"phoenix"
] | defmodule PetalProWeb.UserConfirmationController do
use PetalProWeb, :controller
alias PetalPro.Accounts
def new(conn, _params) do
render(conn, "new.html")
end
def resend_confirm_email(conn, _) do
if is_nil(conn.assigns[:current_user]) do
conn
|> put_flash(:error, gettext("You must be s... |
09b713544ff64d0feb3e45459549898bdcceb3c0 | 5,134 | [
458941818
] | [
"test"
] | ###
# References:
# https://hexdocs.pm/elixir/Map.html
###
# 1) Start ExUnit
ExUnit.start()
# 2) Create test module
defmodule AssertionTest_02Map do
use ExUnit.Case, async: true
defp input(), do: %{"zero" => 0, one: 1, two: 2}
test "Create map" do
assert Map.new() == %{}
assert Map.new(one: 1, two: ... |
09b7c301672959719dddafebec61b924460b4e6b | 3,197 | [
55124370
] | [] | defmodule Bottles do
def sing(nums) do
Enum.map(nums, fn(num) ->
cond do
num > 1 ->
IO.puts "#{num} bottles of beer on the wall, #{num} bottles of beer."
x = num - 1
if x == 1 do
IO.puts "Take one down and p... |
09b7c63799299718ee867a85fb0207b6dae4f604 | 2,290 | [
343887251
] | [
"test",
"phoenix"
] | defmodule DocumentViewerWeb.AuthControllerTest do
# This is not async because we change the logger level in here which could lead to
# flaky tests elsewhere.
use DocumentViewerWeb.ConnCase, async: false
use Plug.Test
import ExUnit.CaptureLog
describe "GET /auth/:provider" do
test "redirects to the call... |
09b84695642720c1599c8dc21b28fd46fef54997 | 1,871 | [
942811655,
920024200
] | [
"ecto"
] | # credo:disable-for-this-file
defmodule Rbac.Repo.RbacRefreshAllPermissionsRequest do
use Rbac.Repo.Schema
import Ecto.Query, only: [where: 3, first: 2]
import Rbac.Repo, only: [insert: 1, one: 1, update: 1]
schema "rbac_refresh_all_permissions_requests" do
field(:state, Ecto.Enum, values: [:pending, :pro... |
09b84769b85f4843abc466b49d65f0ea842a1898 | 1,790 | [
169433366
] | [] | defmodule MergeSort do
# Hmmm.... Implemented a sorting alg in Clojure that leveraged
# divide and conquer... yet I had tries three times to implement merge sort here?...
def merge_sort(list) do
list_len = length(list)
case list_len <= 1 do
true ->
list
_ ->
mid = round(lengt... |
09b8ad4c189e5cbcf00d5c456aab0ac341069162 | 3,666 | [
937373742
] | [
"phoenix"
] | defmodule PolishMeWeb.Router do
use PolishMeWeb, :router
import PolishMeWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {PolishMeWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_heade... |
09b8c3cd05d8d7304ae879a689248f9f54e0015c | 1,541 | [
336126285
] | [
"liveview",
"phoenix"
] | defmodule FoistWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :foist
# 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: "_foist_key",
... |
09b914fe010bf0a7f55413564f83db884ee5617d | 9,024 | [
379711642
] | [] | %{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "2.3.0", "6cb662d5c1b0a8858801cf20997bd006e7016aa8c52959c9ef80e0f34fb60b7a", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2c81d61d4f6ed0e5cf7... |
09b93ee704d5414660f4b8ba5637617865b2dc81 | 13,461 | [
712036559
] | [
"test"
] | defmodule MobileAppBackend.Predictions.PubSubTests do
use ExUnit.Case
alias MBTAV3API.JsonApi
alias MBTAV3API.{Store, Stream}
alias MobileAppBackend.Predictions
alias MobileAppBackend.Predictions.{PubSub, StreamSubscriber}
import Mox
import Test.Support.Helpers
import MobileAppBackend.Factory
setup ... |
09b9831f927431ea11b8187108cd532eac1ddaa5 | 1,833 | [
350458398
] | [
"test",
"ecto"
] | defmodule EventsSpa.RsvpsTest do
use EventsSpa.DataCase
alias EventsSpa.Rsvps
describe "rsvps" do
alias EventsSpa.Rsvps.Rsvp
@valid_attrs %{text: "some text"}
@update_attrs %{text: "some updated text"}
@invalid_attrs %{text: nil}
def rsvp_fixture(attrs \\ %{}) do
{:ok, rsvp} =
... |
09b98800f04ea462671c097c8ee21b85513ec84b | 1,700 | [
57924840
] | [
"test"
] | defmodule Loadmaster.CommandRunnerTest do
use Loadmaster.ModelCase
setup do
repository = insert_repository()
build = insert_build(repository)
image = insert_image(repository)
job = insert_job(build, image)
{:ok, job: job, build: build}
end
test "it runs a command", %{job: job, build: build... |
09b9e78ee7ead20fd9b3b7769533961f3a54ab91 | 1,609 | [
62307661
] | [] | defmodule RiakTS.Error do
alias RiakTS.{Error, ErrorCode}
defexception [:message, :riakts, :connection_id]
@nonposix_errors [:closed, :timeout]
@metadata [:table, :column, :constraint]
def message(e) do
if kw = e.postgres do
"#{kw[:severity]} (#{kw[:code]}): #{kw[:message]}"
<> build_metad... |
09b9fe22d68548c012adcf44ee50f2883636b759 | 2,312 | [
433525038
] | [] | defmodule Aoc2021.Day19 do
def parse(l), do: Enum.map(tl(l), fn x -> String.split(x, ",") |> Enum.map(&String.to_integer/1) end)
def prep(args), do: Enum.chunk_by(args, &(&1=="")) |> Enum.reject(&(&1==[""])) |> Enum.map(&parse(&1))
def delta([x1,y1,z1],[x2,y2,z2]), do: abs(x2-x1)+abs(y2-y1)+abs(z2-z1)
def shif... |
09ba4d36f09ed782b2d682c16d67cf88bf971425 | 3,792 | [
113377673
] | [
"genserver"
] | defmodule Day23.DuetProcessor do
use GenServer
defstruct registers: %{},
mul_count: 0,
instructions: [],
previous_instructions: []
def process_instructions(%Day23.DuetProcessor{instructions: [], mul_count: mul_count}), do: mul_count
def process_instructions(%Day23.DuetProcessor{instructions: [{:se... |
09ba6c56cc91d57d1aa54855db4d591b5e1396fb | 2,237 | [
508774942
] | [
"phoenix",
"ecto"
] | defmodule LunchbotWeb.Admin.OptionsController do
use LunchbotWeb, :controller
alias Lunchbot.LunchbotData
alias Lunchbot.LunchbotData.Options
plug(:put_root_layout, {LunchbotWeb.LayoutView, "torch.html"})
plug(:put_layout, false)
def index(conn, params) do
case LunchbotData.paginate_options(params) d... |
09bad2b156b6ce4ba04bdab44202bf00335bb2b5 | 3,031 | [
674883735
] | [
"phoenix"
] | defmodule ShipWeb.Router do
use ShipWeb, :router
import ShipWeb.PlayerAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {ShipWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetc... |
09baf243ac62025af5c7e8c32d7621569877348d | 3,709 | [
485771308
] | [
"genserver",
"typespec",
"documented"
] | defmodule Apa.Workers.TimeConsumer do
@moduledoc """
Consumer that takes a message in the form
%{
seq: <integer>
sleep: <integer>
}
and sleeps for `sleep` milliseconds, logging its sleeping activity
"""
use GenServer
use AMQP
alias __MODULE__
require Logger
@default_queue "default"
... |
09bafb98ae833980d6f483e04906f92ffa2108e7 | 2,672 | [
16017872,
19126921
] | [
"phoenix"
] | defmodule MogoChat.ControllerUtils do
import Plug.Connection
import Phoenix.Controller
import Ecto.Query
def json_decode(json) do
{:ok, data} = JSEX.decode(json)
data
end
def json_resp(conn, data, status \\ 200) do
json conn, status, json_encode(data)
end
def json_encode(data) do
{:... |
09bb05850d72d21c4939aab2f796e3a564c60618 | 2,214 | [
180777133
] | [] | defmodule DungeonCrawlWeb.LevelAdminChannel do
use DungeonCrawl.Web, :channel
alias DungeonCrawl.Account
alias DungeonCrawl.DungeonProcesses.LevelProcess
alias DungeonCrawl.DungeonProcesses.LevelRegistry
alias DungeonCrawl.DungeonProcesses.Registrar
def join("level_admin:" <> dungeon_instance_id_number_an... |
09bb168a7c3c4944d290d709aaedb8247e8268d6 | 1,932 | [
337078215
] | [
"genserver",
"liveview"
] | defmodule FireWatchWeb.DashboardLive do
use FireWatchWeb, :live_view
alias FireWatch.Fires
alias FireWatchWeb.FireLive.TableComponent
@impl true
def mount(_params, _session, socket) do
if connected?(socket), do: Fires.subscribe()
{:ok,
assign(socket,
query: "",
results: %{},
... |
09bb9b2c64c03fcce2cd552b1f330dfb90f5b5c5 | 3,532 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Games.V1.Api.AchievementDefinitions do
@moduledoc """
API calls for all endpoints tagged `AchievementDefinitions`.
"""
alias GoogleApi.Games.V1.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Lists all ... |
09bc6a62cf2cacc4ce6641fc82d460abb3947c42 | 2,459 | [
454725109
] | [] | defmodule Chopstick do
def start do
stick = spawn_link(fn -> available() end)
end
def available() do
receive do
{:request, from} ->
send(from, :granted)
gone()
:quit -> :ok
end
end
def gone() do
receive do
:return -> available()
:quit -> :ok
end
end
def request(stick) d... |
09bcd51351d10780dd91441f8c90194631fab283 | 5,426 | [
829059969
] | [
"test"
] | defmodule BACnet.Test.Protocol.Services.TimeSynchronizationTest do
alias BACnet.Protocol.APDU.UnconfirmedServiceRequest
alias BACnet.Protocol.BACnetDate
alias BACnet.Protocol.BACnetTime
alias BACnet.Protocol.Constants
alias BACnet.Protocol.Services.Protocol, as: ServicesProtocol
alias BACnet.Protocol.Servic... |
09bd03e8ad0dfd1188b06a7dd0daa02f0ebd803e | 1,606 | [
632544271
] | [
"documented"
] | defmodule LiveSchedulingWeb.ComponentHelpers do
@moduledoc """
Module for constructing dynamic class names
"""
@doc """
Builds a class string from a given input list by joining them together
This code was taken from Elixirs `Enum.join/2` function and optimized for
building class name (e.g removing empty... |
09bd4e756c8450537f61519d74f39924b176665c | 3,448 | [
257865772
] | [
"typespec",
"macro",
"documented"
] | defmodule Pathex.QuotedParser do
# Utils module for parsing paths created with `Pathex.path/2`
@moduledoc false
import Pathex.Common, only: [is_var: 1]
alias Pathex.Operations
@spec parse(Macro.t(), Macro.Env.t(), Pathex.mod()) :: {[Macro.t()], Pathex.Combination.t()}
def parse(quoted, env, mod) do
{b... |
09bd7ea4c16c6b7377c6ecbc4bd603aeba8d2c8e | 15,927 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_O10 do
alias IcdCode.ICDCode
def _O10011 do
%ICDCode{full_code: "O10011",
category_code: "O10",
short_code: "011",
full_name: "Pre-existing essential hypertension complicating pregnancy, first trimester",
short_name: "Pre-existing essential ... |
09be1399c4297b4c75259ec3d5c40bf02ccd4709 | 1,879 | [
258504976
] | [
"macro",
"documented",
"phoenix"
] | defmodule InnoTestWeb 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 InnoTestWeb, :controller
use InnoTestWeb, :view
The definitions below will be executed for every view,
controlle... |
09be5892f2965af8b65ff0c33c03fdcc86c44c25 | 3,807 | [
705690956
] | [
"documented",
"ecto"
] | defmodule CompanyPoc.Entity do
@moduledoc """
The Entity context.
"""
import Ecto.Query, warn: false
alias CompanyPoc.Repo
alias CompanyPoc.Entity.Companies
@doc """
Returns the list of company.
## Examples
iex> list_company()
[%Companies{}, ...]
"""
def list_company do
Repo.... |
09be6f16da865cafdc886226aac01c49a76379b2 | 1,928 | [
189877082
] | [
"phoenix",
"ecto"
] | defmodule BarcampWeb.FaqController do
use BarcampWeb, :controller
alias Barcamp.Content
alias Barcamp.Content.Faq
plug(:put_layout, {BarcampWeb.LayoutView, "torch.html"})
def index(conn, params) do
case Content.paginate_faqs(params) do
{:ok, assigns} ->
render(conn, "index.html", assigns)... |
09bedf2dd4112a670427f6b3dc4de1c64ba96fd4 | 15,266 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Bigquery.V2.ScriptOptions.KeyResultStatementKind do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :KEY_RESULT_STATEMENT_KIND_UNSPECIFIED, 0
field :LAST, 1
field :FIRST_SELECT, 2
end
defmodule Google.Cloud.Bigquery.V2.JobConfigur... |
09befb8c148883035847f452df640c81a754e999 | 18,996 | [
825326647
] | [] | %{
"atecc508a": {:hex, :atecc508a, "1.2.2", "fb85a9beb4e276caffceee8a1ee6139b77f9be8e9b2b4101bfd838857f6b24b6", [:mix], [{:circuits_i2c, "~> 0.2 or ~> 1.0 or ~> 2.0", [hex: :circuits_i2c, repo: "hexpm", optional: false]}, {:x509, "~> 0.5.1 or ~> 0.6", [hex: :x509, repo: "hexpm", optional: false]}], "hexpm", "a0c1ebcd... |
09bfc9a8bc9a0b3944889e1f7e9af94c825bea57 | 3,945 | [
78348037
] | [] | defmodule RecurringEvents.ByPump do
alias RecurringEvents.{Date, Frequency, Guards}
use Guards
@rules [
:by_month,
:by_month_day,
:by_year_day,
:by_week_number,
:by_day,
:by_hour,
:by_minute,
:by_second
]
def inflate(date, rules) when is_map(rules) do
Enum.reduce(@rules,... |
09c030b7e6cc5c9a56210342f555027a605ee4d7 | 1,947 | [
470382917
] | [
"phoenix",
"ecto"
] | defmodule DemoWeb.BlogpostController do
use DemoWeb, :controller
alias Demo.Blogposts
alias Demo.Blogposts.Blogpost
def index(conn, _params) do
blogposts = Blogposts.list_blogposts()
IO.inspect(blogposts, label: "TESTEEEE")
render(conn, "index.html", blogposts: blogposts)
end
def new(conn, _p... |
09c0b71b950f1f480344f1ae1cb4b222d91c1146 | 4,871 | [
997831666
] | [
"test"
] | defmodule CKEditor5.Cloud.CKBoxTest do
use ExUnit.Case, async: true
alias CKEditor5.Cloud.CKBox
alias CKEditor5.Errors
describe "s/0" do
test "validates a correct ckbox configuration map" do
valid_config = %{
version: "35.4.0",
theme: "default"
}
assert {:ok, _} = Norm.c... |
09c0f24aa8a4d746696a740ac390ac648cc088f4 | 2,974 | [
142337811
] | [
"documented"
] | defmodule Courtbot.Import do
@moduledoc false
alias Courtbot.{
Kinds.Csv,
Repo,
Configuration
}
def run, do: Courtbot.Import.run(Configuration.get([:importer, :types]))
def run(config = %{importer: %{kind: kind, origin: "file", source: source}, types: _types}) do
Rollbax.report_message(:info... |
09c11e1e6aaaa42990d92e796d48d3b18aa130c2 | 3,325 | [
103824045
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("garden.exs", __DIR__)
end
ExUnit.start
ExUnit.configure trace: true
defmodule GardenTest do
use ExUnit.Case
@tag :pending
test "gets the garden for Alice with just her plants" do
garden_info = Garden.info("RC\nGG")
assert garden_info.ali... |
09c143d4e439acdd4cca850bd0e85ac074c693c5 | 2,700 | [
25450132
] | [
"supervisor",
"documented"
] | defmodule WorkQueue do
use Exlibris.PipeWhileOk
use Exlibris.BeforeReturning
require Logger
alias WorkQueue.Options
@doc File.read!("README.md")
def process(worker_fn, item_source, extra_opts \\ []) do
pipe_while_ok do
package_parameters(worker_fn, item_source, extra_opts)
|> Options.an... |
09c1a86cd9572b532a35942e052b282ce1e11b0d | 1,728 | [
855858722
] | [
"ecto"
] | defmodule Taskmanager.Schema do
import Ecto.Query, warn: false
alias Ecto.UUID
alias Taskmanager.Repo
alias Ecto.Multi
alias Taskmanager.Schema.Task
alias Taskmanager.Schema.User
def create_user(attrs \\ %{}) do
%User{}
|> User.changeset(attrs)
|> Repo.insert()
end
def change_user(%U... |
09c235ab5c3c71a2783c452cbb5feea2447ac57e | 3,917 | [
739984421
] | [
"test"
] | defmodule Executive.Types.IntegerTest do
use ExUnit.Case, async: true
alias Executive.Schema
alias Executive.Types.Integer, as: IntegerType
doctest IntegerType
describe "name/1" do
test "integer" do
name = IntegerType.name([])
assert name == "integer"
end
test "negative integer" do
... |
09c2492204a9e70857058ff6e39fa096930ae33e | 18,166 | [
988370212
] | [
"test"
] | defmodule UmyaSpreadsheet.AdvancedFillFunctionsTest do
use ExUnit.Case
alias UmyaSpreadsheet.AdvancedFillFunctions
setup do
{:ok, spreadsheet} = UmyaSpreadsheet.new()
{:ok, spreadsheet: spreadsheet}
end
describe "set_gradient_fill/5" do
test "sets basic gradient fill with two colors", %{spreadsh... |
09c2c62d9778edfa0782a2be8af6ba5e059c0036 | 2,209 | [
154788988
] | [
"phoenix"
] | defmodule SapphireWeb.EndpointController do
use SapphireWeb, :controller
alias Sapphire.Mocks.Endpoint
alias Sapphire.Mocks
def index(conn, %{"project_id" => project_id}) do
user = Guardian.Plug.current_resource(conn)
endpoints = Mocks.list_endpoints(user.id, project_id)
project = Mocks.get_projec... |
09c2d32fe153c2482c2f840e6f78815ca78a1c94 | 2,132 | [
614869745
] | [
"test",
"ecto"
] | defmodule Vejper.MediaTest do
use Vejper.DataCase
alias Vejper.Media
describe "images" do
alias Vejper.Media.Image
import Vejper.MediaFixtures
@invalid_attrs %{height: nil, public_id: nil, url: nil, width: nil}
test "list_images/0 returns all images" do
image = image_fixture()
ass... |
09c3126684d42741115f082348609d1ae6a51d37 | 2,541 | [
116635471
] | [
"documented"
] | defmodule ExBinance.User do
@moduledoc """
Private endpoints for order management and account management.
"""
import ExBinance.Api
def account_info do
signed_get("/api/v3/account")
end
def trades(symbol, params) do
params = params |> Map.put(:symbol, String.upcase(symbol))
signed_get("/api/v... |
09c33e5bbc9db4827d2c04bc9c388cbdbb5aa320 | 1,956 | [
57448875
] | [] | defmodule Pxblog.CommentChannel do
use Pxblog.Web, :channel
alias Pxblog.CommentHelper
def join("comments:" <> post_id, payload, socket) do
if authorized?(payload) do
{:ok, socket}
else
{:error, %{reason: "unauthorized"}}
end
end
# Channels can be used in a request/response fashion
... |
09c378873991f5c1ddbbfd7fc0b8f0c361b6a169 | 13,347 | [
1014606324
] | [] | %{
"aten": {:hex, :aten, "0.6.0", "7a57b275a6daf515ac3683fb9853e280b4d0dcdd74292fd66ac4a01c8694f8c7", [:rebar3], [], "hexpm", "5f39a164206ae3f211ef5880b1f7819415686436e3229d30b6a058564fbaa168"},
"backoff": {:hex, :backoff, "1.1.6", "83b72ed2108ba1ee8f7d1c22e0b4a00cfe3593a67dbc792799e8cce9f42f796b", [:rebar3], [], "... |
09c3db2fb1b4315067347c59ab89716840d3f247 | 5,185 | [
635882906
] | [
"macro",
"test"
] | defmodule Mix.Tasks.Ecto.DumpLoadTest do
use ExUnit.Case, async: true
alias Mix.Tasks.Ecto.{Load, Dump}
# Mocked adapters
defmodule Adapter do
@behaviour Ecto.Adapter
@behaviour Ecto.Adapter.Structure
defmacro __before_compile__(_), do: :ok
def dumpers(_, _), do: raise "not implemented"
... |
09c41b47e27248a61b2a1766053fef2c2ad6c79a | 1,580 | [
35306317
] | [
"genserver"
] | defmodule Gaze.ChartsChannel do
use Gaze.Web, :channel
@update_timer 1000
@info_memory [
:total,
:processes,
:atom,
:binary,
:code,
:ets
]
def join("charts", _msg, socket) do
send self, :update
:erlang.system_flag(:scheduler_wall_time, true)
{:ok, socket}
end
def ha... |
09c44f397b528a4907520fa88513cff40f4c335e | 2,396 | [
242704666
] | [
"typespec"
] | defmodule Ghostwheel.Bot do
@max_poll_interval 10 * 1000
@admin_user_id Application.compile_env!(:ghostwheel, :admin_user_id)
use Task
require Logger
@spec start_link(any) :: {:ok, pid}
def start_link(_) do
Task.start_link(__MODULE__, :run, [])
end
@spec run(integer(), integer()) :: no_return
d... |
09c5bfe9dc25bb479bf2ef18a374fab4cd11bfc7 | 2,379 | [
332028257
] | [] | defmodule HyperSchedule.MixProject do
use Mix.Project
def project do
[
app: :hyper_schedule,
version: "0.1.9",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers() ++ [:phoenix_swagger],
start_permanent: Mix.env() == ... |
09c6a0c5627220ead93307c37f3488cf6b9e1e87 | 3,252 | [
223493300
] | [
"phoenix"
] | defmodule BattleBoxWeb.GameController do
use BattleBoxWeb, :controller
alias BattleBox.{Repo, Game, Bot, User, Arena}
import Ecto.Query
def index(conn, params) do
with {:ok, subject} <- load_subject(params) do
games =
Game
|> order_by(desc: :inserted_at)
|> paginate(params)
... |
09c6a193a6bcc70b724d29adec920e904b6446b0 | 2,086 | [
823257580
] | [
"ecto"
] | defmodule Finix.Verifications.Verification do
use Finix.Schema
import Ecto.Changeset
embedded_schema do
field(:id, :string)
field(:created_at, :utc_datetime)
field(:updated_at, :utc_datetime)
field(:application, :string)
field(:identity, :string)
field(:merchant, :string)
field(:merc... |
09c6ae0d3caed01779533fa53222f9b5afb8f117 | 1,921 | [
971519220
] | [
"documented",
"ecto"
] | defmodule GreatApp.Posts do
@moduledoc """
The Posts context.
"""
import Ecto.Query, warn: false
alias GreatApp.Repo
alias GreatApp.Posts.Micropost
@doc """
Returns the list of microposts.
## Examples
iex> list_microposts()
[%Micropost{}, ...]
"""
def list_microposts do
Repo.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.