Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug
.
gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
### Nginx ### | |
check process nginx with pidfile /run/nginx.pid | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 80 protocol http | |
then restart | |
if 3 restarts within 5 cycles then timeout |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time
class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime
steps in:
>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
module ApplicationType | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def model_name | |
superclass.model_name | |
end | |
def name | |
superclass.name |
CREATE VIEW lock_monitor AS | |
SELECT COALESCE(((blockingl.relation)::regclass)::text, blockingl.locktype) AS locked_item, | |
(now() - blockeda.query_start) AS waiting_duration, | |
blockeda.pid AS blocked_pid, | |
blockeda.query AS blocked_query, | |
blockedl.mode AS blocked_mode, | |
blockinga.pid AS blocking_pid, | |
blockinga.query AS blocking_query, | |
blockingl.mode AS blocking_mode | |
FROM (((pg_locks blockedl |
After a bit of digging, I believe the issue was that the 9.6 install setup a cluster for the new instance which was interrupting the pg_upgrade. I ended up getting it working by dropping the new cluster and upgrading the 9.3 cluster using pg_upgradecluster from the following gist: https://gist.github.com/delameko/bd3aa2a54a15c50c723f0eef8f583a44
Install packages
sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y
List clusters. Should show existing (9.3) and newly installed (9.6)
pg_lsclusters
start: | |
rackup config.ru -p 9292 | |
test: | |
time curl 'http://localhost:9292/exception' |