whatever i did was wrong
Bobby Grayson 2 weeks ago 2 files (+29, -8)
MODIFIED
config/runtime.exs
MODIFIED
config/runtime.exs
@@ -36,8 +36,7 @@ url: [host: "bobbby.online", port: 443],check_origin: ["https://bobbby.online","https://www.bobbby.online",- "//bobbby.online",- "//www.bobbby.online"+ "https://salmon-unselfish-aphid.gigalixirapp.com" # Add your Gigalixir app URL],http: [ip: {0, 0, 0, 0, 0, 0, 0, 0},
MODIFIED
lib/blog_web/live/mirror_live.ex
MODIFIED
lib/blog_web/live/mirror_live.ex
@@ -27,7 +27,23 @@def handle_info({ref, source_code}, socket) when is_reference(ref) do# Flush the DOWN messageProcess.demonitor(ref, [:flush])- {:noreply, assign(socket, source_code: source_code)}++ # Split into lines first, then characters+ characters = source_code+ |> String.split("\n")+ |> Enum.map(fn line ->+ line+ |> String.graphemes()+ |> Enum.map(fn char ->+ %{+ char: char,+ duration: :rand.uniform(10) + 5,+ delay: :rand.uniform(5000),+ direction: if(:rand.uniform() > 0.5, do: 1, else: -1)+ }+ end)+ end)+ {:noreply, assign(socket, lines: characters)}enddefp fetch_source_code do@@ -46,14 +62,20 @@ <div class="min-h-screen bg-gray-900 text-white p-8"><div class="max-w-4xl mx-auto"><h1 class="text-3xl font-bold mb-8">Mirror Mirror on the wall, who's the most meta of them all?</h1><div class="bg-gray-800 rounded-lg p-6 shadow-lg">- <pre class="text-sm font-mono whitespace-pre-wrap overflow-x-auto">- <code class="language-elixir">- <%= @source_code %>- </code>- </pre>+ <pre class="text-sm font-mono" style="tab-size: 2;"><code class="language-elixir"><%= if assigns[:lines] do %><%= for line <- @lines do %><%= for char <- line do %><span style={"display: inline-block; animation: spin#{char.duration} #{char.duration}s linear #{char.delay}ms infinite;"}><%= char.char %></span><% end %>+<% end %><% else %>Loading source code...<% end %></code></pre></div></div></div>++ <style>+ <%= for duration <- 5..15 do %>+ @keyframes spin<%= duration %> {+ from { transform: rotate(0deg); }+ to { transform: rotate(<%= if rem(duration, 2) == 0, do: "360", else: "-360" %>deg); }+ }+ <% end %>+ </style>"""endend