Skip to content

Instantly share code, notes, and snippets.

Rafael Barbolo barbolo

Block or report user

Report or block barbolo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@barbolo
barbolo / render_post_with_libxml.rb
Created Jul 18, 2018
Render a post with libxml in Ruby
View render_post_with_libxml.rb
class Renderer::Post
def self.create_doc_xml(root)
doc = LibXML::XML::Document.new
doc.encoding = LibXML::XML::Encoding::UTF_8
doc.root = LibXML::XML::Node.new(root)
doc
end
def self.create_node(name, value=nil, type=nil)
node = LibXML::XML::Node.new(name)
@barbolo
barbolo / benchmark_xml_render.rb
Created Jul 18, 2018
This is a comprehensive XML generation benchmark with some of the most popular Ruby gems
View benchmark_xml_render.rb
# gem install benchmark-memory activesupport builder nokogiri rabl ox libxml-ruby
require 'benchmark'
require 'benchmark-memory'
require 'builder'
require 'active_support/core_ext/hash/conversions'
require 'rabl'
require 'nokogiri'
require 'libxml'
require 'ox'
@barbolo
barbolo / benchamark_hash_to_json.rb
Last active Jun 25, 2019
Benchmark of JSON rendering in Ruby
View benchamark_hash_to_json.rb
# gem install multi_json json yajl-ruby oj benchmark-memory
require 'multi_json'
require 'json'
require 'yajl'
require 'oj'
require 'benchmark'
require 'benchmark-memory'
hash1 = {
@barbolo
barbolo / estagio-programacao-preparacao-exercicios.md
Last active Jul 11, 2018
[Estágio em Programação] Preparação para os exercícios
View estagio-programacao-preparacao-exercicios.md

Preparação para os exercícios

Os exercícios serão feitos usando uma ferramenta de linha de comando desenvolvida especialmente para este curso, chamada ep-cli (abreviação de Estágio em Programação - Command Line Interface).

Com o ep-cli, você pode:

  • Ver o enunciado e as instruções de um exercício;
  • Realizar a correção automática dos seus exercícios.

Instalação do ep-cli

@barbolo
barbolo / pdf_to_xml.rb
Last active Mar 9, 2018
Convert PDF to XML in Ruby using poppler-utils
View pdf_to_xml.rb
# Install dependencies:
#
# posix-spawn (check all benefits at https://github.com/rtomayko/posix-spawn)
# gem install posix-spawn
#
# Poppler utils (http://poppler.freedesktop.org/)
# apt-get install poppler-utils
#
require 'posix/spawn'
You can’t perform that action at this time.