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
Object.prototype.tap: (func) -> | |
func.apply(this, [this]) | |
Object.prototype.clone: -> | |
((this instanceof Array) ? [] : {}).tap (newObj) => | |
for key, val of this | |
if key == 'clone' | |
# no op | |
else if val && typeof val == 'object' | |
newObj[key] = val.clone() |
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
# package org.productivity.java.syslog4j.server; | |
# | |
# import java.util.Hashtable; | |
# import java.util.Iterator; | |
# import java.util.Map; | |
# import java.util.Set; | |
# | |
# import org.productivity.java.syslog4j.Syslog4jVersion; | |
# import org.productivity.java.syslog4j.SyslogConstants; | |
# import org.productivity.java.syslog4j.SyslogRuntimeException; |
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
>> /^\s*$/.match("one\r\n\r\ntwo") | |
=> #<MatchData "\r"> |
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
# Override http debugging, pipe to STDERR. | |
# Output: | |
# <- "POST /watched.xml HTTP/1.1\r\nAccept: */*\r\nConnection: close\r\nContent-Type: application/xml\r\nAuthorization: Basic MzkyZih7219fIUH\r\nContent-Length: 82\r\nHost: xxxxxxxxxxx.com\r\n\r\n" | |
# <- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n" | |
# -> "HTTP/1.1 422 Unprocessable Entity\r\n" | |
module ActiveResource | |
class Connection | |
def http | |
http = Net::HTTP.new(@site.host, @site.port) | |
http.use_ssl = @site.is_a?(URI::HTTPS) |
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 -v => ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10] | |
RUBY_ENGINE = 'ruby' | |
require 'rubygems' | |
gem 'ffi-rzmq' | |
gem 'json' | |
require 'ffi-rzmq' | |
require 'json' | |
require 'request' | |
CTX = ZMQ::Context.new(1) |
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
-- control frame ---------- | |
c:0005 p:---- s:0016 b:0016 l:000015 d:000015 CFUNC :puts | |
c:0004 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :puts | |
c:0003 p:0100 s:0010 b:0010 l:001a78 d:001658 EVAL http_0mq.rb:13 | |
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH | |
c:0001 p:0000 s:0002 b:0002 l:001a78 d:001a78 TOP | |
--------------------------- | |
-- control frame ---------- | |
c:0011 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC :undefine_finalizer | |
c:0010 p:---- s:0030 b:0030 l:000029 d:000029 CFUNC :free |
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
%%{ | |
machine gearman; | |
alphtype int; | |
action req_magic { | |
puts "req_magic" | |
} | |
action get_size { |
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
gem 'sinatra' |
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 Progress | |
SECOND = 1 | |
MINUTE = SECOND * 60 | |
HOUR = MINUTE * 60 | |
DAY = HOUR * 24 | |
CONV = [DAY, HOUR, MINUTE, SECOND] | |
NAMES = %w(days hours minutes seconds) | |
attr_accessor :total, :current |
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
<?PHP | |
// Create our client object. | |
$client= new GearmanClient(); | |
// Add default server (app.gearmanhq.com). | |
$client->addServer('hydra.gearmanhq.com', 4745); | |
//$client->addServer('localhost', 4731); | |
//$client->addServer('gm00.gearmanhq.net', 4745); | |
echo "Sending job...\n"; |