Skip to content

Instantly share code, notes, and snippets.

require 'combine_pdf' # https://github.com/boazsegev/combine_pdf
input_filename = ARGV[0]
if input_filename.empty?
puts 'ERROR:'
puts 'Enter filename'
return
end
# The way to insert some xml into building xml with correct indents
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml.Batch do
xml.Count 1
end
end
batch_xml_element = builder.doc.at('Batch')
xml_text = '<Element><One>1</One><Two>2</Two></Element>'
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __FILE__)
require File.expand_path('../config/environment', __FILE__)
require_relative 'config/boot'
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
module Mod
module_function
def method1
@ashaninBenjamin
ashaninBenjamin / README.md
Last active November 12, 2018 15:12
Carrierwave preloading
  • How to preload file via Carrierwave for api?
  • How to preload huge file before sending all form?

Carrierwave doesn't give approach for preloading file, so there is simple implementation.

@ashaninBenjamin
ashaninBenjamin / .rails-new
Last active March 8, 2023 08:57
Docker + Docker-compose + Rails new
start new rails project with docker