Skip to content

Instantly share code, notes, and snippets.

Anatoly Mikhaylov mikhailov

Block or report user

Report or block mikhailov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Nginx access log
log_format json '{'
'"http":{'
'"method":"$request_method",'
'"request_id":"$request_id",'
'"status_code":$status,'
'"content_type":"$content_type",'
'"url":"$request_uri",'
'"url_details":{'
'"path":"$uri",'
'"scheme":"$scheme",'
@mikhailov
mikhailov / nginx.local.conf
Last active Nov 21, 2017
Troubleshooting Application Performance and Slow TCP Connections with NGINX Amplify
View nginx.local.conf
upstream upstream_close_server_keepalive_timeout_0 {
server upstream:10443;
}
upstream upstream_keepalive_server_keepalive_timeout_0 {
server upstream:11443;
keepalive 64;
}
upstream upstream_close_server_keepalive_timeout_300 {
View reloader_fix.rb
module ActionDispatch
class Reloader
def call(env)
if env['PATH_INFO'].include?(Rails.application.config.assets.prefix)
@app.call(env)
else
@validated = @condition.call
prepare!
@mikhailov
mikhailov / tests.rb
Created Oct 2, 2015
Basic testing framework
View tests.rb
class Object
class UnitTestError < StandardError; end
def describe(description, &block)
if Object.class_eval(&block)
print '.'
else
puts 'FAIL ' + description
raise UnitTestError
View reverse_sentence.rb
class ReverseSentence
def initialize(string)
@array, @array_reversed = string.split(" "), []
end
def process
@array_reversed << @array.pop while @array.any?
@array_reversed.join(" ")
end
View fizz_buzz.rb
class FizzBuzz
def initialize(array)
@array = array
@new_array = []
end
def process
@array.each do |e|
value = \
if e % 3 == 0 && e % 5 == 0
View decimal_mark.rb
class DecimalMark
def initialize(data)
@array = data.split("")
@new_array = []
end
def process
i = 0
loop do
View valid_parentheses.rb
class ValidParentheses
SYMBOLS = {"(" => ")", "[" => "]", "{" => "}"}
def initialize(array)
@array = array.split("")
@stack = []
end
def process
@array.each do |i|
@mikhailov
mikhailov / qu.rb
Last active Sep 20, 2015
quick union
View qu.rb
class QU
attr_reader :array
def initialize(array)
@array = array
end
def union(p,q)
return if p == q
@array[root(p)] = root(q)
@mikhailov
mikhailov / uf.rb
Last active Sep 20, 2015
union find
View uf.rb
class UF
attr_reader :array
def initialize(array)
@array = array
end
def union(p,q)
return if p == q
You can’t perform that action at this time.