Skip to content

Instantly share code, notes, and snippets.

@bradgessler
Created December 10, 2009 08:10
Show Gist options
  • Save bradgessler/253194 to your computer and use it in GitHub Desktop.
Save bradgessler/253194 to your computer and use it in GitHub Desktop.
#### From the Shell...
~ $ cat /Volumes/localhost/polleverywhere/vendor/plugins/deep_cloning/lib/deep_cloning.rb
#### The series of HTTP requests that took place...
------------------Request ------------------
PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite HTTP/1.1
Host: localhost:5000
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getlastmodified/>
<D:getcontentlength/>
<D:resourcetype/>
</D:prop>
</D:propfind>
------------------ Response ------------------
HTTP/1.1 207
Content-Type: text/xml; charset="utf-8"
Content-Length: 524
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>http://localhost:5000/polleverywhere/vendor/plugins/acts_as_infinite</D:href>
<D:propstat>
<D:prop>
<D:getlastmodified>Thu, 01 Oct 2009 18:47:20 GMT</D:getlastmodified>
<D:getcontentlength>238</D:getcontentlength>
<D:resourcetype>
<D:collection/>
</D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
127.0.0.1 - - [10/Dec/2009 00:01:49] "PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite HTTP/1.1" 207 524 0.0098
------------------Request ------------------
PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite/lib HTTP/1.1
Host: localhost:5000
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getlastmodified/>
<D:getcontentlength/>
<D:resourcetype/>
</D:prop>
</D:propfind>
------------------ Response ------------------
HTTP/1.1 207
Content-Type: text/xml; charset="utf-8"
Content-Length: 528
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>http://localhost:5000/polleverywhere/vendor/plugins/acts_as_infinite/lib</D:href>
<D:propstat>
<D:prop>
<D:getlastmodified>Thu, 01 Oct 2009 18:47:20 GMT</D:getlastmodified>
<D:getcontentlength>136</D:getcontentlength>
<D:resourcetype>
<D:collection/>
</D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
127.0.0.1 - - [10/Dec/2009 00:01:49] "PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite/lib HTTP/1.1" 207 528 0.0054
------------------Request ------------------
PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite/lib/acts_as_infinite.rb HTTP/1.1
Host: localhost:5000
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getlastmodified/>
<D:getcontentlength/>
<D:resourcetype/>
</D:prop>
</D:propfind>
------------------ Response ------------------
HTTP/1.1 207
Content-Type: text/xml; charset="utf-8"
Content-Length: 513
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>http://localhost:5000/polleverywhere/vendor/plugins/acts_as_infinite/lib/acts_as_infinite.rb</D:href>
<D:propstat>
<D:prop>
<D:getlastmodified>Thu, 01 Oct 2009 18:47:20 GMT</D:getlastmodified>
<D:getcontentlength>709</D:getcontentlength>
<D:resourcetype></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
127.0.0.1 - - [10/Dec/2009 00:01:49] "PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite/lib/acts_as_infinite.rb HTTP/1.1" 207 513 0.0041
------------------Request ------------------
GET /polleverywhere/vendor/plugins/acts_as_infinite/lib/acts_as_infinite.rb HTTP/1.1
Host: localhost:5000
------------------ Response ------------------
HTTP/1.1 200
Last-Modified: Thu, 01 Oct 2009 18:47:20 GMT
Etag: 4870aa-2c5-4ac4f938
Content-Type: text/plain
Content-Length: 709
# ActsAsInfinite
module PollEverywhere
module ActsAsInfinite
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def acts_as_infinite(*attrs)
class_eval { include PollEverywhere::ActsAsInfinite::InstanceMethods }
attrs.each do |attr|
class_eval %(
def #{ attr }=(val)
write_attribute(:#{ attr }, PollEverywhere::Infinity::parse(val) == ::Infinity ? -1 : val)
end
def #{ attr }
PollEverywhere::Infinity::parse(read_attribute(:#{ attr }))
end
)
end
end
end
module InstanceMethods
end
end
end
127.0.0.1 - - [10/Dec/2009 00:01:49] "GET /polleverywhere/vendor/plugins/acts_as_infinite/lib/acts_as_infinite.rb HTTP/1.1" 200 709 0.0017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment