Skip to content

Instantly share code, notes, and snippets.

View blaugrana17's full-sized avatar

Azat Tezekbaev blaugrana17

  • Amsterdam, Netherlands
View GitHub Profile
@blaugrana17
blaugrana17 / alias_matchers.md
Created December 2, 2021 18:21 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
# frozen_string_literal: true
class Checkout
ITEMS_PRICE = { A: 30, B: 20, C: 50, D: 15 }.freeze
COMBO_ITEM_PRICES = {
A: { quantity: 3, price: 75 },
B: { quantity: 2, price: 35 }
}.freeze
def initialize
@blaugrana17
blaugrana17 / main.rb
Last active May 17, 2022 20:41
Quadrocopter app
# frozen_string_literal: true
require 'pry'
require_relative 'transmitter'
require_relative 'quadrocopter'
quadrocopter = Quadrocopter.new
puts quadrocopter.fly
# frozen_string_literal: true
class MvpEngineMatcher
def initialize
@result_arr = []
@groupped_indexes = []
end
def group_by_sum_of_pairs(arr, sum)
arr.each_with_index do |item, index|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe CodesController, type: :controller do
describe '.check' do
let(:program) { create(:program, code: 'ERN') }
let!(:organization_program) { create(:organization_program, program: program) }
context 'license' do
@blaugrana17
blaugrana17 / postgres-cheatsheet.md
Created September 7, 2020 11:37 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@blaugrana17
blaugrana17 / rails http status codes
Created June 30, 2020 08:02 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing