Daniel Harrington rubiii

View latest
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
 
require 'httpclient'
require 'json'
 
if ARGV.any?
gems = ARGV
else
puts 'feed me some gem name(s)!'
exit
View chk
1 2 3 4 5 6 7 8 9
#!/usr/bin/env ruby
 
require 'httpclient'
require 'json'
 
class Chk
 
RUBYGEMS_URL = 'http://rubygems.org/gems/%s'
NPM_URL = 'https://npmjs.org/package/%s'
View not_todo_list.md

NOT-TODO list

  • Don not watch movies featuring both Sarah Jessica Parker and Hugh Grant
View rsync-wtf.md

sources

app-js/**/*.js.coffee -> public/javascripts/compiled/

rsync -a --filter=P spec --filter=P *.js.map --filter=P *.js --delete -v app-js/ public/javascripts/compiled/

specs

View tldr.md

Savon 3.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on the all-new Wasabi 4.0 which is the driving factor behind this version. This means, that we now require a WSDL! There's a TL;DR for Wasabi 4.0 as well and you should read it.
  • HTTP caused a lot of problems and questions which this project should not have to deal with at all, so I'm replacing HTTPI with a simple adapter you can overwrite for authentication, cookies, etc. Added benefit: you can also easily swap it out in your tests.
  • Thanks to the new parser, Savon can now create example requests and show you the types to use.
View tldr.md

Wasabi 4.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on specifications and validates against real world WSDL documents.
  • It is way faster than ever before, while now parsing all elements.
  • It properly separates operations by service and port.
  • It supports WSDL and XML Schema imports.
  • It knows the input, output and fault message types.
  • It knows about Arrays of elements.
View gist:5579521
1 2 3 4 5 6
brew install graphviz
gem install ruby-prof
 
ruby-prof --mode=wall --printer=dot --file=output.dot fibonacci.rb 25
dot -T pdf -o output.pdf output.dot
open output.pdf
View 01. before
1 2 3 4 5 6 7 8 9 10
ruby-2.0.0-p0 ~/work/wasabi ‹master*› $ r spec/wasabi/document/economic_spec.rb
MethodProfiler results for: Wasabi::Parser
+------------------------+--------------+--------------+--------------+--------------+-------------+
| Method | Min Time | Max Time | Average Time | Total Time | Total Calls |
+------------------------+--------------+--------------+--------------+--------------+-------------+
| #parse | 34266.854 ms | 34266.854 ms | 34266.854 ms | 34266.854 ms | 1 |
| #parse_operations | 31511.302 ms | 31511.302 ms | 31511.302 ms | 31511.302 ms | 1 |
| #parse_types | 2753.060 ms | 2753.060 ms | 2753.060 ms | 2753.060 ms | 1 |
| #input_for | 8.110 ms | 72.536 ms | 10.037 ms | 30331.155 ms | 3022 |
| #at_xpath | 0.079 ms | 66.416 ms | 1.552 ms | 30851.576 ms | 19882 |
View smartmover_example.rb
1 2 3 4 5 6 7 8 9 10
# how to:
#
# 1. find the wsdl file (usually available at #{soap_endpoint + '?wsdl'}) like this:
# https://smartmover.melissadata.net/V2b/Smartmover.asmx?wsdl
#
# 2. throw the wsdl at soapUI (get it, it's free: http://www.soapui.org) and create
# a sample request for the 'DoSmartMover' operation.
#
# 3. use the xml type names from the sample request to create a message hash with the
# hash keys matching the xml tag names.
View awesome_string_factory.rb
1 2 3 4 5 6 7
class Class
def to_proc
Proc.new { |string| self.new string }
end
end
 
%w[a b c].map &String
Something went wrong with that request. Please try again.