This file contains 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
def csv(data) | |
arr = Array.wrap(data) | |
CSV.open(csv_filename, 'wb') do |csv| | |
keys = arr.first.keys | |
# header_row | |
csv << keys | |
arr.each do |hash| | |
csv << hash.values_at(*keys) | |
end | |
end |
This file contains 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
# config/initializers/string.rb | |
class String | |
##---------------bg Color-----------------## | |
def black; "\e[30m#{self}\e[0m" end | |
def red; "\e[31m#{self}\e[0m" end | |
def green; "\e[32m#{self}\e[0m" end | |
def brown; "\e[33m#{self}\e[0m" end | |
def blue; "\e[34m#{self}\e[0m" end |
This file contains 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
# Rotate logs | |
1) vim or nano /etc/logrotate.conf | |
2) Add these lines to the bottom of the file | |
/home/deploy/APPNAME/current/log/*.log { | |
daily | |
missingok | |
rotate 7 | |
compress | |
delaycompress | |
notifempty |
This file contains 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
#!/bin/sh | |
# ngix + required packages | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install curl git-core nginx build-essential tcl8.5 -y | |
# mysql | |
# sudo apt-get install libmysqlclient-dev mysql-server |
NewerOlder