I know a person fired from his Rails dev position who had a sleep issue on the job. They later came under new management and switched to a remote team and let him have his own hours. If you are competent you can do fine with a remote job. You can probably good money and move to a cheaper area.