Yusuke ENDOH writes:
Periodically when fetching web pages using open-uri, he notices that many different kinds of exceptions can be raised.
So far, he’s experienced these below:
-
Errno::ETIMEDOUT
# mysql-style output for an array of ActiveRecord objects | |
# | |
# Usage: | |
# report(records) # displays report with all fields | |
# report(records, :field1, :field2, ...) # displays report with given fields | |
# | |
# Example: | |
# >> report(records, :id, :amount, :created_at) | |
# +------+-----------+--------------------------------+ | |
# | id | amount | created_at | |
# factory_girl for minitest | |
# | |
# Factory.define :user do |f| | |
# f.login 'johndoe%d' # Sequence. | |
# f.email '%{login}@example.com' # Interpolate. | |
# f.password f.password_confirmation('foobar') # Chain. | |
# end | |
# | |
# Factory.define :post do |f| | |
# f.user { Factory :user } # Blocks, if you must. |
=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') |
### | |
Module dependencies | |
### | |
require.paths.unshift "#{__dirname}/lib/support/express-csrf/" | |
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/" | |
express = require 'express' | |
app = module.exports = express.createServer() | |
RedisStore = require 'connect-redis' |
There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.
From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?
# encoding: utf-8 | |
# Be sure to restart your server when you modify this file. | |
# Add new inflection rules using the following format | |
# (all these examples are active by default): | |
# ActiveSupport::Inflector.inflections do |inflect| | |
# inflect.plural /^(ox)$/i, '\1en' | |
# inflect.singular /^(ox)en/i, '\1' | |
# inflect.irregular 'person', 'people' | |
# inflect.uncountable %w( fish sheep ) |
require 'rubygems' | |
def start_simplecov | |
require 'simplecov' | |
SimpleCov.start 'rails' unless ENV["SKIP_COV"] | |
end | |
def spork? | |
defined?(Spork) && Spork.using_spork? | |
end |
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.