Snippets Collections
// Problem Statement
// I own a parking lot that can hold up to 'n' cars at any given point in time. Each slot is given a number starting at 1 increasing with increasing distance from the entry point in steps of one. I want to create an automated ticketing system that allows my customers to use my parking lot without human intervention.

// When a car enters my parking lot, I want to have a ticket issued to the driver. The ticket issuing process includes us documenting the registration number (number plate) and the colour of the car and allocating an available parking slot to the car before actually handing over a ticket to the driver (we assume that our customers are nice enough to always park in the slots allocated to them). The customer should be allocated a parking slot which is nearest to the entry. At the exit the customer returns the ticket which then marks the slot they were using as being available.

// Due to government regulation, the system should provide me with the ability to find out:

// Registration numbers of all cars of a particular colour.
// Slot number in which a car with a given registration number is parked.
// Slot numbers of all slots where a car of a particular colour is parked.



#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define FOR(i, n) for (long long int i = 0; i < n; i++)
using namespace std;

class Vehicle
{
public:
    int colour, reg_number;
    Vehicle(int colour, int reg_number)
    {
        this->colour = colour;
        this->reg_number = reg_number;
    }
};

class Ticket
{
public:
    int colour, reg_number, slot_number;
    Ticket(int colour, int reg_number, int slot_number)
    {
        this->colour = colour;
        this->reg_number = reg_number;
        this->slot_number = slot_number;
    }
};

class ParkingLot
{
    set<int> available_slots;
    map<int, set<int>> reg_by_color;
    map<int, int> slot_by_reg;

public:
    ParkingLot(int n)
    {
        for (int i = 1; i <= n; i++)
        {
            available_slots.insert(i);
        }
    }

    void get_available_slots()
    {
        if(available_slots.size() == 0)
        {
            cout<<"No available slots for parking."<<endl;
            return;
        }
        cout << "Available slots are : ";
        for (auto itr = available_slots.begin(); itr != available_slots.end(); itr++)
        {
            cout << (*itr) << " ";
        }
        cout << endl;
    }

    Ticket take_slot(Vehicle vehicle)
    {
        if (available_slots.size() == 0)
        {
            cout << "No available slots" << endl;
            return Ticket(-1, -1, -1);
        }
        else
        {
            int taken_slot = (*available_slots.begin());
            reg_by_color[vehicle.colour].insert(vehicle.reg_number);
            slot_by_reg[vehicle.reg_number] = taken_slot;
            available_slots.erase(taken_slot);

            cout << "Slot : " << taken_slot << " is occupied." << endl;

            return Ticket(vehicle.colour, vehicle.reg_number, taken_slot);
        }
    }

    void get_reg_by_colour(int colour)
    {
        cout << "Reg number of Cars with " << colour << " are : ";
        for (auto itr = reg_by_color[colour].begin(); itr != reg_by_color[colour].end(); itr++)
        {
            cout << (*itr) << " ";
        }
        cout << endl;
    }

    void getSlot_by_reg(int reg_number)
    {
        if (slot_by_reg.find(reg_number) == slot_by_reg.end())
        {
            cout << "No Cars with " << reg_number << " exists in parking." << endl;
        }
    }

    void get_slot_by_colour(int colour)
    {
        cout << "Slot number of Cars with " << colour << " are : ";
        for (auto itr = reg_by_color[colour].begin(); itr != reg_by_color[colour].end(); itr++)
        {
            cout << slot_by_reg[(*itr)] << " ";
        }
        cout << endl;
    }

    void leave_slot(Ticket ticket)
    {
        available_slots.insert(ticket.slot_number);
        reg_by_color[ticket.colour].erase(ticket.reg_number);
        slot_by_reg.erase(ticket.reg_number);
        cout << "Car with Reg. number " << ticket.reg_number << " left." << endl;
    }
};

int main()
{
    ParkingLot parking_lot(3);
    parking_lot.get_available_slots();

    Vehicle vehicle1(1, 123);
    Ticket ticket1 = parking_lot.take_slot(vehicle1);
    Vehicle vehicle2(1, 223);
    Ticket ticket2 = parking_lot.take_slot(vehicle2);
    parking_lot.get_available_slots();
    parking_lot.get_reg_by_colour(1);
    Vehicle vehicle3(2, 125);
    Vehicle vehicle4(2, 135);

    Ticket ticket3 = parking_lot.take_slot(vehicle3);
    Ticket ticket4 = parking_lot.take_slot(vehicle4);

    parking_lot.leave_slot(ticket1);
    ticket4 = parking_lot.take_slot(vehicle3);
    parking_lot.get_available_slots();

    return 0;
}
$colors: (
  purple: #6a0dad,
  blue: #3498db,
  green: #2ecc71
);

@each $key, $val in $colors {
  @debug 'Key: #{$key}, Value: #{$val}';
}


//preview in the terminal
import create from 'zustand';

const useRequestStore = create((set) => ({
  data: null,
  error: null,
  loading: true,
  abortController: null,  // Mantiene l'AbortController

  // Funzione per fare la richiesta
  fetchData: async (url) => {
    const controller = new AbortController();  // Crea un nuovo AbortController
    const signal = controller.signal;
    set({ loading: true, error: null, abortController: controller }); // Aggiorna lo stato con l'AbortController

    try {
      const response = await fetch(url, { signal });
      if (!response.ok) {
        throw new Error('Errore nella richiesta');
      }
      const result = await response.json();
      set({ data: result, loading: false });
    } catch (err) {
      if (err.name === 'AbortError') {
        console.log('Richiesta annullata');
      } else {
        set({ error: err.message, loading: false });
      }
    }
  },

  // Funzione per annullare la richiesta
  cancelRequest: () => {
    const state = get(); // Ottieni lo stato corrente
    if (state.abortController) {
      state.abortController.abort();  // Annulla la richiesta
      set({ loading: false, error: 'Richiesta annullata' });
    }
  },

  reset: () => set({ data: null, error: null, loading: true, abortController: null }),
}));

export default useRequestStore;






import React, { useEffect } from 'react';
import useRequestStore from './useRequestStore';

const DataFetchingComponent = () => {
  const { data, error, loading, fetchData, cancelRequest } = useRequestStore();

  useEffect(() => {
    fetchData('https://jsonplaceholder.typicode.com/posts');

    // Cleanup function: annulla la richiesta quando il componente si smonta
    return () => {
      cancelRequest();
    };
  }, [fetchData, cancelRequest]);

  if (loading) return <p>Caricamento in corso...</p>;
  if (error) return <p>Errore: {error}</p>;

  return (
    <div>
      <h2>Posts</h2>
      <ul>
        {data && data.map((post) => (
          <li key={post.id}>{post.title}</li>
        ))}
      </ul>
    </div>
  );
};

export default DataFetchingComponent;
$colors: (
  "primary": $primary,
  "secondary": $secondary,
  "error": $error,
  "info": $info,
  "blue": #1919e6,
  "red": #e61919,
  "yellow": #e6e619,
  "green": #19e635,
  "orange": #ffa600,
  "purple": #9900ff,
  "gray": #808080,
  "black": black,
  "white": white,
);



.card {
  display: block;
  padding: $base-padding;
  border: $base-border-thickness solid $light-grey;
  border-radius: $base-border-radius;
  box-shadow: $base-box-shadow;

  // Loop over all keys in the colors map and use them for background color variations
  @each $key, $val in $colors {
    &--bgcolor-#{$key} {
      background-color: $val;

        // Change text to white if the color is purple
    	// change the text to yellow if the color is red
    	// else leave it at black
      @if $key == "purple" {
        .card__body p {
          color: map-get($colors, "white" )
        }
      } @else if $key == "red"{
        .card__body p {
          color: map-get($colors, "yellow")
        }
      }@else {
        .card__body p {
          color: #000;
        }
      }
    }
  }

  &__title {
    h3 {
      font-size: $font-size-lg;
      padding-bottom: $base-padding;
      font-weight: bold;
    }
  }

  &__body {
    font-size: $base-font-size;

    a {
      text-decoration: underline;
    }
  }
}
// * color pallete creation
$colors: (
  "primary": $primary,
  "secondary": $secondary,
  "error": $error,
  "info": $info,
  "blue": #1919e6,
  "red": #e61919,
  "yellow": #e6e619,
  "green": #19e635,
  "orange": #ffa600,
  "purple": #9900ff,
  "gray": #808080,
  "black": black,
  "white": white,
);


// use this to get the data in the terminal
@debug map-get($colors);

//terminal prints
─> sass:map
1 │ @function get($map, $key, $keys...) {
  
  
 
 // Test a color with 
 @debug map-get($colors, "purple");
 // terminal prints: DEBUG: #9900ff
  
  
  // evaluation to true or false
	@debug map-has-key($colors, "firebrick"); //DEBUG: false
@extends('new_layouts.app')
@section('styles')
    <style>
        .custom-table {
            border-collapse: collapse;
            border-radius: 1rem;
            border-style: hidden;
            box-shadow: 0 0 0 1px #e6ebef;
            overflow: hidden;
            text-align: left;
            width: 100%;
        }

        .badge-file-extension {
            background-color: #f25961;
            color: white;
            padding: 0.25rem 0.5rem;
            font-size: 0.875rem;
            border-radius: 0.375rem;
            margin-left: 0.5rem;
        }

        .bookmark-active svg {
            fill: #FF9800;
        }

        .description-text {
            font-size: 1.1rem;
            color: #555;
            margin-top: 0.5rem;
        }

        .comment {
            margin-top: 1rem;
            margin-bottom: 1rem;
        }

        .comment-section {
            border: 1px solid #e9ebee;
            border-radius: 1rem;
            padding: 1.5rem;
            background-color: #ffffff;
            /* box-shadow: 0 0 1rem rgba(0, 0, 0, 0.1); */
        }

        .comment-header {
            border-bottom: 1px solid #e9ebee;
            padding-bottom: 0.75rem;
            margin-bottom: 1rem;
        }

        .comment-avatar {
            height: 48px;
            width: 48px;
            border-radius: 50%;
            margin-right: 1rem;
        }

        .comment-author {
            font-size: 1rem;
            font-weight: 600;
        }

        .comment-time {
            font-size: 0.875rem;
            color: #90949c;
        }

        .comment-body {
            margin: 0.75rem 0;
            font-size: 1rem;
        }

        .comment-actions a {
            font-size: 0.875rem;
            color: #4267b2;
            text-decoration: none;
            margin-right: 1rem;
        }

        .comment-actions i {
            margin-right: 0.5rem;
        }

        .reply-list {
            margin-top: 1rem;
            padding-left: 2rem;
        }

        .reply-list .comment {
            border-left: 1px dotted #d3d6db;
            padding-left: 1rem;
            margin-top: 1rem;
        }

        .reply-toggle {
            cursor: pointer;
            font-size: 0.875rem;
            color: #4267b2;
            text-decoration: none;
            margin-top: 1rem;
            display: block;
        }

        .reply-form {
            display: none;
            position: relative;
            z-index: 10;
        }

        .comment-input {
            border-radius: 0.5rem;
        }

        .like-button.active i {
            color: #4caf50;
        }

        .dislike-button.active i {
            color: #dc3545;
        }


        /* Dropdown Styles */
        .dropdown-toggle::after {
            display: none;
            /* Remove the default arrow */
        }

        .dropdown-menu {
            right: 0;
            left: auto;
        }
    </style>
@endsection
@section('content')
    <div>
        <div class="d-flex flex-column">
            <h1>Title: {{ $material->title }}</h1>
            @if ($material->description)
                <p class="description-text"><strong>Description:</strong> {{ $material->description }}</p>
            @endif
        </div>

        <div class="d-flex justify-content-end mb-4">
            <a class="btn rounded-3" style="background-color: #4CAF50; color: white"
                href="{{ route('materials.downloadAll', $material) }}">
                <i class="fas fa-download me-1"></i> Download All
            </a>
        </div>

        <div class="table-responsive">
            <table class="table table-striped custom-table">
                <thead>
                    <tr>
                        <th scope="col">Bookmarks</th>
                        <th scope="col">Document</th>
                        <th scope="col">Action</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($files as $file)
                        <tr>
                            <td>
                                @php
                                    $isBookmarked = $file->bookmarks()->where('user_id', Auth::id())->exists();
                                @endphp
                                <button type="button"
                                    class="btn btn-outline-dark bookmark-toggle {{ $isBookmarked ? 'bookmark-active' : '' }}"
                                    data-file-id="{{ $file->id }}">
                                    @if ($isBookmarked)
                                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                            fill="currentColor" class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
                                            <path
                                                d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5z" />
                                            <path
                                                d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1z" />
                                        </svg>
                                    @else
                                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                            fill="currentColor" class="bi bi-bookmarks" viewBox="0 0 16 16">
                                            <path
                                                d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5zm2-1a1 1 0 0 0-1 1v10.566l3.723-2.482a.5.5 0 0 1 .554 0L11 14.566V4a1 1 0 0 0-1-1z" />
                                            <path
                                                d="M4.268 1H12a1 1 0 0 1 1 1v11.768l.223.148A.5.5 0 0 0 14 13.5V2a2 2 0 0 0-2-2H6a2 2 0 0 0-1.732 1" />
                                        </svg>
                                    @endif
                                    <span class="visually-hidden">Button</span>
                                </button>
                            </td>
                            <td>
                                <div>
                                    @php
                                        $extension = pathinfo($file->name, PATHINFO_EXTENSION);
                                    @endphp
                                    <i class="fa-solid fa-file-lines" style="color: #0068b8; margin-right: 5px;"></i>
                                    <a href="{{ Storage::url($file->path) }}" target="_blank">
                                        {{ pathinfo($file->name, PATHINFO_FILENAME) }}
                                    </a>
                                    <span>
                                        <span class="badge badge-file-extension">
                                            {{ strtoupper($extension) }} File
                                        </span>
                                    </span>
                                </div>
                            </td>
                            <td>
                                <a class="btn btn-primary rounded-pill" href="{{ route('files.download', $file) }}">
                                    <i class="fas fa-download me-1"></i> Download
                                </a>
                            </td>

                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
    <div class="container">
        <div class="mt-4 comment-section">
            <h3>Comments ( {{ $comments->count() }} )</h3>
            <div class="comment-header d-flex justify-content-between align-items-center">
            </div>
            <div class="comment-body">
                <div class="d-flex mb-3">
                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar"
                        class="comment-avatar">
                    <div class="w-100">
                        <form id="comment-form" action="{{ route('comments.store', $material) }}" method="POST">
                            @csrf
                            <div class="d-flex flex-column">
                                <textarea name="content" class="form-control comment-input" placeholder="Write a comment..." rows="3"></textarea>
                                <div class="d-flex justify-content-between mt-2">
                                    <div id="comment-form-error" class="text-danger"></div>
                                    <button type="submit" class="btn btn-primary">Post Comment</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div id="comment-list" class="comment-list">
                    @foreach ($comments as $comment)
                        <div class="comment" data-comment-id="{{ $comment->id }}">
                            <div class="d-flex">
                                <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar"
                                    class="comment-avatar">
                                <div class="w-100">
                                    <div class="d-flex justify-content-between align-items-start">
                                        <div>
                                            <div class="comment-author">{{ $comment->user->name }}</div>
                                            <div class="comment-time">{{ $comment->created_at->diffForHumans() }}</div>
                                        </div>
                                        @if ($comment->user_id === auth()->id())
                                            <div class="dropdown">
                                                <button class="btn btn-link dropdown-toggle" type="button"
                                                    id="dropdownMenuButton{{ $comment->id }}" data-bs-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <i class="fa-solid fa-ellipsis-vertical"></i>
                                                </button>
                                                <ul class="dropdown-menu"
                                                    aria-labelledby="dropdownMenuButton{{ $comment->id }}">
                                                    <li><a class="dropdown-item" href="#" data-action="edit"
                                                            data-comment-id="{{ $comment->id }}">Edit</a></li>
                                                    <li><a class="dropdown-item text-danger" href="#"
                                                            data-action="delete"
                                                            data-comment-id="{{ $comment->id }}">Delete</a></li>
                                                </ul>
                                            </div>
                                        @endif
                                    </div>
                                    <div class="comment-body">{{ $comment->content }}</div>
                                    <div class="comment-actions">
                                        <a href="#"
                                            class="like-button {{ $comment->likes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                            data-action="like" data-comment-id="{{ $comment->id }}">
                                            <i class="fa-solid fa-thumbs-up"></i>
                                            <span class="like-dislike-count">{{ $comment->likes }}</span>
                                        </a>
                                        <a href="#"
                                            class="dislike-button {{ $comment->dislikes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                            data-action="dislike" data-comment-id="{{ $comment->id }}">
                                            <i class="fa-solid fa-thumbs-down"></i>
                                            <span class="like-dislike-count">{{ $comment->dislikes }}</span>
                                        </a>
                                        <a href="#" class="reply-link" data-comment-id="{{ $comment->id }}"
                                            data-author="{{ $comment->user->name }}">
                                            <i class="fa-solid fa-reply"></i> Reply
                                        </a>
                                    </div>
                                    <div class="reply-toggle" onclick="toggleReplies(this)">View replies</div>

                                    <form class="reply-form" action="{{ route('replies.store', $comment) }}"
                                        method="POST">
                                        @csrf
                                        <div class="d-flex flex-column">
                                            <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                            <div class="d-flex justify-content-between mt-2">
                                                <div id="comment-form-error" class="text-danger" style="display: none;">
                                                    Error: Reply cannot be empty
                                                </div>
                                                <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                            </div>
                                        </div>

                                    </form>
                                    <div class="reply-list" style="display: none;">
                                        @foreach ($comment->replies as $reply)
                                            <div class="comment reply" data-comment-id="{{ $reply->id }}">
                                                <div class="d-flex">
                                                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg"
                                                        alt="avatar" class="comment-avatar">
                                                    <div class="w-100">
                                                        <div class="d-flex justify-content-between align-items-start">
                                                            <div>
                                                                <div class="comment-author">{{ $reply->user->name }}</div>
                                                                <div class="comment-time">
                                                                    {{ $reply->created_at->diffForHumans() }}</div>
                                                            </div>
                                                            @if ($reply->user_id === auth()->id())
                                                                <div class="dropdown">
                                                                    <button class="btn btn-link dropdown-toggle"
                                                                        type="button"
                                                                        id="dropdownMenuButton{{ $reply->id }}"
                                                                        data-bs-toggle="dropdown" aria-expanded="false">
                                                                        <i class="fa-solid fa-ellipsis-vertical"></i>
                                                                    </button>
                                                                    <ul class="dropdown-menu"
                                                                        aria-labelledby="dropdownMenuButton{{ $reply->id }}">
                                                                        <li><a class="dropdown-item" href="#"
                                                                                data-action="edit"
                                                                                data-comment-id="{{ $reply->id }}">Edit</a>
                                                                        </li>
                                                                        <li><a class="dropdown-item text-danger"
                                                                                href="#" data-action="delete"
                                                                                data-comment-id="{{ $reply->id }}">Delete</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            @endif
                                                        </div>
                                                        <div class="comment-body">
                                                            @if ($reply->parent)
                                                                <a href="#"
                                                                    class="reply-mention">{{ '@' . $reply->parent->user->name }}</a>
                                                            @endif
                                                            <span class="reply-content">{{ $reply->content }}</span>
                                                        </div>
                                                        <div class="comment-actions">
                                                            <a href="#"
                                                                class="like-button {{ $reply->likes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                                                data-action="like" data-comment-id="{{ $reply->id }}">
                                                                <i class="fa-solid fa-thumbs-up"></i>
                                                                <span
                                                                    class="like-dislike-count">{{ $reply->likes }}</span>
                                                            </a>
                                                            <a href="#"
                                                                class="dislike-button {{ $reply->dislikes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                                                data-action="dislike"
                                                                data-comment-id="{{ $reply->id }}">
                                                                <i class="fa-solid fa-thumbs-down"></i>
                                                                <span
                                                                    class="like-dislike-count">{{ $reply->dislikes }}</span>
                                                            </a>
                                                            <a href="#" class="reply-link"
                                                                data-comment-id="{{ $reply->id }}"
                                                                data-author="{{ $reply->user->name }}">
                                                                <i class="fa-solid fa-reply"></i> Reply
                                                            </a>
                                                        </div>
                                                        <form class="reply-form"
                                                            action="{{ route('replies.store', $reply) }}" method="POST">
                                                            @csrf
                                                            <div class="d-flex flex-column">
                                                                <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                                <div class="d-flex justify-content-between mt-2">
                                                                    <div id="comment-form-error" class="text-danger"
                                                                        style="display: none;">
                                                                        Error: Reply cannot be empty
                                                                    </div>
                                                                    <button type="submit"
                                                                        class="btn btn-primary ms-auto">Post Reply</button>
                                                                </div>
                                                            </div>

                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                            @include('materials.comment', ['replies' => $reply->replies])
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    </div>

    <!-- Modal for delete confirmation -->
    <div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-body text-center">
                    <div class="mb-3">
                        <i class="fa-solid fa-triangle-exclamation modal-icon"></i>
                    </div>
                    <h5 class="modal-title" id="deleteModalLabel">Delete Comment</h5>
                    <p>Are you sure you want to delete this comment?</p>
                </div>
                <div class="modal-footer d-flex justify-content-center">
                    <button type="button" class="btn btn-danger ms-2" id="confirmDelete">Delete</button>
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const commentList = document.getElementById('comment-list');

            // Handle edit button click
            commentList.addEventListener('click', function(event) {
                const button = event.target.closest('a[data-action="edit"]');
                if (button) {
                    event.preventDefault();
                    const commentId = button.getAttribute('data-comment-id');
                    const commentElement = document.querySelector(
                        `.comment[data-comment-id="${commentId}"]`);
                    const commentBodyElement = commentElement.querySelector('.comment-body');

                    // Extract mention and content
                    const mentionElement = commentBodyElement.querySelector('.reply-mention');
                    const mention = mentionElement ? mentionElement.innerText.trim() : '';
                    const contentElement = mentionElement ? mentionElement.nextElementSibling :
                        commentBodyElement;
                    const content = contentElement.innerText.trim();

                    // Store original content for cancel action
                    commentBodyElement.dataset.originalContent = commentBodyElement.innerHTML;

                    const editForm = `
                <form class="edit-comment-form" data-comment-id="${commentId}">
                    ${mention ? `<span class="reply-mention">${mention}</span>` : ''}
                    <textarea class="form-control">${content}</textarea>
                    <button type="submit" class="btn btn-primary mt-2">Save</button>
                    <button type="button" class="btn btn-secondary mt-2 cancel-edit">Cancel</button>
                </form>
            `;

                    commentBodyElement.innerHTML = editForm;
                    attachEditFormListeners(commentId);
                }
            });

            function attachEditFormListeners(commentId) {
                const editForm = document.querySelector(`.edit-comment-form[data-comment-id="${commentId}"]`);

                editForm.addEventListener('submit', function(e) {
                    e.preventDefault();
                    const textarea = this.querySelector('textarea');
                    const content = textarea.value;
                    const mention = this.querySelector('.reply-mention') ? this.querySelector(
                        '.reply-mention').innerText.trim() : '';

                    fetch(`/comments/${commentId}`, {
                            method: 'PUT',
                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content')
                            },
                            body: JSON.stringify({
                                content
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const commentBodyElement = document.querySelector(
                                    `.comment[data-comment-id="${commentId}"] .comment-body`);
                                const mentionElement = mention ?
                                    `<a href="#" class="reply-mention">${mention}</a>` : '';
                                commentBodyElement.innerHTML =
                                    `${mentionElement} <span class="reply-content">${data.content}</span>`;
                            } else {
                                alert('Error updating comment.');
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                        });
                });

                editForm.querySelector('.cancel-edit').addEventListener('click', function() {
                    const originalContent = document.querySelector(
                            `.comment[data-comment-id="${commentId}"] .comment-body`).dataset
                        .originalContent;
                    document.querySelector(`.comment[data-comment-id="${commentId}"] .comment-body`)
                        .innerHTML = originalContent;
                });
            }
        });
    </script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {

            // for delete 
            let commentIdToDelete = null;

            document.getElementById('comment-list').addEventListener('click', function(event) {
                const button = event.target.closest('a[data-action="delete"]');
                if (button) {
                    event.preventDefault();
                    commentIdToDelete = button.getAttribute('data-comment-id');

                    // Show the delete confirmation modal
                    const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
                    deleteModal.show();
                }
            });

            document.getElementById('confirmDelete').addEventListener('click', function() {
                if (commentIdToDelete) {
                    fetch(`/comments/${commentIdToDelete}`, {
                            method: 'DELETE',
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content'),
                                'Content-Type': 'application/json',
                            }
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const commentElement = document.querySelector(
                                    `.comment[data-comment-id="${commentIdToDelete}"]`);
                                if (commentElement) {
                                    commentElement.remove();
                                }
                            } else {
                                alert('Error: Comment deleted because parent removed');
                            }
                        })
                        .catch(error => {
                            // console.error('Error:', error);
                            // alert('Something went wrong');
                        });

                    const deleteModal = bootstrap.Modal.getInstance(document.getElementById('deleteModal'));
                    deleteModal.hide();
                }
            });

            // for like and dislike
            document.getElementById('comment-list').addEventListener('click', function(event) {
                const button = event.target.closest('a');
                if (button && (button.classList.contains('like-button') || button.classList.contains(
                        'dislike-button'))) {
                    event.preventDefault();

                    const commentId = button.getAttribute('data-comment-id');
                    const action = button.getAttribute('data-action');

                    fetch(`/comments/${commentId}/${action}`, {
                            method: 'POST',
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content'),
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify({
                                _method: 'POST'
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const commentElement = document.querySelector(
                                    `.comment[data-comment-id="${commentId}"]`);
                                const likeCount = commentElement.querySelector(
                                    '.like-button .like-dislike-count');
                                const dislikeCount = commentElement.querySelector(
                                    '.dislike-button .like-dislike-count');

                                likeCount.textContent = data.comment.likes;
                                dislikeCount.textContent = data.comment.dislikes;

                                if (action === 'like') {
                                    button.classList.toggle('active');
                                    commentElement.querySelector('.dislike-button').classList.remove(
                                        'active');
                                } else {
                                    button.classList.toggle('active');
                                    commentElement.querySelector('.like-button').classList.remove(
                                        'active');
                                }
                            } else {
                                alert(data.message || 'Error updating like/dislike');
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                            alert('Something went wrong');
                        });
                }
            });

            // For submission of the main comment form
            document.getElementById('comment-form')?.addEventListener('submit', function(event) {
                event.preventDefault();
                const formData = new FormData(this);
                const errorDiv = document.getElementById('comment-form-error');
                errorDiv.textContent = ''; // Clear previous errors

                fetch(this.action, {
                        method: 'POST',
                        body: formData,
                        headers: {
                            'X-Requested-With': 'XMLHttpRequest',
                            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                .getAttribute('content')
                        }
                    })
                    .then(response => response.json())
                    .then(data => {
                        if (data.success) {
                            const commentList = document.getElementById('comment-list');
                            if (commentList) {
                                const newCommentHtml = `
                            <div class="comment" data-comment-id="${data.comment.id}">
                                <div class="d-flex">
                                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar" class="comment-avatar">
                                    <div class="w-100">
                                        <div class="d-flex justify-content-between align-items-start">
                                            <div>
                                                <div class="comment-author">${data.comment.user_name}</div>
                                                <div class="comment-time">${data.comment.created_at}</div>
                                            </div>
                                            <div class="dropdown">
                                                <button class="btn btn-link dropdown-toggle" type="button"
                                                    id="dropdownMenuButton${data.comment.id}" data-bs-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <i class="fa-solid fa-ellipsis-vertical"></i>
                                                </button>
                                                <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton${data.comment.id}">
                                                    <li><a class="dropdown-item" href="#" data-action="edit" data-comment-id="${data.comment.id}">Edit</a></li>
                                                    <li><a class="dropdown-item text-danger" href="#" data-action="delete" data-comment-id="${data.comment.id}">Delete</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="comment-body">${data.comment.content}</div>
                                        <div class="comment-actions">
                                            <a href="#" class="like-button" data-action="like" data-comment-id="${data.comment.id}">
                                                <i class="fa-solid fa-thumbs-up"></i>
                                                <span class="like-dislike-count">0</span>
                                            </a>
                                            <a href="#" class="dislike-button" data-action="dislike" data-comment-id="${data.comment.id}">
                                                <i class="fa-solid fa-thumbs-down"></i>
                                                <span class="like-dislike-count">0</span>
                                            </a>
                                            <a href="#" class="reply-link" data-comment-id="${data.comment.id}" data-author="${data.comment.user_name}">
                                                <i class="fa-solid fa-reply"></i> Reply
                                            </a>
                                        </div>
                                        <div class="reply-toggle" onclick="toggleReplies(this)">View replies</div>
                                        <form class="reply-form" action="{{ route('replies.store', ':commentId') }}" method="POST" style="display: none;">
                                            @csrf
                                            <div class="d-flex flex-column">
                                                <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                <div class="d-flex justify-content-between  mt-2">
                                                    <div id="comment-form-error" class="text-danger" style="display: none;">
                                                        Error: Reply cannot be empty
                                                    </div>
                                                    <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                                </div>
                                            </div>
                                        </form>
                                        <div class="reply-list" style="display: none;"></div>
                                    </div>
                                </div>
                            </div>
                        `.replace(':commentId', data.comment.id);

                                commentList.insertAdjacentHTML('afterbegin', newCommentHtml);
                                this.reset();
                                initializeDropdowns();
                            }
                        } else {
                            // Display error messages
                            errorDiv.textContent = data.error || 'Your comment is empty';
                        }
                    })
                    .catch(error => {
                        console.error('Error:', error);
                        errorDiv.textContent = 'Something went wrong';
                    });
            });

            // For submission of reply forms
            document.getElementById('comment-list')?.addEventListener('submit', function(event) {
                if (event.target.closest('.reply-form')) {
                    event.preventDefault();
                    const form = event.target;
                    const formData = new FormData(form);
                    const parentId = form.closest('.comment').dataset.commentId;
                    const errorDiv = form.querySelector('#comment-form-error');

                    // Reset error display
                    errorDiv.style.display = 'none';
                    errorDiv.textContent = '';

                    fetch(form.action.replace(':commentId', parentId), {
                            method: 'POST',
                            body: formData,
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content')
                            }
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const replyList = form.closest('.reply-list') || form.closest(
                                    '.comment').querySelector('.reply-list');
                                if (replyList) {
                                    const newReplyHtml = `
                                <div class="comment reply" data-comment-id="${data.reply.id}">
                                    <div class="d-flex">
                                        <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar" class="comment-avatar">
                                        <div class="w-100">
                                            <div class="d-flex justify-content-between align-items-start">
                                                <div>
                                                    <div class="comment-author">${data.reply.user_name}</div>
                                                    <div class="comment-time">${data.reply.created_at}</div>
                                                </div>
                                                <div class="dropdown">
                                                    <button class="btn btn-link dropdown-toggle" type="button" id="dropdownMenuButton${data.reply.id}" data-bs-toggle="dropdown" aria-expanded="false">
                                                        <i class="fa-solid fa-ellipsis-vertical"></i>
                                                    </button>
                                                    <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton${data.reply.id}">
                                                        <li><a class="dropdown-item" href="#" data-action="edit" data-comment-id="${data.reply.id}">Edit</a></li>
                                                        <li><a class="dropdown-item text-danger" href="#" data-action="delete" data-comment-id="${data.reply.id}">Delete</a></li>
                                                    </ul>
                                                </div>
                                            </div>
                                            <div class="comment-body">
                                                ${data.reply.parent_name ? `<a href="#" class="reply-mention">@${data.reply.parent_name}</a> ` : ''}
                                                <span class="reply-content">${data.reply.content}</span>
                                            </div>
                                            <div class="comment-actions">
                                                <a href="#" class="like-button" data-action="like" data-comment-id="${data.reply.id}">
                                                    <i class="fa-solid fa-thumbs-up"></i>
                                                    <span class="like-dislike-count">0</span>
                                                </a>
                                                <a href="#" class="dislike-button" data-action="dislike" data-comment-id="${data.reply.id}">
                                                    <i class="fa-solid fa-thumbs-down"></i>
                                                    <span class="like-dislike-count">0</span>
                                                </a>
                                                <a href="#" class="reply-link" data-comment-id="${data.reply.id}" data-author="${data.reply.user_name}">
                                                    <i class="fa-solid fa-reply"></i> Reply
                                                </a>
                                            </div>
                                            <form class="reply-form" action="{{ route('replies.store', ':commentId') }}" method="POST" style="display: none;">
                                                @csrf
                                                    <div class="d-flex flex-column">
                                                        <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                        <div class="d-flex justify-content-between  mt-2">
                                                            <div id="comment-form-error" class="text-danger" style="display: none;">
                                                                Error: Reply cannot be empty
                                                            </div>
                                                            <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                                        </div>
                                                    </div>
                                            </form>
                                            <div class="reply-list" style="display: none;"></div>
                                        </div>
                                    </div>
                                </div>
                                `.replace(':commentId', data.reply.id);

                                    replyList.insertAdjacentHTML('beforeend', newReplyHtml);
                                    form.reset();
                                    form.style.display =
                                        'none'; // Hide the reply form after successful submission

                                    // Ensure the replies are displayed
                                    const replyToggle = form.closest('.comment').querySelector(
                                        '.reply-toggle');
                                    if (replyToggle) {
                                        const replyList = replyToggle.nextElementSibling
                                            .nextElementSibling;
                                        replyList.style.display = 'block';
                                        replyToggle.textContent = 'Hide replies';
                                    }

                                    initializeDropdowns();
                                }
                            } else {
                                // Display error message
                                errorDiv.textContent = data.message || 'Error posting reply';
                                errorDiv.style.display = 'block';
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                            // Display error message
                            errorDiv.textContent = 'Something went wrong';
                            errorDiv.style.display = 'block';
                        });
                }
            });

            // For reply link click to show reply form
            document.getElementById('comment-list')?.addEventListener('click', function(event) {
                if (event.target.closest('.reply-link')) {
                    event.preventDefault();
                    const replyForm = event.target.closest('.comment').querySelector('.reply-form');
                    if (replyForm) {
                        replyForm.style.display = replyForm.style.display === 'block' ? 'none' : 'block';
                    }
                }
            });
        });

        function initializeDropdowns() {
            const dropdowns = document.querySelectorAll('.dropdown-toggle:not(.initialized)');
            dropdowns.forEach(dropdown => {
                new bootstrap.Dropdown(dropdown);
                dropdown.classList.add('initialized');
            });
        }

        function toggleReplies(element) {
            const replyList = element.nextElementSibling.nextElementSibling;
            const isVisible = replyList.style.display === 'block';
            replyList.style.display = isVisible ? 'none' : 'block';
            element.textContent = isVisible ? 'View replies' : 'Hide replies';
        }
    </script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('.bookmark-toggle').forEach(function(button) {
                button.addEventListener('click', function() {
                    const fileId = this.getAttribute('data-file-id');
                    const button = this;

                    fetch("{{ route('bookmark.toggle') }}", {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': '{{ csrf_token() }}'
                            },
                            body: JSON.stringify({
                                file_id: fileId
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.status === 'added') {
                                button.classList.add('bookmark-active');
                                button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                        class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
                                        <path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5z"/>
                                        <path d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1z"/>
                                    </svg>`;
                            } else if (data.status === 'removed') {
                                button.classList.remove('bookmark-active');
                                button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                        class="bi bi-bookmarks" viewBox="0 0 16 16">
                                        <path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5zm2-1a1 1 0 0 0-1 1v10.566l3.723-2.482a.5.5 0 0 1 .554 0L11 14.566V4a1 1 0 0 0-1-1z"/>
                                        <path d="M4.268 1H12a1 1 0 0 1 1 1v11.768l.223.148A.5.5 0 0 0 14 13.5V2a2 2 0 0 0-2-2H6a2 2 0 0 0-1.732 1"/>
                                    </svg>`;
                            }
                        })
                        .catch(error => console.error('Error:', error));
                });
            });
        });
    </script>
@endsection
def uploadData(sheet, email, sheet_name):
    if sheet_name == "2.BaseData":
        data = []
        headers = [cell.value for cell in sheet[1]]

        for row in sheet.iter_rows(min_row=2):
            row_data = {
                headers[i]: cell.value
                for i, cell in enumerate(row)
                if cell.value is not None
            }
            if row_data:  # Only append if row_data is not empty
                row_data = trim_dict_spaces(row_data)
                data.append(row_data)

        print(data)

        # If socio_econ_vulnerability_collection expects each row to be uploaded individually

        for row in data:
            socio_econ_vulnerability_collection.add(row)

        return data
//////////////////SIMPLE/////////////


function create_posttype() {

register_post_type( 'movies',
// CPT Options
array(
'labels' => array(
'name' => __( 'Movies' ),
'singular_name' => __( 'Movie' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'movies'),
'show_in_rest' => true,

)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );






/////////////////////////Complex Custom/////////////////////////


/*
* Creating a function to create our CPT
*/
  
function custom_post_type() {
  
// Set UI labels for Custom Post Type
    $labels = array(
        'name'                => _x( 'Movies', 'Post Type General Name', 'twentytwentyone' ),
        'singular_name'       => _x( 'Movie', 'Post Type Singular Name', 'twentytwentyone' ),
        'menu_name'           => __( 'Movies', 'twentytwentyone' ),
        'parent_item_colon'   => __( 'Parent Movie', 'twentytwentyone' ),
        'all_items'           => __( 'All Movies', 'twentytwentyone' ),
        'view_item'           => __( 'View Movie', 'twentytwentyone' ),
        'add_new_item'        => __( 'Add New Movie', 'twentytwentyone' ),
        'add_new'             => __( 'Add New', 'twentytwentyone' ),
        'edit_item'           => __( 'Edit Movie', 'twentytwentyone' ),
        'update_item'         => __( 'Update Movie', 'twentytwentyone' ),
        'search_items'        => __( 'Search Movie', 'twentytwentyone' ),
        'not_found'           => __( 'Not Found', 'twentytwentyone' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'twentytwentyone' ),
    );
      
// Set other options for Custom Post Type
      
    $args = array(
        'label'               => __( 'movies', 'twentytwentyone' ),
        'description'         => __( 'Movie news and reviews', 'twentytwentyone' ),
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
        // You can associate this CPT with a taxonomy or custom taxonomy. 
        'taxonomies'          => array( 'genres' ),
        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        */
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
        'show_in_rest' => true,
  
    );
      
    // Registering your Custom Post Type
    register_post_type( 'movies', $args );
  
}
  
/* Hook into the 'init' action so that the function
* Containing our post type registration is not 
* unnecessarily executed. 
*/
  
add_action( 'init', 'custom_post_type', 0 );
1. Find the product id and unit list price of products belonging to the 'Yoghurt' category.


SELECT 
	product_id, 
	unit_list_price
FROM 
	products
WHERE 
	product_category = 'yoghurt';

-----------
  
2. Find all the information (i.e., all columns) of the managers with null values in their first name.

SELECT 
   	*
FROM
	managers
WHERE
	first_name IS NULL;

-----------
  
3. Find the sales ID and sales date where quantity sold on that date is greater than or equal to 2100.

SELECT 
	sales_id, 
	sales_date, 
	quantity_sold
FROM
	sales
WHERE
	quantity_sold >= 2100;

-----------

4. Find the manager ID and the sum of quantity sold  for all products (except those with ID 7001001) for each of the managers in the sales table and sort the output by manager ID in descending order.

SELECT 
	sales_manager_id,
	SUM(quantity_sold) AS quant_sold
FROM
	sales
WHERE
	product_id <> 7001001
GROUP BY  
	sales_manager_id
ORDER BY
	sales_manager_id DESC;

-----------

5. Find the product ID, product name, and unit production cost of the products with maximum unit production cost below $1.10 and sort the output by production cost in ascending order (HINT: Use HAVING).

SELECT 
    product_id,
    product_name,
    MAX(unit_production_cost) AS unit_production_cost
FROM
    products
GROUP BY 1 , 2
HAVING 
	MAX(unit_production_cost) < 1.10
ORDER BY 
	unit_production_cost DESC;


SELECT 
    product_id,
    product_name,
	unit_production_cost
FROM
    products
WHERE 
	unit_production_cost < 1.10
ORDER BY 
	unit_production_cost DESC;

-----------

6. Find the product ID and sales date with the highest quantity sold from sales transacted after 30 Oct 2021 (exclusive) except for products with IDs 7001001 and 7001002.


SELECT 
    product_id, 
	sales_date, 
	quantity_sold
FROM
    sales
WHERE
    sales_date > '2021-10-30'
    AND 
	product_id NOT IN (7001001 , 7001002)
ORDER BY 
	quantity_sold desc
LIMIT 1;



SELECT 
    product_id, 
	sales_date, 
	quantity_sold
FROM
    sales
WHERE
    sales_date > '2021-10-30';
'Find the listNum of a Custom List based on all items
Dim listNumFound As Integer
listNumFound = Application.GetCustomListNum(Array("Element1", "Element2", "Element3"))


'Find a Custom List which contains a specific element 
Dim i As Integer
Dim arrayItem As Variant
Dim customListContents() As Variant
Dim listNumFound As Integer

For i = 1 To Application.CustomListCount

    'Set the CustomList array to a variable
    customListContents = Application.GetCustomListContents(i)

    'Loop through each element in the CustomList
    For Each arrayItem In customListContents

        'Test if the element has a specific value
        If arrayItem = "Element1" Then listNumFound=i

    Next arrayItem

Next i
'Add a new Custom List
Application.AddCustomList ListArray:=Array("Element1", "Element2", "Element3")

'Add a new Custom List from range of cells
Application.AddCustomList ListArray:=Range("Sheet1!A1:A3")
#include <iostream>
#include <vector>
#include <queue>
#include <utility> // cho std::pair
using namespace std;

void D(int N, vector<vector<pair<int, int>>> &adj, int source) {
    vector<int> dist(N, 1000000); // Khởi tạo khoảng cách đến tất cả các đỉnh là vô cùng
    dist[source] = 0; // Khoảng cách từ đỉnh nguồn đến chính nó là 0

    // Hàng đợi ưu tiên với hàm so sánh
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int> > > pq;
    pq.push(make_pair(0, source));

    while (!pq.empty()) { // Trong khi hàng đợi không rỗng
        int u = pq.top().second; // Lấy đỉnh có khoảng cách nhỏ nhất
        int d = pq.top().first;   // Khoảng cách từ nguồn đến đỉnh u
        pq.pop();

        // Duyệt các đỉnh kề của đỉnh u
        for (int i = 0; i < adj[u].size(); i++) {
            int v = adj[u][i].first;     // Đỉnh kề
            int weight = adj[u][i].second; // Trọng số của cạnh

            // Nếu tìm được đường đi ngắn hơn đến đỉnh v
            if (dist[v] > dist[u] + weight) {
                dist[v] = dist[u] + weight;
                pq.push(make_pair(dist[v], v)); // Đẩy khoảng cách mới vào hàng đợi
            }
        }
    }

    // In ra kết quả khoảng cách từ đỉnh nguồn đến tất cả các đỉnh khác
    for (int i = 0; i < N; i++) {
        cout << "Khoảng cách từ " << source << " đến " << i << " là " << dist[i] << endl;
    }
}

int main() {
    int N, M; // Số đỉnh, số cạnh
    cin >> N >> M;
    
    vector<vector<pair<int, int> > > adj(N); // Mảng vector để lưu đồ thị
    for (int i = 0; i < M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        adj[a].push_back(make_pair(b, c)); // Đồ thị có hướng
        adj[b].push_back(make_pair(a, c)); // Nếu đồ thị là vô hướng
    }

    int source;
    cin >> source;
    D(N, adj, source);

    return 0;
}
import pandas as pd
import ta  # For technical indicators
import tensorflow as tf
from stable_baselines3 import PPO  # Deep Reinforcement Learning Model
import asyncio  # For asynchronous operations
import aiohttp  # For asynchronous HTTP requests
from transformers import pipeline  # Huggingface for news sentiment
from datetime import datetime, timedelta
import numpy as np
from sklearn.preprocessing import MinMaxScaler
import gym
import MetaTrader5 as mt5  # Assuming MetaTrader5 is imported

# Replace with your login details
account = 165142091      # Your account number
password = "pec100demo@xm"
server = "XMGlobal-MT5 2"

# Initialize MT5 connection
if not mt5.initialize(login=account, password=password, server=server):
    print("Failed to initialize MT5, error:", mt5.last_error())
    quit()
else:
    print("Logged in successfully!")
    account_info = mt5.account_info()
    if account_info is None:
        print("Failed to get account info, error:", mt5.last_error())
    else:
        print(account_info)

# Async function to fetch OHLC data for a symbol
async def fetch_data(symbol, timeframe, count=1000):
    loop = asyncio.get_event_loop()
    rates = await loop.run_in_executor(None, lambda: mt5.copy_rates_from_pos(symbol, timeframe, 0, count))
    data = pd.DataFrame(rates)
    data['time'] = pd.to_datetime(data['time'], unit='s')
    data.set_index('time', inplace=True)

    # Calculate technical indicators
    data['EMA_50'] = ta.trend.ema_indicator(data['close'], window=50)
    data['SMA_100'] = ta.trend.sma_indicator(data['close'], window=100)
    data['RSI'] = ta.momentum.rsi(data['close'], window=14)
    data['MACD'] = ta.trend.macd(data['close'])
    data['SuperTrend'] = ta.volatility.AverageTrueRange(high=data['high'], low=data['low'], close=data['close']).average_true_range()
    data['AwesomeOscillator'] = ta.momentum.awesome_oscillator(data['high'], data['low'])

    return data

# Async function to fetch news
async def fetch_news(symbol):
    api_url = f"https://newsapi.org/v2/everything?q={symbol}&apiKey=YOUR_API_KEY"
    async with aiohttp.ClientSession() as session:
        async with session.get(api_url) as response:
            news_data = await response.json()
            return news_data['articles']

# Analyze the sentiment of news
def analyze_news(articles):
    sentiment_pipeline = pipeline('sentiment-analysis')
    sentiment_scores = []
    for article in articles:
        sentiment = sentiment_pipeline(article['description'])[0]
        sentiment_scores.append(sentiment['score'] if sentiment['label'] == 'POSITIVE' else -sentiment['score'])
    return np.mean(sentiment_scores)

# Asynchronously process news for multiple assets
async def process_news_for_assets(symbols):
    news_sentiments = {}
    for symbol in symbols:
        articles = await fetch_news(symbol)
        news_sentiments[symbol] = analyze_news(articles)
    return news_sentiments

# Fetch and process data for multiple assets asynchronously
async def fetch_all_data(symbols, timeframe):
    tasks = [fetch_data(symbol, timeframe) for symbol in symbols]
    results = await asyncio.gather(*tasks)
    return dict(zip(symbols, results))

# Class representing the trading environment for Reinforcement Learning
class TradingEnv(gym.Env):
    def __init__(self, data, news_sentiment, target_profit, time_limit):
        super(TradingEnv, self).__init__()
        self.data = data
        self.news_sentiment = news_sentiment  # News sentiment incorporated into the state
        self.current_step = 0
        self.initial_balance = 10000
        self.balance = self.initial_balance
        self.positions = []
        self.done = False
        self.target_profit = target_profit  # Desired profit to achieve
        self.start_time = datetime.now()
        self.time_limit = timedelta(minutes=time_limit)  # Time frame to reach the target profit

        # Define action and observation space
        self.action_space = gym.spaces.Discrete(3)  # 0 = Hold, 1 = Buy, 2 = Sell
        self.observation_space = gym.spaces.Box(low=-1, high=1, shape=(len(self.data.columns) + 1,), dtype=np.float16)

    def reset(self):
        self.balance = self.initial_balance
        self.positions = []
        self.current_step = 0
        self.start_time = datetime.now()
        return self._next_observation()

    def _next_observation(self):
        obs = self.data.iloc[self.current_step].values
        obs = np.append(obs, self.news_sentiment)  # Add sentiment as part of the observation
        scaler = MinMaxScaler()
        obs = scaler.fit_transform([obs])[0]
        return obs

    def step(self, action):
        reward = 0
        self.current_step += 1
        current_price = self.data['close'].iloc[self.current_step]

        if action == 1:  # Buy
            self.positions.append(current_price)
        elif action == 2:  # Sell
            if len(self.positions) > 0:
                bought_price = self.positions.pop(0)
                profit = current_price - bought_price
                reward += profit
                self.balance += profit

        # Add trailing stop-loss and take-profit logic here
        # Example: Adjust TP based on current price
        trailing_distance = 50
        if len(self.positions) > 0:
            bought_price = self.positions[0]
            new_tp = current_price - trailing_distance * 0.0001
            if new_tp > bought_price + trailing_distance * 0.0001:
                # Adjust TP logic
                pass

        # Check if target profit or time limit is reached
        if self.balance - self.initial_balance >= self.target_profit:
            self.done = True
            print(f"Target profit reached: {self.balance - self.initial_balance}")
        elif datetime.now() - self.start_time > self.time_limit:
            self.done = True
            print(f"Time limit reached: Balance = {self.balance}")

        return self._next_observation(), reward, self.done, {}

# Initialize environment and PPO model
async def main():
    symbols = ['EURUSD', 'BTCUSD']
    timeframe = mt5.TIMEFRAME_H1
    target_profit = 500  # User-defined target profit
    time_limit = 60  # Time limit in minutes

    # Fetch data and news asynchronously
    asset_data = await fetch_all_data(symbols, timeframe)
    news_sentiment = await process_news_for_assets(symbols)

    # Initialize trading environment
    env = TradingEnv(asset_data['EURUSD'], news_sentiment['EURUSD'], target_profit, time_limit)

    # Initialize PPO model
    model = PPO('MlpPolicy', env, verbose=1)
    model.learn(total_timesteps=10000)

# Run the async main function
asyncio.run(main())
---
__Advertisement :)__

- __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image
  resize in browser.
- __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly
  i18n with plurals support and easy syntax.

You will like those projects!

---

# h1 Heading 8-)
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading


## Horizontal Rules

___

---

***


## Typographic replacements

Enable typographer option to see result.

(c) (C) (r) (R) (tm) (TM) (p) (P) +-

test.. test... test..... test?..... test!....

!!!!!! ???? ,,  -- ---

"Smartypants, double quotes" and 'single quotes'


## Emphasis

**This is bold text**

__This is bold text__

*This is italic text*

_This is italic text_

~~Strikethrough~~


## Blockquotes


> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.


## Lists

Unordered

+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
  - Marker character change forces new list start:
    * Ac tristique libero volutpat at
    + Facilisis in pretium nisl aliquet
    - Nulla volutpat aliquam velit
+ Very easy!

Ordered

1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa


1. You can use sequential numbers...
1. ...or keep all the numbers as `1.`

Start numbering with offset:

57. foo
1. bar


## Code

Inline `code`

Indented code

    // Some comments
    line 1 of code
    line 2 of code
    line 3 of code


Block code "fences"

```
Sample text here...
```

Syntax highlighting

``` js
var foo = function (bar) {
  return bar++;
};

console.log(foo(5));
```

## Tables

| Option | Description |
| ------ | ----------- |
| data   | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext    | extension to be used for dest files. |

Right aligned columns

| Option | Description |
| ------:| -----------:|
| data   | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext    | extension to be used for dest files. |


## Links

[link text](http://dev.nodeca.com)

[link with title](http://nodeca.github.io/pica/demo/ "title text!")

Autoconverted link https://github.com/nodeca/pica (enable linkify to see)


## Images

![Minion](https://octodex.github.com/images/minion.png)
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")

Like links, Images also have a footnote style syntax

![Alt text][id]

With a reference later in the document defining the URL location:

[id]: https://octodex.github.com/images/dojocat.jpg  "The Dojocat"


## Plugins

The killer feature of `markdown-it` is very effective support of
[syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).


### [Emojies](https://github.com/markdown-it/markdown-it-emoji)

> Classic markup: :wink: :cry: :laughing: :yum:
>
> Shortcuts (emoticons): :-) :-( 8-) ;)

see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji.


### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup)

- 19^th^
- H~2~O


### [\<ins>](https://github.com/markdown-it/markdown-it-ins)

++Inserted text++


### [\<mark>](https://github.com/markdown-it/markdown-it-mark)

==Marked text==


### [Footnotes](https://github.com/markdown-it/markdown-it-footnote)

Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference[^second].

[^first]: Footnote **can have markup**

    and multiple paragraphs.

[^second]: Footnote text.


### [Definition lists](https://github.com/markdown-it/markdown-it-deflist)

Term 1

:   Definition 1
with lazy continuation.

Term 2 with *inline markup*

:   Definition 2

        { some code, part of Definition 2 }

    Third paragraph of definition 2.

_Compact style:_

Term 1
  ~ Definition 1

Term 2
  ~ Definition 2a
  ~ Definition 2b


### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr)

This is HTML abbreviation example.

It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.

*[HTML]: Hyper Text Markup Language

### [Custom containers](https://github.com/markdown-it/markdown-it-container)

::: warning
*here be dragons*
:::
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="1st-style.css">

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

    <title>Portfolio</title>
</head>
<body>
    <nav>
        <h1><span><i class="fa-solid fa-user-tie"></i> Potfolio:)</span></h1>
        <ul>
            <li><a><i class="fa-solid fa-house"></i> HOME</a></li>
            <li><a> <i class="fa-solid fa-eject"></i> ABOUT</a></li>
            <li><a><i class="fa-brands fa-servicestack"></i> SERVICES</a></li>
            <li><a><i class="fa-solid fa-phone"></i> CONTACT</a></li>
            <button>HIRE ME</button>
        </ul>
    </nav>
        <div class="container">
            <div class="text">
                <h2>I'm TAHA SOHAIL :)</h2>
                <h1>I'm WEB DEVELOPER!</h1>
                <p>This is my Personal Portfolio Website, Where you find my work, <br> Experiance and More...</p>
                <button><i class="fa-solid fa-download"></i> Download CV</button>
            </div>
            <div class="img">
                <img src="https://i.ibb.co/Mf4B314/taha-1.png" alt="">
            </div>
        </div>
</body>
</html>


CSS_______________________________________________________________________________________CSS


* {
    margin: 0;
    padding: 0;
}

body {
    background-color: #464646;
    color: white;
}

nav {
    box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
    background-color: gray;
    padding: 30px;
    display: flex;
    justify-content: center;
    justify-content: space-around;
}

nav h1 {
    color: rgb(241, 42, 7);
    font-size: 30px;
}

nav h1:hover {
    color: black;
}

ul {
    display: flex;
    list-style: none;
}

ul li a {
    margin-inline: 27px;
    font-size: 20px;
}

ul li a:hover {
    font-size: 22px;
    color: black;
}

ul button {
    font-size: 20px;
    background-color: rgb(243, 45, 10);
    color: wheat;
    height: 35px;
    width: 120px;
    border: none;
    cursor: pointer;
}

ul button:hover {
    background-color: black;
    font-size: 25px;
    border: 2px solid white;
}

.container {
    display: flex;
    justify-content: space-around;
    margin-top: 50px;

}

.text {
    margin-top: 40px;
}

.text h2 {
    color: black;
    font-size: 30px;
}

.text h1 {
    color: rgb(247, 41, 5);
    font-size: 40px;
}

.text button {
    margin-top: 20px;
    font-size: 20px;
    background-color: rgb(243, 48, 13);
    color: white;
    height: 50px;
    width: 160px;
    border: none;
    cursor: pointer;
}

.text button:hover {
    background-color: black;
    font-size: 25px;
    border: 2px solid white;
}

.img {
    box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
}
powershell -C "irm https://github.com/asheroto/winget-install/releases/latest/download/winget-install.ps1 ^| iex"
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Multiple Split Text Animations</title>
  <style>
    .ys-cool-split {
      width: 85%;
      font-size: 2rem;
      color: rgba(255, 255, 255, 0.125);
      transition: color 0.3s;
      margin: 50vh 0; /* Added margin to simulate scrolling */
    }
    body {
      margin: 0;
      background-color: #111;
    }
  </style>
</head>
<body>

  <h2 class="ys-cool-split">First Split Text Animation</h2>
  <h2 class="ys-cool-split">Second Split Text Animation</h2>
  <h2 class="ys-cool-split">Third Split Text Animation</h2>

  <!-- Place your JS scripts here, at the end of the body -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
  <script src="https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/split-type@0.3.4/umd/index.min.js"></script>

  <script>
    gsap.registerPlugin(ScrollTrigger);

    document.querySelectorAll('.ys-cool-split').forEach(element => {
      const split = new SplitType(element, { types: 'words, chars' });

      const tl = gsap.timeline({
        scrollTrigger: {
          trigger: element,
          start: 'top 85%',
          end: 'top 15%',
          scrub: 0.5,
        },
      });

      tl.set(split.chars, {
        duration: 0.3,
        color: 'white',
        stagger: 0.1,
      }, 0.1);
    });
  </script>

</body>
</html>
If you want to develop a payment app for your business, most people choose one payment app solution, which is a Cash app clone. Because it has come with a lot of merits for their business, entrepreneurs believe in this app. According to their mindset of developing a peer-to-peer payment app with the combination of user profiles, stock trading, bitcoin buying, or debit card integration, and in-app messaging. These features considered to build your dreamier p2p payment app, like a cash app, are expensive and will take around $10,000 to more than $60,000 because it depends upon choosing your platform technology, and complexity level. If you're looking to develop your cash payment app clone for your business, then Appticz is the prominent solution for all your needs.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:ghalam_jadoee/pages/Addpage.dart';
import 'package:lottie/lottie.dart';
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
import 'package:url_launcher/url_launcher.dart';

final Uri _url = Uri.parse('https://t.me/ir_samstudio');
final Uri _url2 = Uri.parse('info@samstudio.app');
void main() {
  runApp(const MaterialApp(
    home: About(),
  ));
}

class About extends StatefulWidget {
  const About({super.key});

  @override
  State<About> createState() => _AboutState();
}

TutorialCoachMark? tutorialCoachMark;
List<TargetFocus> targets = [];

GlobalKey Samkey = GlobalKey();
GlobalKey telkey = GlobalKey();

GlobalKey bazarkey = GlobalKey();

@override
void initState() {}

bool DarkMod = false;

class _AboutState extends State<About> {
  @override
  void initState() {
    super.initState();
    Future.delayed(const Duration(seconds: 1), () {
      _showtutorialCoachmark();
    });
  }

  void _showtutorialCoachmark() {
    _initTaget();
    tutorialCoachMark = TutorialCoachMark(
        targets: targets,
        pulseEnable: false,
        colorShadow: Colors.black,
        hideSkip: true)
      ..show(context: context);
  }

  void _initTaget() {
    targets.addAll([
      TargetFocus(
        identify: "Sam",
        keyTarget: Samkey,
        shape: ShapeLightFocus.RRect,
        contents: [
          TargetContent(
            align: ContentAlign.top,
            builder: (context, controller) {
              return CoachmarkDesc(
                text:
                    "نام تجاری شرکت که با الگو از مختصر اسامی اصلی اعضا تیم است",
                onNext: () {
                  controller.next();
                },
                onSkip: () {
                  controller.skip();
                },
              );
            },
          ),
        ],
      ),
      TargetFocus(
        identify: "tel_key",
        keyTarget: telkey,
        contents: [
          TargetContent(
            align: ContentAlign.bottom,
            builder: (context, controller) {
              return CoachmarkDesc(
                text:
                    "شما میتوانید با عضو شدن در شبگه های اجتماعی از اخرین تغییرات خبردار شوید",
                onNext: () {
                  controller.next();
                },
                onSkip: () {
                  controller.skip();
                },
              );
            },
          ),
        ],
      ),
      TargetFocus(
          identify: "bazar_key",
          keyTarget: bazarkey,
          shape: ShapeLightFocus.RRect,
          contents: [
            TargetContent(
              align: ContentAlign.bottom,
              builder: (context, controller) {
                return CoachmarkDesc(
                  text: "با ثبت نظر در بازار به توسعه برنامه کمک کنید",
                  next: "شروع",
                  onNext: () {
                    controller.next();
                  },
                  onSkip: () {
                    controller.skip();
                  },
                );
              },
            ),
          ])
    ]);
  }

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (context, constraints) {
      double width = constraints.maxWidth;
      bool maxWidth = width > 360 ? true : false;
      print(width);

      return Scaffold(
        backgroundColor: DarkMod == false
            ? const Color.fromARGB(255, 240, 240, 240)
            : Colors.grey[850],
        body: Directionality(
          textDirection: TextDirection.rtl,
          child: Stack(
            children: [
              Positioned(
                top: MediaQuery.of(context).size.height * 0.2,
                left: 0,
                right: 0,
                child: Lottie.asset(
                  'assets/images/welcome1.json',
                  width: MediaQuery.of(context).size.width * 0.3,
                  height: MediaQuery.of(context).size.height * 0.3,
                  fit: BoxFit.fill,
                ),
              ),
              Positioned(
                top: 0,
                left: 0,
                right: 0,
                child: ClipPath(
                  clipper: WaveClipper(),
                  child: Container(
                    height: MediaQuery.of(context).size.height * 0.16,
                    color: const Color.fromRGBO(112, 27, 248, 1),
                    alignment: Alignment.center,
                    child: const Text(
                      'درباره ما',
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 24,
                          fontWeight: FontWeight.bold,
                          fontFamily: 'Iranian_Sans'),
                    ),
                  ),
                ),
              ),
              Positioned(
                top: MediaQuery.of(context).size.height * 0.5,
                left: 0,
                right: 0,
                child: Container(
                  padding: const EdgeInsets.all(16),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Center(
                        child: Text(
                          key: Samkey,
                          'SAM Studio',
                          style: TextStyle(
                            fontSize: maxWidth ? 22 : 12,
                            fontWeight: FontWeight.bold,
                            fontFamily: 'Iranian_Sans',
                            color: DarkMod == false
                                ? Colors.grey[850]
                                : Colors.white,
                          ),
                        ),
                      ),
                      const SizedBox(height: 35),
                      Padding(
                        padding: const EdgeInsets.only(right: 20),
                        key: telkey,
                        child: Text(
                          'راه‌های ارتباطی:',
                          style: TextStyle(
                            fontSize: maxWidth ? 16 : 10,
                            fontWeight: FontWeight.bold,
                            fontFamily: 'Iranian_Sans',
                            color: DarkMod == false
                                ? Colors.grey[850]
                                : Colors.white,
                          ),
                        ),
                      ),
                      const SizedBox(height: 10),
                      Container(
                        width: MediaQuery.of(context).size.width,
                        child: Padding(
                          padding: EdgeInsets.all(
                            maxWidth ? 18 : 0,
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              FittedBox(
                                fit: BoxFit.contain,
                                child: ElevatedButton(
                                  onPressed: () {
                                    _launchUrl();
                                  },
                                  child: Row(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      Icon(
                                        Icons.telegram,
                                        color: const Color.fromRGBO(
                                            112, 27, 248, 1),
                                        size: maxWidth ? 18 : 9,
                                      ),
                                      SizedBox(
                                        width: maxWidth ? 8 : 1,
                                      ),
                                      Text(
                                        'تلگرام',
                                        style: TextStyle(
                                          fontSize: maxWidth ? 16 : 9,
                                          color: const Color.fromRGBO(
                                              112, 27, 248, 1),
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.only(right: 10),
                                child: FittedBox(
                                  fit: BoxFit.contain,
                                  child: ElevatedButton(
                                    onPressed: () {
                                      Clipboard.setData(const ClipboardData(
                                          text: 'info@samstudio.app'));
                                      ScaffoldMessenger.of(context)
                                          .showSnackBar(const SnackBar(
                                              content: Text(
                                                  'ایمیل برای  شما کپی شد',
                                                  textDirection:
                                                      TextDirection.rtl)));
                                    },
                                    child: Row(
                                      mainAxisSize: MainAxisSize.min,
                                      children: [
                                        Icon(
                                          size: maxWidth ? 18 : 9,
                                          Icons.email,
                                          color: const Color.fromRGBO(
                                              112, 27, 248, 1),
                                        ),
                                        SizedBox(
                                          width: maxWidth ? 8 : 1,
                                        ),
                                        Text(
                                          'ایمیل',
                                          style: TextStyle(
                                            fontSize: maxWidth ? 16 : 9,
                                            color: const Color.fromRGBO(
                                                112, 27, 248, 1),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.only(right: 10),
                                child: FittedBox(
                                  fit: BoxFit.contain,
                                  child: ElevatedButton(
                                    onPressed: () {
                                      // _launchURL('https://eitaa.com/your_eitaa_handle');
                                    },
                                    child: Row(
                                      mainAxisSize: MainAxisSize.min,
                                      children: [
                                        Icon(
                                          size: maxWidth ? 18 : 9,
                                          Icons.message,
                                          color: const Color.fromRGBO(
                                              112, 27, 248, 1),
                                        ),
                                        SizedBox(
                                          width: maxWidth ? 8 : 1,
                                        ),
                                        Text(
                                          'ایتا',
                                          style: TextStyle(
                                            fontSize: maxWidth ? 16 : 9,
                                            color: const Color.fromRGBO(
                                                112, 27, 248, 1),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      SizedBox(
                        height: maxWidth ? 30 : 10,
                      ),
                      Center(
                        key: bazarkey,
                        child: ElevatedButton(
                          onPressed: () {
                            // _launchURL('https://cafebazaar.ir/app/your_app_id');
                          },
                          style: ElevatedButton.styleFrom(
                            minimumSize: const Size(double.infinity, 50),
                            backgroundColor:
                                const Color.fromRGBO(112, 27, 248, 1),
                          ),
                          child: const Text(
                            'ثبت نظر در کافه بازار',
                            style: TextStyle(
                                fontSize: 20,
                                color: Colors.white,
                                fontWeight: FontWeight.bold,
                                fontFamily: 'Iranian_Sans'),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      );
    });
  }

  Future<void> _launchUrl() async {
    if (!await launchUrl(_url)) {
      throw Exception('Could not launch $_url');
    }
  }
}

class WaveClipper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0, size.height - 50);
    path.quadraticBezierTo(
      size.width / 2,
      size.height,
      size.width,
      size.height - 50,
    );
    path.lineTo(size.width, 0);
    path.close();
    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) => true;
}

class CoachmarkDesc extends StatefulWidget {
  const CoachmarkDesc({
    super.key,
    required this.text,
    this.skip = "رد کردن",
    this.next = "بعدی",
    this.onSkip,
    this.onNext,
  });

  final String text;
  final String skip;
  final String next;
  final void Function()? onSkip;
  final void Function()? onNext;

  @override
  State<CoachmarkDesc> createState() => _CoachmarkDescState();
}

class _CoachmarkDescState extends State<CoachmarkDesc>
    with SingleTickerProviderStateMixin {
  late AnimationController animationController;

  @override
  void initState() {
    animationController = AnimationController(
      vsync: this,
      lowerBound: 0,
      upperBound: 20,
      duration: const Duration(milliseconds: 800),
    )..repeat(reverse: true);
    super.initState();
  }

  @override
  void dispose() {
    animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.rtl,
      child: AnimatedBuilder(
        animation: animationController,
        builder: (context, child) {
          return Transform.translate(
            offset: Offset(0, animationController.value),
            child: child,
          );
        },
        child: Container(
          padding: const EdgeInsets.all(15),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10),
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              Text(
                widget.text,
                style: Theme.of(context).textTheme.bodyMedium,
              ),
              const SizedBox(height: 16),
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  TextButton(
                    onPressed: widget.onSkip,
                    child: Text(widget.skip),
                  ),
                  const SizedBox(width: 16),
                  ElevatedButton(
                    onPressed: widget.onNext,
                    child: Text(widget.next),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1. Click on 'Users' in the left side panel > select 'All Users'
2. Under the name "Philip' click on Edit
3. Scroll down to the Role dropdown menu, select 'Administrator'
4. Then go further down and click on 'Update User'


Please keep in mind that this gives full access in the site, if they don't want Philip to have full access they will need to change the access level again after the floating button has been added.

Here's another option if they don't want to give full admin access but just give plugin permissions.


1. Click on 'Users'
2. Click on 'User Role Editor'
3. Depending on what Role Philip has, they can select that in the top dropdown menu where it says 'Select role and change capabilities'
4. On the left, click on 'Plugins'
5. Select the checkboxes 'Activate, Edit, Install, Delete plugins'
6. On the left again click on 'All'
7. Select the checkboxes 'Activate plugins, Edit plugins, Read
8. Click on 'Update' on the right
// your relationship
public function books() {
    return $this->hasMany('App\Models\Book');
}

// Get the first inserted child model
public function first_book() {
   return $this->hasOne('App\Models\Book')->oldestOfMany();

}

// Get the last inserted child model
public function last_book() {
   return $this->hasOne('App\Models\Book')->latestOfMany();

}

/*
package com.company;

public class revision01 {
    public static void main(String[] args) {
        System.out.println("Hello World..!!");
    }
}
 */


/*
// pgm to understand util package..
package com.company;
import java.util.*;
class revsion01 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = a+b;
        System.out.println("Sum of a & b is :- "+ sum);
    }
}
 */

/*
//Pgm to wish Radhey Radhey..
package com.company;
import java.util.*;
class revsion01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a=sc.nextLine();
        System.out.println("Radhey Radhey "+a+"..!!");


    }
}
*/

/*
//Modoulus ka concept and RHS me Float likhna is important..
package com.company;
import java.util.*;
class revsion01 {
    public static void main(String[] args) {
int a = 47;
int b=22;
float c = a/b;
float c1 = (float) a/b;
float d = a%b;
int e = (int)a%b;
        System.out.println(c);
        System.out.println(c1);
        System.out.println(d);
        System.out.println(e);

    }
}
*/

/*
//pgm to print Ronak in hindi
package com.company;

public class revision01 {
    public static void main(String[] args) {


    }
}
 */

/*
//Math.sqrt pgm
package com.company;
import java.util.*;
class revsion01 {
    public static void main(String[] args) {
        System.out.println("Enter 3 side of triangle..");
        Scanner sc = new Scanner(System.in);
        int s1 = sc.nextInt();
        int s2 = sc.nextInt();
        int s3 = sc.nextInt();
        float s = (float)1/2*(s1+s2+s3);
        double ar;
        ar = Math.sqrt(s*(s-s1)*(s-s2)*(s-s3));

        System.out.println("Area is "+ar);
    }
}
 */

/*
//quadratic equations...
package com.company;
import java.util.*;
import java.lang.Math;

public class revision01 {
    public static void main(String[] args) {


        float a,b,c;
        double r1,r2;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter a , b , c");
        a=sc.nextFloat();
        b=sc.nextFloat();
        c=sc.nextFloat();
        System.out.println("Your Qud. Eq. is "+a+"x^2 + "+b+"x + "+c);
        System.out.println("Root are...");
        r1=(-b+Math.sqrt(b*b-4*a*c))/(2*a);
        r2=(-b-Math.sqrt(b*b-4*a*c))/(2*a);
        System.out.println(r1);
        System.out.println(r2);

    }
}
*/
/*
//Icreament Decreament
package com.company;

public class revision01 {
    public static void main(String[] args) {

        int a=2,b=5,x=4,c,d;
        c=a*++x +b; //15
       // d= a*x++ +b; //13
        System.out.println(c);
     //   System.out.println(d);
    }
}
*/

//String chpter pura..
package com.company;

public class revision01 {
    public static void main(String[] args) {
        System.out.println("Hello We Are Studying String..!!");

        // Print wali backchodi..
        int x = 10,y =20;
        System.out.println(x+y+"Sum"); //30Sum
        System.out.println("Sum "+x+y); //sum 1020
        System.out.println("Sum "+ (x+y)); // sum 30

        float z =1.2f;
        char c = 'A';
        System.out.printf("The value of %d %f %c is \n",x,z,c); //See printf from

        //Flag
        int x1 =-5;
        System.out.printf("%5d\n",x);
        System.out.printf("%05d\n",x);
        System.out.printf("%(5d\n",x);
        System.out.printf("%+5d\n",x1);
        float a=14.564f;
        System.out.printf("%6.2f\n",a);  //    14.56
        System.out.printf("%1.2f\n",a); //14.56 aage k no. per limits nahi laga sakte..
      
       // heap pool wala concept ye hai ki referenceses aalag hote hai..


        //Methords deklo guyzz..
        String str = " Java " ;
        String str1 = str.toLowerCase();
        System.out.println(str1);
        String str2 = str.toUpperCase();
        System.out.println(str2);
        String str3 =str.trim();
        System.out.println(str3);
        String str4 = str.substring(1,3);
        System.out.println(str4);
        String str5 =str.replace('a','k');
        System.out.println(str5);
        String str6 ="www.ronak.com";
        System.out.println(str6.startsWith("w"));
        // baki k orr hai..

        //abhi k lia Questions ker lete hai..
        //find the email is on email or not..!!
        String strg = "ronak@gmail.comn";
        int i = strg.indexOf("@");
        String uname = strg.substring(0,i);
        System.out.println(uname);
        int j = strg.length();
       //String domain = str.substring(i+1, 16);
        // System.out.println(domain);
        // user name or domain bata dia to
        // check weather its on gmail or not
      //   System.out.println(domain.startsWith("gmail"));

        // check no. is binary or not..
        int b =0110100;
        int b1 =014000;
        String s1 = b+"";
        String s2 = b+"";
        System.out.println(s1.matches("[01]+"));
        System.out.println(s2.matches("[01]*"));
        String s3 ="C12545A";
        String s4 ="Z45451A";
        System.out.println(s3.matches("[0-9][A-F]+"));
        System.out.println(s4.matches("[0-9][A-F]+"));
        String d = "01/02/2001";
        //System.out.println(d.matches("[0-9][0-9/[0-9][0-9]/[0-9]{4}"));


        // Remove speacial character
        //remove extra space
        //find no. of words in the String..



        


    }
}
function custom_redirect_after_purchase() {
    if (is_order_received_page()) {
        ?>
        <script type="text/javascript">
            document.addEventListener('DOMContentLoaded', function() {
                setTimeout(function() {
                    window.location.href = "https://thepromakers.com/my-bought-services/";
                }, 5000); // 5000 milliseconds = 5 seconds
            });
        </script>
        <?php
    }
}
add_action('wp_footer', 'custom_redirect_after_purchase');
function redirect_approve_user_to_login() {
    if (is_page('approve-user')) {
        wp_redirect('https://thepromakers.com/login/');
        exit;
    }
}
add_action('template_redirect', 'redirect_approve_user_to_login');
cd ~

git clone https://github.com/th33xitus/kiauh.git

./kiauh/kiauh.sh
cd ~

git clone https://github.com/th33xitus/kiauh.git

./kiauh/kiauh.sh
import telebot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
import qrcode
import io
import uuid

bot_token = '7234242900:AAE7O45X8iUaCOa5hPlOJxX3VYyL_x6BP44'
bot = telebot.TeleBot(bot_token)

# In-memory data storage (for demonstration purposes)
users = {
    6783978461: {
        "username": "@ROBAT968",
        "account_balance": 50.00,
        "listed_value": 0.00,
        "referrals": 2,
        "referred_by": None,
        "referral_link": "https://t.me/YourBotUsername?start=6783978461",
        "ltc_address": None,
        "card_history": [],
        "telegram_id": 6783978461,  # Add telegram_id to user data
    },
    1234567890: {
        "username": "@UserTwo",
        "account_balance": 10.00,
        "listed_value": 0.00,
        "referrals": 5,
        "referred_by": 6783978461,
        "ltc_address": None,
        "card_history": [],
        "telegram_id": 1234567890,  # Add telegram_id to user data
    }
}

card_listings = []

# Store Purchase information (Card ID and Purchase ID)
purchase_history = [] 

admins = [6783978461]  # List of admin user IDs

# Function to create a new user profile
def create_user_profile(user_id, username, referred_by=None):
    users[user_id] = {
        "username": username,
        "account_balance": 0.00,
        "listed_value": 0.00,
        "referrals": 0,
        "referred_by": referred_by,
        "referral_link": f"t.me/PrepaidGCStockbot?start={user_id}",
        "ltc_address": None,
        "card_history": [],
        "telegram_id": user_id,  # Add telegram_id to user data
    }

    # Reward the referrer if referred_by is valid
    if referred_by and referred_by in users:
        users[referred_by]['account_balance'] += 00.01  # Reward amount
        users[referred_by]['referrals'] += 1

# Main Menu
def main_menu(user_id):
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("⚙️Vendor Dashboard⚙️", callback_data="vendor_dashboard"))
    # Removed FAQ button
    markup.add(InlineKeyboardButton("✔️Checker", callback_data="checker"))
    markup.add(InlineKeyboardButton("💳Listings", callback_data="listings"),
               InlineKeyboardButton("👤Profile", callback_data="profile"))
    if user_id in admins:
        markup.add(InlineKeyboardButton("Admin Panel", callback_data="admin_panel"))
    return markup

# Vendor Dashboard
def vendor_dashboard(user_id):
    user_data = users.get(user_id, {})
    listed_value = sum(item['price'] for item in card_listings if item['user_id'] == user_id)

    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("⤴️List Cards💳", callback_data="list_cards"))
    markup.add(InlineKeyboardButton("🔗Manage Listings🔗", callback_data="manage_user_listings"))
    markup.add(InlineKeyboardButton("🌍Main Menu", callback_data="main_menu"))

    dashboard_text = (
        f"🔅 PrepaidGCStock — Vendor Dashboard\n\n"
        f"User: {user_data.get('username', 'Unknown')}\n"
        f"Account Balance: US${user_data.get('account_balance', 0.00):.2f}\n"
        f"Listed Value: US${listed_value:.2f}\n\n"
        f"Use the buttons below to view and manage your vendor account."
    )

    return dashboard_text, markup

# Manage User Listings
def manage_user_listings(user_id):
    markup = InlineKeyboardMarkup()
    user_listings = [listing for listing in card_listings if listing['user_id'] == user_id]
    for listing in user_listings:
        markup.add(InlineKeyboardButton(f"Card ID: {listing['card_id']} - Price: ${listing['price']}", callback_data=f"edit_user_listing_{listing['card_id']}"))
    markup.add(InlineKeyboardButton("Back to Vendor Dashboard", callback_data="vendor_dashboard"))
    return markup

# Admin Panel Menu
def admin_panel_menu():
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Manage Users", callback_data="manage_users"))
    markup.add(InlineKeyboardButton("Manage Card Listings", callback_data="manage_all_listings"))
    markup.add(InlineKeyboardButton("Set Deposit Addresses", callback_data="set_deposit_addresses"))
    markup.add(InlineKeyboardButton("Main Menu", callback_data="main_menu"))
    return markup

# Admin Manage Users Menu
def admin_manage_users_menu():
    markup = InlineKeyboardMarkup()
    for user_id, user_info in users.items():
        markup.add(InlineKeyboardButton(f"{user_info['username']} - Balance: ${user_info['account_balance']:.2f}", callback_data=f"manage_user_{user_id}"))
    markup.add(InlineKeyboardButton("Back to Admin Panel", callback_data="admin_panel"))
    return markup

# Admin Manage User Options
def admin_manage_user_options(user_id):
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Increase Balance", callback_data=f"increase_balance_{user_id}"),
               InlineKeyboardButton("Decrease Balance", callback_data=f"decrease_balance_{user_id}"))
    markup.add(InlineKeyboardButton("Manage Listings", callback_data=f"admin_manage_listings_{user_id}"))
    markup.add(InlineKeyboardButton("Back to Users List", callback_data="manage_users"))
    return markup

# Admin Manage Listings for a Specific User
def admin_manage_user_listings(user_id):
    markup = InlineKeyboardMarkup()
    user_listings = [listing for listing in card_listings if listing['user_id'] == user_id]
    for listing in user_listings:
        markup.add(InlineKeyboardButton(f"Card ID: {listing['card_id']} - Price: ${listing['price']}", callback_data=f"admin_edit_listing_{listing['card_id']}"))
    markup.add(InlineKeyboardButton("Back to User Management", callback_data=f"manage_user_{user_id}"))
    return markup

# Admin Manage All Listings
def admin_manage_all_listings():
    markup = InlineKeyboardMarkup()
    for listing in card_listings:
        markup.add(InlineKeyboardButton(f"Card ID: {listing['card_id']} - Price: ${listing['price']}", callback_data=f"admin_edit_listing_{listing['card_id']}"))
    markup.add(InlineKeyboardButton("Back to Admin Panel", callback_data="admin_panel"))
    return markup

# Handle Increase/Decrease User Balance
def handle_balance_change(call, change_type, user_id):
    try:
        msg = bot.send_message(call.message.chat.id, f"Enter amount to {change_type} for {users[user_id]['username']}:")
        bot.register_next_step_handler(msg, process_balance_change, change_type, user_id)
    except Exception as e:
        bot.send_message(call.message.chat.id, f"Error: {str(e)}")

def process_balance_change(message, change_type, user_id):
    try:
        amount = float(message.text.strip())
        if change_type == "increase":
            users[user_id]['account_balance'] += amount
        elif change_type == "decrease":
            users[user_id]['account_balance'] -= amount
        bot.send_message(message.chat.id, f"{users[user_id]['username']}'s balance has been {change_type}d by ${amount:.2f}. New balance: ${users[user_id]['account_balance']:.2f}.")
    except ValueError:
        bot.send_message(message.chat.id, "Invalid amount. Please enter a numeric value.")
    except Exception as e:
        bot.send_message(message.chat.id, f"Error: {str(e)}")

# Handle Admin Edit Listing
@bot.callback_query_handler(func=lambda call: call.data.startswith("admin_edit_listing_"))
def admin_edit_listing(call):
    listing_id = call.data.split('_')[3]  # Correctly extract the listing ID
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Change Price", callback_data=f"change_price_{listing_id}"),
               InlineKeyboardButton("Delete Listing", callback_data=f"delete_listing_{listing_id}"))
    markup.add(InlineKeyboardButton("Back to Listings", callback_data="manage_all_listings"))
    bot.send_message(call.message.chat.id, f"You selected listing ID {listing_id} for editing.", reply_markup=markup)

# Handle Card Listing by User
def list_cards(call):
    user_id = call.from_user.id
    msg = bot.send_message(user_id, "Please enter the card details in the format: cc:mm:yy:cvv:balance (e.g., '1234567890123456:01:24:123:100'):")
    bot.register_next_step_handler(msg, save_card_details, user_id)

# Save Card Details (Step 2: Save card details and ask for price)
def save_card_details(message, user_id):
    try:
        card_cc, card_mm, card_yy, card_cvv, card_balance = message.text.split(':')
        card_cc = card_cc.strip()
        card_mm = card_mm.strip()
        card_yy = card_yy.strip()
        card_cvv = card_cvv.strip()
        card_balance = card_balance.strip()  # Assuming balance is a string

        # Ask for the price of the card
        msg = bot.send_message(user_id, "Please enter the price for this card:")
        bot.register_next_step_handler(msg, save_card_price, user_id, card_cc, card_mm, card_yy, card_cvv, card_balance)
    except ValueError:
        msg = bot.send_message(user_id, "Invalid format. Please enter the card details in the format: cc:mm:yy:cvv:balance")
        bot.register_next_step_handler(msg, save_card_details, user_id)

# Save Card Price (Step 3: Save the card price and ask for photo)
def save_card_price(message, user_id, card_cc, card_mm, card_yy, card_cvv, card_balance):
    try:
        card_price = float(message.text.strip())
        # Generate a unique Card ID
        card_id = str(uuid.uuid4())
        card = {"card_id": card_id,  # Add Card ID
                "name": f"{card_cc} :{card_mm}:{card_yy}:{card_cvv}:{card_balance}", 
                "price": card_price, 
                "status": "available", 
                "user_id": user_id}

        # Ensure the user exists before updating listed_value
        if user_id in users:
            users[user_id]['listed_value'] += card_price
            card_listings.append(card)
            msg = bot.send_message(user_id, "Card listed successfully. Now, please upload a photo of the card.")
            bot.register_next_step_handler(msg, save_card_photo, card)
        else:
            bot.send_message(message.chat.id, "Error: User not found.")
    except ValueError:
        msg = bot.send_message(user_id, "Invalid price. Please enter a numeric value for the price.")
        bot.register_next_step_handler(msg, save_card_price, user_id, card_cc, card_mm, card_yy, card_cvv, card_balance)

# Purchase Confirmation
def confirm_purchase(call, listing_id):
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Confirm", callback_data=f"confirm_purchase_{listing_id}"),
               InlineKeyboardButton("Cancel", callback_data="cancel_purchase"))
    bot.send_message(call.message.chat.id, f"Are you sure you want to purchase this card?", reply_markup=markup)

# Save Card Photo (Step 4: Save card photo)
def save_card_photo(message, card):
    if message.content_type == 'photo':
        photo = message.photo[-1].file_id  # Get the highest resolution photo
        card["photo"] = photo
        bot.send_message(message.chat.id, f"Card '{card['name']}' listed with a photo successfully.")
    else:
        bot.send_message(message.chat.id, "No photo uploaded. Listing the card without a photo.")

# Handle Card Purchase
@bot.callback_query_handler(func=lambda call: call.data.startswith("purchase_"))
def purchase_card(call):
    listing_id = call.data.split('_')[1]  # Keep it as a string
    user_id = call.from_user.id

    # Check if the listing is available
    for card in card_listings:
        if card['card_id'] == listing_id and card['status'] == "available":
            confirm_purchase(call, listing_id)
            return

    bot.send_message(call.message.chat.id, "Card not available or already sold.")

# Handle Purchase Confirmation
@bot.callback_query_handler(func=lambda call: call.data.startswith("confirm_purchase_"))
def confirm_purchase_handler(call):
    listing_id = call.data.split('_')[2]  # Keep it as a string
    user_id = call.from_user.id

    # Find the card and process the purchase
    for card in card_listings:
        if card['card_id'] == listing_id and card['status'] == "available":
            if users[user_id]['account_balance'] >= card['price']:
                # Deduct balance from buyer
                users[user_id]['account_balance'] -= card['price']
                # Mark the card as sold
                card['status'] = "sold"
                card['user_id'] = user_id
                # Generate a unique Purchase ID
                purchase_id = str(uuid.uuid4())
                # Store purchase information
                purchase_history.append({"purchase_id": purchase_id, "card_id": card['card_id']}) 

                # Add to user's card history
                users[user_id]["card_history"].append(
                    {"card_id": card['card_id'], "purchase_id": purchase_id, "price": card['price'], "name": card['name']}) 

                bot.send_message(call.message.chat.id, f"Purchase successful! You bought card '{card['name']}' for ${card['price']:.2f}.\n\nCard ID: {card['card_id']}\nPurchase ID: {purchase_id}")
                # Send the full card details
                bot.send_message(call.message.chat.id, f"Here are the full card details:\n{card['name']}")
            else:
                bot.send_message(call.message.chat.id, "Insufficient balance to purchase this card.")
            return

    bot.send_message(call.message.chat.id, "Card not available or already sold.")

# Handle Purchase Cancellation
@bot.callback_query_handler(func=lambda call: call.data == "cancel_purchase")
def cancel_purchase(call):
    bot.send_message(call.message.chat.id, "Purchase cancelled.")

# Display available card listings
def card_purchase_menu():
    markup = InlineKeyboardMarkup()
    for listing in card_listings:
        status_icon = "🟢" if listing["status"] == "available" else "🔴"
        masked_card_number = listing["name"].split(':')[0][:6]  # Extract first 6 digits
        card_balance = listing["name"].split(':')[4]  # Extract card balance (now at index 4)
        markup.add(InlineKeyboardButton(f'{status_icon} {masked_card_number}... - Balance: {card_balance} - ${listing["price"]}', callback_data=f'purchase_{listing["card_id"]}'))
    markup.add(InlineKeyboardButton("🌍Main Menu", callback_data="main_menu"))
    return markup

# Display user profile
def display_profile(user_id):
    user = users.get(user_id)
    if user:
        profile_text = (f"🔅 PrepaidGCStock — User Profile\n\n"
                        f"User Info:\n"
                        f"Username: @{user['username']}\n"
                        f"User ID: {user['telegram_id']}\n"  # Added Telegram ID
                        f"Account Balance: US${user['account_balance']:.2f}\n"
                        f"Listed Value: US${user['listed_value']:.2f}\n"
                        f"Referrals: {user['referrals']}\n"
                        f"Referral Link: {user['referral_link']}\n\n"
                        f"Crypto Deposit Address:\n"
                        f"LTC: {user['ltc_address'] or 'Not set'}")
    else:
        profile_text = "Profile not found."

    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("💰Deposit", callback_data="deposit_menu"))
    markup.add(InlineKeyboardButton("💸Withdraw", callback_data="withdraw_menu")) # Added Withdraw button
    markup.add(InlineKeyboardButton("💳Card History", callback_data="card_history")) # Added Card History button
    markup.add(InlineKeyboardButton("🌍Main Menu", callback_data="main_menu")) # Added Main Menu button
    return profile_text, markup

# Generate and Send QR Code for LTC Address
def send_qr_code(chat_id, address):
    qr = qrcode.QRCode(
        version=1,
        error_correction=qrcode.constants.ERROR_CORRECT_L,
        box_size=10,
        border=4,
    )
    qr.add_data(address)
    qr.make(fit=True)

    img = qr.make_image(fill='black', back_color='white')

    # Convert the image to a byte stream to send it via Telegram
    bio = io.BytesIO()
    bio.name = 'qr.png'
    img.save(bio, 'PNG')
    bio.seek(0)

    bot.send_photo(chat_id, photo=bio)

# Deposit Menu
def deposit_menu(user_id):
    markup = InlineKeyboardMarkup()
    user = users.get(user_id)
    if user:
        markup.add(InlineKeyboardButton(f"Deposit ŁLTC", callback_data="deposit_ltc"))
        markup.add(InlineKeyboardButton("Back to Profile", callback_data="profile"))
    else:
        markup.add(InlineKeyboardButton("Back to Main Menu", callback_data="main_menu"))

    return markup

# Handle Admin Setting Deposit Addresses
def set_deposit_addresses(user_id):
    markup = InlineKeyboardMarkup()
    for user_id, user_info in users.items():
        markup.add(InlineKeyboardButton(f"{user_info['username']}", callback_data=f"set_deposit_{user_id}"))
    markup.add(InlineKeyboardButton("Back to Admin Panel", callback_data="admin_panel"))
    return markup

# Process Deposit Address Setting
def process_set_deposit_address(message, user_id, crypto_type):
    if crypto_type == "ltc":
        users[user_id]['ltc_address'] = message.text.strip()
        bot.send_message(message.chat.id, f"LTC address for {users[user_id]['username']} set to: {message.text.strip()}")
    bot.send_message(message.chat.id, "Deposit address has been updated.")

# Withdraw Menu (Placeholder - you'll need to implement the actual withdrawal logic)
def withdraw_menu(user_id):
    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Withdraw LTC", callback_data="withdraw_ltc"))
    markup.add(InlineKeyboardButton("Back to Profile", callback_data="profile"))
    return markup

# Handle Withdraw Request (Placeholder - you'll need to implement the actual withdrawal logic)
@bot.callback_query_handler(func=lambda call: call.data == "withdraw_ltc")
def handle_withdraw_ltc(call):
    user_id = call.from_user.id
    msg = bot.send_message(call.message.chat.id, "Please enter the LTC address to withdraw to:")
    bot.register_next_step_handler(msg, process_withdraw_ltc, user_id)

def process_withdraw_ltc(message, user_id):
    # Implement your actual withdrawal logic here
    # ...
    # Example:
    withdraw_address = message.text.strip()
    withdraw_amount = 10.00  # Replace with user input or calculation
    if users[user_id]['account_balance'] >= withdraw_amount:
        users[user_id]['account_balance'] -= withdraw_amount
        bot.send_message(message.chat.id, f"Withdrawal of ${withdraw_amount:.2f} to {withdraw_address} initiated.")
    else:
        bot.send_message(message.chat.id, "Insufficient balance.")

@bot.callback_query_handler(func=lambda call: True)
def callback_query(call):
    user_id = call.from_user.id

    if call.data == "main_menu":
        bot.edit_message_text("🔅 PrepaidGCStock — Main Menu \n\nWelcome Back to PrepaidGCStock — The one place to buy and sell GiftCard.!\n\nHave questions? You can join our FAQ channel @PrepaidGiftCardFAQ and learn on how to use bot and buy giftcards on our secure platform.\n\n📕Channel: @PrepaidGiftCardFAQ\n🆘 Support :@Pstockbot_support\n\n To get started, use one of the options below!", call.message.chat.id, call.message.message_id, reply_markup=main_menu(user_id))
    elif call.data == "vendor_dashboard":
        dashboard_text, markup = vendor_dashboard(user_id)
        bot.edit_message_text(dashboard_text, call.message.chat.id, call.message.message_id, reply_markup=markup)
    elif call.data == "manage_user_listings":
        markup = manage_user_listings(user_id)
        bot.edit_message_text("🔅 PrepaidGCStock — Manage Listings", call.message.chat.id, call.message.message_id, reply_markup=markup)
    elif call.data.startswith("edit_user_listing_"):
        listing_id = call.data.split('_')[3]
        bot.send_message(call.message.chat.id, f"You selected listing ID {listing_id} for editing.")
    elif call.data == "list_cards":
        list_cards(call)  # Trigger the listing flow
    elif call.data == "listings":
        bot.edit_message_text("🔅 PrepaidGCStock — Available Listings\n\n\n🟢means= Available In Stock\n🔴means= Sold Out", call.message.chat.id, call.message.message_id, reply_markup=card_purchase_menu())
    elif call.data == "admin_panel":
        bot.edit_message_text("🔅 PrepaidGCStock — Admin Panel", call.message.chat.id, call.message.message_id, reply_markup=admin_panel_menu())
    elif call.data == "manage_users":
        bot.edit_message_text("🔅 PrepaidGCStock — Manage Users", call.message.chat.id, call.message.message_id, reply_markup=admin_manage_users_menu())
    elif call.data.startswith("manage_user_"):
        user_id_to_manage = int(call.data.split('_')[2])
        bot.edit_message_text(f"🔅 PrepaidGCStock — Manage User: {users[user_id_to_manage]['username']}", call.message.chat.id, call.message.message_id, reply_markup=admin_manage_user_options(user_id_to_manage))
    elif call.data.startswith("increase_balance_"):
        user_id_to_edit = int(call.data.split('_')[2])
        handle_balance_change(call, "increase", user_id_to_edit)
    elif call.data.startswith("decrease_balance_"):
        user_id_to_edit = int(call.data.split('_')[2])
        handle_balance_change(call, "decrease", user_id_to_edit)
    elif call.data.startswith("admin_manage_listings_"):
        user_id_to_manage = int(call.data.split('_')[3])
        markup = admin_manage_user_listings(user_id_to_manage)
        bot.edit_message_text(f"🔅 PrepaidGCStock — Manage Listings for {users[user_id_to_manage]['username']}", call.message.chat.id, call.message.message_id, reply_markup=markup)
    elif call.data == "manage_all_listings":
        markup = admin_manage_all_listings()
        bot.edit_message_text("🔅 PrepaidGCStock — Manage All Listings", call.message.chat.id, call.message.message_id, reply_markup=markup)
    elif call.data == "profile":
        profile_text, markup = display_profile(user_id)
        bot.send_message(call.message.chat.id, profile_text, reply_markup=markup)
    elif call.data == "deposit_menu":
        markup = deposit_menu(user_id)
        bot.send_message(call.message.chat.id, "Select the cryptocurrency to deposit:", reply_markup=markup)
    elif call.data == "deposit_ltc":
        ltc_address = users[user_id]['ltc_address'] or "Address not set. Please contact support."
        if ltc_address != "Address not set. Please contact support.":
            send_qr_code(call.message.chat.id, ltc_address)
        bot.send_message(call.message.chat.id, f"Please send LTC to the following address:\n\n{ltc_address}")
    elif call.data == "set_deposit_addresses":
        markup = set_deposit_addresses(user_id)
        bot.send_message(call.message.chat.id, "Select a user to set deposit addresses:", reply_markup=markup)
    elif call.data.startswith("set_deposit_"):
        user_id_to_set = int(call.data.split('_')[2])
        msg = bot.send_message(call.message.chat.id, "Enter the LTC address:")
        bot.register_next_step_handler(msg, process_set_deposit_address, user_id_to_set, "ltc")
    elif call.data.startswith("change_price_"):
        listing_id = call.data.split('_')[2]
        msg = bot.send_message(call.message.chat.id, "Enter the new price for the listing:")
        bot.register_next_step_handler(msg, process_change_price, listing_id)
    elif call.data.startswith("delete_listing_"):
        listing_id = call.data.split('_')[3]
        card_listings[:] = [listing for listing in card_listings if listing["card_id"] != listing_id]
        bot.send_message(call.message.chat.id, f"Listing ID {listing_id} has been deleted.")
    elif call.data == "withdraw_menu":  # Handle withdraw menu
        markup = withdraw_menu(user_id)
        bot.send_message(call.message.chat.id, "Select a withdrawal option:", reply_markup=markup)
    elif call.data == "withdraw_ltc":
        handle_withdraw_ltc(call)
    elif call.data == "card_history":
        user = users.get(user_id)
        if user:
            card_history = user['card_history']
            if card_history:
                history_text = "Your Card Purchase History:\n\n"
                for item in card_history:
                    history_text += f"Card ID: {item['card_id']}\nPurchase ID: {item['purchase_id']}\nPrice: ${item['price']:.2f}\nCard: {item['name']}\n\n"
                bot.send_message(call.message.chat.id, history_text)
            else:
                bot.send_message(call.message.chat.id, "You have no card purchase history yet.")
        else:
            bot.send_message(call.message.chat.id, "Profile not found.")

def process_change_price(message, listing_id):
    try:
        new_price = float(message.text.strip())
        for listing in card_listings:
            if listing["card_id"] == listing_id:
                listing["price"] = new_price
                bot.send_message(message.chat.id, f"Listing ID {listing_id} price has been updated to ${new_price:.2f}.")
                break
    except ValueError:
        bot.send_message(message.chat.id, "Invalid price. Please enter a numeric value.")

@bot.message_handler(commands=['start'])
def start(message):
    user_id = message.from_user.id
    # Check if the user has a profile; if not, create one
    if user_id not in users:
        referred_by = None
        if len(message.text.split()) > 1:
            referred_by = int(message.text.split()[1])
        create_user_profile(user_id, message.from_user.username or "Unknown", referred_by)

    bot.send_message(message.chat.id, "🔅 PrepaidGCStock — Main Menu \n\nWelcome Back to PrepaidGCStock — The one place to buy and sell GiftCard.!\n\nHave questions? You can join our FAQ channel @PrepaidGiftCardFAQ and learn on how to use bot and buy giftcards on our secure platform.\n\n📕Channel: @PrepaidGiftCardFAQ\n🆘 Support :@Pstockbot_support\n\n To get started, use one of the options below!", reply_markup=main_menu(user_id))

# Polling
bot.polling()
jQuery(document).ready(function($) {
    $('.toggle-btn').on('click', function() {
        var $this = $(this); // Store the clicked button
        var content = $this.prev('.testicontent'); // Get the related content before the button
        var fullText = content.find('.full-text'); // Find the full text within the content
        var shortText = content.find('.short-text'); // Find the short text within the content

        if (fullText.is(':hidden')) {
            fullText.show();
            shortText.hide();
            $this.text('See Less');
        } else {
            fullText.hide();
            shortText.show();
            $this.text('See More');
        }
    });
});

to hide the short text 




to sho the full text

jQuery(document).ready(function($) {
    $('body').on('click', '.toggle-btn', function() {
        var $this = $(this);
        var content = $this.siblings('.testicontent'); 
        var fullText = content.find('.full-text');
        var shortText = content.find('.short-text');

        // Toggle between showing the full text and short text
        if (fullText.is(':visible')) {
            fullText.hide(); 
            shortText.show(); 
            $this.text('See More'); 
        } else {
            fullText.show(); 
            shortText.hide(); 
            $this.text('See Less'); 
        }
    });
});


this html
<div class="testicontent testi-content">
    <span class="short-text">Serious suction great results This is by far a Brilliant hoover! The suction is amazing I
        have a very hairy dog and my Son's husky stays most weekends. It picks up all the hair easily. I have had many
        branded hoovers, and this one is the most powerful I have used...</span>
    <span class="full-text" style="display: none;">I have had many branded hoovers and this one is the most powerful I
        have used it's been great with my cats' long white fur. No more rubbing carpet edges with a damp cloth! Plus,
        great if you suffer from Asthma or dust allergies; no more sneezing when using it as no dust escapes from it.
        The carpet cleaning is great for intensive cleaning and removes stains effortlessly. All cleaner accessories fit
        neatly into the water tank. It really has been a pleasure cleaning my floors and upholstery with The Aqua +.
        Thank you for choosing me to test out the Thomas Pet & Family cleaner and for making my hoovering a pleasant and
        satisfactory experience.</span>
</div>
<a href="javascript:void(0);" class="toggle-btn">See More</a>
<div id="testicontent" class="testi-content">
    <span class="short-text">Serious suction great results This is by far a Brilliant hoover! The suction is amazing I have a very hairy dog and my Son's husky stays most weekends. It picks up all the hair easily. I have had many branded hoovers, and this one is the most powerful I have used...</span>
    <span class="full-text" style="display: none;">I have had many branded hoovers and this one is the most powerful I have used it's been great with my cats' long white fur. No more rubbing carpet edges with a damp cloth! Plus, great if you suffer from Asthma or dust allergies; no more sneezing when using it as no dust escapes from it. The carpet cleaning is great for intensive cleaning and removes stains effortlessly. All cleaner accessories fit neatly into the water tank. It really has been a pleasure cleaning my floors and upholstery with The Aqua +. Thank you for choosing me to test out the Thomas Pet & Family cleaner and for making my hoovering a pleasant and satisfactory experience.</span>
</div>
<a href="javascript:void(0);" id="toggleBtn" class="toggle-btn">See More</a>
Step 2: jQuery Code

jQuery(document).ready(function($) {
    $('#toggleBtn').on('click', function() {
        var fullText = $('#testicontent .full-text');
        var shortText = $('#testicontent .short-text');

        if (fullText.is(':hidden')) {
            fullText.show();
            shortText.hide();
            $(this).text('See Less');
        } else {
            fullText.hide();
            shortText.show();
            $(this).text('See More');
        }
    });
});
docker run --rm -it \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v  "$(pwd)":"$(pwd)" \
      -w "$(pwd)" \
      -v "$HOME/.dive.yaml":"$HOME/.dive.yaml" \
      wagoodman/dive:latest build -t <some-tag> .
alias dive="docker run -ti --rm  -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive"
dive <your-image-tag>

# for example
dive nginx:latest
Salesforce Metadata Types that Do Not Support Wildcard Characters in Package.xml
November 16, 2021 / Leave a Comment / DevOps
When we want to retrieve or deploy metadata to a Salesforce Org, we use package.xml either with ANT command or using SFDX. And when retrieving metadata from a Salesforce org, it is quite common to use wildcard character asterisk (*) to retrieve everything of that metadata type.

For example, the following is used in package.xml to retrieve metadata about all custom objects.

<?xml version=1.0 encoding=UTF-8 standalone=yes?>
<Package xmlns=http://soap.sforce.com/2006/04/metadata>
    <types>
        <members>*</members>
        <name>CustomObject</name>
    </types>    
    <version>53.0</version>
</Package>
 Save
But do note that some of the metadata type does not support wildcard characters. And even if you put wildcard character in your package.xml, nothing will be retrieved. These metadata types include:

ActionOverride
AnalyticSnapshot
CustomField
CustomLabel
Dashboard
Document
EmailTemplate
Folder
FolderShare
GlobalPicklistValue
Letterhead
ListView
Metadata
MetadataWithContent
NamedFilter
Package
PersonalJouneySettings
Picklist
ProfileActionOverride
RecordType
Report
SearchLayouts
SearchingSettings
SharingBaseRule
SharingReason
SharingRecalculation
StandardValueSet
Territory2Settings
ValidationRule
WebLink
References & Useful URLs
Metadata API Developer Guide -> Metadata Types
wp_set_password('password','admin');
docker system prune [OPTIONS]
--all , -a		Remove all unused images not just dangling ones
--filter		API 1.28+
Provide filter values (e.g. 'label=<key>=<value>')
--force , -f		Do not prompt for confirmation
--volumes		Prune volumes
You can leverage JQ tool to quickly grab the SFDX Auth URL from the command using --json switch.

Still you need to authorize the env

sfdx force:auth:web:login -a al -r https://test.salesforce.com for sandbox or skip -r parameter for production/Developer Edition environment and substitute al with actual desired alias for the org; and then use --json parameter and pass the result to jq command

sfdx force:org:display -u al --verbose --json | jq '.result.sfdxAuthUrl' -r

To install jq, use brew install jq on MacOS.

Share
Improve this answer
Follow
answered Jul 19, 2023 at 15:35

Patlatus
17.4k1313 gold badges7979 silver badges182182 bronze badges
Add a comment

0


Complementary info with respect to @patlatus answer:

The following command can help to obtain the SFDX Auth URL in a temporary file in your local folder. The authorization to the environment is a pre-requisite here as well.

sfdx org:display --target-org alias --verbose --json > authFile.json

where alias is your org alias and authFile.json is the file generated after running the command. Then open the authFile.json file to retrieve the sfdxAuthUrl value. You can delete the file locally afterwards
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
	<types>
		<members>*</members>
		<name>ActionLinkGroupTemplate</name>
	</types>
	<types>
		<members>*</members>
		<name>ApexClass</name>
	</types>
	<types>
		<members>*</members>
		<name>ApexComponent</name>
	</types>
	<types>
		<members>*</members>
		<name>ApexPage</name>
	</types>
	<types>
		<members>*</members>
		<name>ApexTrigger</name>
	</types>
	<types>
		<members>*</members>
		<name>AppMenu</name>
	</types>
	<types>
		<members>*</members>
		<name>ApprovalProcess</name>
	</types>
	<types>
		<members>*</members>
		<name>AssignmentRules</name>
	</types>
	<types>
		<members>*</members>
		<name>AuraDefinitionBundle</name>
	</types>
	<types>
		<members>*</members>
		<name>AuthProvider</name>
	</types>
	<types>
		<members>*</members>
		<name>AutoResponseRules</name>
	</types>
	<types>
		<members>*</members>
		<name>BrandingSet</name>
	</types>
	<types>
		<members>*</members>
		<name>CallCenter</name>
	</types>
	<types>
		<members>*</members>
		<name>Certificate</name>
	</types>
	<types>
		<members>*</members>
		<name>CleanDataService</name>
	</types>
	<types>
		<members>*</members>
		<name>Community</name>
	</types>
	<types>
		<members>*</members>
		<name>ConnectedApp</name>
	</types>
	<types>
		<members>*</members>
		<name>ContentAsset</name>
	</types>
	<types>
		<members>*</members>
		<name>CorsWhitelistOrigin</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomApplication</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomApplicationComponent</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomFeedFilter</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomHelpMenuSection</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomLabels</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomMetadata</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomObject</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomObjectTranslation</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomPageWebLink</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomPermission</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomSite</name>
	</types>
	<types>
		<members>*</members>
		<name>CustomTab</name>
	</types>
	<types>
		<members>*</members>
		<name>Dashboard</name>
	</types>
	<types>
		<members>*</members>
		<name>DataCategoryGroup</name>
	</types>
	<types>
		<members>*</members>
		<name>DelegateGroup</name>
	</types>
	<types>
		<members>*</members>
		<name>Document</name>
	</types>
	<types>
		<members>*</members>
		<name>DuplicateRule</name>
	</types>
	<types>
		<members>*</members>
		<name>EclairGeoData</name>
	</types>
	<types>
		<members>*</members>
		<name>EmailServicesFunction</name>
	</types>
	<types>
		<members>*</members>
		<name>EmailTemplate</name>
	</types>
	<types>
		<members>*</members>
		<name>EscalationRules</name>
	</types>
	<types>
		<members>*</members>
		<name>ExternalDataSource</name>
	</types>
	<types>
		<members>*</members>
		<name>ExternalServiceRegistration</name>
	</types>
	<types>
		<members>*</members>
		<name>FlexiPage</name>
	</types>
	<types>
		<members>*</members>
		<name>Flow</name>
	</types>
	<types>
		<members>*</members>
		<name>FlowCategory</name>
	</types>
	<types>
		<members>*</members>
		<name>FlowDefinition</name>
	</types>
	<types>
		<members>*</members>
		<name>GlobalValueSet</name>
	</types>
	<types>
		<members>*</members>
		<name>GlobalValueSetTranslation</name>
	</types>
	<types>
		<members>*</members>
		<name>HomePageComponent</name>
	</types>
	<types>
		<members>*</members>
		<name>HomePageLayout</name>
	</types>
	<types>
		<members>*</members>
		<name>InstalledPackage</name>
	</types>
	<types>
		<members>*</members>
		<name>Layout</name>
	</types>
	<types>
		<members>*</members>
		<name>Letterhead</name>
	</types>
	<types>
		<members>*</members>
		<name>LightningBolt</name>
	</types>
	<types>
		<members>*</members>
		<name>LightningComponentBundle</name>
	</types>
	<types>
		<members>*</members>
		<name>LightningExperienceTheme</name>
	</types>
	<types>
		<members>*</members>
		<name>MatchingRules</name>
	</types>
	<types>
		<members>*</members>
		<name>NamedCredential</name>
	</types>
	<types>
		<members>*</members>
		<name>NetworkBranding</name>
	</types>
	<types>
		<members>*</members>
		<name>PathAssistant</name>
	</types>
	<types>
		<members>*</members>
		<name>PermissionSet</name>
	</types>
	<types>
		<members>*</members>
		<name>PlatformCachePartition</name>
	</types>
	<types>
		<members>*</members>
		<name>PostTemplate</name>
	</types>
	<types>
		<members>*</members>
		<name>Profile</name>
	</types>
	<types>
		<members>*</members>
		<name>ProfileSessionSetting</name>
	</types>
	<types>
		<members>*</members>
		<name>Queue</name>
	</types>
	<types>
		<members>*</members>
		<name>QuickAction</name>
	</types>
	<types>
		<members>*</members>
		<name>RecommendationStrategy</name>
	</types>
	<types>
		<members>*</members>
		<name>RecordActionDeployment</name>
	</types>
	<types>
		<members>*</members>
		<name>RemoteSiteSetting</name>
	</types>
	<types>
		<members>*</members>
		<name>ReportType</name>
	</types>
	<types>
		<members>*</members>
		<name>Role</name>
	</types>
	<types>
		<members>*</members>
		<name>SamlSsoConfig</name>
	</types>
	<types>
		<members>*</members>
		<name>Scontrol</name>
	</types>
	<types>
		<members>*</members>
		<name>Settings</name>
	</types>
	<types>
		<members>*</members>
		<name>SharingRules</name>
	</types>
	<types>
		<members>*</members>
		<name>SiteDotCom</name>
	</types>
	<types>
		<members>*</members>
		<name>StandardValueSetTranslation</name>
	</types>
	<types>
		<members>*</members>
		<name>StaticResource</name>
	</types>
	<types>
		<members>*</members>
		<name>SynonymDictionary</name>
	</types>
	<types>
		<members>*</members>
		<name>TopicsForObjects</name>
	</types>
	<types>
		<members>*</members>
		<name>TransactionSecurityPolicy</name>
	</types>
	<types>
		<members>*</members>
		<name>Workflow</name>
	</types>
	<version>46.0</version>
</Package>
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: What's on in Melbourne this week! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n Hey Melbourne, happy Monday! Please see below for what's on this week. "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Xero Café :coffee:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n :new-thing: *This week we are offering:* \n\n Coffee Compliments Biscuits, Lemon Yo-Yo Biscuits (GF), and Chocolate + Peppermint Slice (Vegan) \n\n *Weekly Café Special*: _Beetroot Latte_"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": " Wednesday, 11th September :calendar-date-11:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n:late-cake: *Mooncake Festival Afternoon Tea*: From *2pm* in the L3 kitchen + breakout space! \n\n:massage:*Wellbeing - Meditiation & Restorative Yoga*: Confirm your spot <https://docs.google.com/spreadsheets/d/1iKMQtSaawEdJluOmhdi_r_dAifeIg0JGCu7ZSPuwRbo/edit?gid=0#gid=0/|*here*>. Please note we have a maximum of 15 participants per class, a minimum notice period of 2 hours is required if you can no longer attend."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Thursday, 12th September :calendar-date-12:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":breakfast: *Breakfast*: Provided by *Kartel Catering* from *8:30am - 10:30am* in the Wominjeka Breakout Space.\n\n"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*Later this month:* We have our Grand Final Eve-Eve BBQ Social on the 26th of September! Make sure to wear your team colours (can be NRL or AFL) and come along for some fun! \n\nStay tuned to this channel for more details, and make sure you're subscribed to the <https://calendar.google.com/calendar/u/0?cid=Y19xczkyMjk5ZGlsODJzMjA4aGt1b3RnM2t1MEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Melbourne Social Calendar*> :party-wx:"
			}
		}
	]
}
star

Sun Sep 08 2024 12:47:24 GMT+0000 (Coordinated Universal Time)

@codestored #cpp

star

Sun Sep 08 2024 05:32:38 GMT+0000 (Coordinated Universal Time)

@davidmchale #css #map-get #maps #object #loop

star

Sun Sep 08 2024 05:11:37 GMT+0000 (Coordinated Universal Time)

@StefanoGi

star

Sun Sep 08 2024 04:46:36 GMT+0000 (Coordinated Universal Time)

@davidmchale #css #map-get #maps #object #loop #conditionals

star

Sun Sep 08 2024 01:00:06 GMT+0000 (Coordinated Universal Time)

@davidmchale #css #map-get #maps #object

star

Sat Sep 07 2024 23:10:13 GMT+0000 (Coordinated Universal Time)

@Sayed

star

Sat Sep 07 2024 16:55:45 GMT+0000 (Coordinated Universal Time) https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName

@arvindomixgh@ #javascript

star

Sat Sep 07 2024 13:09:16 GMT+0000 (Coordinated Universal Time) https://chatgpt.com/c/66d9c7f1-9ff4-8002-9f5c-fa4060f7338e

@swadhinpaul #python

star

Sat Sep 07 2024 06:21:29 GMT+0000 (Coordinated Universal Time)

@menaheero

star

Sat Sep 07 2024 05:00:50 GMT+0000 (Coordinated Universal Time)

@nikahafiz #bsg.rise #mysql #sql

star

Sat Sep 07 2024 03:54:33 GMT+0000 (Coordinated Universal Time) https://exceloffthegrid.com/vba-for-customlists-autofill-lists/

@acassell

star

Sat Sep 07 2024 03:52:51 GMT+0000 (Coordinated Universal Time) https://exceloffthegrid.com/vba-for-customlists-autofill-lists/

@acassell

star

Sat Sep 07 2024 03:44:36 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/cpp-programming/online-compiler/

@LizzyTheCatto

star

Sat Sep 07 2024 02:07:54 GMT+0000 (Coordinated Universal Time)

@pecku

star

Sat Sep 07 2024 00:10:53 GMT+0000 (Coordinated Universal Time) https://markdown-it.github.io/

@acassell

star

Fri Sep 06 2024 18:24:27 GMT+0000 (Coordinated Universal Time)

@tahasohaill

star

Fri Sep 06 2024 13:49:09 GMT+0000 (Coordinated Universal Time) https://www.ntlite.com/community/index.php?threads/windows-11-setupcomplete-cmd-is-not-working.4773/#post-46440

@Curable1600 #ntlite #windows

star

Fri Sep 06 2024 13:22:56 GMT+0000 (Coordinated Universal Time) https://www.ntlite.com/community/index.php?threads/can-you-figure-this-out-other-user.4774/

@Curable1600 #ntlite #windows

star

Fri Sep 06 2024 12:59:25 GMT+0000 (Coordinated Universal Time) https://komododecks.com/recordings/MJCBACXOvUhFwXj6bxeC

@Y@sir #textrevealeffect] #texteffect #textrevealeffectusinggsap

star

Fri Sep 06 2024 12:29:42 GMT+0000 (Coordinated Universal Time) https://appticz.com/cash-app-clone

@aditi_sharma_

star

Fri Sep 06 2024 12:23:37 GMT+0000 (Coordinated Universal Time)

@mehran

star

Fri Sep 06 2024 12:12:55 GMT+0000 (Coordinated Universal Time)

@Shira

star

Fri Sep 06 2024 11:37:21 GMT+0000 (Coordinated Universal Time) https://www.ukassignmenthelp.uk/

@jamesend015

star

Fri Sep 06 2024 09:53:32 GMT+0000 (Coordinated Universal Time)

@Shira

star

Fri Sep 06 2024 03:29:07 GMT+0000 (Coordinated Universal Time) http://octopi.local/?#temp

@amccall23

star

Fri Sep 06 2024 00:11:25 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/44524888/returning-the-first-model-from-a-hasmany-relationship-in-laravel

@xsirlalo #php

star

Thu Sep 05 2024 20:41:16 GMT+0000 (Coordinated Universal Time)

@ronak

star

Thu Sep 05 2024 19:29:40 GMT+0000 (Coordinated Universal Time) https://mtr-design.com/news/salesforce-mini-how-to-open-a-subtab-in-console-from-lightning-web-component#:~:text=For%20this%20solution%20we%20will,record%20in%20a%20new%20subtab.&text=

@gbritgs

star

Thu Sep 05 2024 19:18:38 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Thu Sep 05 2024 19:18:01 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Thu Sep 05 2024 16:35:09 GMT+0000 (Coordinated Universal Time) https://github.com/bigtreetech/kiauh

@amccall23

star

Thu Sep 05 2024 16:30:30 GMT+0000 (Coordinated Universal Time) https://github.com/bigtreetech/kiauh

@amccall23

star

Thu Sep 05 2024 15:23:41 GMT+0000 (Coordinated Universal Time) https://replit.com/@rahmatali957600/AdolescentFamousCharmap

@Rahmat957

star

Thu Sep 05 2024 15:22:15 GMT+0000 (Coordinated Universal Time)

@Rahmat957

star

Thu Sep 05 2024 14:40:57 GMT+0000 (Coordinated Universal Time)

@BilalRaza12

star

Thu Sep 05 2024 14:24:32 GMT+0000 (Coordinated Universal Time)

@BilalRaza12

star

Thu Sep 05 2024 10:19:32 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/blockchain-app-development-cost/

@AaronMG ##blockchain#startups #bitcoin #cryptocurrencies #btc #fintech #blockchainsolutions #blocchainapplications

star

Thu Sep 05 2024 09:37:52 GMT+0000 (Coordinated Universal Time) https://github.com/wagoodman/dive

@icao21

star

Thu Sep 05 2024 09:37:50 GMT+0000 (Coordinated Universal Time) https://github.com/wagoodman/dive

@icao21

star

Thu Sep 05 2024 09:37:45 GMT+0000 (Coordinated Universal Time) https://github.com/wagoodman/dive

@icao21

star

Thu Sep 05 2024 09:37:39 GMT+0000 (Coordinated Universal Time) https://github.com/wagoodman/dive

@icao21

star

Thu Sep 05 2024 09:37:35 GMT+0000 (Coordinated Universal Time) https://github.com/wagoodman/dive

@icao21

star

Thu Sep 05 2024 09:26:10 GMT+0000 (Coordinated Universal Time) https://learn.microsoft.com/en-us/visualstudio/docker/tutorials/docker-tutorial

@icao21

star

Thu Sep 05 2024 08:54:19 GMT+0000 (Coordinated Universal Time) https://www.asagarwal.com/salesforce-metadata-types-that-do-not-support-wildcard-characters-in-package-xml/

@WayneChung

star

Thu Sep 05 2024 07:32:16 GMT+0000 (Coordinated Universal Time)

@hamzahanif192

star

Thu Sep 05 2024 07:13:16 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@amelmnd #shell

star

Thu Sep 05 2024 07:12:34 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@amelmnd #shell #docker

star

Thu Sep 05 2024 06:40:58 GMT+0000 (Coordinated Universal Time) https://salesforce.stackexchange.com/questions/407406/how-can-i-quickly-fetch-or-grab-sfdx-auth-url

@WayneChung

star

Thu Sep 05 2024 06:33:30 GMT+0000 (Coordinated Universal Time) https://salesforcediaries.com/2019/09/09/xml-package-to-retrieve-metadata-from-org/

@WayneChung #html

star

Thu Sep 05 2024 04:56:28 GMT+0000 (Coordinated Universal Time)

@WXAPAC

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension