01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140
Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.
[Laughter]
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; | |
| ;; BACK UP YOUR LOGSEQ DIR BEFORE RUNNING THIS! | |
| ;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; Copyright (C) Aug 4 2022, William R. Burdick Jr. | |
| ;; | |
| ;; LICENSE | |
| ;; This code is dual-licensed with MIT and GPL licenses. |
| namespace :db do | |
| desc "Drop postgresql db connections" | |
| task :disconnect => :environment do | |
| begin | |
| ActiveRecord::Base.connection.select_all("select * from pg_stat_activity order by procpid;").each do |x| | |
| ActiveRecord::Base.connection.execute("select pg_terminate_backend(#{x['procpid']})") | |
| end | |
| rescue | |
| end | |
| puts "DB sessions disconnected." |
| --colour | |
| -I app |
| require 'rubygems' | |
| def start_simplecov | |
| require 'simplecov' | |
| SimpleCov.start 'rails' unless ENV["SKIP_COV"] | |
| end | |
| def spork? | |
| defined?(Spork) && Spork.using_spork? | |
| end |
| # WAIT! Do consider that `wait` may not be needed. This article describes | |
| # that reasoning. Please read it and make informed decisions. | |
| # https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/ | |
| # 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 |
| #= require jquery | |
| #= require jquery_ujs | |
| #= require lib/modernizr | |
| #= require lib/jquery.lettering | |
| #= require_tree . | |
| $ -> | |
| $('*[data-googlemap]').googleMap() | |
| true |
| !!! Strict | |
| %html{locale_attrs} | |
| %head | |
| %title&= yield(:title) || t(:site_name) | |
| %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ | |
| %meta{ :name => "description", :content => "" }/ | |
| %meta{ :name => "keywords", :content => "" }/ | |
| = stylesheet_link_tag 'screen', :media => 'screen, projection' | |
| = stylesheet_link_tag 'print', :media => 'print' | |
| = stylesheet_link_tag 'buttons', :media => 'screen, projection' |