Yusuke ENDOH writes:
Periodically when fetching web pages using open-uri, he notices that many different kinds of exceptions can be raised.
So far, he’s experienced these below:
-
Errno::ETIMEDOUT
| config['mongo'] = EventMachine::Synchrony::ConnectionPool.new(size: 20) do | |
| conn = EM::Mongo::Connection.new('localhost', 27017, 1, {:reconnect_in => 1}) | |
| conn.db('muisco') | |
| end |
| class CardCreator < Struct.new(:listener) | |
| def create(iteration, attributes) | |
| card = iteration.cards.build(attributes) | |
| if card.save | |
| listener.created(card) | |
| else | |
| listener.create_failed(card) | |
| end | |
| end | |
| end |
| gem 'mongo' | |
| gem 'em-mongo' | |
| gem 'bson_ext' | |
| gem 'goliath' | |
| gem 'grape' |
| gem 'mongo' | |
| gem 'em-mongo' | |
| gem 'bson_ext' | |
| gem 'goliath' | |
| gem 'grape' |
| [cmilfont@milfont:/Users/cmilfont/projetos/forteschat3/oraculo:homologacao:a1a293f:+M] | |
| $ rspec spec/integration/chamado_spec.rb -e "Deveria submeter a dúvida para a tela de Faqs" | |
| Run filtered including {:full_description=>/(?-mix:Deveria\ submeter\ a\ dúvida\ para\ a\ tela\ de\ Faqs)/} | |
| Chamado | |
| Como cliente | |
| Pagina inicial | |
| DEPRECATION WARNING: <% %> style block helpers are deprecated. Please use <%= %>. (called from _app_views_chamados_index_html_erb__1905729048714370975_2183758900_2238918427965469768 at /Users/cmilfont/projetos/forteschat3/oraculo/app/views/chamados/index.html.erb:40) | |
| http://127.0.0.1:51920/javascripts/vendor/jquery-1.7.1.min.js:4 TypeError: Result of expression 'o' [null] is not an object. | |
| Deveria submeter a dúvida para a tela de Faqs (FAILED - 1) |
| class ApplicationController < ActionController::Base | |
| protect_from_forgery | |
| after_filter :set_access_control_headers | |
| def set_access_control_headers | |
| headers['Access-Control-Allow-Origin'] = '*' | |
| headers['Access-Control-Request-Method'] = '*' | |
| end | |
| end |
Yusuke ENDOH writes:
Periodically when fetching web pages using open-uri, he notices that many different kinds of exceptions can be raised.
So far, he’s experienced these below:
Errno::ETIMEDOUT
| require 'benchmark/ips' | |
| h = { foo: :bar } | |
| Benchmark.ips do |r| | |
| r.report('#[]') { h[:foo] } | |
| r.report('#fetch') { h.fetch(:foo) } | |
| end |
| #!/usr/bin/env ruby | |
| # | |
| ###################################################################################################################################### | |
| # Taken here http://fulloo.info/Examples/RubyExamples/Dijkstra/DijkstraListing.html and carefully corrected to be more ruby idiomatic. | |
| ###################################################################################################################################### | |
| # | |
| # Example in Ruby -- Dijkstra's algorithm in DCI | |
| # Modified and simplified for a Manhattan geometry with 8 roles | |
| # | |
| # |
| def transfere(to, valor) | |
| to.link("transfer").post(:valor => valor) | |
| end | |
| def processa_pagamento(pessoa, aulas, consultorias, opensource, bank) | |
| parcelas = [] | |
| total = 0 | |
| aulas.each do |a| | |
| aula.verify do |v| |