Skip to content

Instantly share code, notes, and snippets.

View lorenzoplanas's full-sized avatar
💭
🏖️

Lorenzo Planas lorenzoplanas

💭
🏖️
View GitHub Profile
@lorenzoplanas
lorenzoplanas / em_syslog2.rb
Created December 13, 2011 09:22 — forked from ngauthier/em_syslog2.rb
An EventMachine Syslog Protocol
# this is a configurable version of an EventMachine syslogger
# It was build to replace https://github.com/melito/em-syslog
#
# You can instantiate many of them (no global variables) as
# well as configure the facility. It also quacks like a ruby
# logger so it can be interchanged with a ruby logger.
#
# Example:
#
# # 11 is the facility code for an FTP daemon
@lorenzoplanas
lorenzoplanas / http_client_spec.rb
Created December 13, 2011 09:22 — forked from xaviershay/http_client_spec.rb
Running a rack app in a thread for integration tests.
require 'integration_helper'
require 'rack'
require 'rack/handler/webrick'
describe HttpClient do
before :all do
@server = WEBrick::HTTPServer.new(
:Port => 9293,
:Logger => Rails.logger,
:AccessLog => Rails.logger
class Post
include Mongoid::Document
field :title, :type => String
has_many :comments do
def update(selector, params)
@target.each { |t| t.update_attributes(params) if t.matches?(selector) }
end
end
end