config/database.php
'redis' => [
// ...
'sessions' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
# This is just a cheat sheet: | |
# On production | |
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
# On local | |
scp -C production:~/database.sql.gz | |
dropdb database && createdb database | |
gunzip < database.sql.gz | psql database |
I have to make a system which can give us short version of URL and a way to track clicks.
This gist is about how I solved the first part of problem: as short as possible URL.
First things first. If we talk about system which handle URLs then we should have a table in database.
Example table of URLs:
const principal = 100000; | |
const interestRate = 0.12 / 12; | |
const instalments = 24; | |
function annuityFactor(interestRate, instalments) { | |
return (interestRate + ( interestRate / ( Math.pow(1 + interestRate, instalments) - 1 ) ) ); | |
} | |
function annuityPayment(principal, interestRate, instalments) { | |
return principal * annuityFactor(interestRate, instalments); |
server { | |
listen <ip>:<port>; | |
server_name <domain>; | |
charset off; | |
set $root_path <path_to_rails_application>/public; | |
disable_symlinks if_not_owner from=$root_path; | |
root $root_path; | |
access_log <path_to_logs_dir>/<domain>-access.log; | |
error_log <path_to_logs_dir>/<domain>-error.log notice; |