TIL, 2018-02-14, Adding SSL to the Blog
Musings
- SSL on the blog: Reference, Reference, CloudFlare
- CSR: Certificate Signing Request. Nothing on Github pages + custom domain? Sad. I just used CloudFlare.
- So CloudFlare is being used as a DNS but no idea how to turn on the SSL for CF.
- Turns out I just needed to wait for a bit hehe. Also I like CF better than Namecheap’s interface.
- Upgraded nokogiri gem in TIL. Should I just lock version numbers for all gems? I’ve had bad experiences with this in Node, but IT’S NODE.
- What’s weird is that when I updated Bundler and did
bundle install
again, it didn’t update thebundled_with
. I needed to actually do something that will changeGemfile.lock
for a re-bundle to occur. - Read a brilliant article on the Art of Manliness blog re: focusing. I actually practiced it while reading the Smalltalk book.
- Comparing time Reference
- You can do
be_within
. - You can compare both first with
to_s(:db)
. - Actually,
2.minutes
just does2 * 60
.
- You can do
Smalltalk Best Practice Patterns
- Did Matz or Ruby/Rails core team read this? I know DHH did. Much of the principles are in Rails.
- Shortcut Constructor Method: Show how an object can be created.
- Converter Method: Defining methods on objects to convert them from one class to the other.
to_s
,to_date
. - Converter Constructor: Same as Converter, but static class.
Date.from_string
. - Query methods: Predicate method. Better to use
on?
thanstatus
if there are only 2 statuses. - Comparing methods: Create a method that accepts another object of the same class as the argument, and code the logic to compare the two.
Comparable
in Ruby. - Reversing Method: Create another class that makes another method look cool.
- Method Object: If there is a method with a lot of local vars, you can create a new object with those local vars as instance vars, then pass the original object in.
Order.price
becomesdef price PriceCalculator.new(self).process
.