Skip to content

Instantly share code, notes, and snippets.

@Sergey-B
Sergey-B / upload_file.rb
Created December 3, 2019 08:45
Upload file by url service
module Services
module ServiceName
class UploadFileByUrl
def call image_url
api_key = ENV[:api_secret]
upload_url = ENV[:upload_url]
conn = Faraday.new(
url: upload_url,
headers: {
# encoding: UTF-8
#!/usr/bin/env ruby
def check(password)
if password.length < 7
"Sorry, too few characters."
elsif password.length < 20
"Sorry, you must use no fewer than 20 total characters."
elsif !(/\d/ =~ password)
"Sorry, you must use at least one numerical character."
@Sergey-B
Sergey-B / deploy_template.rb
Last active December 20, 2015 20:48
deployconfig template
# Rails template appication file for gem 'deployconfig' ssh://git@git.snpdev.ru:42204/deployconfig.git
#USAGE
#rails new app_name -m template.rb
#Application name from command-line arguments 'rails new application_name'
application_name = ARGV[0]
#Gemfile
gem_group :development do
# Use SQLite for development DB
@Sergey-B
Sergey-B / template.rb
Last active December 19, 2015 19:39
Rails template appication file for gem 'deployconfig' https://github.com/Sergey-B/deployconfig-generator
# Rails template appication file for gem 'deployconfig' https://github.com/Sergey-B/deployconfig-generator
#USAGE
#rails new app_name -m template.rb
#Application name from command-line arguments 'rails new application_name'
application_name = ARGV[0]
#Gemfile
gem 'deployconfig', '0.0.1', :git => 'https://github.com/Sergey-B/deployconfig-generator.git'
gem 'capistrano'
@Sergey-B
Sergey-B / template1.rb
Last active December 19, 2015 18:29
Template for use deployconfig gem (works local)
# Rails template appication file for gem 'deployconfig' https://github.com/Sergey-B/deployconfig-generator
#USAGE
#rails new app_name -m template.rb
#Application name from command-line arguments 'rails new application_name'
application_name = ARGV[0]
#Gemfile
gem 'deployconfig', '0.0.1', :git => 'sh://git@git.snpdev.ru:42204/deployconfig.git'
gem 'capistrano'
@Sergey-B
Sergey-B / template.rb
Last active December 19, 2015 16:19
Template for invoke generators from gem 'deployconfig-generator'
# template1.rb
application_name = ARGV[0]
gem 'deployconfig', '0.0.1', :git => 'git@github.com:Sergey-B/deployconfig-generator.git'
gem 'capistrano'
gem 'capistrano-ext'
gem_group :assets do
gem 'therubyracer', :platforms => :ruby
end