If you are an attendee of eurucamp 2012, you get the chance to win a FREE Señor Developer t-shirt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Class | |
def to_proc | |
Proc.new { |string| self.new string } | |
end | |
end | |
%w[a b c].map &String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rspec --format MacVimFormatter --color spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<wsdl:definitions xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://3e.pl/ADInterface" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" targetNamespace="http://3e.pl/ADInterface"> | |
<wsdl:types> | |
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://3e.pl/ADInterface" elementFormDefault="qualified" targetNamespace="http://3e.pl/ADInterface"> | |
<xsd:element name="Window" type="tns:Window"/> | |
<xsd:complexType name="Window"> | |
<xsd:sequence> | |
<xsd:element name="Description" type="xsd:string"/> | |
<xsd:element name="Help" type="xsd:string"/> | |
<xsd:element name="Tabs" type="tns:TabList"/> | |
</xsd:sequence> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HTTPI | |
module Adapter | |
class Curb < Base | |
register :curb | |
dependencies 'curb' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "zlib" | |
require "stringio" | |
xml = StringIO.new File.read("xml.gz") | |
gzip = Zlib::GzipReader.new(xml) | |
gzip.read |
Measure your test performance with e.g. CI Reporter and refactor slow tests.
- Extract domain objects from your fat models. ActiveRecord is not your domain.
- Decouple code that doesn't follow the Single Responsibility Principle.
- Inject dependencies instead of referring to globals like
Rails
orUser
.
From my experience, tests that don't require "test_helper" reveal the coupling in your application.