<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ivan Marynych</title>
    <description>The latest articles on DEV Community by Ivan Marynych (@loqimean).</description>
    <link>https://dev.to/loqimean</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F846996%2F73f9dc4c-3070-4d9c-a3a6-21debf28bc0c.jpeg</url>
      <title>DEV Community: Ivan Marynych</title>
      <link>https://dev.to/loqimean</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loqimean"/>
    <language>en</language>
    <item>
      <title>The most performed RANDOM querying on Rails!</title>
      <dc:creator>Ivan Marynych</dc:creator>
      <pubDate>Fri, 14 Jul 2023 22:31:32 +0000</pubDate>
      <link>https://dev.to/loqimean/the-most-performed-random-on-rails-4g4p</link>
      <guid>https://dev.to/loqimean/the-most-performed-random-on-rails-4g4p</guid>
      <description>&lt;h2&gt;
  
  
  🌟 Prepare to have your mind blown by the Unbelievable Performance Gem! 🌟
&lt;/h2&gt;

&lt;p&gt;Are you tired of slow random record retrieval in your Rails applications? Say goodbye to sluggish queries and hello to lightning-fast performance! Our gem is here to revolutionize the way you fetch random records, delivering results that will leave you speechless.&lt;/p&gt;

&lt;p&gt;🔥 Experience the future of speed and efficiency as our gem seamlessly integrates into your codebase. With near-instantaneous responses, you can elevate your user experience to new heights.&lt;/p&gt;

&lt;p&gt;💪 Join the ranks of developers who are already witnessing jaw-dropping results. Don't miss out on this game-changing gem that's setting new performance standards in the Rails community.&lt;/p&gt;

&lt;p&gt;Ready to ignite your Rails application? Visit our repo to learn more about the Unbelievable Performance Gem and be part of the performance revolution today! 🚀💎&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/the-rubies-way" rel="noopener noreferrer"&gt;
        the-rubies-way
      &lt;/a&gt; / &lt;a href="https://github.com/the-rubies-way/random-rails" rel="noopener noreferrer"&gt;
        random-rails
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      The most performed gem to get random record you ever seen! Available for Ruby on Rails with PostgreSQL right now!
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a href="https://github.com/the-rubies-way/random-rails/actions/workflows/linter.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/the-rubies-way/random-rails/actions/workflows/linter.yml/badge.svg" alt="lint"&gt;&lt;/a&gt;
&lt;a href="https://github.com/the-rubies-way/random-rails/actions/workflows/test.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/the-rubies-way/random-rails/actions/workflows/test.yml/badge.svg" alt="test"&gt;&lt;/a&gt;
&lt;a href="https://rubygems.org/gems/random-rails" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/3e837570e0670c2e217eb15853cce191f4b3bbe510fb1e1fbf1359bf566c257b/68747470733a2f2f696d672e736869656c64732e696f2f67656d2f762f72616e646f6d2d7261696c73" alt="Gem Version"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
  &lt;a rel="noopener noreferrer" href="https://private-user-images.githubusercontent.com/49816584/499373838-cc522bff-2de6-41f3-b458-83867bf70b26.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE2OTUyMTksIm5iZiI6MTc3MTY5NDkxOSwicGF0aCI6Ii80OTgxNjU4NC80OTkzNzM4MzgtY2M1MjJiZmYtMmRlNi00MWYzLWI0NTgtODM4NjdiZjcwYjI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjIxVDE3MjgzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5MzJlZWVkNTM0MjQ2YTM0ZjcxNTllNDlmMzQyOTc4NTVlNDI1Mjk3ODc4ODU0N2FjMGM5ZTg2NTRjOTQzYTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ysJyPUinJ9j0pboeU55YD_P2pDlXlBwoCRRSz5Hh5QE"&gt;&lt;img width="600" height="600" alt="Image Oct 9, 2025, 04_30_33" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprivate-user-images.githubusercontent.com%2F49816584%2F499373838-cc522bff-2de6-41f3-b458-83867bf70b26.png%3Fjwt%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE2OTUyMTksIm5iZiI6MTc3MTY5NDkxOSwicGF0aCI6Ii80OTgxNjU4NC80OTkzNzM4MzgtY2M1MjJiZmYtMmRlNi00MWYzLWI0NTgtODM4NjdiZjcwYjI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjIxVDE3MjgzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5MzJlZWVkNTM0MjQ2YTM0ZjcxNTllNDlmMzQyOTc4NTVlNDI1Mjk3ODc4ODU0N2FjMGM5ZTg2NTRjOTQzYTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ysJyPUinJ9j0pboeU55YD_P2pDlXlBwoCRRSz5Hh5QE"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;RandomRails&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;🚀 The most performant way to get random records from ActiveRecord. Supports &lt;strong&gt;PostgreSQL&lt;/strong&gt;, &lt;strong&gt;MySQL&lt;/strong&gt;, and &lt;strong&gt;SQLite&lt;/strong&gt; with intelligent strategy selection to replace slow &lt;code&gt;ORDER BY RANDOM()&lt;/code&gt; queries.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Why RandomRails?&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Traditional &lt;code&gt;ORDER BY RANDOM()&lt;/code&gt; queries become extremely slow on large tables because they require sorting the entire dataset. RandomRails solves this by using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TABLESAMPLE BERNOULLI&lt;/strong&gt; for PostgreSQL (ultra-fast on large tables)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient offset-based sampling&lt;/strong&gt; for all databases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intelligent strategy selection&lt;/strong&gt; based on table size and database type&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configurable sampling methods&lt;/strong&gt; for different use cases&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Performance Comparison&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Real-world benchmark results comparing RandomRails with traditional methods (10 iterations each):&lt;/p&gt;

&lt;p&gt;&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;br&gt;
&lt;thead&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;th&gt;Sample Size&lt;/th&gt;
&lt;br&gt;
&lt;th&gt;&lt;code&gt;ORDER BY RANDOM()&lt;/code&gt;&lt;/th&gt;
&lt;br&gt;
&lt;th&gt;&lt;code&gt;User.random()&lt;/code&gt;&lt;/th&gt;
&lt;br&gt;
&lt;th&gt;&lt;code&gt;User.sample()&lt;/code&gt;&lt;/th&gt;
&lt;br&gt;
&lt;th&gt;Performance Gain&lt;/th&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;/thead&gt;
&lt;br&gt;
&lt;tbody&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;1,000 users&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;3.8359s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;0.2157s&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;347.1409s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;17.79x faster&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;10,000 users&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;6.1273s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;2.7313s&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;369.7583s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;2.24x faster&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;100,000 users&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;31.578s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;3.6968s&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;369.4334s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;8.54x faster&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;1,000,000 users&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;171.497s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;5.3441s&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;373.6102s&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;&lt;strong&gt;32.09x faster&lt;/strong&gt;&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;/tbody&gt;
&lt;br&gt;
&lt;/table&gt;&lt;/div&gt;&lt;br&gt;
&lt;a rel="noopener noreferrer" href="https://private-user-images.githubusercontent.com/49816584/499350155-3c395cfd-d28f-45d1-92f2-872075552782.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE2OTUyMTksIm5iZiI6MTc3MTY5NDkxOSwicGF0aCI6Ii80OTgxNjU4NC80OTkzNTAxNTUtM2MzOTVjZmQtZDI4Zi00NWQxLTkyZjItODcyMDc1NTUyNzgyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjIxVDE3MjgzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4NDdhZWM3ODRmMGNhZTNjMzQzMzA4MDAyM2I0M2JmNDA4NmJlZjkyYzZiNjZlOThkNTdiZjk0MDAxNzVjOWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wRk_RN_piVuZLkJhCF82DY_nsOwiamoyNdh0oQqxx-E"&gt;&lt;img width="1968" height="1180" alt="image" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprivate-user-images.githubusercontent.com%2F49816584%2F499350155-3c395cfd-d28f-45d1-92f2-872075552782.png%3Fjwt%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE2OTUyMTksIm5iZiI6MTc3MTY5NDkxOSwicGF0aCI6Ii80OTgxNjU4NC80OTkzNTAxNTUtM2MzOTVjZmQtZDI4Zi00NWQxLTkyZjItODcyMDc1NTUyNzgyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjIxVDE3MjgzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4NDdhZWM3ODRmMGNhZTNjMzQzMzA4MDAyM2I0M2JmNDA4NmJlZjkyYzZiNjZlOThkNTdiZjk0MDAxNzVjOWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wRk_RN_piVuZLkJhCF82DY_nsOwiamoyNdh0oQqxx-E"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways:&lt;/strong&gt;&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;RandomRails consistently outperforms &lt;code&gt;ORDER BY RANDOM()&lt;/code&gt; by 2-32x&lt;/li&gt;

&lt;li&gt;Performance advantage increases dramatically…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/the-rubies-way/random-rails" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>random</category>
      <category>sql</category>
      <category>rails</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Verifying Monobank Acquiring API Webhook Sign with Ruby Script</title>
      <dc:creator>Ivan Marynych</dc:creator>
      <pubDate>Sat, 10 Jun 2023 14:25:00 +0000</pubDate>
      <link>https://dev.to/loqimean/verifying-monobank-acquiring-api-webhook-sign-with-ruby-script-ng8</link>
      <guid>https://dev.to/loqimean/verifying-monobank-acquiring-api-webhook-sign-with-ruby-script-ng8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yDiMEXGx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dslqd06124nblqzezt0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yDiMEXGx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dslqd06124nblqzezt0.jpg" alt="The monobank cat with ruby" width="720" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Webhooks play a crucial role in modern API integrations, allowing real-time communication between applications. However, ensuring the integrity and authenticity of incoming webhook data is essential to prevent security breaches. In this article, we will explore a Ruby script that demonstrates how to verify the Monobank Acquiring API webhook sign, ensuring the received data is from a trusted source. The script, available at the GitHub repository &lt;a href="https://github.com/loqimean/monobank_webhook_sign_verification/"&gt;loqimean/monobank_webhook_sign_verification&lt;/a&gt;, provides a straightforward implementation to validate the webhook sign using Ruby.&lt;/p&gt;

&lt;p&gt;Understanding the Monobank Acquiring API Webhook Sign: The Monobank Acquiring API sends webhook notifications containing transaction information. To verify the authenticity of these notifications, Monobank includes a webhook sign in the request headers. This sign is generated using a shared secret key and serves as proof of origin for the webhook data. The Ruby script we will discuss utilizes this sign to validate incoming webhook requests.&lt;/p&gt;

&lt;p&gt;Implementation Details: The Ruby script available in the repository mentioned above showcases a concise and efficient method to verify the Monobank Acquiring API webhook sign. Let’s walk through the important components of the script:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Dependencies: The script requires the ‘openssl’ and ‘base64’ libraries, which are commonly available in Ruby installations. If you encounter any issues related to these dependencies, make sure they are installed or update your Ruby environment accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verification Process: The script parses the incoming webhook request headers to extract the provided webhook sign and the body of the request. It then applies the same hashing algorithm used by Monobank (SHA1) to generate a local sign from the request body, using the shared secret key obtained from Monobank. Finally, it compares the locally generated sign with the one received in the webhook request headers. If they match, the script confirms the authenticity of the webhook data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error Handling: To provide comprehensive feedback, the script incorporates error handling mechanisms. If any errors occur during the verification process, appropriate error messages are displayed, aiding in troubleshooting and debugging.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Webhook sign verification is a crucial step in securing API integrations, ensuring that data originates from trusted sources. The Ruby script provided in &lt;a href="https://github.com/loqimean/monobank_webhook_sign_verification/"&gt;loqimean/monobank_webhook_sign_verification&lt;/a&gt; repository offers a simple yet effective way to verify the Monobank Acquiring API webhook sign. By implementing this script in your application, you can enhance the security of your Monobank webhook integrations, safeguarding the integrity of your data and preventing potential security breaches.&lt;/p&gt;

&lt;p&gt;Remember to regularly update your secret key and keep it securely stored. Additionally, monitoring and logging webhook verification results can be beneficial for detecting any unusual activity or potential attacks.&lt;/p&gt;

&lt;p&gt;Please note that while the provided script demonstrates a viable approach to verify Monobank Acquiring API webhook signs, it’s important to review and customize it based on your specific requirements and security practices.&lt;/p&gt;

&lt;p&gt;Remember to regularly review the official Monobank documentation for any updates or changes to their API implementation.&lt;/p&gt;

&lt;p&gt;Happy coding and secure webhook integrations! 🎉&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>monobank</category>
      <category>ecdsa</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
