(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Keep delayed job workers running using systemd on ubuntu | |
| # Usage | |
| # Start "sudo systemctl start delayed_job@{0..3}" to start 4 worker instances | |
| # Enable "sudo systemctl enable delayed_job@{0..3}" to enable 4 worker instances | |
| # Restart "sudo systemctl restart delayed_job@{0..3}" to restart 4 worker instances | |
| # Disable "sudo systemctl disable delayed_job@{0..3}" to disable 4 worker instances | |
| # Stop "sudo systemctl stop delayed_job@{0..3}" to stop 4 worker instances | |
| [Unit] | |
| Description=Delayed Job Worker %i |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| class TaxCode | |
| GENERATORS = { | |
| :us => lambda { |id| "US-#{id}" }, | |
| :br => lambda { |id| "#{id + 9}-BRA" }, | |
| } | |
| def self.generate(code, id) | |
| gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}" | |
| gen.call(id) | |
| end |