ArgumentError wrong number of arguments (given 2, expected 1) at javascript_pack_tag when you upgrade to Ruby 3.0.0

    <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

With Ruby 3.0.0 will result in the the following error.


wrong number of arguments (given 2, expected 1)

According to javascript_pack_tag doc at, it seems fine.

#javascript_pack_tag(*names, **options) ⇒ Object

Creates script tags that reference the js chunks from entrypoints when using split chunks API, as compiled by webpack per the entries list in package/environments/base.js. By default, this list is auto-generated to match everything in app/packs/entrypoints/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up. See:


<%= javascript_pack_tag ‘calendar’, ‘map’, ‘data-turbolinks-track’: ‘reload’ %> # =>

This error message is misleading. Your javascript_pack_tag code is totally fine. For example even if you remove the kwargs (keyword arguments) you still see the same error.

What’s actually causing this error is sprockets (4.0.0) lib/sprockets/base.rb:79:in `find_asset'.

Back then sprockets 4.0.1 had a bug that it simply did not work at all, so I added this line in Gemfile to prevent using sprockets 4.0.1, which caused sprockets to be out of date.

Therefore solution is just to remove this line. It worked after that!

Change Timezone of a Time object in Ruby

require 'time'
time = Time.parse('2021-02-05 23:03:09 +0000')
p time
# 2021-02-05 23:03:09 +0000

Let’s show that in your local time. Use Time#localtime which requires an offset like “-8:00”, but don’t hardcode that value.

require 'time'
time = Time.parse('2021-02-05 23:03:09 +0000')
p time.localtime(Time.zone_offset(
# 2021-02-05 15:03:09 -0800

It worked!

In case when you’d like to hardcode your timezone:

require 'time'
time = Time.parse('2021-02-05 23:03:09 +0000')
p time.localtime(Time.zone_offset('PST'))
# 2021-02-05 15:03:09 -0800

Happy new year!

In 2020, the last year, I had done many new things I had never achieved.

  • Snowboarding
    • Technically speaking I took beginner lessons in the late 2019, and also I had very little snowboarding experience over 10 years, ago, but most of my snowboarding experience started in 2020.
    • Now I can run all the green runs and most of the blue runs at Grouse Mountain with no trouble.
  • Incorporating
    • Yes, I founded a corporation
  • Accounting
    • GNU Cash is a great tool not only to bookkeeping but also to educate myself the basics of double-entry accounting.
  • React
    • I had focused mostly on (web) services backends, so my web frontend technology was many years behind. While I was making GenericFactoryGame, I took my time to learn React and Twitter Bootstrap.
  • Google Cloud Platform (GCP)
    • I had been using it, but I had never used by myself or maintained a system from the beginning to the completion. Now I have more confident with it from some my personal projects.

In 2021 some challenges are waiting for me to be get achieved. I’ll try doing my best.

What is tax deduction

The concept of tax deduction had never been intuitive to me, but I recently finally got the idea.

Tax deduction seems to have the following characters.

  • It reduces your taxable income
  • It reduces your tax owed to government and to your province.
  • It’s like a discount coupon when you purchase something

Spoiler alert: the conclusion of this post is that tax deduction is not a discount coupon but it works like a discount coupon, so you can assume that to be so for the most of cases.


Tax deduction is a reduction of income that is able to be taxed and is commonly a result of expenses, particularly those incurred to produce additional income. Tax deductions are a form of tax incentives, along with exemptions and credits. The difference between deductions, exemptions and credits is that deductions and exemptions both reduce taxable income, while credits reduce tax.[1]

Ok so tax deduction is not a discount coupon. You pay same amount of money to shops but pay less to federal/provinces.

Scenario 1: Expense goods

Say you need 100 of $1.00 pens for your work at home. They belongs to Office expenses in Canada, so you can deduct 100%.

If your income (not the money you actually get in your hands) is $100,000, you pay $25,899 total tax (average tax rate 25.90%, and marginal tax rate 38.01%).
However in this case you expensed 100 pens, so your income becomes $99,900, so you only have to pay $25,861 total (average tax rate 25.89%, and marginal tax rate 38.01%).

By paying $100 you saved $38. This means the tax deduction system worked like 38% discount for your purchase.

Conclusion: Tax deduction works as discount coupon for business activity purchases. The discount rate follows your marginal tax, not your average tax.

NOTE: You probably don’t need 100 pens just for yourself. This is just an exaggerated for demonstration. If you actually do so, it doesn’t seem to be realistic and reasonable, so I don’t think it’s considered to be a business activity, unless your job involves significant amount of writings that actually consume these pens.

Scenario 2: Buy a condo and use it partially as home office

If you use 25% of the condo rooms (like 1 bedroom) just for your work and not for anything else, you can deduct the followings as your business expenses in Canada. Work-space-in-the-home expenses

  • electricity
  • maintenance
  • property taxes
  • home insurance

But not these:

  • mortgage interest
  • capital cost allowance

If your marginal tax rate is 38% like Scenario 1, tax deduction works like a 9.5% discount coupon for these 4 expenses.

Scenario 3: You are a small corporate owner.

As a corporate owner, you have roughly 2 choices.

  • Pay as much salary as corporate income to yourself, to avoid corporate tax
  • Pay as less salary as possible, to avoid personal income tax

But you would almost always choose the second one, because corporate tax is significantly lower than personal income tax.

  • Corporation taxes in BC for small business: 9% federal + 2% provincial = 11%
  • Corporation taxes in BC: 38% or 28% or 15% federal + 12% provincial = 27% ~ 50% (???)

Personal marginal tax rate in BC is

  • 20.06% ~ 49.8%
  • Federal: 15%, 20.5%, 26%, 29%, or 33%
  • BC: 5.06%, 7.7%, 10.5%, 12.29%, 14.7%, 16.8%

So if you are a small business owner, the first priority is to keep your salary as little as possible, if you want to reduce the tax to pay in the year. You eventually have to pay all the rest out to yourself as salary (or as dividends) when you close the business though.

Anywhere, speaking of tax deduction, since corporate tax rate for small businesses is 11%, it’s not as powerful as individuals.

Personal expenses and deductions

It very depends on each people, but the typical personal expenses probably follows like the following trend

  • Home mortgage ($10k~$20k?)
  • Property Taxes / Maintenance Fee / Homeowners’ Insurance ($8K~$15K?)
    • Or rent ($30k~40K?)
  • Car ($22k~$26K? or 0)
  • Home equity line of credit interest if you invest ($0k~$20K)
  • Cellular phone / internet services ($2K?)
  • Hydro, public train/bus, medicine

And here’s how much you can deduct

  • 0%
    • Home mortgage
      • Depends on the distance (e.g. 500km = 500 * 0.28 = $140)
    • Car (based on driving distance for your business activity)
  • 15%
    • public train/bus
      • Depends on the space (e.g. 25%)
    • Property Taxes / Maintenance Fee / Homeowners’ Insurance
      • Rent
      • Hydro
      • Depends on the hours used (e.g. 8/24 = 33%?)
    • Cellular phone / internet services (based on how many hours you use for your business? (needs more research))
  • 100%
    • Home equity line of credit interest if you invest ($0k~$20K)
    • Medicine (needs more research)

Well it’s very complicated…

One year after moving back to Vancouver

I moved back to Vancouver, BC from Tokyo, Japan last year. It’s been a crazy year from mid 2019 to mid 2020!

  • Started working fully remotely
    • I often worked from home even when I was in Tokyo, but not entirely
  • Started learning personal financing and portfolio balancing
    • My open P/L is a big negative number unfortunately
  • Started snowboarding
    • This changed a lot
  • Kept working out as my new routine
    • Running and leg blaster
  • Missing good fish
    • Here in Vancouver unfortunately it’s very hard to get good fish in a reasonable price

Released a factory logistics game called “GenericFactoryGame”

GenericFactoryGame (as of 2020-05-17, it’s still preview version, which means I may add more breaking changes)

This is a game involving a factory which makes something you expect, let’s say a generic purpose factory, converting from a generic ingredient to a generic product. You are supposed to keep the ingredients/products flow well by adjusting the import/export and factory efficiency. The budget is tight but you also have to keep expanding the factory both by the number of employees and its equipments. Don’t forget keep providing high quality products to your customers, so that your company get high credit; higher credit helps better debt volume and rate, and provides better contracts with customers.

This game is pretty challenging. I even lose often, even though this game does not have any randomness!

You can see all the saved data and high scores to observe how others did too.



For developers

It’s implemented in Ruby 2.7.1, Rails 6.0.2, React, and Twitter bootstrap. I made a playable initial prototype in a day and a half, assuming unless I complete within a weekend this project holds forever. Luckily everything went well, so I could keep developing.

Tried creating a sample Elixir Phoenix web app

It’s just a memo for myself.


I followed Phoenix Guides. I also used docker for PostgreSQL instead of installing it directly into the system.

docker run --rm --name hello-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres

sudo pacman -S inotify-tools # archlinux

mix local.hex
mix archive.install hex phx_new 1.5.1
mix hello
cd hello
mix ecto.create
mix phx.gen.html Messages Post posts name:string body:text
# Edit git/hello/config/dev.exs to use "password" password and replace "localhost" with ""
mix phx.server

How to prioritize deoplete’s filename completion higher than others but less than vimshell


When I auto-complete filenames/dirnames, particularly when it prefixes ./ or ~/, I always expect filename completions comes first, and I don’t need other completions; they are just noise. In vimshell it works as I expect, but in cmdwin buffer which filetype is vim it doesn’t work as I expect.

good (vimshell):

bad (cmdwin, which means filetype=vim):


I tried solving this by setting filetype priority into deoplete, but it didn’t work:

call deoplete#custom#source('file', 'rank', 1000)

Because vimshell’s completion rank is 500, filetype completion for vim’s rank is 500, and filename completion rank is 150. The higher the rank is the higher the candidates appear. The number 500 is the default rank for arbitrary omni-completions.


Solution (OUTDATED: See the bottom)

Just patch the rank locally against vimshell and deoplete’s file source. It’s dirty but it works.


diff --git a/rplugin/python3/deoplete/source/ b/rplugin/python3/deoplete/source/
index 910dde6..24576de 100644
--- a/rplugin/python3/deoplete/source/
+++ b/rplugin/python3/deoplete/source/
@@ -22,7 +22,7 @@ class Source(Base): = 'file'
self.mark = '[F]'
self.min_pattern_length = 0
- self.rank = 150
+ self.rank = 550 typing.List[str] = ['InsertEnter']
self.vars = {
'enable_buffer_path': True,


diff --git a/rplugin/python3/deoplete/sources/ b/rplugin/python3/deoplete/sources/
index 0f36424..a5e9eff 100644
--- a/rplugin/python3/deoplete/sources/
+++ b/rplugin/python3/deoplete/sources/
@@ -36,7 +36,7 @@ class Source(Base):
self.mark = '[vimshell]'
self.filetypes = ['vimshell']
self.is_bytepos = True
- self.rank = 500
+ self.rank = 600

def get_complete_position(self, context):


Now they works as below.




New Solution

After publishing this article Shougo pointed me that I can just do without patching, and it worked!

Things I’ve done well in 2019

  • Tech talks at big conferences
  • Moving!
    • Tokyo, Japan ✈ Vancouver, Canada
  • Working fully remotely as a self-employed software developer
    • It forced me to learn about tax and financing stuff
  • Running at gym
    • I selectively chose to live in a condo which has free and easy access to its gym
    • In 2020 I’m still trying to be able to run for 5 km within 30 minutes
  • Mutual funds & ETFs, and real estates
    • They are extremely hard and completely new to me
  • Snowboarding!
  • Misc
    • Swimming (not really focused on it very much yet)
    • Book reading
      • Microservices architecture, Essential scrum, and The Long Short Story (started listening to speech features instead of using my eyes to read — it saved a lot of my time and energy, sacrificing the depth of my understanding though)
    • Games
      • Satisfactory, Civilization 6, Railway Empire, Cities: Skylines, and 7 days to die a18
      • Catan (only when I was in Japan)

Started snowboarding

After visiting Whistler, BC for multiple of winter activities including snowboard beginner lesson, ziptrek, and snow tubing, my wife and I started snowboarding more seriously.

Grouse mountain is very close to Downtown Vancouver where we live, so we bought a pair of winter passes that offer unlimited Skyride and snowboard lift accesses between Dec 2019 to Apr 2020.


“the Cut” in Grouse Mountain from Downtown Vancouver: