Skip to content

Instantly share code, notes, and snippets.

View dvoryankin's full-sized avatar
🌴
On vacation

Dvoryankin Dmitry dvoryankin

🌴
On vacation
View GitHub Profile
@dvoryankin
dvoryankin / .pryrc
Created December 15, 2020 12:07
.pryrc
# See https://github.com/justin808/justin808-dotfiles/blob/master/home/.pryrc
# Using these pry gems
# Essentials
# gem "pry"
# gem "pry-rails"
# gem "pry-byebug"
# gem "pry-doc"
# gem "pry-rescue"
# If you like this one:
@dvoryankin
dvoryankin / rspec_rails_cheetsheet.rb
Created March 1, 2019 12:51 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
{
"auto_indent": true,
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"detect_indentation": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_face": "Fira Code",
"font_size": 14,
"ignored_packages":
[
# using these pry gems
# gem "pry"
# gem "pry-rails"
# gem "pry-byebug"
# gem "pry-stack_explorer"
# gem "pry-doc"
# gem "pry-state"
# gem "pry-toys"
# gem "pry-rescue"
{
"color_scheme": "Packages/Boxy Theme/schemes/Boxy Tomorrow.tmTheme",
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"translate_tabs_to_spaces": true,
"detect_indentation": true,
"auto_indent": true,
"font_face": "Firacode",
"font_size": 11,
@dvoryankin
dvoryankin / nokogiri.rb
Created February 15, 2018 15:08
nokogiri scraper answers
# 1) What is your favorite Ruby class/library or method and why?
# I like ruby structure at all. It is intuitive understandability of its methods and language reads as plain english.
# I started using ruby for linux administration and writing scripts on ruby, so my favourite class is 'File', I like its for convenient methods for working with filesystem.
# Of course also array and hash classes, because simply a pleasure to work with objects of these classes.
# As for method - maybe reduce, because it allows to do complex things by a simple logic and allows do not make a big hardreading constructions.
# Also I like a lot of methods for working with hashes and arrays for their simplicity and clarity.
# Before ruby, I had experience with Java and C#, and now I'm glad that I'm working with ruby.
-----
@dvoryankin
dvoryankin / test.rb
Last active May 29, 2020 14:51 — forked from Mehonoshin/test.rb
# BasketsController < ApplicationController
class BasketController
# всё сразу в одном методе
def add_to_basket
# могут быть одинаковые названия, поэтому искать лучше по id товара
item = Item.find_by_title(params[:item_title])
# непонятно зачем глобальная переменная
# BasketsController < ApplicationController
class BasketController
# всё сразу в одном методе
def add_to_basket
# могут быть одинаковые названия, поэтому искать лучше по id товара
item = Item.find_by_title(params[:item_title])
# непонятно зачем глобальная переменная
require 'telegram/bot'
require 'open-uri'
require 'net/http'
require 'uri'
token = 'kakoy-to token'
KRAEV = ['Краев мой друг', 'Серега - отличный парень', 'Люблю Краева',
'Без Сережки чата не станет'].freeze
DIMA = ["Дима самый лучший", "Серов - душа компании", "Дима самый умный, хоть и дурак",
factory :rubric do
title 'rubric'
content 'rubric_content'
trait :rubric1 do
title 'rubric1'
content 'rubric1'
end
trait :rubric2 do