I hereby claim:
- I am bartuz on github.
- I am fbartuzi (https://keybase.io/fbartuzi) on keybase.
- I have a public key whose fingerprint is 3434 16BB 7526 A36F 7B75 0DF1 22A4 EBE5 92DE FB89
To claim this, I am signing this object:
# RSpec matcher for validates_with. | |
# https://gist.github.com/2032846 | |
# Usage: | |
# | |
# describe User do | |
# it { should validate_with CustomValidator } | |
# end | |
RSpec::Matchers.define :validate_with do |expected_validator, options| | |
match do |subject| | |
@validator = subject.class.validators.find do |validator| |
# https://www.agileplannerapp.com/blog/building-agile-planner/refactoring-with-hexagonal-rails | |
def checkout | |
cart = CartCheckout.new(many, params) | |
if cart.save | |
redirect_to cart_path, notice: t('.success') | |
else | |
redirect_to cart_path, notice: t('.failure', reason: cart.error_message) | |
end | |
end |
class BinaryTree | |
attr_accessor :root | |
def initialize | |
@root = Node.new | |
end | |
def insert(letter, path) | |
node = root | |
path.each_char do |direction| |
Call: | |
Set custom options: | |
= link_to talk, method: :delete, class: 'icon-close', data: {confirm: "Вы действительно хотите удалить всю переписку с данным пользователем?", confirm_options: {title: 'Удалить все сообщения', yes: 'Да', no: 'Нифига'}}, remote: true | |
or standart rails way | |
= link_to talk, method: :delete, class: 'icon-close', data: {confirm: "Вы действительно хотите удалить всю переписку с данным пользователем?"}, remote: true |
require 'benchmark' | |
ActiveRecord::Base.logger = nil | |
Benchmark.bmbm do |bench| | |
bench.report("SQL query") do | |
1000.times { Whatever.count } | |
end | |
bench.report("exception hit") do |
I hereby claim:
To claim this, I am signing this object:
#before | |
def initialize(options = {}) | |
@type = options.fetch(:destination_type) { CARD_TO_CARD } | |
@options = options | |
end | |
#after | |
def initialize(destination_type: CARD_TO_CARD, **options) | |
@type = destination_type | |
@options = options |
Jeśli: | |
1. Usuniesz klucz z web appki phraseappa | |
2. $ yarn phraseapp:push | |
3. Klucz pojawia sie ponownie we phareappie | |
Jeśli <— Prawdiłowe flow | |
1. Usuniesz klucz z phraseappa | |
2. $ yarn phraseapp:pull | |
3. $ yarn phraseapp:push | |
4. klucz znika z plików .json i z web appki phraseappa |
Using MongoDB in golang with mgo |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
# Activate the gem you are reporting the issue against. |