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
jruby-1.6.7 :001 > require 'securerandom' | |
=> true | |
jruby-1.6.7 :002 > SecureRandom.uuid | |
NoMethodError: undefined method `uuid' for SecureRandom:Module | |
from (irb):2:in `evaluate' | |
from org/jruby/RubyKernel.java:1083:in `eval' | |
from /home/deployer/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:158:in `eval_input' | |
from /home/deployer/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:271:in `signal_status' | |
from /home/deployer/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:155:in `eval_input' | |
from org/jruby/RubyKernel.java:1410:in `loop' |
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
source 'http://rubygems.org' | |
gem 'daemons' | |
gem 'eventmachine' | |
gem 'nokogiri' | |
gem 'json' | |
gem 'activesupport' | |
gem 'i18n' | |
gem 'yajl-ruby' | |
gem 'net-http-persistent' |
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
# gem install json -v '1.6.6'Building native extensions. This could take a while... | |
ERROR: Error installing json: | |
ERROR: Failed to build gem native extension. | |
/opt/csw/bin/ruby191 extconf.rb | |
creating Makefile | |
make | |
compiling generator.c | |
sh: /opt/SUNWspro/bin/cc: not found |
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
19:23 luckyruby: oracle's got us by the balls right now. our bread and butter application runs on pl/sql + oracle + solaris + sun V490s. | |
19:24 peerce: rewrite it to run on postgresql on x86, save a freekin bundle. | |
19:24 luckyruby: i'm in the process of rewriting it from scratch in ruby on rails, postgresql, redis | |
19:24 luckyruby: running on ubuntu | |
19:24 stram: oh my god | |
19:25 peerce: meh. not a fan of rails activerecord crap | |
19:25 jamesd_: watch out ruby may have issues with scaling | |
19:25 stram: stram on rails | |
19:25 peerce: its real obvious the author of that hated relational databases and did his best to mess them up for you |
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 send_GET | |
url = 'http://somewebservice.com/api?foo=bar' | |
http = EventMachine::HttpRequest.new(URI url).get | |
http.callback { | |
operation = proc do | |
parsed_json = JSON.parse(http.response) | |
xml_response = convert_json_to_xml(parsed_json) | |
end | |
callback = proc do |r| | |
send_data r |
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
<table class='pretty'> | |
<tr> | |
<th>Name</th> | |
<th>Description</th> | |
<th> </th> | |
</tr> | |
<tr class='even'> | |
<td>ECAR</td> | |
<td> | |
<a href="/locations/111/edit_car_type_description?location_car_type_id=1625" data-method="get" data-remote="true">Toyota Yaris 4 Passengers or Similar</a> |
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
- if @location.car_types.present? | |
%table.pretty | |
%tr | |
%th Name | |
%th Description | |
%th | |
- for car_type in @location.supported_car_types | |
%tr{:class => cycle('even','odd', :name => 'colors')} | |
%td= car_type.name | |
%td |
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
link_to image_tag('delete.png'), remove_car_type_location_path(:location_car_type_id => car_type.id), :method => :delete, :remote => true, :confirm => 'Are you sure?' |
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 'nokogiri' | |
require 'uri' | |
require 'oj' | |
require 'net/http/persistent' | |
class XMLParser | |
def initialize(msg) | |
@doc = Nokogiri::XML(msg) | |
@nodes = {} |
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 'celluloid/io' | |
class EchoServer | |
include Celluloid::IO | |
def initialize(host, port) | |
puts "*** Starting echo server on #{host}:#{port}" | |
# Since we included Celluloid::IO, we're actually making a | |
# Celluloid::IO::TCPServer here | |
@server = TCPServer.new(host, port) |