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

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.

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

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

1
2
3
4
5
6
7
url = "http://sample.com/search?q=%A0"
Faraday.get(url)
ArgumentError: invalid byte sequence in UTF-8
Faraday.get(url.force_encoding(Encoding::BINARY))
=> #<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