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
0218b23624ac9d2f1fc497de312a9b9e772dd7c0
4,104
[ 930600936 ]
[ "documented" ]
defmodule TriviaAdvisor.Scraping.Scrapers.QuestionOne.VenueExtractor do @moduledoc """ Extracts venue data specifically from Question One HTML structure. """ require Logger alias TriviaAdvisor.Scraping.Helpers.VenueHelpers @doc """ Extracts venue data from a Question One venue page. ## Parameters ...
021914737ad949ec624a0a67e959f2436c55397e
3,958
[ 287965791 ]
[ "test", "phoenix" ]
defmodule LogLacWeb.AtmosphericPressureControllerTest do use LogLacWeb.ConnCase alias LogLac.Measurement import LogLac.TestData @create_attrs %{date: "2010-04-17T14:00:00Z", value: 42, device_code: "d1", sensor_code: "s1"} @update_attrs %{date: "2011-05-18T15:01:01Z", value: 43, device_code: "d2", sensor_co...
021915b04f00781c4747d2d87b94ec611f107975
14,045
[ 196008840 ]
[ "test" ]
defmodule GameServer.DaraDots.BoardTest do use ExUnit.Case, async: true alias GameServer.DaraDots.{Board, Coordinate, RunnerPiece} test "placed runner should face up given first row" do with {:ok, board} <- Board.new_test(), {:ok, coord} <- Coordinate.new(1, 1) do placed_board = Board.place_r...
02196cd4e5734866f37c6ed63dfa9a2496075c59
2,838
[ 680481530 ]
[ "test", "ecto" ]
defmodule AllThingsSocial.InfluencerAccountsTest do use AllThingsSocial.DataCase alias AllThingsSocial.InfluencerAccounts describe "influencer_accounts" do alias AllThingsSocial.InfluencerAccounts.InfluencerAccount import AllThingsSocial.InfluencerAccountsFixtures @invalid_attrs %{column: nil} ...
0219c8ac1b490a8a2a8dd0293bde9c7e8115708b
2,758
[ 73496108 ]
[ "phoenix" ]
defmodule Pxblog.UserController do use Pxblog.Web, :controller alias Pxblog.User alias Pxblog.Role plug :authorize_admin when action in [:new, :create] plug :authorize_user when action in [:edit, :update, :delete] def index(conn, _params) do users = Repo.all(User) render(conn, "index.html", use...
021a173da14865d7efafb46b5f466155147f4f3d
2,021
[ 138562706 ]
[ "test", "ecto" ]
defmodule Blogger.ContentTest do use Blogger.DataCase alias Blogger.Content describe "posts" do alias Blogger.Content.Post @valid_attrs %{body: "some body", title: "some title"} @update_attrs %{body: "some updated body", title: "some updated title"} @invalid_attrs %{body: nil, title: nil} ...
021a52df19af05a907b2abe2e944f33a69d84547
3,705
[ 127699042 ]
[ "test", "documented" ]
defmodule ReverbServer.ListingTypesTest do @moduledoc false require Logger alias ReverbServer.ListingTypes, as: T alias ReverbServer.Utils, as: U ExUnit.start() defmodule AllListingTypesTests do use ExUnit.Case, async: true test "assert ListingLinks.from_str_map creates ListingLinks struct from js...
021a8b84e45e5ef6814b3ae6810abc53af6e6404
1,572
[ 63128357 ]
[]
use Mix.Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with brunch.io to recompile .js and .css sources. config :escritor, Escritor.Endpoint, http: [port: 400...
021aeb3713246a1d04134ffa5da73f4dd29de33f
1,661
[ 65390089 ]
[ "macro", "documented" ]
defmodule Synex.Params do @doc """ Shorter syntax for common map key-value definition idiom. iex> {name, age} = {"Jack", 26} iex> params(%{name, age, "test" => true}) %{"name" => "Jack", "age" => 26, "test" => true} iex> person = %{"name" => "Jack", "age" => 26} iex> name = "John" ...
021b006af10e2754d42a2129391e31554ac2f28e
2,160
[ 975720677 ]
[ "typespec", "documented" ]
defmodule Tempex.Forecast do @moduledoc """ This module provides functions to get the forecast for a city. It fetches temperature data concurrently for multiple cities and calculates their mean temperatures. """ @type city :: String.t() @type coordinates :: %{latitude: float(), longitude: float()} @type ...
021b9648a6fc2dd515fc6793748b1d423b49e45a
2,719
[ 324861116 ]
[]
defmodule Codegen.Gen.Migration do @behaviour Codegen.Generator @template_paths [".", :codegen] @source_dir "priv/templates/codegen.gen.schema" require IEx alias Codegen.Generator alias Codegen.Template alias Codegen.Helper.Schema def build(context_list, opts \\ []) when is_list(context_list) do ...
021b969ac5631cc23c4618e5797b3b9cad902213
4,229
[ 545502803 ]
[ "liveview", "ecto" ]
defmodule RasbetWeb.WalletLive.Index do use RasbetWeb, :live_view alias Rasbet.Wallet alias Rasbet.Wallet.Deposit alias Rasbet.Wallet.Withdrawal alias RasbetWeb.Router alias Rasbet.Promotions.Promo on_mount {RasbetWeb.LiveAuth, :require_authenticated_user} @impl true def mount(_params, _session, so...
021ba3275236ea42f9de33629bf7987c9ed5e708
2,072
[ 170498902 ]
[ "documented", "ecto" ]
defmodule BotBattle.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias BotBattle.Repo alias BotBattle.Accounts.User @doc """ Returns the list of users. ## Examples iex> list_users() [%User{}, ...] """ def list_users do Repo.all(User) e...
021bad77cf40dc645ac735e2ad47c35a09ad107a
1,572
[ 415908578 ]
[ "liveview", "ecto" ]
defmodule PentoWeb.ProductLive.FormComponent do use PentoWeb, :live_component alias Pento.Catalog @impl true def update(%{product: product} = assigns, socket) do changeset = Catalog.change_product(product) {:ok, socket |> assign(assigns) |> assign(:changeset, changeset)} end @imp...
021bd8b39e500cf6385f67a1631deb62037eb772
4,552
[ 346206189 ]
[]
defmodule BokkenWeb.EventController do use BokkenWeb, controller: "1.6" alias Bokken.Accounts alias Bokken.Events alias Bokken.Events.Event alias Bokken.Mailer alias BokkenWeb.EventsEmails action_fallback BokkenWeb.FallbackController def index(conn, params) do events = Events.list_events(params) ...
021c686064c3f267a413ecf4ed27acfa0be5e8cc
3,306
[ 418010354 ]
[]
defmodule Solution do defmodule Program do defstruct [:mp, :i, :offset, :arg, :halted] def new(ins, i \\ 0, offset \\ 0, arg \\ 0) do %Program{mp: ins, i: i, offset: offset, arg: arg, halted: false} end def update_arg(p, arg) do %{p | arg: arg} end def run(%Program{halted: true}...
021c9c864ac5dda2ebbe743141d22f1774ecb1f6
2,103
[ 82525654 ]
[ "typespec", "macro", "documented", "ecto" ]
defmodule ExOauth2Provider.AccessGrants.AccessGrant do @moduledoc """ Handles the Ecto schema for access grant. ## Usage Configure `lib/my_project/oauth_access_grants/oauth_access_grant.ex` the following way: defmodule MyApp.OauthAccessGrants.OauthAccessGrant do use Ecto.Schema use ExOa...
021cb81818bffc5ec6d066c0e8f17e167dd5e4bb
1,706
[ 129697834 ]
[ "documented" ]
defmodule Antikythera.SecondsSinceEpoch do use Croma.SubtypeOfInt, min: 0 end defmodule Antikythera.MilliSecondsSinceEpoch do use Croma.SubtypeOfInt, min: 0 end defmodule Antikythera.MilliSecondsInGregorian do @time_epoch_offset_milliseconds :calendar.datetime_to_gregorian_seconds( ...
021cdb0ee930aee63584c82e6336fb99eb82943a
5,245
[ 780461734 ]
[ "typespec", "documented" ]
defmodule WorkReport.Parser do alias WorkReport.Model.Month alias WorkReport.Model.Day alias WorkReport.Model.Task @doc """ Parses a text represendation of the markdown document into domain entities in the form of a set of months with days and tasks """ @spec parse_file(String.t()) :: {integer(), [Mont...
021cf8336465f2c67642ca0ded6e8d4ed3cb0181
4,506
[ 470712252 ]
[ "liveview", "ecto" ]
defmodule StoryWeb.PreviewLive do use StoryWeb, :live_view alias Story.Accounts alias Story.Accounts.User alias Phoenix.LiveView.JS alias Story.SOStoryScraper #defp load_file(relative_path) do #(File.cwd!() <> relative_path) #|> Path.expand(relative_path) #|> Path.absname() #|> File.read() ...
021cfb7f99153ef52ad2531f5ee6211c05c17ab3
3,533
[ 90960584 ]
[]
%{"cache_tab": {:hex, :cache_tab, "1.0.7", "8e2c958c0c2178e6c015aa7340c761521dc71b642192a5a7887f4aeffa29c7b1", [:rebar3], [{:p1_utils, "1.0.7", [hex: :p1_utils, optional: false]}]}, "distillery": {:hex, :distillery, "1.2.2", "d5a52920cbe2378c8a21dfc83b526b4225944b9dce7bf170fe5f5cddda81ffb3", [:mix], []}, "earmark":...
021dd4b5eb96439d4738b99b6763732eb631db4e
1,889
[ 163211350 ]
[ "typespec" ]
defmodule ListOps do # Please don't use any external modules (especially List or Enum) in your # implementation. The point of this exercise is to create these basic # functions yourself. You may use basic Kernel functions (like `Kernel.+/2` # for adding numbers), but please do not use Kernel functions for Lists...
021e0c05ad04793b9997574ae927e6ac530f91a0
2,918
[ 522336177 ]
[ "typespec", "documented", "ecto" ]
defmodule Trc.Service.Dataset do @moduledoc """ This module parses and sets the Datasets. It also fetches them from the database. """ @limit_default 50 @epoch_start 0 alias Trc.Model.Dataset alias Trc.Service.DatasetCache alias Trc.Repo @doc """ Gets the `dataset` by its name """ @spec ge...
021e151383c2ce4ab1bc37506b5365528c95b40d
3,592
[ 985604537 ]
[ "liveview" ]
defmodule MstoskyWeb.AppLive.UserLiveHelpers do import Phoenix.Component alias Mstosky.Accounts.User alias Mstosky.Repo def handle_edit_user(socket, %{"id" => id}) do user = Enum.find(socket.assigns.filtered_users, fn u -> to_string(u.id) == to_string(id) end) if user do changeset = User...
021e50145b2c9fe0a7abc52d3046b2acc66d90dd
6,560
[ 149927508 ]
[]
defmodule Chord do ################################################################################################### # takes input from command line. Create a registry, counter for keeping track of the number of hops # Input: numNodes, numRequests # Calls: createNodes ################################################...
021e6b02645fc56647045ab25a5c146862f9d5a0
2,838
[ 183334521 ]
[ "test" ]
defmodule PlantBuddyWeb.PlantControllerTest do use PlantBuddyWeb.ConnCase alias PlantBuddy.Plants @create_attrs %{frequency: 42, last_water: ~N[2010-04-17 14:00:00.000000], location: "some location", name: "some name"} @update_attrs %{frequency: 43, last_water: ~N[2011-05-18 15:01:01.000000], location: "some ...
021e77de149a5c68ba7584ed783f56ebb25fa077
2,436
[ 180234325 ]
[]
defmodule TicTacToe.GameManager do @quit_char Application.get_env(:tic_tac_toe, :quit_char) def start(deps, continue \\ true) def start(deps, true) do { user_interface, game_status, game_setup } = { deps.user_interface, deps.game_status, deps.game_setup } setup_deps = %{ user_interface: deps...
021ea9284afbc1afbfe7ea9c43f5dae8bc279741
12,365
[ 552991938 ]
[ "test" ]
defmodule RPNCalculatorInspectionTest do use ExUnit.Case doctest RPNCalculatorInspection defmodule RPNCalculator do def unsafe_division(input) do [_, a, b] = Regex.run(~r/^(\d*) (\d*) \/$/, input) String.to_integer(a) / String.to_integer(b) end end defp flush_messages() do receive do...
021f5c49cbf0c40e60fc5c509933cc674bd147d7
2,777
[ 39093815 ]
[]
defmodule Mix.Tasks.Compile.Comeonin do @shortdoc "Compiles Comeonin" def run(_) do File.mkdir("priv") {exec, args} = case :os.type do {:win32, _} -> {"nmake", ["/F", "Makefile.win", "priv\\bcrypt_nif.dll"]} {:unix, :freebsd} -> {"gmake", ["priv/bcrypt_nif.so"]} {:unix, :o...
021f609e78e3392b6fe2ec1a092986ec1297393e
1,541
[ 51291223 ]
[ "phoenix" ]
defmodule Rumbl.UserSocket do use Phoenix.Socket @max_age 2 * 7 * 24 * 60 * 60 ## Channels # channel "room:*", Rumbl.RoomChannel ## Transports transport :websocket, Phoenix.Transports.WebSocket # transport :longpoll, Phoenix.Transports.LongPoll # Socket params are passed from the client and can # be...
022004f90677a58b9946b9c3fc6be45cf40c67ce
1,654
[ 65339106 ]
[ "genserver" ]
defmodule Dasher.Metrics do require Logger use GenServer @table_name :dasher_data def start_link do GenServer.start_link(__MODULE__, {}, [name: __MODULE__]) end def add(metric_name, data_type, data) do GenServer.call(__MODULE__, {:add, metric_name, data_type, data}) end def get(metric_name) ...
0221210db6a4840264fd4dbc2fdd7dfaa16be051
3,564
[ 19935149 ]
[ "genserver" ]
defmodule Websocket.EsWebsock do use GenServer # This code uses erlang OTP's gen_server to handle incoming data like movements, messages and registration # All data is centralized in the server state and is lost on exit. At this time there is no centralized database # though I don't plan on adding features that requir...
02219bfd44a586c28000389e16f53a5b421da273
6,199
[ 948973699, 520217048 ]
[ "documented" ]
defmodule Ockam.Examples.Stream.BiDirectional.SecureChannel do @moduledoc """ Ping-pong example for bi-directional stream communication Use-case: integrate ockam nodes which implement stream protocol consumer and publisher Pre-requisites: Ockam cloud node running with stream service and TCP listener Tw...
0221c7a05ce0a87c74da1e9e793c1537c9719f31
4,219
[ 387788489 ]
[ "test", "ecto" ]
defmodule Vbtfriends.AccountsTest do use Vbtfriends.DataCase alias Vbtfriends.Accounts describe "users" do alias Vbtfriends.Accounts.User @valid_attrs %{name: "some name", username: "some username"} @update_attrs %{name: "some updated name", username: "some updated username"} @invalid_attrs %{n...
0221dd5ad88a5c67a213246c35a0bc982d2d1e31
4,180
[ 408017726 ]
[ "macro", "test" ]
defmodule ProjectEuler.FibonacciTest do use ExUnit.Case, async: true alias ProjectEuler.Fibonacci # to handle infinite recursive loops...this should be unnecessary as long as # inputs are being guarded properly @moduletag timeout: 2000 @fibonacci_numbers [1, 2, 3, 5, 8, 13, 21, 34] for {n, i} <- Enum.w...
02234df14cce8485261dda9849a729a60dc97e58
1,564
[ 167750729 ]
[ "macro", "documented", "phoenix" ]
defmodule TransactWeb 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 TransactWeb, :controller use TransactWeb, :view The definitions below will be executed for every view, controlle...
02238834735d31d5e3a2e9d665dbab4e399b2225
3,995
[ 232365694 ]
[ "genserver", "liveview" ]
defmodule TastingsWeb.TastingLiveView do use Phoenix.LiveView alias TastingsWeb.Presence alias Tastings.Bottle alias Tastings.Accounts alias TastingsWeb.Router.Helpers, as: Routes defp topic(tasting_id), do: "tasting:#{tasting_id}" # TODO: can I redirect from the render - to change the path? def rend...
022447b36b53ce96b12505effd96139ad289160d
5,313
[ 520932864 ]
[ "genserver", "typespec", "liveview" ]
defmodule LivebookWeb.SessionLive.MixStandaloneLive do use LivebookWeb, :live_view alias Livebook.{Session, Runtime, Utils, FileSystem} @type status :: :initial | :initializing | :finished @impl true def mount(_params, %{"session" => session, "current_runtime" => current_runtime}, socket) do unless Liv...
0224549ac9b2de907a4ec37b286313084381774d
6,641
[ 725803417 ]
[ "typespec", "documented" ]
defmodule CoordinateGrid do @typedoc """ User provided value being stored at `t:coordinate` in `t:grid`. """ @type value :: term() @typedoc """ x,y coordinate for location in `t`. """ @type coordinate :: {integer(), integer()} @typedoc """ Representation of item at a `t:coordinate` in `t`. """ ...
022469f25726a6d1bb2aca86b34f13b1555df02d
3,293
[ 431159307 ]
[]
defmodule AdventOfCode.Day09 do @behaviour AdventOfCode def run(input) do moves = parse_moves(input) [answer_a, answer_b] = for rope_length <- [2, 10] do count_tail_visits(build_rope(rope_length), moves) end {answer_a, answer_b} end ### Parsing # Returns a list of atoms, o...
02246d711b39e403d9e39aed843375cef9022bcc
3,102
[ 585533798, 244770637 ]
[ "test", "ecto" ]
defmodule MsnrApi.ActivityTypesTest do use MsnrApi.DataCase alias MsnrApi.ActivityTypes describe "activity_types" do alias MsnrApi.ActivityTypes.ActivityType import MsnrApi.ActivityTypesFixtures @invalid_attrs %{content: nil, description: nil, has_signup: nil, is_group: nil, name: nil} test "...
02248a6b631592d41ad48e1c2daab235f11058a8
1,841
[ 58721317 ]
[ "ecto" ]
defmodule Exantenna.User do use Exantenna.Web, :model schema "users" do field :email, :string field :password, :string, virtual: true field :password_confirmation, :string, virtual: true field :encrypted_password, :string field :last_logintime, Timex.Ecto.DateTime has_many :blogs, Exant...
02249a471653ed4b69236008f01848e905750607
7,646
[ 51404339 ]
[]
defmodule Avrex do use Bitwise # ENCODE # PRIMITIVE TYPES def encode(val, :int) do z = (val <<< 1) ^^^ (val >>> 31) varint_encode(<<z::size(32)>>) end def encode(val, :long) do z = (val <<< 1) ^^^ (val >>> 63) varint_encode(<<z::size(64)>>) end def encode(val, :float) when is_float(v...
0224e272e777ef9b2282d561d739082fb796296c
1,971
[ 803858849 ]
[]
# 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 :visnov, ecto_repos: [Visnov.Repo], genera...
0225169b098143722b6e82998d95ee48263cf9eb
13,098
[ 1002277727 ]
[ "test", "documented" ]
defmodule AiSelfSustainingMinimal.Government.GovernmentCliSimulationTest do @moduledoc """ 80/20 Simulation Test for Government Infrastructure CLI Patterns. Demonstrates that enterprise patterns can be simulated without enterprise infrastructure complexity. This test validates: - Security context val...
022531161958711c5e59475a7e28bd32253852e5
11,474
[ 89630812 ]
[ "typespec", "documented" ]
defmodule IbGib.Auth.Identity do @moduledoc """ This module relates to handling identity with respect to ib_gib. I am starting out with the following fundamental thing: identity^gib Each of these will be instanced, mut8d and rel8d. ## Overall Workflow So a user will come to the page. This creates a new ...
022563a2e9a05a6b7856c3ce527b8da22a42e82f
1,685
[ 181576229 ]
[ "documented" ]
defmodule MMS.Address do @moduledoc """ Specification: OMA-WAP-MMS-ENC-V1_1-20040715-A 8. MMS Addressing Model address = ( e-mail / device-address ) e-mail = "Joe User <<EMAIL>>" ; corresponding syntax defined in RFC822 per header field device-address = ( global-phone-number "/TYPE=PLMN" ) ...
0225d7b30645b555d5f4c8cb6a715a6b32f7c16e
4,734
[ 205748023 ]
[ "genserver" ]
defmodule Agot.Tjp do use GenServer alias Agot.Analytica alias Agot.Games alias Agot.Repo alias Agot.Tournaments def start_link do GenServer.start_link(__MODULE__, %{}) end def init(state) do IO.inspect("SPINNING UP in 1 min") Process.send_after(self(), :joust, 1000 * 60) # 1 minute {:...
0226536031193ba0e9ce58d801bb99339f7a6132
8,299
[ 144321293 ]
[]
%{ "amqp": {:hex, :amqp, "0.3.1", "c22887ff851e57c8012a7b340a9a837ae997ee819079e447222100ef2a1a7735", [:mix], [{:amqp_client, "~> 3.6.14", [hex: :amqp_client, repo: "hexpm", optional: false]}, {:rabbit_common, "~> 3.6.14", [hex: :rabbit_common, repo: "hexpm", optional: false]}, {:recon, "~> 2.3.2", [hex: :recon, repo...
022683e5e70d06bd904c81f3eddd6f32f1123c15
1,548
[ 233474849 ]
[]
defmodule Firmware.AlsaPlayer do alias __MODULE__ @channels 2 @frames_per_second 44100 def child_spec([]) do %{ id: AlsaPlayer, start: {AlsaPlayer, :start_link, []} } end def start_link() do Task.start_link(fn -> play_infinite_chunks() end) end def play_infinite_chunks() do ...
0226dba37926d57c9abb321867e3db49d19107bc
3,616
[ 105192416 ]
[ "test" ]
defmodule LukimatWeb.UserControllerTest do use LukimatWeb.ConnCase alias Lukimat.Accounts @create_attrs %{class: "some class", email: "<EMAIL>", password: "password", password_confirmation: "password", first_name: "some first_name", language: "some language", last_name: "some last_name", role: "some role"} #@...
0227dd4e1497eb1d82fb803c670f8011635ada90
2,215
[ 498463393 ]
[ "documented" ]
defmodule BitcoinLib.Signing.Psbt.GenericProperties.Bip32Derivation do @moduledoc """ A bip32 derivation in a partially signed bitcoin transaction """ defstruct [:pub_key, :master_key_fingerprint, :derivation_path] @compressed_pub_key_size 33 @uncompressed_pub_key_size 65 alias BitcoinLib.Signing.Psbt....
02282cbb454a267f6be981891e66de7ff3373127
2,289
[ 486468195 ]
[]
defmodule TreeVsList do def bench() do bench(100) end def bench(l) do ls = [16,32,64,128,256,512,1024,2*1024,4*1024,8*1024] time = fn (i, f) -> seq = Enum.map(1..i, fn(_) -> :rand.uniform(100000) end) elem(:timer.tc(fn () -> loop(l, fn -> f.(seq) end) end),0) end bench = fn (i) -> ...
022877cc898c512b4f2eb86f3d93e438beb8e1e1
1,510
[ 484800172 ]
[]
defmodule Resaltador do def concurrente(lista) do Task.async_stream(lista, fn x -> main(x) end) IO.inspect(self()) end def secuencial([head|tail]) do main(head) secuencial(tail) end def secuencial([]), do: nil def getTokens(fname) do File.read!(fname) |> to_charlist |> :lexer.string()...
0228d85da8bc5b43d5b31029b1df80e1343d7963
2,264
[ 385602070 ]
[ "test", "phoenix" ]
defmodule SvedixerWeb.LikeControllerTest do use SvedixerWeb.ConnCase alias Svedixer.Feed alias Svedixer.Feed.Like @create_attrs %{ } @update_attrs %{ } @invalid_attrs %{} def fixture(:like) do {:ok, like} = Feed.create_like(@create_attrs) like end setup %{conn: conn} do {:ok, con...
022a2f3f3ec74858d958f29f553c0981d8b617dd
2,466
[ 684973864 ]
[ "test", "phoenix" ]
defmodule MappingAppBaseWeb.MarkerControllerTest do use MappingAppBaseWeb.ConnCase import MappingAppBase.MarkersFixtures @create_attrs %{latitude: 120.5, longitude: 120.5} @update_attrs %{latitude: 456.7, longitude: 456.7} @invalid_attrs %{latitude: nil, longitude: nil} describe "index" do test "list...
022a3137eb29b9dc75440cf15bc1509ca6976601
1,929
[ 177432114 ]
[ "typespec", "documented" ]
defmodule Islands.Board.Response do @moduledoc """ A 4-element tuple reflecting the effect of a guess (hit or miss) on a board. """ alias Islands.{Board, Coord, Island} @typedoc "Preliminary response to a guess" @type guess_check :: {:hit, Island.t()} | {:miss, Coord.t()} @typedoc "Full response to a gu...
022a3fdeb30a36aa11e5009ab192be5f13322d40
2,057
[ 312891699 ]
[ "phoenix" ]
defmodule HubbabuddyWeb.AuthController do use HubbabuddyWeb, :controller plug Ueberauth alias Ueberauth.Strategy.Helpers, as: UeberauthHelpers alias HubbabuddyWeb.Router.Helpers, as: RouterHelpers alias Hubbabuddy.Users.User action_fallback(HubbabuddyWeb.ErrorController) def index(conn, _params) do ...
022a6500e8469ff026fc658f7a6178f5e6bdbcd4
2,805
[ 805016438 ]
[ "test" ]
defmodule Template.MonoWeb.OrganizationControllerTest do use Template.MonoWeb.ConnCase alias Template.Mono.Accounts @create_attrs %{} @update_attrs %{} @invalid_attrs %{} def fixture(:organization) do {:ok, organization} = Accounts.create_organization(@create_attrs) organization end describe...
022a82636a690d6f050f330ba97d6921dae268f3
4,268
[ 715494291 ]
[ "phoenix" ]
defmodule RobocoderWeb.AccountsController do use RobocoderWeb, :controller alias Robocoder.Accounts def github_auth(conn, _params) do redirect(conn, external: "https://github.com/login/oauth/authorize?client_id=#{System.get_env("GITHUB_CLIENT_ID")}&redirect_uri=#{System.get_env("GITHUB_REDIRECT_URI")}&scope=...
022abddc5e3a13a011f859319ec187116f545f77
1,945
[ 180487399 ]
[ "test", "ecto" ]
defmodule Server.BudgetsTest do use Server.DataCase alias Server.Budgets describe "budgets" do alias Server.Budgets.Budget @valid_attrs %{budget: 42} @update_attrs %{budget: 43} @invalid_attrs %{budget: nil} def budget_fixture(attrs \\ %{}) do {:ok, budget} = attrs |>...
022ac5cf637a5f4025164ae9035452ebbb6f3d34
1,582
[ 744024035 ]
[ "phoenix" ]
defmodule FoodFavorWeb.Router do use FoodFavorWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {FoodFavorWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers, %{"content-security-poli...
022b4d61fe3663dad2831224b83a88bfb000a16d
5,874
[ 129699403 ]
[ "test" ]
defmodule Tuist.VCS.Workers.CommentWorkerTest do use TuistTestSupport.Cases.DataCase, async: true use Mimic alias Tuist.VCS alias Tuist.VCS.Workers.CommentWorker alias TuistTestSupport.Fixtures.AppBuildsFixtures alias TuistTestSupport.Fixtures.ProjectsFixtures alias TuistTestSupport.Fixtures.RunsFixtures...
022b99305f8be48ce18d18f18cf6d900a9a5caf5
5,714
[ 896883006 ]
[]
defmodule Day5 do import Utils defp day(), do: 5 # Part 1 def add_map_value(map, key, value) do map |> Map.update(key, [value], fn existing_value -> [value | existing_value] end) end def parse_prio_rules(rules_raw) do rules_raw |> Enum.reduce(%{}, fn [before, later], acc -> add_map_value(acc, ...
022c55b5cd8140f40ba52f3ad082e4a46973b93d
2,517
[ 37900140 ]
[ "documented" ]
defmodule Lye.Gratitude do @doc """ Interface functions """ def start do spawn __MODULE__, :gratitude_list, [[]] end def pool(range, pid \\ nil) do pids = range |> Enum.map(fn _x -> pid = if is_nil(pid) do start() else pid end add(pid, "I am alive #{current_d...
022c57e8f2cd004a6b3ba9536da7ab5af8a5bd26
2,905
[ 193244709 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2DiscoveryTarget do @moduledoc """ Target used to match against for Discovery. ## Attributes * `bigQueryTarget` (*type:* `GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2BigQueryDiscoveryTarget.t`, *default:* `nil`) - BigQuery target for Discovery. The first target...
022c81097db734cfec662ccba079d97dc5433be2
1,749
[ 266261344 ]
[]
defmodule Solution do def read_str do IO.read(:line) |> String.trim() end # public interface, take first char and remember it as the current value def encode(<<char::utf8, rest::binary>>, <<char1::utf8, rest1::binary>>) do s = <<char::utf8>> IO.puts "initial #{s}" do_encode1(rest, rest1, <<c...
022cf80ac688a5841015c90155d29aeb6860d557
1,606
[ 72234921 ]
[ "test" ]
defmodule Hare.Context.Action.DeclareExchangeTest do use ExUnit.Case, async: true alias Hare.Core.Exchange alias Hare.Context.Action.DeclareExchange alias Hare.Adapter.Sandbox, as: Adapter test "validate/1" do config = [name: "foo", type: :fanout, opts: [durable: true]] ...
022d69b6dbd730900c05e1b8690ff3810e9295b1
2,422
[ 812033859, 277006571 ]
[ "liveview", "test" ]
defmodule PearsWeb.TeamConfirmationLiveTest do use PearsWeb.ConnCase import Phoenix.LiveViewTest import Pears.AccountsFixtures alias Pears.Accounts alias Pears.Repo setup do %{team: team_fixture()} end describe "Confirm team" do test "renders confirmation page", %{conn: conn} do {:ok, ...
022dbaac7d66eb2176de2071f7b3db6429406ac6
4,045
[ 263995896 ]
[ "macro", "documented", "phoenix" ]
defmodule Coherence.Router do @moduledoc """ Handles routing for Coherence. ## Usage Add the following to your `web/router.ex` file defmodule MyProject.Router do use MyProject.Web, :router use Coherence.Router # Add this pipeline :browser do plug :accepts, ["h...
022e41834cebe0e3e6c3cd82d33d9401fc60a21e
3,806
[ 34357359 ]
[ "test" ]
defmodule OSC.SerializeTest do use ExUnit.Case, async: false use ExCheck alias OSC.Serialize, as: S alias OSC.Util @float_epsilon :math.pow( 2, -24 ) test ".string test strings" do assert S.string("Heya") == <<72, 101, 121, 97>> assert S.string("Wassup!") == <<87, 97, 115, 115, 117, 112, 33, 0...
022e7166e8f73303f35d2b13791a8509b9f05c8d
3,624
[ 105431136 ]
[]
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []}, "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []}, "credo": {:hex, :credo, "0.8.7", "b1aad9cd3aa7acdbaea49765bfc9f1605dc4555023a037d...
022e8a14fe45c87c8c2c089e357e06c4df803bc9
14,142
[ 507349355 ]
[ "ecto" ]
defmodule OmegaBravera.Challenges.Notifier do alias OmegaBravera.{ Challenges.NGOChal, Repo, Money.Donation, Accounts.User, Accounts.Donor, Notifications } alias OmegaBravera.Activity.ActivityAccumulator alias SendGrid.{Email, Mail} import OmegaBravera.Notifications, only: [user_subsc...
022ea13e8581ef4e9da1001cb1516462f8b7d314
2,861
[ 80608777 ]
[]
defmodule An.Fetcher.DoslegsLoader do @behaviour An.Fetcher.AbstractLoader alias An.DosLeg alias An.ActeLeg alias An.TexteLeg alias An.Repo @url "LOI/dossiers_legislatifs/Dossiers_Legislatifs_XIV.json.zip" def get_url do An.Fetcher.AbstractLoader.an_url(@url) end def handle_resource(resource_p...
022eb1a073cb9b8f746eaa7be563d8abf8a79dcb
1,630
[ 160069216 ]
[ "macro", "documented", "phoenix" ]
defmodule PollingWeb 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 PollingWeb, :controller use PollingWeb, :view The definitions below will be executed for every view, controller, ...
022ee0e30692e0ce7b325c7b93fd9d65b34fd506
4,912
[ 274214639 ]
[ "typespec", "macro", "documented" ]
defmodule TypeCheck.Builtin.ImplementsProtocol do defstruct [:protocol] @moduledoc """ Checks whether there is a protocol implementation for this value. Returns a problem tuple with the reason `:no_match` otherwise. """ use TypeCheck @type! t :: %__MODULE__{protocol: module()} @type! problem_tuple ::...
022f631a22aea11ff7b76f4d56a3cdb279210fc9
7,615
[ 123378820 ]
[ "typespec" ]
defmodule EzParser do alias CodeParserState, as: State @behaviour State.Parser @type parser_state :: State.state @type file_path :: State.Parser.file_path @type state :: %EzParser{ parser_state: parser_state, current_item: {atom, atom} } defstruct parser_state: %State{}, current_item: {:unde...
022fd703a0d45e979dd5e144ebef6d7fdb839db0
1,926
[ 457585612 ]
[ "documented" ]
defmodule Paystack.SplitPayment.Base do @callback create(map) :: Paystack.Api.t() @callback list() :: Paystack.Api.t() @callback list(map | list) :: Paystack.Api.t() @callback fetch(String.t()) :: Paystack.Api.t() @callback update(String.t(), map) :: Paystack.Api.t() @callback add_subaccount(String.t(), map...
023090cc6df8b097e04d5fb5343ddc464d5fce63
2,432
[ 42124629 ]
[]
use Mix.Config # For production, we configure the host to read the PORT # from the system environment. Therefore, you will need # to set PORT=80 before running your server. # # You should also configure the url host to something # meaningful, we use this information when generating URLs. # # Finally, we also include t...
0230c2bae99de442e8687bbf7de8fbb279658c0d
10,327
[ 419435907 ]
[ "test" ]
defmodule Oli.Analytics.DatashopTest do use Oli.DataCase import SweetXml alias Oli.Seeder alias Oli.Utils.Seeder.StudentAttemptSeed alias Oli.Analytics.Datashop alias Oli.Delivery.Attempts.Core.StudentInput alias Oli.Delivery.Attempts.PageLifecycle.Hierarchy describe "datashop export" do setup do...
02310330145bbd38652d89fe095d5fdd148842c4
1,708
[ 111696338 ]
[ "phoenix" ]
defmodule UserInterests.UserController do use UserInterests.Web, :controller alias UserInterests.{User, SessionView, ChangesetView, UserInterest, UserView, TopicOfInterest, TopicOfInterestView } def create(conn, params) do changeset = User.registration_changeset(%User{}, params) case Repo.insert(changese...
023154d4d23b881901459b9d1965b919d7b74b5a
1,602
[ 286321931 ]
[]
%{ "jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"}, "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0...
023156d9b2a8b3afbe88f5e23251ab38173ab63e
7,319
[ 540820838 ]
[]
%{ "binance": {:hex, :binance, "1.0.1", "2b6084479aaa31081a1270b5dc73d180bcc205732f5aa8b3ac4fa7e865292230", [:mix], [{:exconstructor, "~> 1.2.3", [hex: :exconstructor, repo: "hexpm", optional: false]}, {:httpoison, "~> 1.4", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 4.0.0", [hex: :poison, repo...
0231da7a9e309c98c430ba2504f5e76087009dd0
1,564
[ 58059466 ]
[ "typespec", "documented" ]
defmodule Want.Atom do @moduledoc """ Performs type conversions to atom values. """ use Want.Type @type result :: {:ok, atom()} | {:error, binary()} @doc """ Cast a value to an atom. ## Options * `:exists` - If true, only convert to an atom if a matching atom already exists. ##...
02320aefd871bb6957118195226c863a3fe6287a
2,694
[ 365284974 ]
[ "documented", "ecto" ]
defmodule MyApp.Library do @moduledoc """ The Library context. """ import Ecto.Query, warn: false alias MyApp.Repo alias MyApp.Library.Book @page_size 25 @doc """ Returns the list of books. This is paginated ## Examples iex> list_books(user_id, nil) [%Book{}, ...] iex> list_bo...
0232140eedbb544865f019c40f492eb670ced825
2,234
[ 67346910 ]
[ "ecto" ]
defmodule RecurringEvents.Event.Repetition.Changeset do use RecurringEvents.Changeset alias RecurringEvents.Event.Repetition alias RecurringEvents.Event.Repetition.Frequency @params_required ~w(frequency interval start_date end_date start_time end_time)a @params_optional ~w(exclusions)a def build(schema ...
02336f9d7d0043546d49c6a03377196598a5af0b
2,429
[ 105384771 ]
[ "typespec", "documented" ]
defmodule GenerateCsv do @moduledoc """ Documentation for GenerateCsv. """ @doc """ Create especified number of csv lines ## Parameters count: Number of entries that willbe generated ## Examples iex> GenerateCsv.create(1) ["51734,euvl 878,tptzd2", "14928,ougt 237,jmwc83"] "...
0233e9eaf927ade5eaded1dca97a3a087f27ac09
3,203
[ 764408696 ]
[ "liveview" ]
defmodule WaveletFMWeb.Explore do use WaveletFMWeb, :live_view alias WaveletFM.FMs alias WaveletFM.FMs.FM alias WaveletFM.FMs.Follow alias WaveletFMWeb.Components.PostsComponent def mount(_params, _session, socket) do following = socket.assigns.current_fm |> FMs.list_following() |> E...
02341695ff942a4d75e781911468f9d36f0919b2
3,950
[ 112967082 ]
[]
# Solution for the second part of http://adventofcode.com/2017/day/3 # BTW Stream.unfold and Stream.transform and Enum.flat_map_reduce ROCK!!! # direction_stream returns an infinite stream of direction instructions: # :up, :left, :left, :down, :down, :right, :right, :right, :up, :up, :up, :left, # :left, :left, :left...
0234ab155e4b2cbfce37b883313fca5c13c6129f
7,508
[ 976020898 ]
[ "documented", "ecto" ]
defmodule CMS.Accounts.UserToken do use Ecto.Schema import Ecto.Query alias CMS.Accounts.UserToken @hash_algorithm :sha256 @rand_size 32 # It is very important to keep the magic link token expiry short, # since someone with access to the email may take over the account. @magic_link_validity_in_minutes...
0234bce0fc922efbbb5d1b886638346247f7dfe4
6,766
[ 972810178, 168643505 ]
[ "typespec", "documented", "ecto" ]
defmodule Data.Exit do @moduledoc """ Exit Schema """ use Data.Schema alias Data.Proficiency alias Data.Room alias Data.Zone @directions [ "north", "east", "south", "west", "up", "down", "in", "out", "north west", "north east", "south west", "south east...
0234caa4fe4720814cc07147f0b5d18cfc622457
14,539
[ 292029041 ]
[ "test" ]
defmodule CaptainHook.WebhookEndpointsTest do use CaptainHook.DataCase, async: true alias CaptainHook.WebhookEndpoints describe "list_webhook_endpoints/1" do test "list_webhook_endpoints" do %{id: id_1} = insert!(:webhook_endpoint, created_at: utc_now()) %{id: id_2} = insert!(:webhook_endpoint, ...
02360b92a82161f75f2d236c56f4c742a46c2920
2,770
[ 344191061 ]
[]
defmodule Invoicer.Mixfile do use Mix.Project def project do [ app: :invoicer, version: "0.0.1", elixir: "~> 1.11", erlang: "~> 23.1", elixirc_paths: elixirc_paths(Mix.env()), test_paths: ["test"], test_pattern: "**/*_test.exs", test_coverage: [tool: ExCoveralls]...
02361e9d6971e5da98a1da0955aedc466391f304
1,965
[ 301098768 ]
[ "test" ]
defmodule EmulationTest.FP32 do use ExUnit.Case use Bitwise alias Emulation.Common.FP32 alias Emulation.Common.ShiftRegister, as: SR test "normalise base 2 1100.101" do fraction = SR.push_right(0, 1, 22) |> SR.push_right(0, 22) |> SR.push_right(1, 22) expected_fraction = SR....
0236bde3be5bfb00739ab1274acd32a725a0921e
1,778
[ 462980465 ]
[ "macro", "documented", "phoenix" ]
defmodule LilyWeb 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 LilyWeb, :controller use LilyWeb, :view The definitions below will be executed for every view, controller, etc, so k...
023704b626b38d1e84e15d4c69226ce21e82fb24
1,686
[ 865067234 ]
[ "phoenix" ]
defmodule DiscussWeb.Router do use DiscussWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {DiscussWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug DiscussWeb.Plugs.SetUs...
023737e1263fc35f522cf51f2e7bc3714124eb7e
2,186
[ 186023046 ]
[ "ecto" ]
defmodule OkrApp.Objectives.OkrPreloader do alias OkrApp.Repo import Ecto.Query def preload(okrs, :current_objectives_key_results_full) do key_results_preload = from( kr in OkrApp.Objectives.KeyResult, where: is_nil(kr.deleted_at), order_by: [asc: :id] ) assessment_p...
02384b1f21efce1300e7dac6538726af722fd4f6
5,963
[ 57101607 ]
[ "documented" ]
defmodule Sonex.Service do @alarm_clock "AlarmClock" @audio_input "AudioIn" @device_props "DeviceProperties" @music_services "MusicServices" @system_props "SystemProperties" @redering_cont "RenderingControl" @zone_group "ZoneGroupTopology" @group_mgmt "GroupManagement" @content_dir "ContentDirectory" ...
02385aa5a1a557e1ca9618fa99f03a223573d43f
2,606
[ 571644441 ]
[]
import Config config :hakaton_muzika_web, file_server: "localhost:4001" config :hakaton_muzika, music_path: Path.expand("~/Music/") # Configure your database config :hakaton_muzika, HakatonMuzika.Repo, database: Path.expand("../hakaton_muzika_dev.db", Path.dirname(__ENV__.file)), pool_size: 5, stacktrace: ...
0238ffc0839c46292edc08540f7e96d52ebc2af9
1,887
[ 322851889 ]
[ "macro", "documented", "phoenix" ]
defmodule BieroWeb 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 BieroWeb, :controller use BieroWeb, :view The definitions below will be executed for every view, controller, etc, s...