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
#!/usr/bin/env ruby | |
## Please compile and install zeromq before running this script. | |
require 'rubygems' | |
require 'ffi-rzmq' | |
require 'json' | |
context = 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
#!/usr/bin/env ruby | |
require 'celluloid/zmq' | |
require 'logger' | |
require 'airbrake-ruby' | |
#require 'logstash-logger' | |
Airbrake.configure do |c| | |
c.project_id = 123018 | |
c.project_key = '552470f432b338efb3c4aab31412f93a' | |
c.environment = 'production' |
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
input { | |
udp { | |
port => 5300 | |
codec => 'json' | |
} | |
} | |
## the policy_router SQL filter | |
filter { | |
if ([type] == "policy_router") { | |
grok { |
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 Ticket | |
def purchase | |
puts "** Purchasing the Ticket **" | |
end | |
alias_method :call,:purchase | |
end | |
## Following are they way you can invoke the download method | |
Ticket.new.purchase | |
## => ** Purchasing the Ticket ** |
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 'celluloid/zmq' | |
require 'colorize' | |
Celluloid::ZMQ.init | |
class Server | |
include Celluloid::ZMQ | |
def initialize() | |
@socket = Socket::Pull.new |
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
## Using this as the Celluloid server the client messages are received in parallel. | |
require 'celluloid/zmq' | |
require 'colorize' | |
Celluloid::ZMQ.init | |
class Server | |
include Celluloid::ZMQ | |
def initialize() | |
@socket = Socket::Pull.new |
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 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize | |
@socket = Socket::Push.new | |
begin |
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 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize | |
@socket = Socket::Push.new | |
begin |
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
... | |
... | |
... | |
use Warden::Manager | |
use Rack::Mongoid::Middleware::IdentityMap | |
use ExceptionNotifier | |
use OmniAuthMiddleware ## <-- | |
use OmniAuth::Builder | |
run MyAppliction::Application.routes |
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 'rubygems' | |
require 'json-schema' | |
## /poaster_instance.json | |
## Seem like the need to have access_control a part of this json | |
poaster_instance_schema = { | |
"type" => "object", | |
"required" => ['id','facades','name'], | |
"properties" => { | |
"id" => {"type" => "string"}, | |
"name" => {"type" => "string"}, |