Build Silly Apps for your Friends

A friend of mine runs a Horror podcast called Nite Shift Video, Horror Movie Reviews, Scary Stories, and Interviews with other people in the Spooky Community. One of the interview ice breakers he does is a scary version of MASH. No, not the old tv show about soldiers in the Korean war. The future telling paper and pen game from grade school.

Mash was a game where you picked some categories and filled them in with choices then people would pick a magic number through various means. Then you would count through and cross off every Nth choice until you were left with one choice in each category. Then that was supposed to be your future.

The host, Nite Shift Jay, would run a custom one they made in pen and paper and have the guest guess a number to decide their horror movie future. However, to cut down on the dead air time as he followed the algorithm of moving through the choices crossing out numbers, Jay asked me to make a website version, so he could just take the number and get the result to keep things running smooth.


With this request in mind, The Mash Website was built. This was a simple project, took me maybe a day to build and deploy once I sat down and did it. However, I did get to learn things even during a small project like this.

  • Utilize Docker to deploy on digital ocean
  • Use LetsEncrypt to secure a subdomain of my root domain.
  • Build a Dynamic Form builder, to allow users to decide how many categories and choices they want.
  • Automate log rotation, docker health checks and automated restarts.

All these things are simple in the grand scheme of things but very valuable to have done yourself. Most jobs you get hired at likely already have a lot of this done, or have someone who manages the DevOp side of things. So it feels good to take something and put it out for the world to use. Obviously, it could use a lot more cleanup and design, however, it served the purpose for Jay. Through the magic of google analytics as well, it seems as at least 24 other people have used it as well. While it’s not changing the world or making me millions, I hope it made someone smile.


Mash Website: https://mash.p3rishable.com/games

Nite Shift Video: https://www.instagram.com/niteshiftvideo/

10% Rule & My Reading List for 2022

I’m going to try to read 34 books this year. I know it seems like quite a bit, and honestly, it is. However, I read a really interesting article about the 10% rule recently. Basically, it’s an easy way to break books up into daily percentage chunks so you can have small and attainable goals to accomplish each day.

The rules are easy:

  1. Create a backlog of books – for this, I selected from several different lists of suggested reads for Rails developers, Management, Startup, and Philosophy books. I took these suggestions and randomized them into an ordered list and decided that is my reading order for the year.
  2. Start Reading – Load them onto your Kindle or borrow them from your local library, and start reading 10% each day. Utilizing the downtime or wasted time, that exists during my day. Whether it’s while I’m waiting for my coffee to brew, or sitting in the dark waiting for my son to fall asleep because his newfound separation anxiety requires I stay in the room until he drifts off.

If you want to join me I’ve included my list below along with Amazon links, or you can use your public library, most have their own app to borrow digital copies of books for free.

  1. Drive: The Surprising Truth About What Motivates Us
  2. Patterns of Enterprise Application Architecture
  3. The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition)
  4. Being Geek: The Software Developer’s Career Handbook
  5. A Guide to the Good Life: The Ancient Art of Stoic Joy
  6. Shape Up – Ryan Singer
  7. Effective Programming – Jeff Atwood
  8. Getting Real – Basecamp
  9. Rework
  10. Design Patterns: Elements of Reusable Object-Oriented Software
  11. Ruby Cookbook: Recipes for Object-Oriented Scripting
  12. Ruby Best Practices: Increase Your Productivity – Write Better Code
  13. Zero to One: Notes on Startups, or How to Build the Future
  14. The Happiness Project, Tenth Anniversary Edition: Or, Why I Spent a Year Trying to Sing in the Morning, Clean My Closets, Fight Right, Read Aristotle, and Generally Have More Fun
  15. The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition)
  16. The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
  17. Thank You for Being Late: An Optimist’s Guide to Thriving in the Age of Accelerations (Version 2.0, With a New Afterword)
  18. Remote: Office Not Required
  19. Flow: The Psychology of Optimal Experience (Harper Perennial Modern Classics)
  20. Clean Code: A Handbook of Agile Software Craftsmanship
  21. Rails AntiPatterns: Best Practice Ruby on Rails Refactoring (Addison-Wesley Professional Ruby) (Addison-Wesley Professional Ruby Series)
  22. Domain-Driven Design: Tackling Complexity in the Heart of Software
  23. Maverick Startup: 11 X-Factors to Bootstrap From Zero to Six Figures and Beyond
  24. Creativity, Inc.: Overcoming the Unseen Forces That Stand in the Way of True Inspiration
  25. Turn the Ship Around!: A True Story of Turning Followers into Leaders
  26. How to stop sucking and be awesome instead – Jeff Atwood
  27. The Well-Grounded Rubyist
  28. Psycho-Cybernetics: Updated and Expanded
  29. Peopleware: Productive Projects and Teams
  30. Practical Object-Oriented Design: An Agile Primer Using Ruby
  31. Refactoring: Improving the Design of Existing Code (2nd Edition) (Addison-Wesley Signature Series (Fowler))
  32. It Doesn’t Have to Be Crazy at Work
  33. Eloquent Ruby (Addison-Wesley Professional Ruby Series)
  34. Meditations: A New Translation

I would love to hear what books you plan on reading this year, and if you have any book suggestions to be added to my list for 2023. Feel free to let me know in the comments or on my socials. I will try to give some quick reviews on the books after I finish them, as well as update my progress throughout the year. Until then Happy Reading!

Run Rake tasks on a server with Capistrano and Rake

I ran into the issue the other day of getting my Jenkins to be able to
run rake tasks on a remote server. So I decided to write a rake task
that allowed it to offload the connection to the remote box onto
Capistrano. This nifty little Rake task will allow you to run Rake tasks
in a production environment on a remote server using the Dynamic Duo of
Capistrano 3 and Rake.

desc "Easily Run rake task on a remote server"
  task :server_side_rake do
    on roles(:app), in: :sequence, wait: 5 do
      within release_path do
      with rails_env: :production do
      execute :rake, ENV['task'], "RAILS_ENV=production"
      end
    end
  end
end

Then you can run your one off rake task with the following command:

cap production server_side_rake task=one_time_rake_task --trace

Easy as that!

Check for Compiled Assets Existence.

Have you ever run into a situation where you wanted to check if an asset exists in Rails. Then when you deploy to production, it doesn’t work. That is because Rails by default compiles assets which changes the path and file name.

We found this out the hard way, luckily it was just the first deploy so
it didn’t affect any customers. So I thought I would share the solution we found.

Inside of a helper add the following code:

def asset_exist?(path)
  if Rails.configuration.assets.compile
    Rails.application.precompiled_assets.include? path
  else
    Rails.application.assets_manifest.assets[path].present?
  end
end

Then in your view or controller:

if asset_exist?('test.png')
  puts "Asset found!"
else
  puts "Asset not found!"
end

There you have it!

Mobile Testing on Rails

If you have worked on making a website, in this mobile age you have probably run into the issue of testing local code on external devices, such as your cell phone or tablet. I’ll show you a really quick way to all your Rails server to be exposed to other devices on your network.

– Ensure Both Devices are on the same network.
– Then start your rails server using the following command:

rails s -b 0.0.0.0

Next find your local ip:

Mac
This can be found in your System Preferences -> Network and will be shown in tiny print under the status of your connection.

Linux
Use ifconfig to find your address

ifconfig

If you’re lazy you can use this command to just give you back what you want.

ifconfig | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`

Finally on your mobile browser and go to the url YOUR_IP:PORT