Skip to content

Instantly share code, notes, and snippets.

View steved's full-sized avatar

Steven Davidovitz steved

  • San Francisco, CA, USA
View GitHub Profile
@steved
steved / request.rb
Created December 9, 2010 17:11
Eventmachine Deferrable example
require 'httparty'
require 'eventmachine'
class Request
include EM::Deferrable
@@requests = []
attr_reader :method, :params
@steved
steved / output
Created December 9, 2010 17:12
Sample output of request.rb
10014: Jerrold Nadler => District 8, (202) 225-5635
10014 is in NY
91108: David Dreier => District 26, (202) 225-2305
91108: Adam B. Schiff => District 29, (202) 225-4176
91108 is in CA
90210: Henry A. Waxman => District 30, (202) 225-3976
90210: Howard L. Berman => District 28, (202) 225-4695
90210 is in CA
10065: No Data Found
...
@steved
steved / timings
Created December 9, 2010 17:26
Timings of request.rb and request_serial.rb
$ time ruby request_serial.rb > serial
real 0m7.150s
user 0m0.423s
sys 0m0.146s
$ time ruby request.rb > parallel
real 0m2.274s
user 0m1.997s
sys 0m0.157s
@steved
steved / escape_utils_redcarpet.rb
Created April 18, 2013 02:46
Redcarpet and escape_utils use different versions of houdini underneath. Unfortunately, that means any project with both will have problems.
require 'redcarpet' # => 2.2.2
require 'escape_utils' # => 0.3.2
EscapeUtils.escape_html("test")
__END__
ruby(11004,0x7fff75318960) malloc: *** error for object 0x106a20cd0: pointer being realloc'd was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
@steved
steved / oauth2.zendesk.rb
Created August 6, 2013 18:26
Ruby OAuth2 Example for Zendesk
require 'zendesk_api'
require 'oauth2'
client = OAuth2::Client.new('{my client unique identifier}',
'{my client secret}',
site: 'https://{subdomain}.zendesk.com',
token_url: "/oauth/tokens",
authorize_url: "/oauth/authorizations/new")
diff --git a/src/checks.c b/src/checks.c
index 0668a76..dba45f0 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1349,14 +1349,15 @@ static void event_srv_chk_r(struct connection *conn)
*check->bi->data = '\0';
check->bi->i = 0;
- /* Close the connection... We absolutely want to perform a hard close
- * and reset the connection if some data are pending, otherwise we end