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
class Array | |
def to_csv(csv_filename="hash.csv") | |
require 'csv' | |
CSV.open(csv_filename, "wb") do |csv| | |
csv << first.keys # adds the attributes name on the first line | |
self.each do |hash| | |
csv << hash.values | |
end | |
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
rails_version = '6.1.3' | |
# Include rails specific gems | |
# We need this until https://github.com/rails/rails/issues/41750 is resolved | |
gem 'actioncable', rails_version | |
gem 'actionmailer', rails_version | |
gem 'actionpack', rails_version | |
gem 'actionview', rails_version | |
gem 'activejob', rails_version | |
gem 'activemodel', rails_version | |
gem 'activerecord', rails_version |
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
sudo apt-get update | |
sudo apt-get install build-essential git libreadline-dev zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev | |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash | |
# may need this, but install script above should handle it; and yeah, you can do multiline inserts with awk/sed or whatever | |
echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(pyenv init -)"' >> ~/.bashrc | |
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc | |
source ~/.bashrc | |
pyenv install 3.6.0 |
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
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
describe 'Modal' do | |
should 'display login errors' do | |
visit root_path | |
click_link 'My HomeMarks' | |
within '#login_area' do | |
fill_in 'email', with: 'will@not.work' | |
fill_in 'password', with: 'test' |
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
[database] | |
log_queries = true |
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
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |
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
# graphite/statsd/grafana setup on new Amazon Linux instance | |
# add http://graphite/ to grafana as a data source | |
sudo su | |
yum update --assumeyes | |
yum install --assumeyes docker | |
service docker start | |
docker \ | |
run \ |
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
<VirtualHost *:80> | |
ServerName www.esdb.cn | |
ServerAlias esdb.cn | |
DocumentRoot /home/ubuntu/apps/xxx.com/current/public | |
<Directory /home/ubuntu/apps/xxx.com/current/public> | |
Options FollowSymLinks | |
AllowOverride None | |
Require all granted | |
</Directory> |