Snippets Collections
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:"
			}
		}
	]
}
sudo service klipper stop
make flash FLASH_DEVICE=first
sudo service klipper start
sudo service klipper stop
make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
sudo service klipper start
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
# This file contains common pin mappings for the Biqu B1 SE Plus.
# To use this config, the firmware should be compiled for the
# STM32F407 with a "32KiB bootloader".

# In newer versions of this board shipped in late 2021 the STM32F429
# is used, if this is the case compile for this with a "32KiB bootloader"
# You will need to check the chip on your board to identify which you have.
#
# The "make flash" command does not work on the SKR 2. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR 2
# with that SD card.

# See docs/Config_Reference.md for a description of parameters.

[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_1D0039000F47393438343535-if00

########################################
# Stepper X Pins and TMC2208 configuration
@font-face {
  font-family: "Joane-SemiBold";
  src: url('{{ "Joane-SemiBold.otf" | file_url }}') format("otf");
       
}
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim oauth2 As New ChilkatOAuth2
Dim success As Long

' This should be the port in the localhost callback URL for your app.  
' The callback URL would look like "http://localhost:3017/" if the port number is 3017.
oauth2.ListenPort = 3017

oauth2.AuthorizationEndpoint = "https://github.com/login/oauth/authorize"
oauth2.TokenEndpoint = "https://github.com/login/oauth/access_token"

' Replace these with actual values.
oauth2.ClientId = "GITHUB-CLIENT-ID"
oauth2.ClientSecret = "GITHUB-CLIENT-SECRET"

oauth2.CodeChallenge = 1
oauth2.CodeChallengeMethod = "S256"

' Begin the OAuth2 three-legged flow.  This returns a URL that should be loaded in a browser.
Dim url As String
url = oauth2.StartAuth()
If (oauth2.LastMethodSuccess <> 1) Then
    Debug.Print oauth2.LastErrorText
    Exit Sub
End If

' At this point, your application should load the URL in a browser.
' For example, 
' in C#:  System.Diagnostics.Process.Start(url);
' in Java: Desktop.getDesktop().browse(new URI(url));
' in VBScript: Set wsh=WScript.CreateObject("WScript.Shell")
'              wsh.Run url
' in Xojo: ShowURL(url)  (see http://docs.xojo.com/index.php/ShowURL)
' in Dataflex: Runprogram Background "c:\Program Files\Internet Explorer\iexplore.exe" sUrl        
' The GitHub account owner would interactively accept or deny the authorization request.

' Add the code to load the url in a web browser here...
' Add the code to load the url in a web browser here...
' Add the code to load the url in a web browser here...

' Now wait for the authorization.
' We'll wait for a max of 30 seconds.
Dim numMsWaited As Long
numMsWaited = 0
Do While (numMsWaited < 30000) And (oauth2.AuthFlowState < 3)
    oauth2.SleepMs 100
    numMsWaited = numMsWaited + 100
Loop

' If there was no response from the browser within 30 seconds, then 
' the AuthFlowState will be equal to 1 or 2.
' 1: Waiting for Redirect. The OAuth2 background thread is waiting to receive the redirect HTTP request from the browser.
' 2: Waiting for Final Response. The OAuth2 background thread is waiting for the final access token response.
' In that case, cancel the background task started in the call to StartAuth.
If (oauth2.AuthFlowState < 3) Then
    success = oauth2.Cancel()
    Debug.Print "No response from the browser!"
    Exit Sub
End If

' Check the AuthFlowState to see if authorization was granted, denied, or if some error occurred
' The possible AuthFlowState values are:
' 3: Completed with Success. The OAuth2 flow has completed, the background thread exited, and the successful JSON response is available in AccessTokenResponse property.
' 4: Completed with Access Denied. The OAuth2 flow has completed, the background thread exited, and the error JSON is available in AccessTokenResponse property.
' 5: Failed Prior to Completion. The OAuth2 flow failed to complete, the background thread exited, and the error information is available in the FailureInfo property.
If (oauth2.AuthFlowState = 5) Then
    Debug.Print "OAuth2 failed to complete."
    Debug.Print oauth2.FailureInfo
    Exit Sub
End If

If (oauth2.AuthFlowState = 4) Then
    Debug.Print "OAuth2 authorization was denied."
    Debug.Print oauth2.AccessTokenResponse
    Exit Sub
End If

If (oauth2.AuthFlowState <> 3) Then
    Debug.Print "Unexpected AuthFlowState:" & oauth2.AuthFlowState
    Exit Sub
End If

Debug.Print "OAuth2 authorization granted!"
Debug.Print "Access Token = " & oauth2.AccessToken
import sys
import chilkat2

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = chilkat2.Http()

# Implements the following CURL command:

# curl -X GET --user wp_username:app_password https://www.yoursite.com/wp-json/wp/v2/posts?page=1

# Use the following online tool to generate HTTP code from a CURL command
# Convert a cURL Command to HTTP Source Code

# Use your WordPress login, such as "admin", not the application name.
http.Login = "wp_username"
# Use the application password, such as "Nths RwVH eDJ4 weNZ orMN jabq"
http.Password = "app_password"
http.BasicAuth = True

sbResponseBody = chilkat2.StringBuilder()
success = http.QuickGetSb("https://www.yoursite.com/wp-json/wp/v2/posts?page=1",sbResponseBody)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

jarrResp = chilkat2.JsonArray()
jarrResp.LoadSb(sbResponseBody)
jarrResp.EmitCompact = False

print("Response Body:")
print(jarrResp.Emit())

respStatusCode = http.LastStatus
print("Response Status Code = " + str(respStatusCode))
if (respStatusCode >= 400):
    print("Response Header:")
    print(http.LastHeader)
    print("Failed.")
    sys.exit()

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# [
#   {
#     "id": 1902,
#     "date": "2020-11-16T09:54:09",
#     "date_gmt": "2020-11-16T16:54:09",
#     "guid": {
#       "rendered": "http:\/\/cknotes.com\/?p=1902"
#     },
#     "modified": "2020-11-16T09:54:09",
#     "modified_gmt": "2020-11-16T16:54:09",
#     "slug": "xero-redirect-uri-for-oauth2-and-desktop-apps",
#     "status": "publish",
#     "type": "post",
#     "link": "https:\/\/cknotes.com\/xero-redirect-uri-for-oauth2-and-desktop-apps\/",
#     "title": {
#       "rendered": "Xero Redirect URI for OAuth2 and Desktop Apps"
#     },
#     "content": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "excerpt": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "author": 1,
#     "featured_media": 0,
#     "comment_status": "closed",
#     "ping_status": "open",
#     "sticky": false,
#     "template": "",
#     "format": "standard",
#     "meta": [
#     ],
#     "categories": [
#       815
#     ],
#     "tags": [
#       594,
#       816
#     ],
#     "_links": {
#       "self": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902"
#         }
#       ],
#       "collection": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts"
#         }
#       ],
#       "about": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/post"
#         }
#       ],
#       "author": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
#         }
#       ],
#       "replies": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1902"
#         }
#       ],
#       "version-history": [
#         {
#           "count": 1,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"
#         }
#       ],
#       "predecessor-version": [
#         {
#           "id": 1904,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1904"
#         }
#       ],
#       "wp:attachment": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media?parent=1902"
#         }
#       ],
#       "wp:term": [
#         {
#           "taxonomy": "category",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/categories?post=1902"
#         },
#         {
#           "taxonomy": "post_tag",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/tags?post=1902"
#         }
#       ],
#       "curies": [
#         {
#           "name": "wp",
#           "href": "https:\/\/api.w.org\/{rel}",
#           "templated": true
#         }
#       ]
#     }
#   },
# ...
# ]

# Sample code for parsing the JSON response...
# Use the following online tool to generate parsing code from sample JSON:
# Generate Parsing Code from JSON

date_gmt = chilkat2.DtObj()

i = 0
count_i = jarrResp.Size
while i < count_i :
    # json is a CkJsonObject
    json = jarrResp.ObjectAt(i)
    id = json.IntOf("id")
    date = json.StringOf("date")
    json.DtOf("date_gmt",False,date_gmt)
    guidRendered = json.StringOf("guid.rendered")
    modified = json.StringOf("modified")
    modified_gmt = json.StringOf("modified_gmt")
    slug = json.StringOf("slug")
    status = json.StringOf("status")
    v_type = json.StringOf("type")
    link = json.StringOf("link")
    titleRendered = json.StringOf("title.rendered")
    contentRendered = json.StringOf("content.rendered")
    contentProtected = json.BoolOf("content.protected")
    excerptRendered = json.StringOf("excerpt.rendered")
    excerptProtected = json.BoolOf("excerpt.protected")
    author = json.IntOf("author")
    featured_media = json.IntOf("featured_media")
    comment_status = json.StringOf("comment_status")
    ping_status = json.StringOf("ping_status")
    sticky = json.BoolOf("sticky")
    template = json.StringOf("template")
    format = json.StringOf("format")
    j = 0
    count_j = json.SizeOfArray("meta")
    while j < count_j :
        json.J = j
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("categories")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("categories[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("tags")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("tags[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.self")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.self[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.collection")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.collection[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.about")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.about[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.author")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.author[j].embeddable")
        href = json.StringOf("_links.author[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.replies")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.replies[j].embeddable")
        href = json.StringOf("_links.replies[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.version-history")
    while j < count_j :
        json.J = j
        count = json.IntOf("_links.version-history[j].count")
        href = json.StringOf("_links.version-history[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.predecessor-version")
    while j < count_j :
        json.J = j
        id = json.IntOf("_links.predecessor-version[j].id")
        href = json.StringOf("_links.predecessor-version[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:attachment")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.wp:attachment[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:term")
    while j < count_j :
        json.J = j
        taxonomy = json.StringOf("_links.wp:term[j].taxonomy")
        embeddable = json.BoolOf("_links.wp:term[j].embeddable")
        href = json.StringOf("_links.wp:term[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.curies")
    while j < count_j :
        json.J = j
        name = json.StringOf("_links.curies[j].name")
        href = json.StringOf("_links.curies[j].href")
        templated = json.BoolOf("_links.curies[j].templated")
        j = j + 1

    i = i + 1


import sys
import chilkat2

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = chilkat2.Http()

# Implements the following CURL command:

# curl -X GET --user wp_username:wp_password https://www.yoursite.com/wp-json/wp/v2/posts?page=1

# Use the following online tool to generate HTTP code from a CURL command
# Convert a cURL Command to HTTP Source Code

http.Login = "wp_username"
http.Password = "wp_password"
http.BasicAuth = True

sbResponseBody = chilkat2.StringBuilder()
success = http.QuickGetSb("https://www.yoursite.com/wp-json/wp/v2/posts?page=1",sbResponseBody)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

jarrResp = chilkat2.JsonArray()
jarrResp.LoadSb(sbResponseBody)
jarrResp.EmitCompact = False

print("Response Body:")
print(jarrResp.Emit())

respStatusCode = http.LastStatus
print("Response Status Code = " + str(respStatusCode))
if (respStatusCode >= 400):
    print("Response Header:")
    print(http.LastHeader)
    print("Failed.")
    sys.exit()

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# [
#   {
#     "id": 1902,
#     "date": "2020-11-16T09:54:09",
#     "date_gmt": "2020-11-16T16:54:09",
#     "guid": {
#       "rendered": "http:\/\/cknotes.com\/?p=1902"
#     },
#     "modified": "2020-11-16T09:54:09",
#     "modified_gmt": "2020-11-16T16:54:09",
#     "slug": "xero-redirect-uri-for-oauth2-and-desktop-apps",
#     "status": "publish",
#     "type": "post",
#     "link": "https:\/\/cknotes.com\/xero-redirect-uri-for-oauth2-and-desktop-apps\/",
#     "title": {
#       "rendered": "Xero Redirect URI for OAuth2 and Desktop Apps"
#     },
#     "content": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "excerpt": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "author": 1,
#     "featured_media": 0,
#     "comment_status": "closed",
#     "ping_status": "open",
#     "sticky": false,
#     "template": "",
#     "format": "standard",
#     "meta": [
#     ],
#     "categories": [
#       815
#     ],
#     "tags": [
#       594,
#       816
#     ],
#     "_links": {
#       "self": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902"
#         }
#       ],
#       "collection": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts"
#         }
#       ],
#       "about": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/post"
#         }
#       ],
#       "author": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
#         }
#       ],
#       "replies": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1902"
#         }
#       ],
#       "version-history": [
#         {
#           "count": 1,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"
#         }
#       ],
#       "predecessor-version": [
#         {
#           "id": 1904,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1904"
#         }
#       ],
#       "wp:attachment": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media?parent=1902"
#         }
#       ],
#       "wp:term": [
#         {
#           "taxonomy": "category",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/categories?post=1902"
#         },
#         {
#           "taxonomy": "post_tag",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/tags?post=1902"
#         }
#       ],
#       "curies": [
#         {
#           "name": "wp",
#           "href": "https:\/\/api.w.org\/{rel}",
#           "templated": true
#         }
#       ]
#     }
#   },
# ...
# ]

# Sample code for parsing the JSON response...
# Use the following online tool to generate parsing code from sample JSON:
# Generate Parsing Code from JSON

date_gmt = chilkat2.DtObj()

i = 0
count_i = jarrResp.Size
while i < count_i :
    # json is a CkJsonObject
    json = jarrResp.ObjectAt(i)
    id = json.IntOf("id")
    date = json.StringOf("date")
    json.DtOf("date_gmt",False,date_gmt)
    guidRendered = json.StringOf("guid.rendered")
    modified = json.StringOf("modified")
    modified_gmt = json.StringOf("modified_gmt")
    slug = json.StringOf("slug")
    status = json.StringOf("status")
    v_type = json.StringOf("type")
    link = json.StringOf("link")
    titleRendered = json.StringOf("title.rendered")
    contentRendered = json.StringOf("content.rendered")
    contentProtected = json.BoolOf("content.protected")
    excerptRendered = json.StringOf("excerpt.rendered")
    excerptProtected = json.BoolOf("excerpt.protected")
    author = json.IntOf("author")
    featured_media = json.IntOf("featured_media")
    comment_status = json.StringOf("comment_status")
    ping_status = json.StringOf("ping_status")
    sticky = json.BoolOf("sticky")
    template = json.StringOf("template")
    format = json.StringOf("format")
    j = 0
    count_j = json.SizeOfArray("meta")
    while j < count_j :
        json.J = j
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("categories")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("categories[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("tags")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("tags[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.self")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.self[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.collection")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.collection[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.about")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.about[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.author")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.author[j].embeddable")
        href = json.StringOf("_links.author[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.replies")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.replies[j].embeddable")
        href = json.StringOf("_links.replies[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.version-history")
    while j < count_j :
        json.J = j
        count = json.IntOf("_links.version-history[j].count")
        href = json.StringOf("_links.version-history[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.predecessor-version")
    while j < count_j :
        json.J = j
        id = json.IntOf("_links.predecessor-version[j].id")
        href = json.StringOf("_links.predecessor-version[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:attachment")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.wp:attachment[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:term")
    while j < count_j :
        json.J = j
        taxonomy = json.StringOf("_links.wp:term[j].taxonomy")
        embeddable = json.BoolOf("_links.wp:term[j].embeddable")
        href = json.StringOf("_links.wp:term[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.curies")
    while j < count_j :
        json.J = j
        name = json.StringOf("_links.curies[j].name")
        href = json.StringOf("_links.curies[j].href")
        templated = json.BoolOf("_links.curies[j].templated")
        j = j + 1

    i = i + 1


import sys
import chilkat2

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = chilkat2.Http()

# Use your API key here, such as TaVFjSBu8IMR0MbvZNn7A6P04GXrbtHm
# This causes the "Authorization: Bearer <api_key>" header to be added to each HTTP request.
http.AuthToken = "api_key"

sbResponseBody = chilkat2.StringBuilder()
success = http.QuickGetSb("https://www.yoursite.com/wp-json/wp/v2/posts?page=1",sbResponseBody)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

jarrResp = chilkat2.JsonArray()
jarrResp.LoadSb(sbResponseBody)
jarrResp.EmitCompact = False

print("Response Body:")
print(jarrResp.Emit())

respStatusCode = http.LastStatus
print("Response Status Code = " + str(respStatusCode))
if (respStatusCode >= 400):
    print("Response Header:")
    print(http.LastHeader)
    print("Failed.")
    sys.exit()

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# [
#   {
#     "id": 1902,
#     "date": "2020-11-16T09:54:09",
#     "date_gmt": "2020-11-16T16:54:09",
#     "guid": {
#       "rendered": "http:\/\/cknotes.com\/?p=1902"
#     },
#     "modified": "2020-11-16T09:54:09",
#     "modified_gmt": "2020-11-16T16:54:09",
#     "slug": "xero-redirect-uri-for-oauth2-and-desktop-apps",
#     "status": "publish",
#     "type": "post",
#     "link": "https:\/\/cknotes.com\/xero-redirect-uri-for-oauth2-and-desktop-apps\/",
#     "title": {
#       "rendered": "Xero Redirect URI for OAuth2 and Desktop Apps"
#     },
#     "content": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "excerpt": {
#       "rendered": "<p>...",
#       "protected": false
#     },
#     "author": 1,
#     "featured_media": 0,
#     "comment_status": "closed",
#     "ping_status": "open",
#     "sticky": false,
#     "template": "",
#     "format": "standard",
#     "meta": [
#     ],
#     "categories": [
#       815
#     ],
#     "tags": [
#       594,
#       816
#     ],
#     "_links": {
#       "self": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902"
#         }
#       ],
#       "collection": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts"
#         }
#       ],
#       "about": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/post"
#         }
#       ],
#       "author": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
#         }
#       ],
#       "replies": [
#         {
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1902"
#         }
#       ],
#       "version-history": [
#         {
#           "count": 1,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"
#         }
#       ],
#       "predecessor-version": [
#         {
#           "id": 1904,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1904"
#         }
#       ],
#       "wp:attachment": [
#         {
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media?parent=1902"
#         }
#       ],
#       "wp:term": [
#         {
#           "taxonomy": "category",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/categories?post=1902"
#         },
#         {
#           "taxonomy": "post_tag",
#           "embeddable": true,
#           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/tags?post=1902"
#         }
#       ],
#       "curies": [
#         {
#           "name": "wp",
#           "href": "https:\/\/api.w.org\/{rel}",
#           "templated": true
#         }
#       ]
#     }
#   },
# ...
# ]

# Sample code for parsing the JSON response...
# Use the following online tool to generate parsing code from sample JSON:
# Generate Parsing Code from JSON

date_gmt = chilkat2.DtObj()

i = 0
count_i = jarrResp.Size
while i < count_i :
    # json is a CkJsonObject
    json = jarrResp.ObjectAt(i)
    id = json.IntOf("id")
    date = json.StringOf("date")
    json.DtOf("date_gmt",False,date_gmt)
    guidRendered = json.StringOf("guid.rendered")
    modified = json.StringOf("modified")
    modified_gmt = json.StringOf("modified_gmt")
    slug = json.StringOf("slug")
    status = json.StringOf("status")
    v_type = json.StringOf("type")
    link = json.StringOf("link")
    titleRendered = json.StringOf("title.rendered")
    contentRendered = json.StringOf("content.rendered")
    contentProtected = json.BoolOf("content.protected")
    excerptRendered = json.StringOf("excerpt.rendered")
    excerptProtected = json.BoolOf("excerpt.protected")
    author = json.IntOf("author")
    featured_media = json.IntOf("featured_media")
    comment_status = json.StringOf("comment_status")
    ping_status = json.StringOf("ping_status")
    sticky = json.BoolOf("sticky")
    template = json.StringOf("template")
    format = json.StringOf("format")
    j = 0
    count_j = json.SizeOfArray("meta")
    while j < count_j :
        json.J = j
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("categories")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("categories[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("tags")
    while j < count_j :
        json.J = j
        intVal = json.IntOf("tags[j]")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.self")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.self[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.collection")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.collection[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.about")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.about[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.author")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.author[j].embeddable")
        href = json.StringOf("_links.author[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.replies")
    while j < count_j :
        json.J = j
        embeddable = json.BoolOf("_links.replies[j].embeddable")
        href = json.StringOf("_links.replies[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.version-history")
    while j < count_j :
        json.J = j
        count = json.IntOf("_links.version-history[j].count")
        href = json.StringOf("_links.version-history[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.predecessor-version")
    while j < count_j :
        json.J = j
        id = json.IntOf("_links.predecessor-version[j].id")
        href = json.StringOf("_links.predecessor-version[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:attachment")
    while j < count_j :
        json.J = j
        href = json.StringOf("_links.wp:attachment[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.wp:term")
    while j < count_j :
        json.J = j
        taxonomy = json.StringOf("_links.wp:term[j].taxonomy")
        embeddable = json.BoolOf("_links.wp:term[j].embeddable")
        href = json.StringOf("_links.wp:term[j].href")
        j = j + 1

    j = 0
    count_j = json.SizeOfArray("_links.curies")
    while j < count_j :
        json.J = j
        name = json.StringOf("_links.curies[j].name")
        href = json.StringOf("_links.curies[j].href")
        templated = json.BoolOf("_links.curies[j].templated")
        j = j + 1

    i = i + 1


<?php

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

$http = new COM("Chilkat_9_5_0.Http");

// Implements the following CURL command:

// curl -X GET --user wp_username:wp_password https://www.yoursite.com/wp-json/wp/v2/posts?page=1

// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code

$http->Login = 'wp_username';
$http->Password = 'wp_password';
$http->BasicAuth = 1;

$sbResponseBody = new COM("Chilkat_9_5_0.StringBuilder");
$success = $http->QuickGetSb('https://www.yoursite.com/wp-json/wp/v2/posts?page=1',$sbResponseBody);
if ($success == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

$jarrResp = new COM("Chilkat_9_5_0.JsonArray");
$jarrResp->LoadSb($sbResponseBody);
$jarrResp->EmitCompact = 0;

print 'Response Body:' . "\n";
print $jarrResp->emit() . "\n";

$respStatusCode = $http->LastStatus;
print 'Response Status Code = ' . $respStatusCode . "\n";
if ($respStatusCode >= 400) {
    print 'Response Header:' . "\n";
    print $http->LastHeader . "\n";
    print 'Failed.' . "\n";
    exit;
}

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// [
//   {
//     "id": 1902,
//     "date": "2020-11-16T09:54:09",
//     "date_gmt": "2020-11-16T16:54:09",
//     "guid": {
//       "rendered": "http:\/\/cknotes.com\/?p=1902"
//     },
//     "modified": "2020-11-16T09:54:09",
//     "modified_gmt": "2020-11-16T16:54:09",
//     "slug": "xero-redirect-uri-for-oauth2-and-desktop-apps",
//     "status": "publish",
//     "type": "post",
//     "link": "https:\/\/cknotes.com\/xero-redirect-uri-for-oauth2-and-desktop-apps\/",
//     "title": {
//       "rendered": "Xero Redirect URI for OAuth2 and Desktop Apps"
//     },
//     "content": {
//       "rendered": "<p>...",
//       "protected": false
//     },
//     "excerpt": {
//       "rendered": "<p>...",
//       "protected": false
//     },
//     "author": 1,
//     "featured_media": 0,
//     "comment_status": "closed",
//     "ping_status": "open",
//     "sticky": false,
//     "template": "",
//     "format": "standard",
//     "meta": [
//     ],
//     "categories": [
//       815
//     ],
//     "tags": [
//       594,
//       816
//     ],
//     "_links": {
//       "self": [
//         {
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902"
//         }
//       ],
//       "collection": [
//         {
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts"
//         }
//       ],
//       "about": [
//         {
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/post"
//         }
//       ],
//       "author": [
//         {
//           "embeddable": true,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
//         }
//       ],
//       "replies": [
//         {
//           "embeddable": true,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1902"
//         }
//       ],
//       "version-history": [
//         {
//           "count": 1,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"
//         }
//       ],
//       "predecessor-version": [
//         {
//           "id": 1904,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1904"
//         }
//       ],
//       "wp:attachment": [
//         {
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media?parent=1902"
//         }
//       ],
//       "wp:term": [
//         {
//           "taxonomy": "category",
//           "embeddable": true,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/categories?post=1902"
//         },
//         {
//           "taxonomy": "post_tag",
//           "embeddable": true,
//           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/tags?post=1902"
//         }
//       ],
//       "curies": [
//         {
//           "name": "wp",
//           "href": "https:\/\/api.w.org\/{rel}",
//           "templated": true
//         }
//       ]
//     }
//   },
// ...
// ]

// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON

$date_gmt = new COM("Chilkat_9_5_0.DtObj");

$i = 0;
$count_i = $jarrResp->Size;
while ($i < $count_i) {
    // json is a Chilkat_9_5_0.JsonObject
    $json = $jarrResp->ObjectAt($i);
    $id = $json->IntOf('id');
    $date = $json->stringOf('date');
    $json->DtOf('date_gmt',0,$date_gmt);
    $guidRendered = $json->stringOf('guid.rendered');
    $modified = $json->stringOf('modified');
    $modified_gmt = $json->stringOf('modified_gmt');
    $slug = $json->stringOf('slug');
    $status = $json->stringOf('status');
    $v_type = $json->stringOf('type');
    $link = $json->stringOf('link');
    $titleRendered = $json->stringOf('title.rendered');
    $contentRendered = $json->stringOf('content.rendered');
    $contentProtected = $json->BoolOf('content.protected');
    $excerptRendered = $json->stringOf('excerpt.rendered');
    $excerptProtected = $json->BoolOf('excerpt.protected');
    $author = $json->IntOf('author');
    $featured_media = $json->IntOf('featured_media');
    $comment_status = $json->stringOf('comment_status');
    $ping_status = $json->stringOf('ping_status');
    $sticky = $json->BoolOf('sticky');
    $template = $json->stringOf('template');
    $format = $json->stringOf('format');
    $j = 0;
    $count_j = $json->SizeOfArray('meta');
    while ($j < $count_j) {
        $json->J = $j;
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('categories');
    while ($j < $count_j) {
        $json->J = $j;
        $intVal = $json->IntOf('categories[j]');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('tags');
    while ($j < $count_j) {
        $json->J = $j;
        $intVal = $json->IntOf('tags[j]');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.self');
    while ($j < $count_j) {
        $json->J = $j;
        $href = $json->stringOf('_links.self[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.collection');
    while ($j < $count_j) {
        $json->J = $j;
        $href = $json->stringOf('_links.collection[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.about');
    while ($j < $count_j) {
        $json->J = $j;
        $href = $json->stringOf('_links.about[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.author');
    while ($j < $count_j) {
        $json->J = $j;
        $embeddable = $json->BoolOf('_links.author[j].embeddable');
        $href = $json->stringOf('_links.author[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.replies');
    while ($j < $count_j) {
        $json->J = $j;
        $embeddable = $json->BoolOf('_links.replies[j].embeddable');
        $href = $json->stringOf('_links.replies[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.version-history');
    while ($j < $count_j) {
        $json->J = $j;
        $count = $json->IntOf('_links.version-history[j].count');
        $href = $json->stringOf('_links.version-history[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.predecessor-version');
    while ($j < $count_j) {
        $json->J = $j;
        $id = $json->IntOf('_links.predecessor-version[j].id');
        $href = $json->stringOf('_links.predecessor-version[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.wp:attachment');
    while ($j < $count_j) {
        $json->J = $j;
        $href = $json->stringOf('_links.wp:attachment[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.wp:term');
    while ($j < $count_j) {
        $json->J = $j;
        $taxonomy = $json->stringOf('_links.wp:term[j].taxonomy');
        $embeddable = $json->BoolOf('_links.wp:term[j].embeddable');
        $href = $json->stringOf('_links.wp:term[j].href');
        $j = $j + 1;
    }

    $j = 0;
    $count_j = $json->SizeOfArray('_links.curies');
    while ($j < $count_j) {
        $json->J = $j;
        $name = $json->stringOf('_links.curies[j].name');
        $href = $json->stringOf('_links.curies[j].href');
        $templated = $json->BoolOf('_links.curies[j].templated');
        $j = $j + 1;
    }

    $i = $i + 1;
}


?>

from stripe import StripeClient

client = StripeClient("sk_test_...")

# list customers
customers = client.customers.list()

# print the first customer's email
print(customers.data[0].email)

# retrieve specific Customer
customer = client.customers.retrieve("cus_123456789")

# print that customer's email
print(customer.email)
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Blank template</title>
        <!-- Load external CSS styles -->
        <link rel="stylesheet" href="styles.css">
    </head>
    <body>
        <h1>My awesome space</h1>
        <!-- Load external JavaScript -->
        <script src="scripts.js"></script>     
    </body>
</html>
1. Utilizar el widget TextArea con la propiedad autoSize:

use yii\widgets\ActiveForm;
use yii\widgets\TextArea;

$form = ActiveForm::begin();

echo $form->field($model, 'my_field')->widget(TextArea::class, [
    'options' => [
        'rows' => 3,
        'style' => 'resize:none;', // Deshabilita el redimensionamiento manual
    ],
    'pluginOptions' => [
        'autoSize' => [
            'enable' => true,
            'maxLines' => 5, // Número máximo de líneas
            'minLines' => 3, // Número mínimo de líneas
        ],
    ],
]);

ActiveForm::end();

2. Utilizar el widget TinyMCE con la propiedad autogrow:

use dosamigos\tinymce\TinyMce;

echo $form->field($model, 'my_field')->widget(TinyMce::class, [
    'options' => [
        'rows' => 3,
    ],
    'pluginOptions' => [
        'autogrow_onload' => true,
        'autogrow_minimum_height' => 100,
        'autogrow_maximum_height' => 400,
        'autogrow_bottom_margin' => 20,
    ],
]);

3. Utilizar JavaScript para ajustar automáticamente el tamaño del campo:

use yii\helpers\Html;

echo Html::activeTextArea($model, 'my_field', [
    'rows' => 3,
    'style' => 'resize:none;', // Deshabilita el redimensionamiento manual
    'onInput' => 'this.style.height = this.scrollHeight + "px";',
]);
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
* {
  box-sizing: border-box;
}
​
/* Create two equal columns that floats next to each other */
.column {
  float: left;
  width: 50%;
  padding: 10px;
}
​
/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}
/* Style the buttons */
.btn {
  border: none;
  outline: none;
  padding: 12px 16px;
  background-color: #f1f1f1;
  cursor: pointer;
}
​
.btn:hover {
  background-color: #ddd;
}
​
.btn.active {
  background-color: #666;
  color: white;
}
</style>
</head>
<body>
sudo apt install kube-linter
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

' An Office365 OAuth2 access token must first be obtained prior
' to running this code.

' Getting the OAuth2 access token for the 1st time requires the O365 account owner's 
' interactive authorizaition via a web browser.  Afterwards, the access token
' can be repeatedly refreshed automatically.

' See the following examples for getting and refreshing an OAuth2 access token

' Get Office365 SMTP/IMAP/POP3 OAuth2 Access Token
' Refresh Office365 SMTP/IMAP/POP3 OAuth2 Access Token

' First get our previously obtained OAuth2 access token.
set jsonToken = CreateObject("Chilkat_9_5_0.JsonObject")
success = jsonToken.LoadFile("qa_data/tokens/office365.json")
If (success = 0) Then
    outFile.WriteLine("Failed to open the office365 OAuth JSON file.")
    WScript.Quit
End If

set imap = CreateObject("Chilkat_9_5_0.Imap")

imap.Ssl = 1
imap.Port = 993

' Connect to the Office365 IMAP server.
success = imap.Connect("outlook.office365.com")
If (success <> 1) Then
    outFile.WriteLine(imap.LastErrorText)
    WScript.Quit
End If

' Use OAuth2 authentication.
imap.AuthMethod = "XOAUTH2"

' Login using our username (i.e. email address) and the access token for the password.
success = imap.Login("OFFICE365_EMAIL_ADDRESS",jsonToken.StringOf("access_token"))
If (success <> 1) Then
    outFile.WriteLine(imap.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine("O365 OAuth authentication is successful.")

' The ListMailboxes method returns a Mailboxes object
' that contains the collection of mailboxes.
' It accepts two arguments: a refName and a wildcardedMailbox.

refName = ""
' refName is usually set to an empty string.
' A non-empty reference name argument is the name of a mailbox or a level of
' mailbox hierarchy, and indicates the context in which the mailbox
' name is interpreted.

' Select all mailboxes matching this pattern:
wildcardedMailbox = "*"

' mboxes is a Chilkat_9_5_0.Mailboxes
Set mboxes = imap.ListMailboxes(refName,wildcardedMailbox)
If (imap.LastMethodSuccess = 0) Then
    outFile.WriteLine(imap.LastErrorText)
    WScript.Quit
End If

i = 0
Do While i < mboxes.Count
    outFile.WriteLine(mboxes.GetName(i))
    i = i + 1
Loop

' Sample output looks like this:
' Archive
' Calendar
' Calendar/Birthdays
' Calendar/United States holidays
' Contacts
' Conversation History
' Deleted Items
' Drafts
' INBOX
' INBOX/abc
' INBOX/misc
' INBOX/misc/birdeye
' INBOX/old
' INBOX/old/large
' INBOX/receipts
' Journal
' Junk Email
' Notes
' Outbox
' RSS Subscriptions
' Sent Items
' Sync Issues
' Sync Issues/Conflicts
' Sync Issues/Local Failures
' Sync Issues/Server Failures
' Tasks
' Trash

' Disconnect from the IMAP server.
success = imap.Disconnect()


outFile.Close

docker pull stackrox/kube-linter:latest
go install golang.stackrox.io/kube-linter/cmd/kube-linter@latest
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New ChilkatHttp
Dim success As Long

' Implements the following CURL command:

' curl -X GET --user wp_username:wp_password https://www.yoursite.com/wp-json/wp/v2/posts?page=1

' Use the following online tool to generate HTTP code from a CURL command
' Convert a cURL Command to HTTP Source Code

http.Login = "wp_username"
http.Password = "wp_password"
http.BasicAuth = 1

Dim sbResponseBody As New ChilkatStringBuilder
success = http.QuickGetSb("https://www.yoursite.com/wp-json/wp/v2/posts?page=1",sbResponseBody)
If (success = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Dim jarrResp As New ChilkatJsonArray
success = jarrResp.LoadSb(sbResponseBody)
jarrResp.EmitCompact = 0

Debug.Print "Response Body:"
Debug.Print jarrResp.Emit()

Dim respStatusCode As Long
respStatusCode = http.LastStatus
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
    Debug.Print "Response Header:"
    Debug.Print http.LastHeader
    Debug.Print "Failed."
    Exit Sub
End If

' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)

' [
'   {
'     "id": 1902,
'     "date": "2020-11-16T09:54:09",
'     "date_gmt": "2020-11-16T16:54:09",
'     "guid": {
'       "rendered": "http:\/\/cknotes.com\/?p=1902"
'     },
'     "modified": "2020-11-16T09:54:09",
'     "modified_gmt": "2020-11-16T16:54:09",
'     "slug": "xero-redirect-uri-for-oauth2-and-desktop-apps",
'     "status": "publish",
'     "type": "post",
'     "link": "https:\/\/cknotes.com\/xero-redirect-uri-for-oauth2-and-desktop-apps\/",
'     "title": {
'       "rendered": "Xero Redirect URI for OAuth2 and Desktop Apps"
'     },
'     "content": {
'       "rendered": "<p>...",
'       "protected": false
'     },
'     "excerpt": {
'       "rendered": "<p>...",
'       "protected": false
'     },
'     "author": 1,
'     "featured_media": 0,
'     "comment_status": "closed",
'     "ping_status": "open",
'     "sticky": false,
'     "template": "",
'     "format": "standard",
'     "meta": [
'     ],
'     "categories": [
'       815
'     ],
'     "tags": [
'       594,
'       816
'     ],
'     "_links": {
'       "self": [
'         {
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902"
'         }
'       ],
'       "collection": [
'         {
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts"
'         }
'       ],
'       "about": [
'         {
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/post"
'         }
'       ],
'       "author": [
'         {
'           "embeddable": true,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
'         }
'       ],
'       "replies": [
'         {
'           "embeddable": true,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1902"
'         }
'       ],
'       "version-history": [
'         {
'           "count": 1,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"
'         }
'       ],
'       "predecessor-version": [
'         {
'           "id": 1904,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1904"
'         }
'       ],
'       "wp:attachment": [
'         {
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media?parent=1902"
'         }
'       ],
'       "wp:term": [
'         {
'           "taxonomy": "category",
'           "embeddable": true,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/categories?post=1902"
'         },
'         {
'           "taxonomy": "post_tag",
'           "embeddable": true,
'           "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/tags?post=1902"
'         }
'       ],
'       "curies": [
'         {
'           "name": "wp",
'           "href": "https:\/\/api.w.org\/{rel}",
'           "templated": true
'         }
'       ]
'     }
'   },
' ...
' ]

' Sample code for parsing the JSON response...
' Use the following online tool to generate parsing code from sample JSON:
' Generate Parsing Code from JSON

Dim date_gmt As New DtObj
Dim json As ChilkatJsonObject
Dim id As Long
Dim date As String
Dim guidRendered As String
Dim modified As String
Dim modified_gmt As String
Dim slug As String
Dim status As String
Dim v_type As String
Dim link As String
Dim titleRendered As String
Dim contentRendered As String
Dim contentProtected As Long
Dim excerptRendered As String
Dim excerptProtected As Long
Dim author As Long
Dim featured_media As Long
Dim comment_status As String
Dim ping_status As String
Dim sticky As Long
Dim template As String
Dim format As String
Dim j As Long
Dim count_j As Long
Dim intVal As Long
Dim href As String
Dim embeddable As Long
Dim count As Long
Dim taxonomy As String
Dim name As String
Dim templated As Long

Dim i As Long
i = 0
Dim count_i As Long
count_i = jarrResp.Size
Do While i < count_i
    Set json = jarrResp.ObjectAt(i)
    id = json.IntOf("id")
    date = json.StringOf("date")
    success = json.DtOf("date_gmt",0,date_gmt)
    guidRendered = json.StringOf("guid.rendered")
    modified = json.StringOf("modified")
    modified_gmt = json.StringOf("modified_gmt")
    slug = json.StringOf("slug")
    status = json.StringOf("status")
    v_type = json.StringOf("type")
    link = json.StringOf("link")
    titleRendered = json.StringOf("title.rendered")
    contentRendered = json.StringOf("content.rendered")
    contentProtected = json.BoolOf("content.protected")
    excerptRendered = json.StringOf("excerpt.rendered")
    excerptProtected = json.BoolOf("excerpt.protected")
    author = json.IntOf("author")
    featured_media = json.IntOf("featured_media")
    comment_status = json.StringOf("comment_status")
    ping_status = json.StringOf("ping_status")
    sticky = json.BoolOf("sticky")
    template = json.StringOf("template")
    format = json.StringOf("format")
    j = 0
    count_j = json.SizeOfArray("meta")
    Do While j < count_j
        json.J = j
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("categories")
    Do While j < count_j
        json.J = j
        intVal = json.IntOf("categories[j]")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("tags")
    Do While j < count_j
        json.J = j
        intVal = json.IntOf("tags[j]")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.self")
    Do While j < count_j
        json.J = j
        href = json.StringOf("_links.self[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.collection")
    Do While j < count_j
        json.J = j
        href = json.StringOf("_links.collection[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.about")
    Do While j < count_j
        json.J = j
        href = json.StringOf("_links.about[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.author")
    Do While j < count_j
        json.J = j
        embeddable = json.BoolOf("_links.author[j].embeddable")
        href = json.StringOf("_links.author[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.replies")
    Do While j < count_j
        json.J = j
        embeddable = json.BoolOf("_links.replies[j].embeddable")
        href = json.StringOf("_links.replies[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.version-history")
    Do While j < count_j
        json.J = j
        count = json.IntOf("_links.version-history[j].count")
        href = json.StringOf("_links.version-history[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.predecessor-version")
    Do While j < count_j
        json.J = j
        id = json.IntOf("_links.predecessor-version[j].id")
        href = json.StringOf("_links.predecessor-version[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.wp:attachment")
    Do While j < count_j
        json.J = j
        href = json.StringOf("_links.wp:attachment[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.wp:term")
    Do While j < count_j
        json.J = j
        taxonomy = json.StringOf("_links.wp:term[j].taxonomy")
        embeddable = json.BoolOf("_links.wp:term[j].embeddable")
        href = json.StringOf("_links.wp:term[j].href")
        j = j + 1
    Loop
    j = 0
    count_j = json.SizeOfArray("_links.curies")
    Do While j < count_j
        json.J = j
        name = json.StringOf("_links.curies[j].name")
        href = json.StringOf("_links.curies[j].href")
        templated = json.BoolOf("_links.curies[j].templated")
        j = j + 1
    Loop

    i = i + 1
Loop

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim oauth2 As New ChilkatOAuth2
Dim success As Long

' For Google OAuth2, set the listen port equal to the port used
' in the Authorized Redirect URL for the Client ID.
' For example, in this case the Authorized Redirect URL would be http://localhost:55568/
' Your app should choose a port not likely not used by any other application.
oauth2.ListenPort = 55568

oauth2.AuthorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth"
oauth2.TokenEndpoint = "https://www.googleapis.com/oauth2/v4/token"

' Replace these with actual values.
oauth2.ClientId = "GOOGLE-CLIENT-ID"
oauth2.ClientSecret = "GOOGLE-CLIENT-SECRET"

oauth2.CodeChallenge = 1
oauth2.CodeChallengeMethod = "S256"

' This is the scope for Google Drive.
' See https://developers.google.com/identity/protocols/googlescopes
oauth2.Scope = "https://www.googleapis.com/auth/drive"

' Begin the OAuth2 three-legged flow.  This returns a URL that should be loaded in a browser.
Dim url As String
url = oauth2.StartAuth()
If (oauth2.LastMethodSuccess <> 1) Then
    Debug.Print oauth2.LastErrorText
    Exit Sub
End If

' At this point, your application should load the URL in a browser.
' For example, 
' in C#:  System.Diagnostics.Process.Start(url);
' in Java: Desktop.getDesktop().browse(new URI(url));
' in VBScript: Set wsh=WScript.CreateObject("WScript.Shell")
'              wsh.Run url
' in Xojo: ShowURL(url)  (see http://docs.xojo.com/index.php/ShowURL)
' in Dataflex: Runprogram Background "c:\Program Files\Internet Explorer\iexplore.exe" sUrl        
' The Google account owner would interactively accept or deny the authorization request.

' Add the code to load the url in a web browser here...
' Add the code to load the url in a web browser here...
' Add the code to load the url in a web browser here...

' Now wait for the authorization.
' We'll wait for a max of 30 seconds.
Dim numMsWaited As Long
numMsWaited = 0
Do While (numMsWaited < 30000) And (oauth2.AuthFlowState < 3)
    oauth2.SleepMs 100
    numMsWaited = numMsWaited + 100
Loop

' If there was no response from the browser within 30 seconds, then 
' the AuthFlowState will be equal to 1 or 2.
' 1: Waiting for Redirect. The OAuth2 background thread is waiting to receive the redirect HTTP request from the browser.
' 2: Waiting for Final Response. The OAuth2 background thread is waiting for the final access token response.
' In that case, cancel the background task started in the call to StartAuth.
If (oauth2.AuthFlowState < 3) Then
    success = oauth2.Cancel()
    Debug.Print "No response from the browser!"
    Exit Sub
End If

' Check the AuthFlowState to see if authorization was granted, denied, or if some error occurred
' The possible AuthFlowState values are:
' 3: Completed with Success. The OAuth2 flow has completed, the background thread exited, and the successful JSON response is available in AccessTokenResponse property.
' 4: Completed with Access Denied. The OAuth2 flow has completed, the background thread exited, and the error JSON is available in AccessTokenResponse property.
' 5: Failed Prior to Completion. The OAuth2 flow failed to complete, the background thread exited, and the error information is available in the FailureInfo property.
If (oauth2.AuthFlowState = 5) Then
    Debug.Print "OAuth2 failed to complete."
    Debug.Print oauth2.FailureInfo
    Exit Sub
End If

If (oauth2.AuthFlowState = 4) Then
    Debug.Print "OAuth2 authorization was denied."
    Debug.Print oauth2.AccessTokenResponse
    Exit Sub
End If

If (oauth2.AuthFlowState <> 3) Then
    Debug.Print "Unexpected AuthFlowState:" & oauth2.AuthFlowState
    Exit Sub
End If

' Save the full JSON access token response to a file.
Dim sbJson As New ChilkatStringBuilder
success = sbJson.Append(oauth2.AccessTokenResponse)
success = sbJson.WriteFile("qa_data/tokens/_googleDrive.json","utf-8",0)

' The saved JSON response looks like this:

' 	{
' 	 "access_token": "ya39.Ci-XA_C5bGgRDC3UaD-h0_NeL-DVIQnI2gHtBBBHkZzrwlARkwX6R3O0PCDEzRlfaQ",
' 	 "token_type": "Bearer",
' 	 "expires_in": 3600,
' 	 "refresh_token": "1/r_2c_7jddspcdfesrrfKqfXtqo08D6Q-gUU0DsdfVMsx0c"
' 	}
' 
Debug.Print "OAuth2 authorization granted!"
Debug.Print "Access Token = " & oauth2.AccessToken
<!DOCTYPE html>
<html>
<style>
#mydiv {
  position: absolute;
  z-index: 9;
  background-color: #f1f1f1;
  text-align: center;
  border: 1px solid #d3d3d3;
}
​
#mydivheader {
  padding: 10px;
  cursor: move;
  z-index: 10;
  background-color: #2196F3;
  color: #fff;
}
</style>
<body>
​
<h1>Draggable DIV Element</h1>
​
<p>Click and hold the mouse button down while moving the DIV element</p>
​
<div id="mydiv">
  <div id="mydivheader">Click here to move</div>
  <p>Move</p>
  <p>this</p>
  <p>DIV</p>
</div>
​
<script>
//Make the DIV element draggagle:
dragElement(document.getElementById("mydiv"));
​
function dragElement(elmnt) {
  var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  if (document.getElementById(elmnt.id + "header")) {
    /* if present, the header is where you move the DIV from:*/
    document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
  } else {
    /* otherwise, move the DIV from anywhere inside the DIV:*/
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {box-sizing: border-box}
body {font-family: Verdana, sans-serif; margin:0}
​
/* Slideshow container */
.slideshow-container {
  position: relative;
  background: #f1f1f1f1;
}
​
/* Slides */
.mySlides {
  display: none;
  padding: 80px;
  text-align: center;
}
​
/* Next & previous buttons */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -30px;
  padding: 16px;
  color: #888;
  font-weight: bold;
  font-size: 20px;
  border-radius: 0 3px 3px 0;
  user-select: none;
}
​
/* Position the "next button" to the right */
.next {
  position: absolute;
  right: 0;
  border-radius: 3px 0 0 3px;
}
​
<!DOCTYPE html>
<html>
<style>
#myContainer {
  width: 400px;
  height: 400px;
  position: relative;
  background: yellow;
}
#myAnimation {
  width: 50px;
  height: 50px;
  position: absolute;
  background-color: red;
}
</style>
<body>
​
<p>
<button onclick="myMove()">Click Me</button> 
</p>
​
<div id ="myContainer">
<div id ="myAnimation"></div>
</div>
​
<script>
var id = null;
function myMove() {
  var elem = document.getElementById("myAnimation");   
  var pos = 0;
  clearInterval(id);
  id = setInterval(frame, 10);
  function frame() {
    if (pos == 350) {
      clearInterval(id);
    } else {
      pos++; 
      elem.style.top = pos + 'px'; 
      elem.style.left = pos + 'px'; 
    }
  }
}
<!DOCTYPE html>
<html>
<body>
​
<div id="myDiv">
&lt;!DOCTYPE html&gt;<br>
&lt;html&gt;<br>
&lt;body&gt;<br>
<br>
&lt;h1&gt;Testing an HTML Syntax Highlighter&lt;/h2&gt;<br>
&lt;p&gt;Hello world!&lt;/p&gt;<br>
&lt;a href="https://www.w3schools.com"&gt;Back to School&lt;/a&gt;<br>
<br>
&lt;/body&gt;<br>
&lt;/html&gt;
</div>
​
<script>
w3CodeColor(document.getElementById("myDiv"));
​
function w3CodeColor(elmnt, mode) {
  var lang = (mode || "html");
  var elmntObj = (document.getElementById(elmnt) || elmnt);
  var elmntTxt = elmntObj.innerHTML;
  var tagcolor = "mediumblue";
  var tagnamecolor = "brown";
  var attributecolor = "red";
  var attributevaluecolor = "mediumblue";
  var commentcolor = "green";
  var cssselectorcolor = "brown";
  var csspropertycolor = "red";
  var csspropertyvaluecolor = "mediumblue";
  var cssdelimitercolor = "black";
  var cssimportantcolor = "red";  
  var jscolor = "black";
  var jskeywordcolor = "mediumblue";
  var jsstringcolor = "brown";
  var jsnumbercolor = "red";
  var jspropertycolor = "black";
  elmntObj.style.fontFamily = "Consolas,'Courier New', monospace";
  if (!lang) {lang = "html"; }
  if (lang == "html") {elmntTxt = htmlMode(elmntTxt);}
  if (lang == "css") {elmntTxt = cssMode(elmntTxt);}
browser-sync start --proxy "https://hein.eu-theme.ddev.site" --https --files 'app/**/*.phtml, app/**/*.xml, app/**/*.css, app/**/*.js'
Để giải thích cách hoạt động của thuật toán Dijkstra trong mã qua ví dụ đồ thị bạn đã cung cấp, hãy xem xét các bước chi tiết từng bước khi thuật toán chạy:

Đồ thị Mẫu
Số đỉnh: 5 (đánh số từ 0 đến 4).

Số cạnh: 6.

Các cạnh với trọng số:

0 1 2 (cạnh từ đỉnh 0 đến đỉnh 1 với trọng số 2).
0 2 4 (cạnh từ đỉnh 0 đến đỉnh 2 với trọng số 4).
1 2 1 (cạnh từ đỉnh 1 đến đỉnh 2 với trọng số 1).
1 3 7 (cạnh từ đỉnh 1 đến đỉnh 3 với trọng số 7).
2 4 3 (cạnh từ đỉnh 2 đến đỉnh 4 với trọng số 3).
3 4 1 (cạnh từ đỉnh 3 đến đỉnh 4 với trọng số 1).
Đỉnh nguồn: 0.

Mô tả Thuật toán Dijkstra qua Ví dụ
Khởi tạo:

Đỉnh nguồn là 0.
Tạo mảng dist để lưu trữ khoảng cách ngắn nhất từ đỉnh nguồn 0 đến tất cả các đỉnh khác. Ban đầu, dist được thiết lập như sau:
dist[0] = 0 (khoảng cách từ đỉnh 0 đến chính nó là 0).
dist[1] = 1000000, dist[2] = 1000000, dist[3] = 1000000, dist[4] = 1000000 (khoảng cách đến tất cả các đỉnh khác ban đầu là vô cực).
Tạo hàng đợi ưu tiên pq và thêm đỉnh nguồn 0 với khoảng cách 0: pq = [(0, 0)].
Vòng lặp Thuật toán:

Lần lặp đầu tiên:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (0, 0):
u = 0, d = 0.
Duyệt các đỉnh kề của u = 0:
Đỉnh 1: trọng số cạnh (0, 1) là 2.
dist[1] = min(1000000, 0 + 2) = 2.
Cập nhật dist[1] thành 2 và đẩy (2, 1) vào hàng đợi pq.
Đỉnh 2: trọng số cạnh (0, 2) là 4.
dist[2] = min(1000000, 0 + 4) = 4.
Cập nhật dist[2] thành 4 và đẩy (4, 2) vào hàng đợi pq.
Sau lần lặp này: pq = [(2, 1), (4, 2)].
Lần lặp thứ hai:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (2, 1):
u = 1, d = 2.
Duyệt các đỉnh kề của u = 1:
Đỉnh 0: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Đỉnh 2: trọng số cạnh (1, 2) là 1.
dist[2] = min(4, 2 + 1) = 3.
Cập nhật dist[2] thành 3 và đẩy (3, 2) vào hàng đợi pq.
Đỉnh 3: trọng số cạnh (1, 3) là 7.
dist[3] = min(1000000, 2 + 7) = 9.
Cập nhật dist[3] thành 9 và đẩy (9, 3) vào hàng đợi pq.
Sau lần lặp này: pq = [(3, 2), (4, 2), (9, 3)].
Lần lặp thứ ba:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (3, 2):
u = 2, d = 3.
Duyệt các đỉnh kề của u = 2:
Đỉnh 0: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Đỉnh 1: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Đỉnh 4: trọng số cạnh (2, 4) là 3.
dist[4] = min(1000000, 3 + 3) = 6.
Cập nhật dist[4] thành 6 và đẩy (6, 4) vào hàng đợi pq.
Sau lần lặp này: pq = [(4, 2), (9, 3), (6, 4)].
Lần lặp thứ tư:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (4, 2):
u = 2, d = 4.
Đỉnh 2 đã được xử lý rồi, bỏ qua phần này.
Sau lần lặp này: pq = [(6, 4), (9, 3)].
Lần lặp thứ năm:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (6, 4):
u = 4, d = 6.
Duyệt các đỉnh kề của u = 4:
Đỉnh 2: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Đỉnh 3: trọng số cạnh (4, 3) là 1.
dist[3] = min(9, 6 + 1) = 7.
Cập nhật dist[3] thành 7 và đẩy (7, 3) vào hàng đợi pq.
Sau lần lặp này: pq = [(7, 3), (9, 3)].
Lần lặp thứ sáu:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (7, 3):
u = 3, d = 7.
Duyệt các đỉnh kề của u = 3:
Đỉnh 1: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Đỉnh 4: đã nằm trong tập đỉnh đã xử lý, bỏ qua.
Sau lần lặp này: pq = [(9, 3)].
Lần lặp thứ bảy:

Lấy phần tử có khoảng cách nhỏ nhất từ hàng đợi pq, đó là (9, 3):
u = 3, d = 9.
Đỉnh 3 đã được xử lý rồi, bỏ qua phần này.
Hàng đợi pq rỗng, thuật toán kết thúc.
Kết quả Cuối cùng
Thuật toán Dijkstra tính toán được khoảng cách ngắn nhất từ đỉnh 0 đến tất cả các đỉnh khác như sau:

dist[0] = 0: Khoảng cách từ 0 đến 0.
dist[1] = 2: Khoảng cách từ 0 đến 1 là 2.
dist[2] = 3: Khoảng cách từ 0 đến 2 là 3.
dist[3] = 7: Khoảng cách từ 0 đến 3 là 7.
dist[4] = 6: Khoảng cách từ 0 đến 4 là 6.
Kết quả này phù hợp với đồ thị mẫu và cách thức hoạt động của thuật toán Dijkstra.
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

star

Thu Sep 05 2024 04:54:02 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:53:55 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:53:44 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:53:36 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:53:31 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:53:17 GMT+0000 (Coordinated Universal Time) https://www.klipper3d.org/Installation.html

@amccall23

star

Thu Sep 05 2024 04:48:02 GMT+0000 (Coordinated Universal Time) https://klipper.discourse.group/t/biqu-b1-se-plus-klipper-config/1794

@amccall23

star

Wed Sep 04 2024 23:06:38 GMT+0000 (Coordinated Universal Time) https://help.archetypethemes.co/en/articles/206016

@letsstartdesign

star

Wed Sep 04 2024 22:39:26 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/vb6/github_oauth2_access_token.asp

@acassell

star

Wed Sep 04 2024 22:32:35 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/chilkat2-python/wordpress_application_passwords_authentication.asp

@acassell

star

Wed Sep 04 2024 22:32:17 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/chilkat2-python/wordpress_basic_auth_miniorange.asp

@acassell

star

Wed Sep 04 2024 22:31:48 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/chilkat2-python/wordpress_api_key_miniorange.asp

@acassell

star

Wed Sep 04 2024 22:31:15 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/phpAx/wordpress_basic_auth_miniorange.asp

@acassell

star

Wed Sep 04 2024 22:22:51 GMT+0000 (Coordinated Universal Time) https://github.com/stripe/stripe-python

@acassell

star

Wed Sep 04 2024 20:41:10 GMT+0000 (Coordinated Universal Time)

@Hunterisadog

star

Wed Sep 04 2024 19:29:54 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/howto/tryit.asp?filename

@ElyasAkbari #undefined

star

Wed Sep 04 2024 19:25:46 GMT+0000 (Coordinated Universal Time)

@shashi #bash

star

Wed Sep 04 2024 19:17:06 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/vbscript/office365_imap_list_mailboxes.asp

@acassell

star

Wed Sep 04 2024 19:15:49 GMT+0000 (Coordinated Universal Time)

@shashi #bash

star

Wed Sep 04 2024 19:15:25 GMT+0000 (Coordinated Universal Time)

@shashi #bash

star

Wed Sep 04 2024 19:15:18 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/vb6/wordpress_basic_auth_miniorange.asp

@acassell

star

Wed Sep 04 2024 19:13:55 GMT+0000 (Coordinated Universal Time) https://www.example-code.com/vb6/google_oauth2_access_token.asp

@acassell

star

Wed Sep 04 2024 19:08:25 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/howto/tryit.asp?filename

@ElyasAkbari #undefined

star

Wed Sep 04 2024 19:08:01 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/howto/tryit.asp?filename

@ElyasAkbari #undefined

star

Wed Sep 04 2024 19:07:42 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/howto/tryit.asp?filename

@ElyasAkbari #undefined

star

Wed Sep 04 2024 19:02:21 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/howto/tryit.asp?filename

@ElyasAkbari #undefined

star

Wed Sep 04 2024 13:13:52 GMT+0000 (Coordinated Universal Time)

@zaki

star

Wed Sep 04 2024 11:27:32 GMT+0000 (Coordinated Universal Time) https://chatgpt.com/

@LizzyTheCatto

Save snippets that work with our extensions

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