Hegwin.Me
Thoughts grows up by feeding itself with its own words.
Home
Tools
WoW Battle Pet
Meow Etymons
About
Different methods in Ruby to manipulate directories and files
Ruby中目录和文件操作的几种方式
Ruby
Jun 20, 2019
Creating a directory: Method 1: You can create a directory using Dir.mkdir with an optional parameter to mark the permissions of the directory. For example, if I want to create a `ruby` subdirectory in the /Users/hegwin/Workspace directory, I can do this Dir.mkdir('/Users/hegwin/Workspace/ruby') After normal creation, Dir.mkdir will return the integer 0. This method is similar to the Linux command `mkdir`,...
Excerpt from Home Deus A Brier Histroy of Tomorrow
读《未来简史》以及摘抄
Book Review
Excerpt
Neuroscience
Oct 15, 2018
I finally finished reading the book "A Brief History of Tomorrow" today. I did not see or buy this book in a bookstore. Coincidentally, I had some expiring points from China Unicom and I had to spend them on exchanging something before they were no longer valid. Inadvertently I got the electronic edition of this book with those points. Although...
Improve Memory for Your Rails App
Rails 应用的内存优化
Ruby on Rails
GC
Memory
Oct 13, 2018
I was in Zhengzhou today for the two-day Ruby Summit China 2018; the Summit was held at the "Big Corn" in Zhengzhou. I didn't expect that a city like Zhengzhou, where the density of Internet companies is not that high, could host an Internet conference of this scale (Ruby Summit was just one of the sessions). What was even more...
Soft Girl Gone Determined - Excerpt from Moon and Sixpense and Gone with The Wind
小女孩总会长大的 - 《月亮和六便士》《飘》摘抄
English
Excerpt
Jul 22, 2018
To improve my English, I read English novels. I recently read Maugham's The Moon and Sixpense, and Margaret Mitchell's Gone with the Wind. The result is that although I felt their fine diction and subtlety of expression, I didn't actually learn much English expression, rather my emotions followed the ebb and flow of the novel's plot. Especially the growth and...
Notes of CPR from a First Aid Training
成人心肺复苏(CPR)学习笔记
CPR
First Aid
Run
May 07, 2018
I attended a two-day first aid training last weekend. I am quite interested in saving the injured and giving help; Even in the game World of Warcraft, I play a healing class in - Priest. The first aid training actually covered a lot of topics, including the general management of burns, cuts, and choking, but more important to me was...
Ruby 2.5 allows rescue/ensure inside do/end blocks
Ruby 2.5 允许在do/end代码块中使用rescue
Ruby
Jan 31, 2018
This article introduces a new feature of Ruby 2.5: in previous versions of Ruby if you needed to use rescue to catch and handle exceptions, you had to put the `rescue` in to the codes that might throw an exception in the "begin end" block. Since Ruby 2.5, you can use rescue in a normal "do end" block. Note that...
Deduction vs. Induction vs. Abduction - Different Ways to Reason and Draw Conclusions
三种推理方式:演绎,归纳和溯因
Logic
English
Jan 21, 2018
I've been reading the Sherlock Holmes series of novels for a while now. Whether it's "A Study in Scarlet Letter" or "The Four Signatures", there is a chapter titled "The Science of Deduction" (The Science of Deduction). This aroused my curiosity - what exactly is deductive reasoning? We know there are other modes of reasoning, such as inductive reasoning and...
Takeaways from Google Developer Days 2017: PWA Progressive Web App
谷歌开发者大会2017心得:PWA 渐进式网页应用
PWA
Ruby on Rails
Dec 14, 2017
This is the second post in the Google Developer Days 2017 Take Ways series. Progressive Web App (PWA) was a recurring technology at this year's GDG, and I participated in at least two talks on the topic of PWA. The main problem that PWA is trying to solve is the ability to make a Web App nearly as efficient as...
Takeaways from Google Developer Days 2017: Firebase and Serverless
谷歌开发者大会2017心得:Firebase 和 Serverless
Firebase
Serverless
Dec 13, 2017
Today was the first day of the Google Developer Days (GDG) in Shanghai. Since GDG is held on a weekday, I had to take a leave of absence from work to attend. There were a lot of exciting topics at GDG. I'm going to write a few posts about what I got out of GDG 2017 (and if I get...
Tools to Help to Improve SQL in Rails
Rails优化SQL可能用到的工具
Ruby
Ruby on Rails
SQL Performance
Sep 27, 2017
Have you ever encountered a Rails app that is slow in rendering pages? Are you trying to find out what's causing it to be "slow"? Where is the performance bottleneck? Is it the slow execution of SQL queries (maybe N+1, or not having the right indexes), or is it something else, like the view being too big? Performance optimization has...
< Prev Page
Next Page >