This does not covers installation of docker and compose
Also, presuming myapp is already created
For this example RoR app Will have
- Web server
- Postgres DB
| #!/bin/bash | |
| d=2019-04-01 | |
| while [ "$d" != 2019-08-04 ]; do | |
| echo $d | |
| php artisan export:adverts:fetch:leads --date="$d" | |
| d=$(date -I -d "$d + 1 day") | |
| done |
| %s/\(\w\)\(\w*\)/\U\1\L\2/g #capitalize words |
| 0xe295cFcd1666800726B4ed8ffF59F32e814b7bE9 |
| #!/bin/bash | |
| HEROKU_APP_NAME="XXX" | |
| LOCAL_DATABASE="XXX" | |
| heroku pg:backups capture DATABASE_URL --app $HEROKU_APP_NAME | |
| curl -o production.dump `heroku pg:backups public-url --app $HEROKU_APP_NAME` | |
| pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $(whoami) -d $LOCAL_DATABASE production.dump |
| require 'minitest/autorun' | |
| require_relative 'nice_flatten' | |
| class NiceFlattenTest < Minitest::Test | |
| def test_flattens_an_array_of_nested_arrays_into_a_flat_array | |
| flattened_array = [[1, 2, [3]], 4].flatten | |
| assert_equal [1, 2, 3, 4], flattened_array | |
| end | |
| def test_flattens_another_array_of_nested_arrays_into_a_flat_array |
| class NiceFlatten | |
| def flatten | |
| to_s | |
| .gsub(/[\[|\]]/, '') | |
| .split(', ') | |
| .map(&:to_i) | |
| end | |
| end |
| module Byebug | |
| class << self | |
| def start_remote_debugging | |
| require "byebug/core" | |
| require "byebug" | |
| port = begin | |
| server = TCPServer.new(nil, 0) | |
| server.addr[1] | |
| ensure | |
| server.close if server |
| def rename_photos | |
| images.each do |image| | |
| extension = File.extname(image.attachment_file_name).downcase | |
| old_file_name = image.attachment_file_name | |
| new_file_name = slug+"-"+"#{image.position}"+"#{extension}" | |
| image.attachment_file_name = new_file_name | |
| (image.attachment.styles.keys+[:original]).each do |style| | |
| FileUtils.move(File.join(File.dirname(image.attachment.path(style)), old_file_name), image.attachment.path(style)) | |
| end | |
| image.save! |
| # Path to your oh-my-zsh installation. | |
| export ZSH=$HOME/.oh-my-zsh | |
| # Set name of the theme to load. | |
| # Look in ~/.oh-my-zsh/themes/ | |
| # Optionally, if you set this to "random", it'll load a random theme each | |
| # time that oh-my-zsh is loaded. | |
| ZSH_THEME="psyrendust" | |
| ZSH_CUSTOM="$HOME/.oh-my-zsh-psyrendust" |