This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker-compose up | |
sudo docker-compose down | |
sudo docker-compose ps | |
sudo docker exec -it [container_id] bash | |
# Backup | |
sudo docker exec container_id sh -c 'exec mysqldump -uroot -ppassword app' > ./data.sql | |
# Restore | |
docker cp FILE_NAME.sql CONTAINER_ID:/FILE_NAME.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install nginx | |
sudo apt-get install -y nginx-extras | |
# install generator | |
sudo apt install certbot python3-certbot-nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.new do | |
sleep 5000 | |
Rails.logger.debug "execution started" | |
# your codes here | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# model/product.rb | |
belongs_to :product, optional: true | |
# model/variation.rb | |
has_many :variations, dependent: :destroy | |
accepts_nested_attributes_for :variations, :allow_destroy => true | |
# admin/products.rb | |
permit_params :name, :description, | |
variations_attributes: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu installation | |
sudo apt-get install mysql-server mysql-client libmysqlclient-dev | |
# Mac installation | |
brew install mysql | |
brew install openssl | |
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ | |
# mac m1 additional command | |
gem install mysql2 -v '0.5.3' -- --with-opt-dir=$(brew --prefix openssl) --with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# link | |
https://github.com/jordanbrock/bootstrap-daterangepicker-rails | |
# Gemfile | |
gem 'jquery-rails' | |
gem 'momentjs-rails' | |
gem 'bootstrap-daterangepicker-rails' | |
# application.js | |
//= require moment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Isl |