New class 'OptionType'
The 'addOption' method has a new parameter: { dart-core.String valueHelp: false }
$ wget --spider -o ./broken-links.txt -e robots=off -w 1 -r -p https://www.dartlang.org/ | |
$ cat broken-links.txt |grep -B 2 '404 Not' | |
--2014-09-01 17:08:11-- https://www.dartlang.org/articles/writing-unit-tests-for-pub-packages/ | |
Reusing existing connection to www.dartlang.org:443. | |
HTTP request sent, awaiting response... 404 Not Found | |
-- | |
--2014-09-01 17:13:48-- https://www.dartlang.org/articles/benchmarking/ | |
Reusing existing connection to www.dartlang.org:443. | |
HTTP request sent, awaiting response... 404 Not Found |
$ git clone [email protected]:mikel/mail.git $ cd mail $ bundle $ time bundle exec rake
Before: | |
Top 10 allocation sites: | |
String allocations at <PWD>/lib/mail/utilities.rb:180 | |
4639 allocations during ./spec/mail/attachments_list_spec.rb:312 | |
... | |
Array allocations at <PWD>/lib/mail/parsers/received_parser.rb:13 | |
2326 allocations during ./spec/mail/message_spec.rb:1627 | |
... | |
String allocations at <PWD>/lib/mail/fields/common/common_field.rb:46 | |
2269 allocations during ./spec/mail/fields/content_type_field_spec.rb:198 |
def curry(prc, *args) | |
Proc.new { |*remaining| prc.call(*args.map { |arg| arg || remaining.shift }) } | |
end | |
def curry_m(m, n, *args) | |
define_method(m, curry(method(n), *args)) | |
end | |
power = ->(a,b){ "#{a}**#{b} is #{a**b}" } | |
square = curry power, nil, 2 |
require 'stringio' | |
require 'zlib' | |
GZ_FILE = "rack-issue-571.gz" | |
class VerboseStringIO < StringIO | |
attr_accessor :log | |
def initialize(*args) | |
@log = [] |
require "mechanize" | |
a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } | |
a.get("https://www.google.com/") do |page| | |
puts page.at("#gbqfq").inspect | |
end | |
require "mechanize" |
function jQaddClass( elem, value ) { | |
var newClass = value; | |
if ( elem.nodeType === 1 ) { | |
if ( !elem.className ) { | |
elem.className = value; | |
} else { | |
var className = " " + elem.className + " ", setClass = elem.className; | |
if ( className.indexOf( " " + newClass + " " ) < 0 ) { |
number = 1234567 | |
# Chaining methods more than once-ish is confusing; the developer has to keep | |
# in mind wtf is going on: | |
number.to_s.reverse.split(//).each_slice(3).map(&:join).join(',').reverse | |
# Commenting the state of each chain helps: | |
number.to_s. # String, e.g. "1234567" | |
reverse. # reverse it, e.g. "7654321" | |
split(//). # split on every character, e.g. ["7", "6", "5", "4", "3", "2", "1"] |
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'highline/import' | |
require 'uri' | |
class AdHoccer | |
include Capybara::DSL | |
def initialize(url, recipient) |