CORS – Set Access-Control-Allow-Origin for multiple domains

When there is a requirement to allow multiple request origins, you can do it with the following configuration: SetEnvIfNoCase Origin “https?:\/\/(dev|staging|game|mail)?(\d+)?$” ACAO=$0Header always set Access-Control-Allow-Origin %{ACAO}e env=ACAO This needs to go inside the Directory directive in the apache configuration file. With the snippet above, you will be able to allow requests from the following domains […]

Read more "CORS – Set Access-Control-Allow-Origin for multiple domains"

Set up awesome_print as default Rails console formatter

awesome_print pretty prints/formats Ruby objects. This post focuses on having awesome_print enabled in the rails console without changing/updating the Gemfile. This way it is available in all Rails applications and consoles. You can always add the gem to the Gemfile and have this working for that specific rails application. gem ‘awesome_print’, :require => ‘ap’ To […]

Read more "Set up awesome_print as default Rails console formatter"

Install Gems without ri, rdoc documentation

These days it is not necessary to have gem documentation installed locally. This unnecessarily increases installation time. Unless you have specific requirement for locally available documentation, you can skip the installation of rdoc and ri documentation when installing gems. Just add this to your home directory in <home_directory>/.gemrc file gem: –no-document # skip installation of all documentation […]

Read more "Install Gems without ri, rdoc documentation"