Ruby

From Wasya Wiki
Revision as of 16:40, 15 May 2024 by Piousbox (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ruby Toolbox

  • ankane/blazer
    • "Explore your data with SQL" - a mounted visualization engine?
    • Version 3.0.2 still has mongodb support
  • ankane/ahoy
  • ankane/ahoy_email

Install ruby on ubuntu 20

From: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-20-04

 sudo apt update
 sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
 curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
 echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
 echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Test:

 type rbenv

How to render text on image with RMagick and Word wrap?

From: https://stackoverflow.com/questions/11788216/how-to-render-text-on-image-with-rmagick-and-word-wrap

phrase = "my super long text that needs to be auto line breaked and cropped"
background = Magick::Image.read('my_bg_img.jpg').first
image = Magick::Image.read("caption:#{phrase}") do
  self.size = '800x600' #Text box size
  self.background_color = 'none' #transparent
  self.pointsize = 22 # font size
  self.font = 'Helvetica' #font family
  self.fill = 'gray' #font color
  self.gravity = Magick::CenterGravity #Text orientation
end.first
background.composite!(image, Magick::NorthEastGravity, 20, 40, Magick::OverCompositeOp)
background.format = "jpeg"
return background.to_blob