Skip to content

Instantly share code, notes, and snippets.

View EvanBrightside's full-sized avatar
:electron:
code it!

Ivan Zabrodin EvanBrightside

:electron:
code it!
View GitHub Profile
@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)
@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])
# непонятно зачем глобальная переменная
@dmitryfry
dmitryfry / books_list.txt
Created January 18, 2018 09:27 — forked from fedorkk/books_list.txt
Список книг для обучения
Алгоритмы:
1) Стивен Скиена "Алгоритмы. Руководство по разработке"
2) Томас Кормен "Алгоритмы. Построение и анализ"
3) Дональд Кнут "Искусство программирования" (никто в реальности не читал этот многотомный труд целиком...)
Общее:
1) Род Хаггарти "Дискретная математика для программистов"
2) Романовский И.В. "Дискретный анализ"
Паттерны проектирования:
1. Знание основ Ruby, фреймворка Ruby on Rails
- http://guides.rubyonrails.org/
- http://rusrails.ru/
Вопросы:
1. Чем отличается статическая и динамическая типизации в языках программирования?
2. Какие виды наследования поддерживаются в Ruby?
3. Что такое модуль? Какая разница между классом и модулем?
4. Какие есть уровни контроля доступа к методам для классов и модулей?
5. Какие есть способы вызова методов в Ruby?
6. Что означает ключевое слово self?
@jtallant
jtallant / setting-up-sinatra-with-active-record.md
Last active March 25, 2024 13:26
Setting up Sinatra with Active Record

Setting up Sinatra Project

create an empty project and add a Gemfile

cd ~/Desktop
mkdir project-name
cd project-name
touch Gemfile
@jrgns
jrgns / ansible-play.rb
Last active March 22, 2018 23:17
Run Ansible from Slack Ruby Bot (https://github.com/slack-ruby/slack-ruby-bot)
# deploybot/commands/ansible-play.rb
module Deploybot
module Commands
class AnsiblePlay < SlackRubyBot::Commands::Base
class AnsibleRunner
attr_reader :playbook
def initialize(playbook)
@playbook = playbook
end
@VimleshS
VimleshS / ruby_cert.rb
Created August 30, 2016 09:35
Usage examples of ruby’s openssl lib
#Reference
#https://devnotcorp.wordpress.com/2012/08/21/usage-examples-of-rubys-openssl-lib/
#!/usr/bin/ruby
require 'openssl'
require 'date'
require 'time'
@tomysmile
tomysmile / mac-setup-redis.md
Last active July 10, 2025 21:05
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@subfuzion
subfuzion / curl.md
Last active December 5, 2025 19:15
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@maxivak
maxivak / 00.md
Last active September 15, 2025 13:09
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual: