Category "ruby"

Library not loaded: /opt/local/lib/libssl.1.0.0.dylib (LoadError)

I just discovered I can no longer gem push … any more and some digging led me to a need to update my RVM SSL certs. I ran rvm osx-ssl-certs status all b

How can I send mail with rails without a template?

In my Rails 3 project, I want to send some simple notification emails. I don't need to make a template for them or do any logic. I just want to fire them off fr

Is there any Ruby project for backup?

I have some rails projects and mysql database in the server, i need to backup them every 1-2 days. I would like to do backup with Ruby, who can give me some adv

Does Ruby have a string.startswith("abc") built in method?

Does Ruby have a some_string.starts_with("abc") method that's built in?

fix `Missing frozen string literal comment` issue

I created a new migration, it looks like this one: class AddCommentsToUsers < ActiveRecord::Migration def change add_column :users, :comments, :text

How to retrieve the field name of a ShapeFile feature field?

I am using gdal-ruby to parse ESRI ShapeFiles like in this demo. I want to iterate through all features in order to push the field values into a database. Howev

How can I format a float to a certain number of decimal and integer digits?

I am trying to format a float in Ruby to exactly four digits, including the decimal. For instance: 1 => 01.00 2.4 => 02.40 1.4455 => 01.45 Right no

display list of days in a week in Rails using Date::DAYNAMES

I'm having trouble displaying a list of days in a week in a form. <%= form_for [@hourable, @hour] do |f| %> <% days = [] Date::DAYNAMES.each_with

Problem with quantifiers and look-behind

### Ruby 1.8.7 ### require 'rubygems' require 'oniguruma' # for look-behind Oniguruma::ORegexp.new('h(?=\w*)') # => /h(?=\w*)/ Oniguruma::ORegexp.new('(?&

YAML indentation for array in hash

I think indentation is important in YAML. I tested the following in irb: > puts({1=>[1,2,3]}.to_yaml) --- 1: - 1 - 2 - 3 => nil I expected some

Converting zipfile extracting code from ruby to python

I am converting a code from ruby to python that extracts the contents of a zipfile. I am new to python and not sure how to exactly convert the below code. ruby