Skip to content

Instantly share code, notes, and snippets.

View nononoy's full-sized avatar

Slava Gruzdov nononoy

View GitHub Profile
@ID25
ID25 / ruby.md
Last active January 26, 2021 12:14

Предыдущий: 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 года, Пишем свой код во время чтения.

Следующий уровень, продвинутые книги по руби:

module BeforeRender
extend ActiveSupport::Concern
included do
define_callbacks :render
end
def render(*args, &block)
run_callbacks(:render) do
super
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;
@mirrec
mirrec / delete_mails_imap.rb
Last active May 24, 2022 10:05
how to delete email from mailbox with ruby and imap
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"
@oivoodoo
oivoodoo / routes.rake
Created March 5, 2013 10:06
rake task for printing grape routes.
namespace :grape do
desc 'Print compiled grape routes'
task :routes => :environment do
API.routes.each do |route|
puts route
end
end
end