Skip to content

Instantly share code, notes, and snippets.

@mazz
mazz / logtrace.log
Last active February 6, 2024 21:34
passwordless_auth_live.ex
defp handle_validation(socket, {:ok, _user_pin}) do
Accounts.UserPin.purge_pins(socket.assigns.auth_user)
sign_in_token =
socket.assigns.auth_user
|> Accounts.generate_user_session_token()
|> Base.encode64()
# sign_in_token is still valid up to here
dbg(sign_in_token)
[watch] build finished, watching for changes...
Rebuilding...
Done in 911ms.
[debug] Upgrading connection to websocket
[debug] Shard connection up, waiting for consumers to boot
[error] ** State machine <0.715.0> terminating
** Last event = {info,{gun_upgrade,<0.735.0>,
#Ref<0.3877279376.554958849.24784>,
[error] ** State machine <0.715.0> terminating
** Last event = {state_timeout,connect_timeout}
** When server state = {connecting_http,
#{stream => nil,seq => nil,
'__struct__' => 'Elixir.Nostrum.Struct.WSState',
session => nil,conn => <0.720.0>,
gateway => <<"gateway.discord.gg">>,
last_heartbeat_ack => nil,
last_heartbeat_send => nil,
heartbeat_interval => nil,shard_num => 0,
defmodule Word.Repo.Migrations.CreateMusic do
use Ecto.Migration
def change do
execute "CREATE EXTENSION IF NOT EXISTS citext", ""
create table(:music, primary_key: false) do
add :id, :id, primary_key: true
add :absolute_id, :integer
add :uuid, :uuid
import SwiftUI
import LNPopupUI
import LNPopupController
import Combine
import KSPlayer
struct BlurView: UIViewRepresentable {
var style: UIBlurEffect.Style = .systemMaterial
func makeUIView(context: Context) -> UIVisualEffectView {
return UIVisualEffectView(effect: UIBlurEffect(style: style))
defmodule MyApp.Multimedia.ProgressTrack do
use MyApp.Schema
import Ecto.Changeset
import Ecto.Query
import Ecto.Changeset
alias MyApp.Repo
schema "progress_track" do
# field(:video_id, :integer)
@mazz
mazz / vidstack-hook.js
Created June 8, 2023 05:29
vidstack-hook.js
/*
Docs: https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks
Usage: when using phx-hook, a unique DOM ID must always be set.
<div phx-hook="ExampleHook" id="someUniqueId"></div>
*/
// import 'vidstack/styles/defaults.css'
// import 'vidstack/styles/community-skin/video.css'
@mazz
mazz / channel.ex
Created May 28, 2023 14:58
channel.ex
@required_fields [
:name,
:org_id,
:owner_id,
:channel_category_id,
:slug,
:item_ids
]
@optional_fields [:visibility, :ordinality, :slug, :poster_path, :description, :content_type]
import UIKit
import AVKit
import AVFoundation
import AssetsLibrary
func synchronized(_ object: AnyObject, block: () -> Void) {
objc_sync_enter(object)
block()
objc_sync_exit(object)
}
@mazz
mazz / change.ex
Created December 21, 2022 02:18
why :membership_type and :role are not added to the changeset
def update_changeset(membership, attrs) do
dbg(membership)
dbg(attrs)
# attrs #=> %{is_paid: false, membership_type: "personal", role: "admin"}
to_atom_attrs =
Enum.map(attrs, fn {k, v} ->
if is_atom(v) do
{k, v}
else