Hegwin.Me

The hydra-universe twisting its body scaled in stars.

How to Deploy Ruby Code on AWS Lambda: A Brief Guide from Manual to Automated

从手动到自动,部署 Ruby 代码到 AWS Lambda

Recently, I've made some new attempts to develop and deploy some of the features that are not very relevant to the main business as separate AWS Lambda - it's also a step forward in the trend of serverless development. This post is based on what I learned from deploying Ruby code to AWS Lambda. Currently, AWS Lambda supports languages such...

Counter Cache and counter_culture

Counter Cache 和 counter_culture

Have you ever encountered a requirement where, assuming we are a book review site (e.g., douban.com), we need to display the number of reviews for each record in a list of books. We'll have a Book model and a Review model, which have a one-to-many relationship, `Book.has_many :reviews `. The most straightforward approach would be to do something like `books.each...

Upgrade Ruby from 3.0 to 3.2

升级 Ruby 到 3.2

Now that Ruby 3.3 preview 2 has been released, I've been working on upgrading a 3.0 project to 3.2. I've encountered a few problems with upgrading from 3.0 to 3.2, so I'm going to try to organize them here, and hopefully they'll help. ## Bundled gems In Ruby 3.1, some libs went from being standard libraries to bundled gems, such...

Notes about Observer APIs in JavaScript

JavaScript 中的 Observer API

Recently, I need to implement a feature in a web page. The background is like this, we have a navigation bar at the top of the page that slides left and right, when the user scrolls down the page, we will add a class named active to the corresponding item in the navigation bar, when this active item is not...

Takeaways from Ruby Conf China 2023 Day 2

Ruby Conf China 2023 参会笔记 Day 2

This year, AI is really a hot topic, from EverythingGPT to LLM, everyone is talking about this new technological change. At the two-day Ruby Conf China 2023, there were also three topics focusing on AI and LLM, which was very exciting. This post records what I learned on the second day of Ruby Conf. There were two speakers talking about...

Takeaways from Ruby Conf China 2023 Day 1

Ruby Conf China 2023 参会笔记 Day 1

Last weekend (August 19-20, 2023), Ruby Conf China was successfully held in Shanghai. This was the first time since COVID-19 that Ruby Conf was held offline - we've been waiting for it for three years. It's amazing that the venue was the same one we booked for Ruby Conf 2021 three years ago (JW Marriott at Tomorrow Square); Due to...

The Limits of Photolithography - Questions from reading The Future of Computing by Matz

光刻机的极限--读《代码的未来》产生的疑问

I recently finished reading "The Future of Computing" by Yukihiro Matsumoto (Matz), a book published by Matz in 2012. Although ten years have passed since its publication, some of the technologies mentioned in the book have disappeared and some of the "future" has been realized, it is still a rewarding read in this era. The Future of Computing focuses on...

A Thought-Provoking Exploration of Aging and End-of-Life Care and A Review of Being Mortal by Atul Gawande

关于衰老与老年生活质量,以及《最好的告别》

You have to be prepared for "that", my father's doctor told me when he called me out of the hospital room alone. In May 2022, my father was hospitalized for a stroke, and I returned to his city to care for him for four months, the longest I had stayed in my hometown in over a decade. There were more...

Rotate cookies when upgrading to Rails 7

Rails 7升级过程中针对cookie一系列变化的应对策略

Rails 7 brought a number of new features as well as breaking changes, which made the upgrade from 6.1 more troublesome than the previous one. Rails modified the default cookie serilaizer and the default encryption method, causing incompatibility between the old and new cookies, so the upgrade needs to be done in steps to ensure the best user experience. #...

On Reading the Prince and Comparison on Translation Services

关于阅读《君主论》和翻译工具的比较

Recently, I've been considering changing the cloud service provider of my cell phone, so I'm cleaning up my photo albums to reduce the cost of migration and to say "goodbye to the past" and "not to be burdened by memories". I found some screenshots left when I read the English version of The Prince in 2017. I can't exactly remember...