User contributions for Admin

Jump to: navigation, search
Search for contributionsExpandCollapse
⧼contribs-top⧽
⧼contribs-date⧽
(newest | oldest) View (newer 50 | ) (20 | 50 | 100 | 250 | 500)

20 February 2025

29 December 2024

27 December 2024

  • 09:2109:21, 27 December 2024 diff hist +419 N How to Think About Phoenix Dead ViewsCreated page with "Each page (resource) has a route. These routes are assigned a controller and a function from that controller. In the code below, when a user goes to the "/" route a controller named PageController is found and a function named home is invoked. Controllers are simply modules and the third argument (in this case named '''home''') is a function on the controller. <source> get "/", PageController, :home </source>" current
  • 09:1209:12, 27 December 2024 diff hist +39 Phoenix Flash MessageNo edit summary current
  • 09:1209:12, 27 December 2024 diff hist +8 Phoenix Flash MessageNo edit summary
  • 09:1109:11, 27 December 2024 diff hist +625 N Phoenix Flash MessageCreated page with "In Phoenix the flash message is invoked from the controller. <source> def create(conn, %{"doink" => doink_params}) do case Doinks.create_doink(doink_params) do {:ok, doink} -> conn |> put_flash(:info, "Doink created successfully.") |> redirect(to: ~p"/doinks/#{doink}") {:error, %Ecto.Changeset{} = changeset} -> render(conn, :new, changeset: changeset) end end </source> The message itself needs to be in the view..."

24 December 2024

23 December 2024

8 December 2024

29 November 2024

25 November 2024

24 November 2024

11 October 2024

10 October 2024

21 August 2024

17 August 2024

16 August 2024

5 August 2024

  • 15:4515:45, 5 August 2024 diff hist +12 Postgres SetupNo edit summary current
  • 15:4515:45, 5 August 2024 diff hist +308 N Postgres SetupCreated page with "==Windows== Download postgres from: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads When complete , launch the SQL Shell (psql) prompt application. Press Enter for each item in the list except "password". For password the default password is password. Type the password and hit Enter."

17 July 2024

13 July 2024

12 July 2024

  • 02:3802:38, 12 July 2024 diff hist +417 Elixir Todo List ExerciseNo edit summary
  • 01:4601:46, 12 July 2024 diff hist +1,043 N Elixir Todo List ExerciseCreated page with "<source> defmodule TodoList do defstruct todos: [] def start do loop(%TodoList{}) end def loop(state) do IO.puts("Todo List:") IO.inspect state.todos IO.puts("\nOptions:") IO.puts("1. Add Todo") IO.puts("2. Mark Todo as Done") IO.puts("3. Exit") case IO.gets("Select an option: ") |> String.trim() |> String.to_integer() do 1 -> todo = IO.gets("Enter Todo: ") |> String.trim() new_state = add_todo(state, to..."

30 June 2024

  • 06:2106:21, 30 June 2024 diff hist +2,397 N GenserverCreated page with "mix new App --sup <b>app/lib/app.ex</b> <source> defmodule App.Service do use GenServer def start_link(state) do GenServer.start_link(__MODULE__, state, name: __MODULE__) end def init(state) do {:ok, state} end def get_state(pid) do GenServer.call(pid, :get_state) end def set_state(pid,state) do GenServer.call(pid, {:set_state, state}) end def handle_call(:get_state, _from, state) do {:reply, state, state} end de..." current
  • 05:5005:50, 30 June 2024 diff hist +50 N How to View All Running ApplicationsCreated page with "<source> :application.which_applications </source>" current

29 June 2024

  • 05:0705:07, 29 June 2024 diff hist +2,474 N Phoenix LiveView Async AssignsCreated page with "== Example== <source> defmodule AppWeb.PageLive do use AppWeb, :live_view alias Phoenix.LiveView.AsyncResult @impl true def mount(_params, _session, socket) do {:ok, assign_async(socket, :number, fn -> {:ok, %{number: really_complicated_function()}} end)} end @impl true def handle_event("generate_number", _, socket) do {:noreply, socket |> assign(:number, AsyncResult.loading()) |> start_async(:get_random_number, fn -> really_c..." current

21 June 2024

20 June 2024

  • 19:4419:44, 20 June 2024 diff hist +669 N Compare Identical FilesCreated page with "<source> defmodule FileComparator do def compare(file1, file2) do IO.inspect File.cwd!() content1 = read_file(file1) content2 = read_file(file2) if content1 == content2 do IO.puts("The files have identical content.") else IO.puts("The files have different content.") end end defp read_file(file_path) do case File.read(file_path) do {:ok, content} -> content {:error, reason} -> raise "Failed to read #{file_path}:..." current

17 June 2024

13 June 2024

12 June 2024

11 June 2024

  • 20:2720:27, 11 June 2024 diff hist +308 Elixir Phoenix SSHNo edit summary current
  • 17:4417:44, 11 June 2024 diff hist +1,274 N Use Phoenix to SSH into a Server and Download a File to Users Local MachineCreated page with "'''Download_Controller ''' <source> defmodule AppWeb.DownloadController do use AppWeb, :controller def home(conn, %{"switch" => switch}) do {:ok, conn} = SSH.connect( # "sim.com.whatever" user: "root", identity: "/home/user/.ssh/id_rsa_nop", save_accepted_host: false, silently_accept_hosts: true, user_interaction: false ) file_path = "priv/test.json" {:ok, json_data} = conn case File.write(file_path..." current
  • 01:4601:46, 11 June 2024 diff hist +548 N Struct Pattern Matching in Arguments of FunctionsCreated page with "=Example= <source> %Person{} = person </source> <source> defmodule Person do defstruct [ first_name: nil, last_name: nil, birthday: nil, location: "home" ] def full_name(%Person{} = person) do "#{person.first_name} #{person.last_name}" end def age(%Person{} = person) do days = Date.diff(Date.utc_today, person.birthday) days / 365.25 end def home(%Person{} = person) do %{person | location: "home"} end def away(%P..." current

10 June 2024

(newest | oldest) View (newer 50 | ) (20 | 50 | 100 | 250 | 500)