This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to Gemfile | |
# gem "mail" | |
# | |
# or do in terminal | |
# 'gem install mail' | |
# send_mail_with_inline_image.rb | |
require 'mail' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
require "active_support" | |
require 'active_support/inflector' | |
puts ActiveSupport::Inflector::transliterate("Nějaký ten string ščřžýáíé") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "ščřžýáíéáýžřčřžýáíážřýášžýěáč".scan(/./mu)[0,10].join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RedisConnect | |
@@db_redis = nil | |
@@db_adtext_redis = nil | |
def self.redis | |
if @@db_redis.nil? | |
config = YAML.load_file('config/database.yml')[ENV['RACK_ENV']] | |
@@db_redis = Redis.new(:host => config["host"], :port => config["port"], :db => config["db"]) | |
end | |
return @@db_redis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RedisConnect | |
@@db_redis = nil | |
@@db_adtext_redis = nil | |
def self.redis | |
if @@db_redis.nil? | |
config = YAML.load_file('config/database.yml')[ENV['RACK_ENV']] | |
@@db_redis = Redis.new(:host => config["host"], :port => config["port"], :db => config["db"]) | |
end | |
return @@db_redis |
NewerOlder