Skip to content

Instantly share code, notes, and snippets.

View edzhelyov's full-sized avatar

Evgeni Dzhelyov edzhelyov

  • Sofia, Bulgaria
View GitHub Profile
@edzhelyov
edzhelyov / README.md
Created March 15, 2024 21:03
Elastic APM docker compose without security (works out of the box)

The APM server runs on localhost:8200 which is the default port the auto instrumentation is configured. In my case I tested with Ruby instrumentation out of the box and it works without any additional configurations.

@edzhelyov
edzhelyov / bug.rb
Created August 22, 2018 08:12
Bug report for ActiveModel 5.2.1 and ActiveAttr
# frozen_string_literal: true
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
@edzhelyov
edzhelyov / better_logger.rb
Created August 9, 2012 11:28 — forked from indirect/better_logger.rb
Rails 3 logs with severity and PIDs
# You must require this file in application.rb, above the Application
# definition, for this to work. For example:
#
# # Syslog-like Rails logs
# if Rails.env.production?
# require File.expand_path('../../lib/better_logger', __FILE__)
# end
#
# module MyApp
# class Application < Rails::Application
@edzhelyov
edzhelyov / method_dispatch.rb
Created June 18, 2012 12:31
How Ruby methods are resolved
module B
def speak
'B'
end
end
module C
def speak
'C'
end
@edzhelyov
edzhelyov / search.rb
Created March 7, 2012 13:05
Search helper
class Search
class NotUrlHelperPresent < Exception; end
attr_writer :url_helper
def url(params)
raise NotUrlHelperPresent unless @url_helper
@url_helper.call(params)
@edzhelyov
edzhelyov / gist:1759309
Created February 7, 2012 11:47
Running tests
BACKTRACE=true ruby -Itest test/backend/active_resource/locale_test.rb
Loaded suite test/backend/active_resource/locale_test
Started
EEE
Finished in 0.163526 seconds.
1) Error:
test: find the primary locale should return primary locale. (I18n::Backend::ActiveResource::LocaleTest):
Errno::ECONNREFUSED: Connection refused - connect(2)
/home/evgenidzhelyov/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/http.rb:560:in `initialize'
@edzhelyov
edzhelyov / test.rb
Created January 6, 2012 12:21
simple integration test
require 'test_helper'
class AnalyticsTaggingTest < ActionDispatch::IntegrationTest
include Capybara::DSL
context "The header of the page" do
should "include tracking meta tag" do
visit('/')
@edzhelyov
edzhelyov / spec.rb
Created November 22, 2011 12:31
maks birthday
describe '#greets_maks_for_his_birthday' do
context 'on his birthday' do
it 'greets him on facebook' do
maks_birthday = Date.new(2011, 11, 22)
Date.stub(:now).and_return(maks_birthday)
greets_maks_for_his_birthday.should post_to_facebook('Хей, ЧРД, мен')
end
end
end
require "thread"
$mutex = Mutex.new
$total = 0
def incr
$mutex.synchronize { $total += 1 }
sleep
end
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.10)
actionpack (3.0.10)
activemodel (3.0.10)
activerecord (3.0.10)
activeresource (3.0.10)
activesupport (3.0.10)
arel (2.0.10)