It is easy to add wrappers for input components in simple_form, but it takes some time to modify rendering of buttons ("f.button").
We want to have this in our form:
= f.button :submit_cancel, 'Save'
require "net/imap" | |
imap = Net::IMAP.new("imap.domain.sk") | |
imap.login("info@domain.sk", "HESLO") | |
imap.select("inbox") | |
# search for emails that you want to delete | |
bad_messages = imap.search(["FROM", "from@gmail.com"]) | |
puts "#{bad_messages.count} messages will be deleted" |
upstream backend { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
access_log /var/log/nginx/yoursite.access.log; | |
error_log /var/log/nginx/yoursite.error.log; |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
Предыдущий: https://2ch.hk/pr/res/560026.html
RUBY_SHAPKA VERSION = 1.0.6
FAQ:
1. C чего мне начать, чтобы стать рубистом? Отличным началом будет Programming Ruby (The Pragmatic Programmers Guide), читать Eloquent Ruby и The Well Grounded Rubyist после прочтения первой толку особо не даст, одни и теже вещи, дальше читаем Ruby Way, затем познаем метапрограммирование с Metaprogramming Ruby. А дальше открываем Ruby cookbook 2015 года, Пишем свой код во время чтения.
Следующий уровень, продвинутые книги по руби:
#openssl | |
require 'openssl' | |
require 'base64' | |
require "digest" | |
include OpenSSL | |
def aes256_encrypt(key, data) | |
key = Digest::SHA256.digest(key) if(key.kind_of?(String) && 32 != key.bytesize) | |
aes = OpenSSL::Cipher.new('AES-256-CBC') | |
aes.encrypt |
namespace :grape do | |
desc 'Print compiled grape routes' | |
task :routes => :environment do | |
API.routes.each do |route| | |
puts route | |
end | |
end | |
end |
module BeforeRender | |
extend ActiveSupport::Concern | |
included do | |
define_callbacks :render | |
end | |
def render(*args, &block) | |
run_callbacks(:render) do | |
super |
unless Rails.env.production? | |
connection = ActiveRecord::Base.connection | |
connection.tables.each do |table| | |
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations" | |
end | |
sql = File.read('db/import.sql') | |
statements = sql.split(/;$/) | |
statements.pop |