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 |
|---|---|---|---|---|
08eb774be61ca23e5a8a3e798109eff74715623d | 3,210 | [
150193030
] | [
"documented"
] | defmodule MyScenicApp.Scene.Primitives do
@moduledoc """
Sample scene.
"""
use Scenic.Scene
alias Scenic.Graph
import Scenic.Primitives
alias MyScenicApp.Component.Nav
alias MyScenicApp.Component.Notes
require ScenicJsx
import ScenicJsx
@bird_hash "0DMsqJaAU2OyRdd9Hp3WWJoO3WE"
@bird_path :co... |
08ebd756c200f2d341d9a3c526c426e323bfd175 | 4,386 | [
130748338
] | [
"test",
"phoenix",
"ecto"
] | defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do
use Pleroma.Web.ConnCase
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
import Pleroma.Factory
import Ecto.Query
clear_config([ScheduledActivity, :enabled])
test "shows scheduled activities" do
%{user: user, conn: conn} = oau... |
08ec64cf33f6d2fadb0d277dee7229dcf8e50ea8 | 1,816 | [
596202192
] | [
"typespec",
"liveview",
"phoenix"
] | defmodule GitsudoWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :gitsudo_web
# 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: "_gitsu... |
08ecfba3e3c800fe9e0d40f16dcf52e0af807151 | 3,265 | [
641114850
] | [
"liveview",
"documented"
] | defmodule NavEx.Adapters.Session do
@moduledoc """
NavEx.Adapters.Session is adapter for keeping user's navigation history
utilizing Plug.Conn session. **Doesn't support LiveView sockets.**
## Adapter config
adapter_config: %{
history_key: "nav_ex_history" # name of the key in session wher... |
08edc987168fd35f0a6108ed159289186f194c6a | 2,465 | [
689539389,
719407286,
657617659,
477647394,
490494758,
15848380,
467107546
] | [] | # TODO: Delete this once FBOS 14.x reaches EOL.
defmodule FarmbotOS.LegacyMigrator do
import Ecto.Query
alias FarmbotOS.Config.NetworkInterface
alias FarmbotOS.Asset.Repo
require Logger
@db_path "/root/config-prod.sqlite3"
@done_flag "/root/v15_migration_done"
def run(), do: spawn(__MODULE__, :do_run, []... |
08ee25f62366fab95fed5cf40887962aad562c5a | 2,546 | [
101083642
] | [
"test"
] | defmodule PtodosWeb.ListControllerTest do
use PtodosWeb.ConnCase
alias Ptodos.TodoLists
@create_attrs %{title: "some title"}
@update_attrs %{title: "some updated title"}
@invalid_attrs %{title: nil}
def fixture(:list) do
{:ok, list} = TodoLists.create_list(@create_attrs)
list
end
describe "i... |
08ee2742824fc1138a572d7b6642f79f4bb8c5e1 | 3,445 | [
225182698
] | [
"documented"
] | defmodule Advent.Y2018.Day07.Part1 do
def run(puzzle) do
puzzle
|> String.split("\n")
|> parse()
|> traverse()
|> Enum.join()
end
@doc ~S"""
iex> import Advent.Y2018.Day07.Part1
iex> parse([
...> "Step C must be finished before step A can begin.",
...> "Step C must be finished bef... |
08eed713370462bbc155713bfd6b672dce13b50f | 4,905 | [
860954801,
960969573,
994845470,
982475980,
977683393,
949431805,
951028820,
978697806,
1003966956,
1005960494,
932340894,
956155713,
997702824
] | [
"test"
] | defmodule TunezWeb.Graphql.ArtistTest do
use TunezWeb.ConnCase, async: true
describe "queries" do
@tag :skip
test "getArtistById" do
# artist = generate(artist(name: "Test Name"))
# album = generate(album(artist_id: artist.id))
# assert {:ok, resp} =
# """
# ... |
08ef6ed9444d995eb37ef9a284f0c609eaa89cfb | 5,758 | [
892030950
] | [
"genserver",
"documented"
] | defmodule ChatRoom do
@moduledoc """
Represents a single chat room GenServer responsible for managing participants
and messages within that room.
"""
use GenServer
@doc """
Starts the chat room GenServer.
## Parameters
- `name`: The unique identifier for the chat room. This is used for
regi... |
08ef8d3566e711a03bf9c76fc775a24f2f869fa2 | 8,201 | [
754991826
] | [] | defmodule Board do
defstruct size: 0,
hand: "",
hand_length: "",
words: [],
board: [],
occupied_tiles: MapSet.new(),
possible_placements: []
def new(board_string, hand) when is_binary(board_string) and is_binary(hand) do
board_array =
... |
08effe83aefe90a02dede2cb54d22659d6c1623e | 2,945 | [
234686244
] | [
"documented"
] | defmodule Solution do
@moduledoc """
Problem can be find here:
https://www.hackerrank.com/challenges/lisa-workbook/problem
"""
@doc """
Hackerank solution
"""
def main do
[n, k] = IO.gets("") |> String.trim |> String.split(" ")
|> Enum.map(&String.to_integer/1)
chapter_list_with_problem... |
08f07a716418a21c6ef20867346a43d5a33477cc | 1,710 | [
48420890
] | [
"typespec",
"documented"
] | defmodule RocketEquation do
@moduledoc """
# Day 1: The Tyranny of the Rocket Equation
https://adventofcode.com/2019/day/1
## Part 1: Sum the fuel requirements of all the modules
Take each module's mass divided by three, round down, and subtract 2.
## Part 2: Include fuel for the fuel, and for its fuel ... |
08f1960a99277a5f135574724ba2013715357d10 | 7,035 | [
861973806
] | [
"test",
"supervisor"
] | defmodule TowerErrorTrackerTest do
use ExUnit.Case
doctest TowerErrorTracker
use AssertEventually, timeout: 100, interval: 10
import ExUnit.CaptureLog, only: [capture_log: 1]
setup do
Path.wildcard("tmp/test-*.db")
|> Enum.map(&File.rm!/1)
put_env(:error_tracker, :repo, TestApp.Repo)
put_e... |
08f1b93b4132d6eabdb74c9a00ba048f1c99ec15 | 6,419 | [
105390378
] | [
"typespec",
"documented"
] | defmodule RFM69 do
use Bitwise
alias RFM69.Device
alias RFM69.Configuration
@moduledoc false
@fifo_size 66
@transfer_sleep trunc(@fifo_size / 4)
@doc """
Sets the base frequency of the RFM69 chip in MHz
"""
@frf_location 0x07
@spec set_base_frequency(Device.t, pos_integer) :: {:ok}
def set_ba... |
08f1d07d365cc1a3a715321c5bc637d8af60b9a4 | 5,474 | [
53360942
] | [
"test",
"documented"
] | defmodule HPackTest do
use ExUnit.Case
alias HPack.Table
doctest HPack
setup do
{:ok, table: Table.new(1_000)}
end
test "decode from static table", %{table: table} do
assert {:ok, _table, [{":method", "GET"}]} = HPack.decode(<<0x82>>, table)
end
test "decode big number (Index5+)", %{table: ... |
08f1d745ec6ae77a050853ca9256ad7c7f098faa | 8,291 | [
886747774
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "he... |
08f1fccd3bd0d2d564aefa3e3a8ab6bdab038c14 | 11,150 | [
858389646
] | [
"test",
"ecto"
] | defmodule Klepsidra.DocumentsTest do
use Klepsidra.DataCase
alias Klepsidra.Documents
describe "document_issuers" do
alias Klepsidra.Documents.DocumentIssuer
import Klepsidra.DocumentsFixtures
@invalid_attrs %{
id: nil,
name: nil,
description: nil,
country_id: nil,
co... |
08f2d1c9d6a29749b264022a46dcac508697cb7b | 1,764 | [
896993983
] | [] | defmodule Aoc.Y2024.Day10 do
alias Aoc.Helper
def find_trailheads(grid) do
grid
|> Map.filter(fn {_k, v} -> v == "0" end)
|> Map.keys()
end
defp four_directions({x, y}) do
[{x, y + 1}, {x, y - 1}, {x + 1, y}, {x - 1, y}]
end
def find_hiking_trail_score(trail_heads, grid) when is_list(trai... |
08f4314c083a60a3803c89cd715f8af37d0c5cd2 | 10,075 | [
989352999
] | [
"documented"
] | defmodule ElixirScope.ASTRepository.TestSupport.CFGValidationHelpers do
@moduledoc """
Helpers for deep CFG validation and path analysis.
These helpers provide utilities for validating the semantic correctness
of Control Flow Graphs, including path analysis, reachability validation,
and structural verifica... |
08f50c862f7e0f266e0cda1d1f65b7ad8a8208dd | 1,658 | [
824383954
] | [
"typespec",
"documented"
] | defmodule Galerie.Directory.FileName do
@moduledoc """
Structure to work with parsed filename.
"""
defstruct [:extension, :original_name, :name, :group_name]
alias Galerie.Directory.FileName
@type picture_type :: :jpeg | :tiff
@type t :: %FileName{
extension: String.t(),
original_na... |
08f5418a694bc659eb9fe10317f8a2f990a5fe42 | 2,473 | [
476843035
] | [
"documented"
] | defmodule ArslaneToNarnia.Slack do
@moduledoc """
Install instructions:
1. Create a new app at https://api.slack.com and use a manifest
2. Copy manifest below and change the TODO's
_metadata:
major_version: 1
minor_version: 1
display_information:
name: TODO
features:
app_home:
home_tab... |
08f56488783cd7ac05a0f45c572917ca3ce9a9bb | 3,362 | [
489499073
] | [
"test"
] | defmodule Moar.RetryTest do
# @related [subject](lib/retry.ex)
use Moar.SimpleCase, async: true
doctest Moar.Retry
defmodule Counter do
use Agent
def start_link(_opts \\ []), do: Agent.start_link(fn -> 0 end)
def value(pid), do: Agent.get(pid, & &1)
def increment(pid), do: Agent.update(pid, ... |
08f605179517e5180647acbaa626abf32077f865 | 1,991 | [
536150270
] | [
"genserver",
"documented"
] | defmodule Core.Realtime.ColorManager do
require Logger
use GenServer
@moduledoc """
Realtime.ColorManager keeps track of color assignments for users.
It persists the color assignments in an ETS table. It also provides
functionality to assign and release colors for users.
"""
@name __MODULE__
@color... |
08f613a83919354db6a3db89da1bb1a897a6f563 | 1,630 | [
347515060
] | [
"phoenix"
] | defmodule PetTrackerWeb.Router do
use PetTrackerWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {PetTrackerWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do... |
08f615f42c7b02a29febf9353f04c09decb9d013 | 2,162 | [
115219443
] | [] | defmodule Advisor.Questions do
@questions %{
retry: [
{:choice, "Sorry, I don't quite understand what you said, do you want to", [{"restart the conversation", "restart"}, {"answer the question again", "back"}]}
],
restart: [
{:text, "resetting everything and let's restart"},
{ :choice,... |
08f630e17df52690b2bfd177b329162d218c61ea | 5,458 | [
922114765
] | [
"test",
"ecto"
] | defmodule Famichat.ChatTest do
use Famichat.DataCase
alias Famichat.Chat
import Famichat.ChatFixtures
describe "users" do
alias Famichat.Chat.User
@invalid_attrs %{username: nil, family_id: nil}
test "list_users/0 returns all users" do
user = user_fixture()
users = Chat.list_users()... |
08f6392bffc4727411fd848a44c97a86a8258274 | 2,310 | [
438055844
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule WikiWeb 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 WikiWeb, :controller
use WikiWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
08f7528fd067e8c9f9d079a295b9c4b63ee7a808 | 2,227 | [
38493005
] | [
"phoenix"
] | defmodule TwitchDiscovery.DiscoverController do
use TwitchDiscovery.Web, :controller
import ExPrintf
def index(conn, _params) do
render conn, "index.html"
end
def video_length(length) do
hours = Float.floor(length / 3600)
remainder = length - hours * 3600
minutes = Float.floor(remainder / 6... |
08f7ee82ff39d875b00c74a7a42de0d94ff9e1d7 | 1,776 | [
529508269
] | [
"phoenix"
] | defmodule EthertransactWeb.Router do
use EthertransactWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {EthertransactWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipelin... |
08f7f1fd0d4e53bae04de9f1226fd2f862b7ac5e | 2,902 | [
58293274
] | [] | require IEx;
defmodule Flow.Listener do
require Tirexs
def start_link(opts) do
spawn(fn -> loop(opts[:socket]) end)
end
defp valid?(data) do
# checking existence of "bids" and "asks" keys in Map
data["bids"] && data["asks"]
end
defp convert(price, quantity) do
{p, _} = Float.parse( price... |
08f8695267827715c9fb185d737f9d41cdff5f67 | 4,820 | [
256651798,
389101999
] | [
"typespec",
"documented"
] | defmodule Mix.Tasks.GitHooks.Install do
@shortdoc "Installs the configured git hooks backing up the previous files."
@moduledoc """
Installs the configured git hooks.
Before installing the new hooks, the already hooks files are backed up
with the extension `.pre_git_hooks_backup`.
## Command line options... |
08f8aa483cae82c1f7a1d01157fdd63e44274f53 | 1,605 | [
189455360
] | [
"typespec",
"documented"
] | defmodule Noether do
@moduledoc """
Noether aims to ease common data manipulation tasks by introducing simple algebraic functions and other utilities.
Functions and names are inspired (sometimes taken as-is) from Haskell.
The `Noether.Maybe` module introduces operations on nullable values.
The `Noether.E... |
08f8d58aec2fc95ce44d2048d2c843eaef686a83 | 2,203 | [
924877386
] | [] | defmodule ALCHEMY.Consumers.VectorConsumer do
use GenStage
alias ALCHEMY.Repo
alias ALCHEMY.Schemas.Item
require Logger
def start_link(opts \\ []) do
name = Keyword.get(opts, :name, __MODULE__)
GenStage.start_link(__MODULE__, opts, name: name)
end
@impl true
def init(opts) do
subscribe_to ... |
08f8f39565cd48ebc40b0ccd4ee3deb09be6daaa | 1,532 | [
48712150
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# Configures the endpoint
config :forum, Forum.Endpoint,
mailgun_domain: "https://a... |
08f927659bc58338fa42964e058e50223139c98e | 1,750 | [
117180923,
121351619
] | [
"documented",
"ecto"
] | defmodule Graphical.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
alias Graphical.Accounts.User
alias Graphical.Repo
schema "users" do
field :email, :string
field :name, :string
field :token, :string
field :password, :string, virtual: true
field :password_hash, :string
has_m... |
08f9b2bb3195c67eda8a0bd0c471c92ff5fd81a5 | 4,372 | [
965914483
] | [
"documented"
] | defmodule OptimumCredo.Check.Readability.DepsOrder do
@moduledoc """
A check that ensures dependencies are alphabetically ordered within their groups.
Alphabetically ordered dependencies are more easily scannable by the reader.
This check enforces that dependencies in app_deps and optimum_deps
are ordered al... |
08fa2640686033e23fa804bb244f4a347b8dbb46 | 1,549 | [
138947639
] | [
"macro",
"documented"
] | defmodule Witchcraft do
@moduledoc """
Top level module
## Hierarchy
Semigroupoid Semigroup Setoid Foldable Functor -----------┐
↓ ↓ ↓ ↓ ↙ ↓ ↘ |
Category Monoid Ord Traversable Apply Bifunctor |
↓ ... |
08fa5696bc222a68dcc881c8ba3b6c09aadc3b28 | 21,592 | [
167857988
] | [] | if Code.ensure_loaded?(SweetXml) do
defmodule ExAws.AutoScaling.Parsers do
use ExAws.Operation.Query.Parser
alias AwsDetective.AutoScaling.ParseTransforms
def parse({:ok, %{body: xml} = resp}, :describe_account_limits) do
parsed_body =
xml
|> SweetXml.xpath(
~x"//DescribeA... |
08fa5d8a8cef9a6daee329b7f649c55fc8ef06fa | 6,727 | [
115751654,
117305725,
120836354,
228308394,
116902741,
117114985,
117301263,
117414829,
121099893,
113956009,
121318872,
103569528,
117378187,
118397994,
117451365,
145635147,
115170667,
117610516,
121081121,
121188479,
114048299,
115417830,
121399547,
119208322,
1210... | [
"typespec",
"documented"
] | defmodule Gettext.Merger do
@moduledoc false
alias Gettext.PO
alias Gettext.PO.Translation
alias Gettext.PO.PluralTranslation
alias Gettext.Fuzzy
@new_po_informative_comment """
## `msgid`s in this file come from POT (.pot) files.
##
## Do not add, change, or remove `msgid`s manually here as
## th... |
08fa8a2f8d86764b741c2d007c8aaf3541a030ce | 7,206 | [
297408972
] | [] | %{
"bertex": {:hex, :bertex, "1.3.0", "0ad0df9159b5110d9d2b6654f72fbf42a54884ef43b6b651e6224c0af30ba3cb", [:mix], [], "hexpm", "0a5d5e478bb5764b7b7bae37cae1ca491200e58b089df121a2fe1c223d8ee57a"},
"cachex": {:hex, :cachex, "3.3.0", "6f2ebb8f27491fe39121bd207c78badc499214d76c695658b19d6079beeca5c2", [:mix], [{:eterna... |
08fb0d48c8ec6332d15cbf8f902af83938443785 | 1,984 | [
736382405,
1014267127,
767597580
] | [
"documented",
"ecto"
] | defmodule Pensieve.Hogwarts do
@moduledoc """
The Hogwarts context.
"""
import Ecto.Query, warn: false
alias Pensieve.Repo
alias Pensieve.Hogwarts.Wizard
@doc """
Returns the list of wizards.
## Examples
iex> list_wizards()
[%Wizard{}, ...]
"""
def list_wizards do
Repo.all(Wi... |
08fb192298d23165b2f128ca1c1429874c812779 | 3,103 | [
159464688
] | [
"test"
] | defmodule ShopQueueTest do
use ExUnit.Case
doctest GenServerTry.ShopQueue
alias GenServerTry.ShopQueue
setup do
{:ok, pid} = ShopQueue.start_link
%{pid: pid}
end
test "shopping starts off empty", %{pid: pid} do
assert ShopQueue.count(pid) == 0
assert ShopQueue.show(pid) == []
end
te... |
08fc0e49c37a43f79f4f17dcc80efc441beecff4 | 4,050 | [
301914883
] | [
"documented",
"ecto"
] | defmodule Kg.Accounts.UserToken do
use Ecto.Schema
import Ecto.Query
@hash_algorithm :sha256
@rand_size 32
# It is very important to keep the reset password token expiry short,
# since someone with access to the email may take over the account.
@reset_password_validity_in_days 1
@confirm_validity_in_d... |
08fc63e66b1f92b4bb718cf2e08677cd4f885fd0 | 5,009 | [
130057999
] | [
"typespec",
"documented"
] | defmodule Pigeon.APNS do
@moduledoc """
Apple Push Notification Service (APNS)
"""
require Logger
import Supervisor.Spec
alias Pigeon.APNS.{Config, Notification}
alias Pigeon.Worker
@typedoc ~S"""
Can be either a single notification or a list.
"""
@type notification :: Notification.t | [Notific... |
08fcaad2ecbeae96514998635286a36e2bac3e14 | 2,185 | [
744281225,
116826798,
313251367
] | [
"typespec",
"documented",
"phoenix"
] | defmodule EWallet.Web.APIDocs.Controller do
@moduledoc false
use EWallet, :controller
alias Phoenix.Controller
plug(:put_layout, false)
@doc false
@spec forward(Plug.Conn.t(), map) :: Plug.Conn.t()
def forward(%{private: %{redirect_to: destination}} = conn, _attrs) do
redirect(conn, to: destination)
... |
08fd1a1c06f832a6e20068c004afb25520d44817 | 1,542 | [
333239824
] | [
"documented"
] | defmodule DevSupport do
@moduledoc false
alias Mix.Tasks.Builddb
@migration_test_source_root_dir "../../../../database"
@migration_unit_test_ds_type "mscmp_syst_instance_unit_test"
@migration_integration_test_ds_type "mscmp_syst_instance_integration_test"
def start_dev_environment(db_kind \\ :unit_testin... |
08fd8465e53e6bc887f0c351e7f03b71b66a3d6f | 16,428 | [
940137860
] | [
"genserver",
"typespec",
"documented"
] | defmodule Pbx.Queue do
@moduledoc """
Manages a call queue with multiple ACD (Automatic Call Distribution) strategies.
Supports multiple routing strategies:
- Skill-based routing: Matches calls to agents based on required skills
- Longest waiting: Prioritizes agents who have been idle the longest
- Workloa... |
08fdacedb6e9a51cddfa6334d39fac824692cf99 | 1,941 | [
475343077,
495424310,
531890950,
481076687,
499293057,
472971204,
496761343,
566619089,
647889562,
466165564,
472228416,
566770189,
577740810,
478529267,
481028861,
475645758,
521625231,
473697525,
497762642,
511272240,
529748378,
546836465,
505555912,
529761913,
8015... | [] | defmodule DBConnection.Mixfile do
use Mix.Project
@source_url "https://github.com/elixir-ecto/db_connection"
@pools [:connection_pool, :ownership]
@version "2.4.2"
def project do
[
app: :db_connection,
version: @version,
elixir: "~> 1.7",
deps: deps(),
docs: docs(),
d... |
08fde09ac246ad7969c932c85042a3a4acf9c1f4 | 4,273 | [
113502073
] | [] | defmodule Advent14 do
def count_used_squares(input), do: input |> Enum.reduce(0, &count_ones/2)
def get_groups(input) do
present_nodes =
input
|> Enum.with_index()
|> Enum.filter(fn {x, _} -> x != "0" end)
indexes = present_nodes |> Enum.map(fn {_, index} -> index end)
connections =... |
08fe1cb9d8acd2531b127bfa9f3c2e0fa760ec28 | 23,643 | [
994404603
] | [
"genserver",
"typespec",
"documented"
] | defmodule WandererKills.Core.Observability.Metrics do
@moduledoc """
Unified metrics collection and management for WandererKills.
This module consolidates all metric collection, aggregation, and reporting
functionality that was previously scattered across the codebase. It provides
a single interface for:
... |
08fe79986f2f7606aba1286ca15c40f7e9787aba | 13,103 | [
988491572
] | [
"test",
"ecto"
] | defmodule DemoPhoenix.AccountsTest do
use DemoPhoenix.DataCase
alias DemoPhoenix.Accounts
import DemoPhoenix.AccountsFixtures
alias DemoPhoenix.Accounts.{User, UserToken}
describe "get_user_by_email/1" do
test "does not return the user if the email does not exist" do
refute Accounts.get_user_by_e... |
08ff243df6959f027565a6e8f06292824d7549f8 | 2,801 | [
396994603,
377666551
] | [] | defmodule ElonBot.Twitter do
require Logger
@headers [{"Authorization", "Bearer #{ElonBot.Config.twitter_bearer_token()}"}]
def load_user(user_name) do
with {:ok, user} <- find_user(user_name),
{:ok, timeline} <- find_timeline(user.id) do
{:ok, %{user: user, tweets: timeline}}
end
end
... |
08ff2c5b4b47d3c361f5117bae2542556e02a73c | 4,564 | [
852052024
] | [
"documented"
] | defmodule Matplotex.Figure.Areal.Scatter do
@moduledoc false
alias Matplotex.Colorscheme.Garner
alias Matplotex.Figure.Areal.PlotOptions
alias Matplotex.Figure.Areal.Region
alias Matplotex.Figure.Areal.Ticker
alias Matplotex.Figure.Marker
alias Matplotex.Figure.Dataset
alias Matplotex.Element.Legend
a... |
08ff853ec89053242359ad4c6363023f5e8d4dbc | 9,511 | [
109536970
] | [] | %{"bamboo": {:hex, :bamboo, "0.8.0", "573889a3efcb906bb9d25a1c4caa4ca22f479235e1b8cc3260d8b88dabeb4b14", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, repo: "hexpm", optional: false]}]... |
08ff87a1cb96f54a79085cbf90690207754e577a | 20,537 | [
290632435
] | [
"test"
] | defmodule KingAlbertEx.GameTest do
use ExUnit.Case, async: true
alias KingAlbertEx.Column
alias KingAlbertEx.Deck
alias KingAlbertEx.Foundation
alias KingAlbertEx.Game
alias KingAlbertEx.Position
alias KingAlbertEx.SpotInHand
setup do
board = [
%Position{kind: Foundation, cards: [{0, :spades... |
090091a721028a6a74444b9e544a0f0772a70eb4 | 2,503 | [
724317220
] | [] | defmodule Aula5 do
def ins(num, []), do: [num]
def ins(num, [h | t]) do
if num > h do
[h | ins(num, t)]
else
[num | [h | t]]
end
end
def ins_no_rep(num, []), do: [num]
def ins_no_rep(num, [h | t]) do
cond do
num > h -> [h | ins_no_rep(num, t)]
num < h -> [num | [h | t]... |
0900dcb94e4dfc1d126b3cc0ba4da23a8a559ff9 | 3,099 | [
51771177
] | [
"test"
] | defmodule Cachex.Actions.RefreshTest do
use Cachex.Test.Case
# This test verifies that we can reset the TTL time on a key. We check this
# by settings keys with and without a TTL, waiting for some time to pass, and
# then check and refresh the TTL. This ensures that the TTL is reset after we
# refresh the ke... |
0901b6fa5602c8555843c811d53ef90423f90c90 | 2,101 | [
429825700
] | [
"test",
"ecto"
] | defmodule FirrjLink.LinksTest do
use FirrjLink.DataCase
alias FirrjLink.Links
describe "links" do
alias FirrjLink.Links.Link
import FirrjLink.LinksFixtures
@invalid_attrs %{link: nil, slug: nil, title: nil, views: nil}
test "list_links/0 returns all links" do
link = link_fixture()
... |
0901be1ab23482853dd0f8d8c0a57e3878e71c58 | 3,316 | [
573326188
] | [
"documented"
] | defmodule AOC2021.Day09.Solver do
@moduledoc """
https://adventofcode.com/2021/day/9
## Both parts
* build the heightmap (parsing, converting to tuple of integers)
* find coordinates of local lows by iterating over the heightmap and comparing with neighbors
### Part 1
* lookup the heights for all loca... |
0901ceff24ecc0d971013d0fee8b76ee0a6cc93a | 1,579 | [
233117862
] | [
"documented"
] | defmodule OtpDemo.Stack do
@moduledoc """
A stack process with its own run loop.
See OtpDemo.GenStack to see the GenServer logic extracted.
"""
def start_link(options) do
name = Keyword.get(options, :name, __MODULE__)
pid = spawn_link(__MODULE__, :loop, [[]])
Process.register(pid, name)
{:ok,... |
09027b636c4aeb0d6e485357f2c814509f591cd8 | 2,203 | [
298012266
] | [
"typespec",
"documented"
] | defmodule AntlUtilsElixir.RpcClient do
@moduledoc "A tiny Rpc Client"
defmodule NodeDownError do
defexception [:message]
end
defmodule BadCallError do
defexception [:message]
end
require Logger
@doc """
Executes functions on a remote node.
Logs call and response.
## Examples
iex>... |
090281f6cecf3021d4c8ccc19ae819b88e42e794 | 13,895 | [
118471365
] | [] | defmodule Stellar.XDR.Types.Transaction do
alias XDR.Type.{
Enum,
Union,
Void,
Int,
Uint,
HyperInt,
HyperUint,
VariableArray,
Uint
}
alias Stellar.XDR.Types.{SignatureHint, Signature, Hash}
alias Stellar.XDR.Types.PublicKey, as: AccountID
alias Stellar.Types.LedgerEntries... |
0902d44e876700c7603f7a6d11ce0350bbc168d8 | 1,767 | [
652565914
] | [
"phoenix",
"ecto"
] | defmodule JobifyWeb.IndustryController do
use JobifyWeb, :controller
alias Jobify.Jobs
alias Jobify.Jobs.Industry
def index(conn, _params) do
industries = Jobs.list_industries()
render(conn, :index, industries: industries)
end
def new(conn, _params) do
changeset = Jobs.change_industry(%Indust... |
090380373472b19c991738db32ab21d897d51e8c | 1,719 | [
300932579
] | [
"test"
] | defmodule CardsTest do
use ExUnit.Case
alias Cards
# doctest Cards
test "can create deck" do
d = Cards.create_deck
assert is_list(d)
end
test "deck has correct type values" do
d = Cards.create_deck
[ {suit, value} | _] = d
assert is_atom(suit)
a... |
0903a955b47abefe2111facd98119f2eb2937c50 | 1,942 | [
543302849
] | [] | defmodule Test.Fixtures do
alias Mnemo.Resources.Postgres.Repo, as: PGRepo
alias Mnemo.Access.Schemas.{
Student,
Subject,
Section,
Block,
Enrollment,
ScheduledBlock,
ReviewBlock
}
def create(type, overrides \\ %{}) do
params = params(type, overrides)
PGRepo.insert(params)
... |
0903b4d55b58e9365734f53d6e0153622b1c64d1 | 5,057 | [
571776611
] | [] | defmodule Pleroma.Web.ApiSpec.Admin.AnnouncementOperation do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Schemas.Announcement
alias Pleroma.Web.ApiSpec.Schemas.ApiError
import Pleroma.Web.ApiSpec.Helpers
def open_api_operation(action) do
operation = String.t... |
0903b76dca4bd6f17e4f4717abd29e981705b38b | 1,939 | [
319845617
] | [
"documented"
] | defmodule Advent.Day22 do
def sample do
"""
Player 1:
9
2
6
3
1
Player 2:
5
8
4
7
10
"""
end
def input, do: File.read!("inputs/22.txt")
def parse(data) do
[p1, p2] = String.split(data, "\n\n", trim: true)
[_ | p1_deck] = String.split(p1, "\n", t... |
0903b9a0a1df905ffb552c7af6223b6ccc44ee77 | 7,872 | [
202927944
] | [
"test"
] | defmodule PR.PlayStateTest do
use PR.DataCase
import Mock
alias PRWeb.Fixtures.Sonos.Error
alias PR.Queue
alias PR.Queue.Track
alias PR.Music.SonosItem
alias PR.PlayState
# This is the bit that gets called after the group is verified
# and the payload is converted to atoms. But that's all
describe... |
09042f55013569748282bd8111b2dc4f9072f7fc | 3,778 | [
515151179
] | [
"test"
] | defmodule PhoenixStorybookTest do
use ExUnit.Case, async: true
alias PhoenixStorybook.{FolderEntry, StoryEntry}
alias PhoenixStorybook.{
EmptyFilesStorybook,
EmptyFoldersStorybook,
FlatListStorybook,
TreeStorybook,
TreeBStorybook
}
describe "stories/0" do
test "when no content path ... |
09044b1f14a74920bd4700beecf903fa3adfb57f | 4,487 | [
186692595
] | [
"typespec",
"macro",
"documented"
] | defmodule Sworm do
@moduledoc """
Sworm takes the accessible API from
[Swarm](https://github.com/bitwalker/swarm), and combines it with
the robustness of [Horde](https://github.com/derekkraan/horde).
It strives to be a combination of a global, distributed process
registry and supervisor, accessible through... |
0904bd9d3dca2d7b3ad5555b1f32cbba7cf72f99 | 3,832 | [
372986455
] | [
"liveview",
"test"
] | defmodule MetapedeWeb.TopicLiveTest do
use MetapedeWeb.ConnCase
import Phoenix.LiveViewTest
alias Metapede.TopicSchema.TopicContext
@create_attrs %{description: "some description", info: "some info", name: "some name", post_id: "some post_id"}
@update_attrs %{description: "some updated description", info: ... |
09053a062e53858581aa0094d74e2c84492fae69 | 2,808 | [
52042806
] | [
"test"
] | if System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("example.exs")
else
Code.load_file("queen_attack.exs")
end
ExUnit.start
ExUnit.configure exclude: :pending, trace: true
defmodule QueenAttackTest do
use ExUnit.Case
# @tag :pending
test "default positions" do
queens = Queens.new
assert q... |
090545a86a2596f684362872179c312601f6b183 | 3,438 | [
231666876
] | [
"test",
"phoenix"
] | defmodule PharmaDashWeb.PatientControllerTest do
use PharmaDashWeb.ConnCase
alias PharmaDash.People
alias PharmaDash.People.Patient
alias PharmaDash.Auth
alias Plug.Test
@current_user_attrs %{
email: "some current user email",
is_active: true,
password: "some current user password",
name:... |
0905734102c5020b52445e2bfdf42483b3f8c661 | 5,279 | [
412558971
] | [
"test"
] | defmodule EmployeeImportTest do
use ExUnit.Case
describe "verify_filter/1" do
test "succeeds when passed correct value" do
assert {:ok, "Both"} == EmployeeImport.verify_filter("Both")
end
test "capitalizes correct input" do
assert {:ok, "Email"} == EmployeeImport.verify_filter("emAIl")
... |
09057cc5568d611cb67c4d7e72bdec6c94de60c9 | 15,908 | [
890838838
] | [
"liveview",
"documented"
] | defmodule TodoplaceWeb.Live.Marketing.EditLinkComponent do
@moduledoc false
use TodoplaceWeb, :live_component
alias Todoplace.{BrandLink, BrandLinks}
@impl true
def update(assigns, socket) do
socket
|> assign(assigns)
|> assign(:brand_link, get_brand_link(assigns))
|> assign_changeset(assign... |
09060096b31ab1833a5656bbf2252e1b5ab08dd6 | 6,390 | [
66685632
] | [] | %{"avrolixr": {:hex, :avrolixr, "0.3.0", "1a450c37ff227427f88179fab4cf031a194a0f0b46dac2854ab30cc34f23b4c9", [:mix], [{:poison, "~> 3.1", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "d9bbbd84e7b1d520242bb87137294094f91db160dbcbf3863cfaec094d3ef8b5"},
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a8... |
0906b68d378f0d2e900c0988a473b77a690c78e5 | 3,088 | [
317900791
] | [] | %{
configs: [
%{
name: "default",
strict: true,
files: %{
included: ["*.exs", "lib/", "test/", "priv/", "config/", "rel/"],
excluded: []
},
checks: [
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.LineEndings},
{Credo.Check.... |
0906c8566c33c109c0cac9efe3b1371c665b492a | 4,179 | [
423666421
] | [] | alias Services.JapaneseVerbConjugator.Client
alias JapaneseVerbConjugation.VerbTenses
# Creates verbs w/ all datafield found on this website:
# http://www.japaneseverbconjugator.com/JVerbList.asp
Client.all()
verbs = JapaneseVerbConjugation.Verbs.list_verbs()
Enum.each(verbs, fn verb ->
with {:ok, %{metadata: proc... |
090702566f442d89da425d2f3a949556715640d7 | 3,124 | [
458828289
] | [
"genserver",
"liveview"
] | defmodule PoeticoinsWeb.CryptoDashboardLive do
use PoeticoinsWeb, :live_view
import PoeticoinsWeb.ProductHelpers
alias Poeticoins.Product
alias PoeticoinsWeb.Router.Helpers, as: Routes
def mount(_params, _session, socket) do
socket =
assign(socket,
products: [],
timezone: get_timezo... |
090703c2de000d18da4bddbb7cbf91e009fc1e64 | 1,975 | [
824383954
] | [
"liveview"
] | defmodule GalerieWeb.Components.Modal do
use GalerieWeb, :component
alias GalerieWeb.Components.Icon
alias GalerieWeb.Html
def render(assigns) do
~H"""
<%= case @component do %>
<% {component, component_assigns} -> %>
<.overlay>
<.live_component id="modal" module={component} {c... |
09070cc50224c41c394ef01b6746108e10679890 | 2,165 | [
212535951
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the paren... |
09071cb8c1a9aef34394ae07484229f641c1aef2 | 15,524 | [
144409835,
149154480,
155456471,
151543773,
145566106,
163091762,
158954162,
164171143
] | [
"typespec",
"documented"
] | defmodule ExDoc.Retriever do
# Functions to extract documentation information from modules.
@moduledoc false
defmodule Error do
@moduledoc false
defexception [:message]
end
alias ExDoc.GroupMatcher
alias ExDoc.Retriever.Error
@doc """
Extract documentation from all modules in the specified di... |
090739e0f90fc3c9bc6544ba6825d98d912a0d77 | 2,568 | [
497730649
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule KeenAuthDemoWeb 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 KeenAuthDemoWeb, :controller
use KeenAuthDemoWeb, :view
The definitions below will be executed for every view,... |
09077e9f5428553b38c05d7aaaf9b74bf769c797 | 6,464 | [
78651147
] | [
"documented"
] | defmodule Slackbot.Parser do
alias Slackbot.{Message, Reaction, DM}
@moduledoc """
The Parser module is responsible to aprse incoming and outgoing data.
Incoming slack messages might have usernames in the shape of "<UZYX>",
and this module is used to translate them to their human-readable counterparts.
""... |
090799d55038359fc2dc813274b1c8fb72d96f58 | 2,565 | [
293896406
] | [
"phoenix",
"ecto"
] | defmodule EVerApiWeb.SponsorController do
use EVerApiWeb, :controller
alias EVerApi.Sponsors
alias EVerApi.Sponsors.Sponsor
alias EVerApi.Ever
alias EVerApiWeb.ControllerHelper
action_fallback EVerApiWeb.FallbackController
# def index(conn, _params) do
# sponsors = Sponsors.list_sponsors()
# re... |
09079dfd8734afd6eeb84bcce1973cfaf8b6081b | 3,932 | [
854097818,
735070915,
897553851,
676083173,
886077676
] | [
"test",
"ecto"
] | defmodule GistClone.GistsTest do
use GistClone.DataCase
alias GistClone.Gists
describe "gists" do
alias GistClone.Gists.Gist
import GistClone.GistsFixtures
@invalid_attrs %{name: nil, description: nil, markup_text: nil}
test "list_gists/0 returns all gists" do
gist = gist_fixture()
... |
0907eb40edf1f32861d72e592f95e28b71e1b4f0 | 1,822 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1DataplexExternalTable do
@moduledoc """
External table registered by Dataplex. Dataplex publishes data discovered from an asset into multiple other systems (BigQuery, DPMS) in form of tables. We call them "external tables". External tables are also sy... |
0908902215a775b69b423a14f61f41f650e2248b | 1,736 | [
35119830
] | [
"genserver"
] | defmodule Session do
use GenServer
def wait_connect_ok(socket, remote_address, remote_port) do
case :gen_udp.recv(socket, 0, 5000) do
{:ok, {_, _, msg}} ->
case Message.from_json(msg) do
{:ok, {:connect_ok, m}} ->
{:ok, %{socket: socket,
connection_id: m.... |
0908a75d756e15c827779c83d2d1dbb21003b0cc | 1,813 | [
27016252
] | [
"test"
] | defmodule SolitaireTest do
use ExUnit.Case
setup do
card = %{suite: :hearts, value: "K"}
{:ok, card: card}
end
test "returns its color", %{card: card} do
assert Solitaire.card_color(card) == :red
end
test "returns its value in points", %{card: card} do
assert Solitaire.card_points(card) ... |
0908f7a46f339d51510015e3cb8af2b1096f8031 | 1,864 | [
694310614
] | [
"supervisor",
"documented"
] | defmodule ElixirMobileTest do
@moduledoc """
ElixirMobileTest keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
# alias Hex.Application
use Application
def co... |
09091a7ee7f24f7cca8a46194756e4538797f851 | 2,777 | [
318311956
] | [] | defmodule PassportValidator do
def problem_one do
count_valid_passport_submissions(&valid_fields?/1)
end
def problem_two do
count_valid_passport_submissions(&valid_passport?/1)
end
defp count_valid_passport_submissions(condition) do
stream_passport_submissions()
|> Stream.map(&convert_submis... |
09094684e9e08acb92230a3ccfd9b685e6bc5029 | 1,891 | [
696588180,
423863622
] | [] | #https://www.beecrowd.com.br/judge/pt/problems/view/1061
defmodule BcParse do
def str_to_float(str) do
str
|> Float.parse()
|> elem(0)
end
def str_to_integer(str) do
str
|> Integer.parse()
|> elem(0)
end
def float_to_str(number, precision \\ 2) do
:erlang.float_to_binary(number,... |
0909a62d59660886f82fb24aaa4707e1d1136fa7 | 4,725 | [
949053483
] | [
"test"
] | defmodule MCP.Server.Transport.SSETest do
use ExUnit.Case, async: false
require Logger
# Use HTTPoison or Finch for actual HTTP client testing
# For simplicity, this test focuses on the GenServer API and state.
# Real integration tests would require an HTTP client.
alias MCP.Server.Transport.SSE
alias M... |
0909dd323ef33be011f5f30f81afa22a9a56cc5a | 2,167 | [
684729669
] | [] | defmodule MultiUserChatServer.Groups.Logic do
def create_group(user_id, group_name, %{groups: groups, group_messages: group_messages} = state) do
new_group = %{
group_id: state[:id_group] + 1,
name: group_name,
users: [user_id],
admin: [user_id],
messages: []
}
create_group ... |
0909fcd24261f0e59bc790852cb2de72a8958914 | 1,614 | [
622609685
] | [
"test"
] | defmodule TFLiteElixir.Tokenizer.FullTokenizer.Test do
use ExUnit.Case
alias TFLiteElixir.Tokenizer.FullTokenizer
@mini_vocab %{
"hello" => 0,
"world" => 1,
"una" => 2,
"##ffa" => 3,
"##ble" => 4,
"hi" => 5,
"there" => 6,
"!" => 7,
"," => 8,
"Hello" => 9,
"World" => 1... |
090a44f6e32995c5eb67c3e3975cef5e3520695e | 6,375 | [
329355024
] | [
"typespec"
] | defmodule Pleroma.Config.DeprecationWarnings do
alias Pleroma.Config
require Logger
alias Pleroma.Config
@type config_namespace() :: atom() | [atom()]
@type config_map() :: {config_namespace(), config_namespace(), String.t()}
@mrf_config_map [
{[:instance, :rewrite_policy], [:mrf, :policies],
"\... |
090abf5436c83cddb6dd3189402e49bceb1dae15 | 2,193 | [
207307095
] | [
"liveview",
"phoenix"
] | defmodule IdkPayWeb.Router do
use IdkPayWeb, :router
# -----------------pipeline ----------------
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(Phoenix.LiveView.Flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
plug(IdkP... |
090ac1d8ff8f8ed18e73bdce229046ca43c15c42 | 2,063 | [
251645291
] | [
"typespec",
"documented"
] | defmodule IntroToSoftwareTesting.FaultyPrograms do
@moduledoc """
Supports exercises from the book Introduction To Sofware Testing, section 1.2
"""
@doc """
findLast returns index of last element in x list that is equal to y.
If there is no such element, returns -1
"""
@spec findLast(list(), integer()) ... |
090ac90b2da63b2c85715653b98f1fee80152ee7 | 1,600 | [
338118832
] | [
"test"
] | defmodule EpiViewpointWeb.UserMultifactorAuthControllerTest do
use EpiViewpointWeb.ConnCase, async: true
import EpiViewpoint.AccountsFixtures
import Mox
setup :verify_on_exit!
alias EpiViewpoint.Test
alias EpiViewpoint.Test.TOTPStub
alias EpiViewpointWeb.Session
alias EpiViewpointWeb.Test.Pages
set... |
090bd8b4ea4ebdf62730c11f7980ad50e61603b3 | 1,650 | [
933399360
] | [
"test"
] | defmodule TestAppWeb.Live.HistoryCommandTest do
use TestAppWeb.Command
describe "HistoryCommand" do
test "displays the last 10 commands" do
{:ok, view, _html} = load_shell()
# does not include the most recent call to history
html = enter_command(view, "history")
refute String.match?(ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.