React apps in subdirectories that use React Router

If you’ve ever deployed your new React app to a subfolder on your server and you’re using React Router you might notice that React Router starts getting all funky and truncates the subfolder name.  This is the expected behavior, albeit something easy to overlook when deploying to a subfolder.  The good news is that there is a pretty straightforward solution: just add a basepath  to your Router and specify the folder name.

Check out the documentation.

For example, I deploy most of my playground apps to apps.bioramp.com, to deploy the Auto9 app I use a subfolder and the resulting URL is http://apps.bioramp.com/auto9

This is what my Router looks like for that app (keep in mind I import my routes from an external file).

Also, keep in the mind that you should have a “homepage” node in your package.json before you a do a build.

Using SMTP relay via Office365 in Rails apps

First you’ll need to add your production box IP address to Exchange Connector

Example URL: https://outlook.office365.com/ecp/?rfr=Admin_o365&exsvurl=1&Realm=yourdomain.com

Then add the following to application production.rb

and boom! your Rails app will start sending emails through Office 365.

Nginx setup with SSL on Ruby app running Passenger

Once you’ve got your certs all setup you can add an entry to /etc/nginx/sites-available and then symlink it to /etc/nginx/site-enabled

An example snippet below:

 

Typed by a human or scanned with barcode reader?

Simple check to determine the speed of user input into a form element. This was to prevent users from typing in barcodes that were required to be entered using a barcode scanner.

HTML:

 

JavaScript:

 

 

CSS Media Queries skeleton for mobile devices