This file contains hidden or 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 'socket' | |
| require 'rubygems' | |
| require 'monitor' | |
| include Socket::Constants | |
| lock = Mutex.new ; buf = [] | |
| client = Connection.new( 2201, '10.45.10.219' ).listen | |
| server = Connection.new( 2202, '10.45.10.219' ).connect | |
| stop = false |
This file contains hidden or 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 'socket' | |
| include Socket::Constants | |
| lock = Mutex.new ; buf = [] | |
| client = TCPServer.new( 2201 ) | |
| server = TCPSocket.new( '10.x.x.x', 2202 ) | |
| def read |
This file contains hidden or 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 'socket' | |
| class Server | |
| def initialize( port ) | |
| @server = TCPServer.new( port ) | |
| @threads = [] | |
| end | |
| def run( &block ) |
This file contains hidden or 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 'socket' | |
| class Server | |
| def initialize( port ) | |
| @server = TCPServer.new( port ) | |
| @threads = [] | |
| end | |
| def run( &block ) |
This file contains hidden or 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
| $:.unshift( "waves/lib" ) | |
| require 'rubygems' | |
| require 'waves' | |
| module BoogieBoard | |
| include Waves::Foundations::Simple | |
| module Configurations | |
This file contains hidden or 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
| module Cassandra | |
| module CSS | |
| # stuff that is pure CSS generation goes here | |
| end | |
| module Hacks |
This file contains hidden or 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
| def self.dependencies( *args ) | |
| self['dependencies'] ||= Set.new | |
| args.length == 0 ? self['dependencies'] : | |
| self['dependencies'] += ( args - gems.dependencies ) | |
| end |
This file contains hidden or 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
| def call( request ) | |
| capture = {} | |
| path = extract_path( request ) | |
| capture if @pattern.all? do | want | | |
| case want | |
| when true then path = [] | |
| when String then want == path.pop | |
| when Symbol then capture[ want ] = path.pop | |
| when Regexp then want === path.pop | |
| when Hash |
This file contains hidden or 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
| # 'html' is the default when there is no extension or Accept header | |
| # we will actually default to json, though ... | |
| Formats = [ :json, :html ] | |
| on( :get, [ :resource ] ) do | |
| # ... do something to get results | |
| format = File.extname( path ); format = 'json' if format.empty? | |
| results.send( "to_#{ format }" ) | |
| end |
This file contains hidden or 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
| ypcmc02106:pages dyoder$ irb | |
| irb(main):001:0> class A ; attr_accessor :foo ; def initialize; foo = String.new ; end ; end | |
| => nil | |
| irb(main):002:0> a1 = A.new | |
| => #<A:0x86970> | |
| irb(main):003:0> a2 = a1.dup | |
| => #<A:0x82a64> | |
| irb(main):004:0> a1.foo = 'hello' | |
| => "hello" | |
| irb(main):005:0> a2.foo |