@airdropgoldchannel · Post #157586 · 14.09.2024 г., 20:27
We’re covering the eligibility cost for the RockyRabbit #airdrop for 5 winners! https://x.com/Bitheartbit/status/1835052286076207357
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #121 · 20 јул.
Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django
Пребарај: #airdrop
@airdropgoldchannel · Post #157586 · 14.09.2024 г., 20:27
We’re covering the eligibility cost for the RockyRabbit #airdrop for 5 winners! https://x.com/Bitheartbit/status/1835052286076207357
Hashtags
@airdropgoldchannel · Post #157348 · 11.08.2024 г., 17:34
Check Your #airdrop Points Click Here 🏄♂️
Hashtags
@airdropgoldchannel · Post #157218 · 06.06.2024 г., 09:51
Learn How to Receive the Photon Chain Airdrop #airdrop https://app.galxe.com/quest/AygxpG3nDj4VfTNkmsTrpN/GCbFatdn4u
Hashtags
@airdropgoldchannel · Post #157192 · 13.05.2024 г., 15:46
Learn How to Receive the Side Protocol #Airdrop https://app.galxe.com/quest/AygxpG3nDj4VfTNkmsTrpN/GCi2itzXeH
Hashtags
@airdropgoldchannel · Post #157153 · 27.04.2024 г., 19:06
Learn How to Receive the MO Network #Airdrop https://app.galxe.com/quest/AygxpG3nDj4VfTNkmsTrpN/GCwoMthSNy
Hashtags
@airdropgoldchannel · Post #157150 · 26.04.2024 г., 06:51
EASY MONEY $180 Twitter Task #Airdrop https://app.galxe.com/quest/AygxpG3nDj4VfTNkmsTrpN/GC93Cthq7i
Hashtags
@legit365airdropss · Post #36069 · 02.03.2026 г., 12:53
✉️Konnex Airdrop 🔸Reward: Confirmed ✅Register: https://hub.konnex.world/points?referral_code=AP40WF8P 🔸Connect Wallet 🔸Complete Tasks 🔸Done #Airdrop
Hashtags
@legit365airdropss · Post #36046 · 27.02.2026 г., 06:28
✉️Konnex Airdrop 🔸Reward: Confirmed ✅Register: https://hub.konnex.world/points?referral_code=AP40WF8P 🔸Connect Wallet 🔸Complete Tasks 🔸Done #Airdrop
Hashtags
@centralchanel · Post #17289 · 17.05.2025 г., 19:24
📢 L1 project has $8,000,000 investment @pharos_network Let's be early for the approved #airdrop with the Testnet of the project! 💰 Cost: $0 ⌛️ Duration: 5 min. Take your place for this approved airdrop with our guide! 👇 📝 Airdrop transactions We will directly do the Testnet transactions of the project. 👇 🔗https://testnet.pharosnetwork.xyz/experience?inviteCode=0r2VJZpIPZ3Q84hh ➤ Connect your wallet with the Connect Wallet button and approve the addition of the testnet network. ➤ Scroll down on the homepage and complete the social tasks by connecting your social media accounts by pressing the follow button first. ➤ Then click on the Home button from the top left and scroll down to get test tokens from the faucet. ➤ Return to the Experience tab again and this time complete tasks such as Swap, adding liquidity (connect the wallet on the websites it directs and perform transactions from the relevant headings.) ➤ Leave the wallet you used for the testnet in the comments and let's send each other test tokens to complete the 3rd task. ➤ Finally, share your own invite links with friends.
Hashtags
@centralchanel · Post #16502 · 10.02.2025 г., 07:55
💵 Mevvynetwork Waiting List 💥A total of $2,800,000 investment was received. Join the project's waitlist and take your place for #airdrop now! 💥We will quickly join the project's waitlist and take our place as early birds. → Registration: https://mevvynetwork.com/waitlist?referralCode=dxan1dx&refSource=copy → Enter your e-mail address and confirm → Click the Join waitlist button and invite friends with your own invitation link
Hashtags
@centralchanel · Post #16016 · 13.01.2025 г., 10:18
🪂 High Potential Airdrop - Bubblemaps 🪂 Quickly take your place for #airdrop with the transactions of the @bubblemaps project that we use to follow smart money! 🚀 Cost: $0 💰 Duration: 5 Sec. ⌛️ 📝 Airdrop Transactions The project has started a waitlist, let's join quickly and take our place early. → First, go to bubblemaps.io/waitlist. → Then leave your email address. → Press the pink arrow button and send. ✔️ That's all the transactions. Don't forget to follow the official X account of the project! With our guide above, you have positioned yourself early for the approved airdrop!
Hashtags
@crypdrops · Post #9304 · 22.10.2024 г., 18:36
Probably making $0 Transaction narratives might get started fully on @ton_blockchain Soon! Get started with this #Airdrop before others jump to this narratives on $Ton! Introducing @keyytton#Airdrop! 📌Send 0 TON to the wallet address below 👇 UQB0ZszlqU7eabz_dyYfIAKsZ0F-U8b4iwJ1cTuePWIqipjA for the $KEY $Airdrop. 🔓 your reward in November. Season 1 ends on November 1st & TGE. Noted: Don't connect your wallet just send 0 Ton. Enjoy!
Hashtags