Skip to content

Instantly share code, notes, and snippets.

class Customer < ApplicationRecord
has_many :customer_documents
has_many :documents, through: :customer_documents
end
ab -t 180 -c 1 https://autorambler.ru/vne-dorog/chudesa-tekhniki-niva-na-gusenicakh.htm
This is ApacheBench, Version 2.3 <$Revision: 1796539 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking autorambler.ru (be patient)
Finished 2036 requests
Server Software: nginx
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>RNS</title>
<link>https://stage.rns.online/</link>
<yandex:logo>https://rns.online/pics/logo100x100.png</yandex:logo>
<yandex:logo type="square">https://rns.online/pics/logo.png</yandex:logo>
<description>Первоисточник новостей о бизнесе и финансах.</description>
<yandex:analytics type="Yandex" id="32047971"/>
<yandex:adNetwork type="AdFox" turbo-ad-id="Content1_Turbo">
@dmitryzuev
dmitryzuev / exercise-web-crawler.go
Created January 17, 2017 20:37
A Tour of Go Exercise: Web Crawler
package main
import (
"fmt"
"sync"
"time"
)
type Fetcher interface {
// Fetch returns the body of URL and
@dmitryzuev
dmitryzuev / shorty.yml
Created August 12, 2016 06:00
Swagger examples
swagger: '2.0'
info:
title: URL Shortener service API
description: Shorten your URL on the fly
version: "1.0.0"
host: shorty-url-shortener.herokuapp.com
schemes:
- http
basePath: /
consumes:
@dmitryzuev
dmitryzuev / string_decoder.rb
Created January 26, 2016 18:55
Convert human readable number to float in Ruby
# Convert human entered string into number
class StringDecoder
# Hash with powers of 10 by names
POWERS = {
'trillion' => 10**12,
'trillions' => 10**12,
'billion' => 10**9,
'billions' => 10**9,
'million' => 10**6,
'millions' => 10**6,
@dmitryzuev
dmitryzuev / string_decoder_spec.rb
Last active January 26, 2016 18:56
Specs for StringDecoder service object
require 'rails_helper'
RSpec.describe StringDecoder do
let(:decoder) { StringDecoder.new }
it 'decodes numeric string' do
input = '1231412353'
expect(decoder.call(input)).to equal(1231412353.0)
end