Export PostgreSQL table to CSV [COPY command]

As PostgreSQL COPY command is convenient, I wrote this tips.
This command is easy and really useful, so please try it.

$ psql
-- Export product table to CSV file
\copy (SELECT * FROM products ORDER BY id) TO '/tmp/produccts.csv' DELIMITER ',' CSV HEADER
# If you want to see the csv including Shift-JIS(Japanese)
nkf -s /tmp/products.csv > /tmp/converted.csv

Read More

RSpec tesiting for rake task [Ruby on Rails]

I summarized the procedure of the RSpec test in this article.
Since I summarized it as simple as possible, please read through those who are trying to create Rake task for the first time.

Read More

What are mock and stub used in unit testing?

This article is a simple explanation of mock and stub used in unit testing.

Read More

How to use alternate created_at / updated_at column

This article shows 2 ways for “How to use alternate created_at/updated_at column.

Read More

Effective Procedures to Setup new Mac El Captain For Rubyist

This article describes effective procedures for Rubyists to setup new Mac OS El Captain.

Read More

Prevent 'ArgumentError: invalid byte sequence in UTF-8' on Faraday[Ruby]

This is a tips to prevent “ArgumentError: invalid byte sequence in UTF-8“.

Sample Code

url = "http://sample.com/search?q=%A0"
ArgumentError: invalid byte sequence in UTF-8
=> #<Faraday::Response:0x007fd8ca826ce8...

Happy Hacking!

Read More

Using Redis for caching & session management with Ruby on Rails

This article shows about cacing data & session management with Ruby on Rails.

Read More

Use Elasticcache with Elasticbeanstalk

This article describes how to use Elasticcache with Elasticbeanstalk.

Read More

How to upload gziped file to S3 from URL[Ruby]

This article shows how to upload gziped file to S3 from URL by Ruby.

Read More

Deploy Rails App to ElasitcBeanstalk on wercker

I published “wercker step” to deploy an application to Elastic Beanstalk instance using AWS CLI.

morizyun/eb-deploy - GitHub

This aritcle describes how to use the wercker step and outline of the step.

Read More