うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

2015-03-31から1日間の記事一覧

Review AND, OR, XOR to shorten code

def check true if hoge.present? && fuga.present? end ↑this above can be improved. def check hoge.present? && fuga.present? end Review AND, OR, XOR def hoge # AND false && false #=> false false && true #=> false true && false #=> false true…

Screen-capture with wkhtmltoimage(wkhtmltopdf) onLinux

In many cases, phantom.js is used to get screen capture. But wkhtmltoimage can be alternative. Install http://wkhtmltopdf.org/downloads.html $ sudo yum install -y openssl libX11 libXext libXext.so.6 $ cd /usr/local/src $ wget http://downlo…

try update_all as bulk update like bulk insert

to use bulk insert on Rails, add gem below. gem 'activerecord-import' In MySQL, bulk update can be used by this gem, but postgres..... sqlite..... update_all solution! # make all records with open: false to open: true Shop.where(open: fals…

try update_all as bulk update like bulk insert

to use bulk insert on Rails, add gem below. gem 'activerecord-import' In MySQL, bulk update can be used by this gem, but postgres..... sqlite..... update_all solution! # make all records with open: false to open: true Shop.where(open: fals…

Screen-capture with wkhtmltoimage(wkhtmltopdf) onLinux

In many cases, phantom.js is used to get screen capture. But wkhtmltoimage can be alternative. Install http://wkhtmltopdf.org/downloads.html $ sudo yum install -y openssl libX11 libXext libXext.so.6 $ cd /usr/local/src $ wget http://downlo…

Review AND, OR, XOR to shorten code

def check true if hoge.present? && fuga.present? end ↑this above can be improved. def check hoge.present? && fuga.present? end Review AND, OR, XOR def hoge # AND false && false #=> false false && true #=> false true && false #=> false true…