repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/test/adapters/sqlite.rb
test/adapters/sqlite.rb
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate.rb
lib/groupdate.rb
# dependencies require "active_support" require "active_support/core_ext/module/attribute_accessors" require "active_support/time" # modules require_relative "groupdate/magic" require_relative "groupdate/series_builder" require_relative "groupdate/version" # adapters require_relative "groupdate/adapters/base_adapter"...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/magic.rb
lib/groupdate/magic.rb
require "i18n" module Groupdate class Magic DAYS = [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday] attr_accessor :period, :options, :group_index, :n_seconds def initialize(period:, **options) @period = period @options = options validate_keywords validate...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/series_builder.rb
lib/groupdate/series_builder.rb
module Groupdate class SeriesBuilder attr_reader :period, :time_zone, :day_start, :week_start, :n_seconds, :options def initialize(period:, time_zone:, day_start:, week_start:, n_seconds:, **options) @period = period @time_zone = time_zone @week_start = week_start @day_start = day_sta...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/active_record.rb
lib/groupdate/active_record.rb
require "active_record" require "groupdate/query_methods" require "groupdate/relation" ActiveRecord::Base.extend(Groupdate::QueryMethods) ActiveRecord::Relation.include(Groupdate::Relation)
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/version.rb
lib/groupdate/version.rb
module Groupdate VERSION = "6.7.0" end
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/query_methods.rb
lib/groupdate/query_methods.rb
module Groupdate module QueryMethods Groupdate::PERIODS.each do |period| define_method :"group_by_#{period}" do |field, **options| Groupdate::Magic::Relation.generate_relation(self, period: period, field: field, **options ) end end def group_by_pe...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/relation.rb
lib/groupdate/relation.rb
require "active_support/concern" module Groupdate module Relation extend ActiveSupport::Concern included do attr_accessor :groupdate_values end def calculate(*args, &block) # prevent calculate from being called twice return super if has_include?(args[1]) default_value = [:c...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/enumerable.rb
lib/groupdate/enumerable.rb
module Enumerable Groupdate::PERIODS.each do |period| define_method :"group_by_#{period}" do |*args, **options, &block| if block raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0)" if args.any? Groupdate::Magic::Enumerable.group_by(self, period, options, &block)...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/adapters/mysql_adapter.rb
lib/groupdate/adapters/mysql_adapter.rb
module Groupdate module Adapters class MySQLAdapter < BaseAdapter def group_clause time_zone = @time_zone.tzinfo.name day_start_column = "CONVERT_TZ(#{column}, '+00:00', ?) - INTERVAL ? second" query = case period when :minute_of_hour ["MINUTE(#{day_s...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/adapters/base_adapter.rb
lib/groupdate/adapters/base_adapter.rb
module Groupdate module Adapters class BaseAdapter attr_reader :period, :column, :day_start, :week_start, :n_seconds def initialize(relation, column:, period:, time_zone:, time_range:, week_start:, day_start:, n_seconds:, adapter_name: nil) @relation = relation @column = column ...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/adapters/postgresql_adapter.rb
lib/groupdate/adapters/postgresql_adapter.rb
module Groupdate module Adapters class PostgreSQLAdapter < BaseAdapter def group_clause time_zone = @time_zone.tzinfo.name day_start_column = "#{column}::timestamptz AT TIME ZONE ? - INTERVAL ?" day_start_interval = "#{day_start} second" query = case period ...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
ankane/groupdate
https://github.com/ankane/groupdate/blob/520f223b1b9393c6fae99de92cdf9cf0a6da2597/lib/groupdate/adapters/sqlite_adapter.rb
lib/groupdate/adapters/sqlite_adapter.rb
module Groupdate module Adapters class SQLiteAdapter < BaseAdapter def group_clause query = if period == :week ["strftime('%Y-%m-%d', #{column}, '-6 days', ?)", "weekday #{(week_start + 1) % 7}"] elsif period == :custom ["datetime((strftime('%s', #{column}...
ruby
MIT
520f223b1b9393c6fae99de92cdf9cf0a6da2597
2026-01-04T15:48:16.889438Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true $VERBOSE = true require 'webmock/rspec' require 'simplecov' SimpleCov.start do add_filter "/spec/" add_filter "/.direnv/" end # if ENV['CI'] == 'true' # require 'codecov' # SimpleCov.formatter = SimpleCov::Formatter::Codecov # end Dir[File.dirname(__FILE__) + "/support/**/*.rb"]...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/support/common_store.rb
spec/support/common_store.rb
# frozen_string_literal: true RSpec.shared_examples "snapshots storage" do |store| before do store.send(:wipe_snapshots_data) end describe '#should_take_snapshot?' do it 'returns true once every N calls' do store.send(:wipe_snapshots_data) expect(store.should_take_snapshot?(3)).to eq(false)...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/support/expand_each_to_matcher.rb
spec/support/expand_each_to_matcher.rb
# frozen_string_literal: true # This defines a matcher we can use to test the result of an each method on an object RSpec::Matchers.define :expand_each_to do |expected| match do |actual| expanded = [] actual.each { |v| expanded << v } expanded.should == expected end end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/integration/middleware_spec.rb
spec/integration/middleware_spec.rb
# frozen_string_literal: true require 'rack/test' require 'zlib' describe Rack::MiniProfiler do include Rack::Test::Methods before(:each) { Rack::MiniProfiler.reset_config } def do_get(params = {}) get '/html', params, 'HTTP_ACCEPT_ENCODING' => 'gzip, compress' end def decompressed_response Zlib:...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/integration/mini_profiler_spec.rb
spec/integration/mini_profiler_spec.rb
# frozen_string_literal: true require 'rack' require 'rack/test' describe Rack::MiniProfiler do include Rack::Test::Methods def app @app ||= Rack::Builder.new { use Rack::MiniProfiler map '/path2/a' do run lambda { |env| [200, { Rack::CONTENT_TYPE => 'text/html' }, +'<h1>path1</h1>'] } ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/integration/trace_exceptions_spec.rb
spec/integration/trace_exceptions_spec.rb
# frozen_string_literal: true # Note: This test is highly dependent on line numbers for backtrace details # Take care when changing the structure of this file and update tests accordingly require 'rack/test' describe 'Rack::MiniProfiler - trace_exceptions' do include Rack::Test::Methods before(:each) { Rack::Mi...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/integration/railtie_methods_spec.rb
spec/integration/railtie_methods_spec.rb
# frozen_string_literal: true require 'securerandom' require 'rack/test' require File.expand_path('../../../lib/mini_profiler_rails/railtie_methods', __FILE__) def to_seconds(array) array.map! { |n, s, f| [n, s / 1000.0, f / 1000.0] } array end describe Rack::MiniProfilerRailsMethods do describe '#render_notif...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/profiler_spec.rb
spec/lib/profiler_spec.rb
# frozen_string_literal: true require 'rack' describe Rack::MiniProfiler do describe 'unique id' do before do @unique = Rack::MiniProfiler.generate_id end it 'is not nil' do expect(@unique).not_to be_nil end it 'is not empty' do expect(@unique).not_to be_empty end d...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/snapshots_transporter_spec.rb
spec/lib/snapshots_transporter_spec.rb
# frozen_string_literal: true require 'zlib' describe Rack::MiniProfiler::SnapshotsTransporter do let(:url) { 'http://example.com/dest' } let(:transporter) do config = Rack::MiniProfiler.config config.snapshots_transport_destination_url = url config.snapshots_transport_auth_key = 'somepasswordhere' ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/client_settings_spec.rb
spec/lib/client_settings_spec.rb
# frozen_string_literal: true require 'rack' describe Rack::MiniProfiler::ClientSettings do describe "with settings" do before do @store = Rack::MiniProfiler::MemoryStore.new settings = URI.encode_www_form_component("dp=t,bt=1") @settings = Rack::MiniProfiler::ClientSettings.new( { "H...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/sql_patches_spec.rb
spec/lib/sql_patches_spec.rb
# frozen_string_literal: true # this enables activerecord, and allows us to test the auto detection logic require 'active_record' describe SqlPatches do # and patched= to some extent describe ".all_patch_files" do it "uses env variable" do with_patch_env("custom1") do expect(SqlPatches.all_patch...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/config_spec.rb
spec/lib/config_spec.rb
# frozen_string_literal: true module Rack describe MiniProfiler::Config do describe '.default' do it 'has "enabled" set to true' do expect(MiniProfiler::Config.default.enabled).to be(true) end end describe 'authorization_mode' do before do @config = MiniProfiler::Confi...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/gc_profiler_spec.rb
spec/lib/gc_profiler_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::GCProfiler do before :each do @app = lambda do |env| env end @env = {} @profiler = Rack::MiniProfiler::GCProfiler.new end describe '#profile_gc' do it 'doesn\'t leave the GC enabled if it was disabled previously' do GC.di...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/storage/abstract_store_spec.rb
spec/lib/storage/abstract_store_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::AbstractStore do TestStore = Class.new(Rack::MiniProfiler::AbstractStore) do def fetch_snapshots_overview overview = {} snapshots.shuffle.each do |ss| group_name = "#{ss[:request_method]} #{ss[:request_path]}" group = overview...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/storage/memcache_store_spec.rb
spec/lib/storage/memcache_store_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::MemcacheStore do context 'page struct' do before do @store = Rack::MiniProfiler::MemcacheStore.new unless @store.alive? fail 'Memcached does not appear to be running on localhost:11211. Use your favorite package manager to install a...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/storage/memory_store_spec.rb
spec/lib/storage/memory_store_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::MemoryStore do let(:config) { Rack::MiniProfiler::Config.default } let(:page_class) { Rack::MiniProfiler::TimerStruct::Page } include_examples "snapshots storage", Rack::MiniProfiler::MemoryStore.new context 'page struct' do before do @sto...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/storage/redis_store_spec.rb
spec/lib/storage/redis_store_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::RedisStore do let(:config) { Rack::MiniProfiler::Config.default } let(:page_class) { Rack::MiniProfiler::TimerStruct::Page } let(:store) { Rack::MiniProfiler::RedisStore.new(db: 2, expires_in: 4) } before do store.send(:redis).flushdb end let...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/storage/file_store_spec.rb
spec/lib/storage/file_store_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::FileStore do context 'page struct' do before do tmp = File.expand_path(__FILE__ + "/../../../tmp") Dir::mkdir(tmp) unless File.exist?(tmp) @store = Rack::MiniProfiler::FileStore.new(path: tmp) end describe 'allowed_tokens' do...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/timer_struct_spec.rb
spec/lib/timer_struct/timer_struct_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::TimerStruct::Base do before do @timer = Rack::MiniProfiler::TimerStruct::Base.new('Mini' => 'Profiler') end it 'has the the Mini attribute' do expect(@timer['Mini']).to eq('Profiler') end it 'allows us to set any attribute we want' do ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/sql_timer_struct_spec.rb
spec/lib/timer_struct/sql_timer_struct_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::TimerStruct::Sql do before do @page = Rack::MiniProfiler::TimerStruct::Page.new({}) end describe 'valid sql timer' do before do @sql = Rack::MiniProfiler::TimerStruct::Sql.new("SELECT * FROM users", 200, @page, nil, true) end [ ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/client_timer_struct_spec.rb
spec/lib/timer_struct/client_timer_struct_spec.rb
# frozen_string_literal: true require 'yaml' describe Rack::MiniProfiler::TimerStruct::Client do let(:described) { Rack::MiniProfiler::TimerStruct::Client } def new_page Rack::MiniProfiler::TimerStruct::Page.new({}) end def fixture(name) YAML.safe_load(File.open(File.dirname(__FILE__) + "/../../fix...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/page_timer_struct_spec.rb
spec/lib/timer_struct/page_timer_struct_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::TimerStruct::Page do before do @page = Rack::MiniProfiler::TimerStruct::Page.new({}) end it 'has an Id' do expect(@page[:id]).not_to be_nil end it 'has a Root' do expect(@page[:root]).not_to be_nil end describe 'to_json' do be...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/custom_spec.rb
spec/lib/timer_struct/custom_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::TimerStruct::Custom do before do @name = 'cool request' @page = Rack::MiniProfiler::TimerStruct::Page.new({}) @request = Rack::MiniProfiler::TimerStruct::Request.createRoot(@name, @page) @custom = Rack::MiniProfiler::TimerStruct::Custo...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/spec/lib/timer_struct/request_timer_struct_spec.rb
spec/lib/timer_struct/request_timer_struct_spec.rb
# frozen_string_literal: true describe Rack::MiniProfiler::TimerStruct::Request do def new_page Rack::MiniProfiler::TimerStruct::Page.new({}) end def origin_and_destination(req) [req.add_child('origin'), req.add_child('destination')] end before do @name = 'cool request' @request = Rack::Mi...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/enable_rails_patches.rb
lib/enable_rails_patches.rb
# frozen_string_literal: true module Rack MINI_PROFILER_ENABLE_RAILS_PATCHES = true end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/prepend_mysql2_patch.rb
lib/prepend_mysql2_patch.rb
# frozen_string_literal: true module Rack MINI_PROFILER_PREPEND_MYSQL2_PATCH = true end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/rack-mini-profiler.rb
lib/rack-mini-profiler.rb
# frozen_string_literal: true require 'mini_profiler/version' require 'mini_profiler/asset_version' require 'mini_profiler' require 'patches/sql_patches' require 'patches/net_patches' if defined?(::Rails) && defined?(::Rails::VERSION) && ::Rails::VERSION::MAJOR.to_i >= 3 require 'mini_profiler_rails/railtie' end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler.rb
lib/mini_profiler.rb
# frozen_string_literal: true require 'cgi' require 'json' require 'erb' require 'mini_profiler/timer_struct' require 'mini_profiler/storage' require 'mini_profiler/config' require 'mini_profiler/profiling_methods' require 'mini_profiler/context' require 'mini_profiler/client_settings' require 'mini_profiler/gc_profi...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/prepend_pg_patch.rb
lib/prepend_pg_patch.rb
# frozen_string_literal: true module Rack MINI_PROFILER_PREPEND_PG_PATCH = true end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/prepend_net_http_patch.rb
lib/prepend_net_http_patch.rb
# frozen_string_literal: true module Rack MINI_PROFILER_PREPEND_NET_HTTP_PATCH = true end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage.rb
lib/mini_profiler/storage.rb
# frozen_string_literal: true require 'mini_profiler/storage/abstract_store' require 'mini_profiler/storage/memcache_store' require 'mini_profiler/storage/memory_store' require 'mini_profiler/storage/redis_store' require 'mini_profiler/storage/file_store'
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/asset_version.rb
lib/mini_profiler/asset_version.rb
# frozen_string_literal: true module Rack class MiniProfiler ASSET_VERSION = 'e0bcc9ce0ae3bb5d6b736b6f282f601f' end end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/actions.rb
lib/mini_profiler/actions.rb
# frozen_string_literal: true module Rack class MiniProfiler module Actions def serve_snapshot(env) MiniProfiler.authorize_request status = 200 headers = { 'content-type' => 'text/html' } qp = Rack::Utils.parse_nested_query(env['QUERY_STRING']) if group_name = qp["gro...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/client_settings.rb
lib/mini_profiler/client_settings.rb
# frozen_string_literal: true module Rack class MiniProfiler class ClientSettings COOKIE_NAME = "__profilin" BACKTRACE_DEFAULT = nil BACKTRACE_FULL = 1 BACKTRACE_NONE = 2 attr_accessor :disable_profiling attr_accessor :backtrace_level def initialize(env, store,...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/version.rb
lib/mini_profiler/version.rb
# frozen_string_literal: true module Rack class MiniProfiler VERSION = "4.0.1" SOURCE_CODE_URI = "https://github.com/MiniProfiler/rack-mini-profiler" end end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct.rb
lib/mini_profiler/timer_struct.rb
# frozen_string_literal: true require 'mini_profiler/timer_struct/base' require 'mini_profiler/timer_struct/page' require 'mini_profiler/timer_struct/sql' require 'mini_profiler/timer_struct/custom' require 'mini_profiler/timer_struct/client' require 'mini_profiler/timer_struct/request'
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/profiling_methods.rb
lib/mini_profiler/profiling_methods.rb
# frozen_string_literal: true module Rack class MiniProfiler module ProfilingMethods def record_sql(query, elapsed_ms, params = nil, cached = nil) return unless current && current.current_timer c = current c.current_timer.add_sql( redact_sql_queries? ? nil : query, ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/views.rb
lib/mini_profiler/views.rb
# frozen_string_literal: true module Rack class MiniProfiler module Views def resources_root @resources_root ||= ::File.expand_path("../../html", __FILE__) end def share_template @share_template ||= ERB.new(::File.read(::File.expand_path("../html/share.html", ::File.dirname(__FI...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/snapshots_transporter.rb
lib/mini_profiler/snapshots_transporter.rb
# frozen_string_literal: true class ::Rack::MiniProfiler::SnapshotsTransporter @@transported_snapshots_count = 0 @@successful_http_requests_count = 0 @@failed_http_requests_count = 0 class << self def transported_snapshots_count @@transported_snapshots_count end def successful_http_requests...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/gc_profiler.rb
lib/mini_profiler/gc_profiler.rb
# frozen_string_literal: true class Rack::MiniProfiler::GCProfiler def initialize @ignore = [] @ignore << @ignore.__id__ end def object_space_stats stats = Hash.new(0).compare_by_identity ids = Hash.new.compare_by_identity @ignore << stats.__id__ @ignore << ids.__id__ ObjectSpace....
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/config.rb
lib/mini_profiler/config.rb
# frozen_string_literal: true module Rack class MiniProfiler class Config def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat vars super(*vars) end def self.attributes @attributes end def self.default new.instance_eval { ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/context.rb
lib/mini_profiler/context.rb
# frozen_string_literal: true class Rack::MiniProfiler::Context attr_accessor :inject_js, :current_timer, :page_struct, :skip_backtrace, :full_backtrace, :discard, :mpt_init, :measure def initialize(opts = {}) opts["measure"] = true unless opts.key? "measure" opts.each do |k, v| self...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage/redis_store.rb
lib/mini_profiler/storage/redis_store.rb
# frozen_string_literal: true require 'digest' require 'securerandom' module Rack class MiniProfiler class RedisStore < AbstractStore attr_reader :prefix EXPIRES_IN_SECONDS = 60 * 60 * 24 def initialize(args = nil) @args = args || {} @prefix = @args...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage/abstract_store.rb
lib/mini_profiler/storage/abstract_store.rb
# frozen_string_literal: true module Rack class MiniProfiler class AbstractStore # maximum age of allowed tokens before cycling in seconds MAX_TOKEN_AGE = 1800 def save(page_struct) raise NotImplementedError.new("save is not implemented") end def load(id) raise No...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage/memcache_store.rb
lib/mini_profiler/storage/memcache_store.rb
# frozen_string_literal: true module Rack class MiniProfiler class MemcacheStore < AbstractStore EXPIRES_IN_SECONDS = 60 * 60 * 24 MAX_RETRIES = 10 def initialize(args = nil) require 'dalli' unless defined? Dalli args ||= {} @prefix = args[:prefix] || "MPMemcac...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage/file_store.rb
lib/mini_profiler/storage/file_store.rb
# frozen_string_literal: true require 'securerandom' module Rack class MiniProfiler class FileStore < AbstractStore # Sub-class thread so we have a named thread (useful for debugging in Thread.list). class CacheCleanupThread < Thread end class FileCache def initialize(path, pre...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/storage/memory_store.rb
lib/mini_profiler/storage/memory_store.rb
# frozen_string_literal: true require 'securerandom' module Rack class MiniProfiler class MemoryStore < AbstractStore # Sub-class thread so we have a named thread (useful for debugging in Thread.list). class CacheCleanupThread < Thread def initialize(interval, cycle, store) @stor...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/sql.rb
lib/mini_profiler/timer_struct/sql.rb
# frozen_string_literal: true require 'erb' module Rack class MiniProfiler # Timing system for a SQL query module TimerStruct class Sql < TimerStruct::Base attr_accessor :parent def initialize(query, duration_ms, page, parent, params = nil, skip_backtrace = false, full_backtrace = fa...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/page.rb
lib/mini_profiler/timer_struct/page.rb
# frozen_string_literal: true module Rack class MiniProfiler module TimerStruct # TimerStruct::Page # Root: TimerStruct::Request # :has_many TimerStruct::Request children # :has_many TimerStruct::Sql children # :has_many TimerStruct::Custom children class Page <...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/base.rb
lib/mini_profiler/timer_struct/base.rb
# frozen_string_literal: true require 'json' module Rack class MiniProfiler module TimerStruct # A base class for timing structures class Base def initialize(attrs = {}) @attributes = attrs end def attributes @attributes ||= {} end def [...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/client.rb
lib/mini_profiler/timer_struct/client.rb
# frozen_string_literal: true module Rack class MiniProfiler module TimerStruct # This class holds the client timings class Client < TimerStruct::Base def self.init_instrumentation %Q{ <script type="text/javascript"> mPt=function(){var t=[];return{t:t,pro...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/request.rb
lib/mini_profiler/timer_struct/request.rb
# frozen_string_literal: true module Rack class MiniProfiler module TimerStruct class Request < TimerStruct::Base def self.createRoot(name, page) TimerStruct::Request.new(name, page, nil).tap do |timer| timer[:is_root] = true end end attr_accessor :...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler/timer_struct/custom.rb
lib/mini_profiler/timer_struct/custom.rb
# frozen_string_literal: true module Rack class MiniProfiler module TimerStruct # Timing system for a custom timers such as cache, redis, RPC, external API # calls, etc. class Custom < TimerStruct::Base attr_accessor :parent def initialize(type, duration_ms, page, parent) ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler_rails/railtie.rb
lib/mini_profiler_rails/railtie.rb
# frozen_string_literal: true require 'fileutils' require_relative './railtie_methods' module Rack::MiniProfilerRails extend Rack::MiniProfilerRailsMethods # call direct if needed to do a defer init def self.initialize!(app) raise "MiniProfilerRails initialized twice. Set `require: false' for rack-mini-pr...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/mini_profiler_rails/railtie_methods.rb
lib/mini_profiler_rails/railtie_methods.rb
# frozen_string_literal: true module Rack::MiniProfilerRailsMethods def render_notification_handler(name, finish, start, name_as_description: false) return if !should_measure? description = name_as_description ? name : "Rendering: #{name}" current = Rack::MiniProfiler.current.current_timer node = cu...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/generators/rack_mini_profiler/install_generator.rb
lib/generators/rack_mini_profiler/install_generator.rb
# frozen_string_literal: true module RackMiniProfiler module Generators class InstallGenerator < ::Rails::Generators::Base source_root File.expand_path("templates", __dir__) def create_initializer_file copy_file "rack_mini_profiler.rb", "config/initializers/rack_mini_profiler.rb" end ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/generators/rack_mini_profiler/templates/rack_mini_profiler.rb
lib/generators/rack_mini_profiler/templates/rack_mini_profiler.rb
# frozen_string_literal: true if Rails.env.development? require "rack-mini-profiler" # The initializer was required late, so initialize it manually. Rack::MiniProfilerRails.initialize!(Rails.application) end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/generators/rack_profiler/install_generator.rb
lib/generators/rack_profiler/install_generator.rb
# frozen_string_literal: true require "generators/rack_mini_profiler/install_generator" module RackProfiler module Generators class InstallGenerator < RackMiniProfiler::Generators::InstallGenerator source_root File.expand_path("../rack_mini_profiler/templates", __dir__) def create_initializer_file ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/sql_patches.rb
lib/patches/sql_patches.rb
# frozen_string_literal: true class SqlPatches def self.correct_version?(required_version, klass) Gem::Dependency.new('', required_version).match?('', klass::VERSION) rescue NameError false end def self.record_sql(statement, parameters = nil, &block) start = Process.clock_gettime(Process::CLOCK_M...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/net_patches.rb
lib/patches/net_patches.rb
# frozen_string_literal: true if ENV['RACK_MINI_PROFILER_PATCH_NET_HTTP'] != 'false' if (defined?(Net) && defined?(Net::HTTP)) if defined?(Rack::MINI_PROFILER_PREPEND_NET_HTTP_PATCH) module NetHTTPWithMiniProfiler def request(request, *args, &block) Rack::MiniProfiler.step("Net::HTTP #{re...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/pg.rb
lib/patches/db/pg.rb
# frozen_string_literal: true if defined?(Rack::MINI_PROFILER_PREPEND_PG_PATCH) require "patches/db/pg/prepend" else require "patches/db/pg/alias_method" end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/activerecord.rb
lib/patches/db/activerecord.rb
# frozen_string_literal: true ## based off https://github.com/newrelic/rpm/blob/master/lib/new_relic/agent/instrumentation/active_record.rb ## fallback for alls sorts of weird dbs module Rack class MiniProfiler module ActiveRecordInstrumentation def self.included(instrumented_class) instrumented_cl...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/plucky.rb
lib/patches/db/plucky.rb
# frozen_string_literal: true # mongo_mapper patches # TODO: Include overrides for distinct, update, cursor, and create class Plucky::Query alias_method :find_each_without_profiling, :find_each alias_method :find_one_without_profiling, :find_one alias_method :count_without_profiling, :count alias_method :remov...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/riak.rb
lib/patches/db/riak.rb
# frozen_string_literal: true # riak-client 2.2.2 patches class Riak::Multiget class << self alias_method :get_all_without_profiling, :get_all def get_all(client, fetch_list) return get_all_without_profiling(client, fetch_list) unless SqlPatches.should_measure? start = Process.clock_getti...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/sequel.rb
lib/patches/db/sequel.rb
# frozen_string_literal: true module Sequel class Database alias_method :log_duration_original, :log_duration def log_duration(duration, message) # `duration` will be in seconds, but we need it in milliseconds for internal consistency. ::Rack::MiniProfiler.record_sql(message, duration * 1000) ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/rsolr.rb
lib/patches/db/rsolr.rb
# frozen_string_literal: true class RSolr::Connection alias_method :execute_without_profiling, :execute def execute_with_profiling(client, request_context) return execute_without_profiling(client, request_context) unless SqlPatches.should_measure? start = Process.clock_gettime(Process::CLOCK_MONOTO...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/moped.rb
lib/patches/db/moped.rb
# frozen_string_literal: true # Mongoid 3 patches class Moped::Node alias_method :process_without_profiling, :process def process(*args, &blk) return process_without_profiling(*args, &blk) unless SqlPatches.should_measure? result, _record = SqlPatches.record_sql(args[0].log_inspect) do process_witho...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/oracle_enhanced.rb
lib/patches/db/oracle_enhanced.rb
# frozen_string_literal: true class ActiveRecord::Result alias_method :each_without_profiling, :each def each(&blk) return each_without_profiling(&blk) unless defined?(@miniprofiler_sql_id) start = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = each_without_profiling(&blk) e...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/mysql2.rb
lib/patches/db/mysql2.rb
# frozen_string_literal: true if defined?(Rack::MINI_PROFILER_PREPEND_MYSQL2_PATCH) require "patches/db/mysql2/prepend" else require "patches/db/mysql2/alias_method" end
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/nobrainer.rb
lib/patches/db/nobrainer.rb
# frozen_string_literal: true class Rack::MiniProfiler::NoBrainerProfiler def on_query(env) if SqlPatches.should_measure? not_indexed = env[:criteria] && env[:criteria].where_present? && !env[:criteria].where_indexed? && !env[:criteria].model.try(:perf_warni...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/mongo.rb
lib/patches/db/mongo.rb
# frozen_string_literal: true # Mongo/Mongoid 5 patches class Mongo::Server::Connection def dispatch_with_timing(*args, &blk) return dispatch_without_timing(*args, &blk) unless SqlPatches.should_measure? result, _record = SqlPatches.record_sql(args[0][0].payload.inspect) do dispatch_without_timing(*ar...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/neo4j.rb
lib/patches/db/neo4j.rb
# frozen_string_literal: true class Neo4j::Core::Query alias_method :response_without_miniprofiler, :response def response return @response if @response start = Process.clock_gettime(Process::CLOCK_MONOTONIC) rval = response_without_miniprofiler elapsed_time = SqlPatches.elapsed_time(start) Ra...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/pg/alias_method.rb
lib/patches/db/pg/alias_method.rb
# frozen_string_literal: true class PG::Result alias_method :each_without_profiling, :each alias_method :values_without_profiling, :values def values(*args, &blk) return values_without_profiling(*args, &blk) unless defined?(@miniprofiler_sql_id) mp_report_sql do values_without_profiling(*args , &b...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/pg/prepend.rb
lib/patches/db/pg/prepend.rb
# frozen_string_literal: true class PG::Result module MiniProfiler def values(*args, &blk) return super unless defined?(@miniprofiler_sql_id) mp_report_sql do super end end def each(*args, &blk) return super unless defined?(@miniprofiler_sql_id) mp_report_sql do ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/mysql2/alias_method.rb
lib/patches/db/mysql2/alias_method.rb
# frozen_string_literal: true # The best kind of instrumentation is in the actual db provider, however we don't want to double instrument class Mysql2::Result alias_method :each_without_profiling, :each def each(*args, &blk) return each_without_profiling(*args, &blk) unless defined?(@miniprofiler_sql_id) ...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/lib/patches/db/mysql2/prepend.rb
lib/patches/db/mysql2/prepend.rb
# frozen_string_literal: true class Mysql2::Result module MiniProfiler def each(*args, &blk) return super unless defined?(@miniprofiler_sql_id) start = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = super elapsed_time = SqlPatches.elapsed_time(start) @minipr...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
MiniProfiler/rack-mini-profiler
https://github.com/MiniProfiler/rack-mini-profiler/blob/92610caa0051510530da5def0602e5e97683f824/website/sample.rb
website/sample.rb
# frozen_string_literal: true require 'stackprof' require 'rack-mini-profiler' require 'sinatra' require 'sinatra/base' class SampleStorage < Rack::MiniProfiler::AbstractStore def initialize(args) @multipliers = [10, 100, 1000] @time_units = [1, 60, 3600, 3600 * 24] @time_multipliers = (1..60).to_a en...
ruby
MIT
92610caa0051510530da5def0602e5e97683f824
2026-01-04T15:48:10.845108Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/backtrace_line_decorator.rb
app/decorators/backtrace_line_decorator.rb
# frozen_string_literal: true class BacktraceLineDecorator < Draper::Decorator EMPTY_STRING = "" def in_app? return false if file.blank? file.match Backtrace::IN_APP_PATH end def number object[:number] end def column object[:column] end def file object.try(:[], :file).to_s en...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/issue_tracker_decorator.rb
app/decorators/issue_tracker_decorator.rb
# frozen_string_literal: true # Decorates an instance of IssueTracker class IssueTrackerDecorator < Draper::Decorator delegate_all def type @type ||= IssueTrackerTypeDecorator.new(object.tracker.class) end end
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/problem_decorator.rb
app/decorators/problem_decorator.rb
# frozen_string_literal: true class ProblemDecorator < Draper::Decorator decorates_association :notices delegate_all end
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/backtrace_decorator.rb
app/decorators/backtrace_decorator.rb
# frozen_string_literal: true class BacktraceDecorator < Draper::Decorator def lines @lines ||= (object.lines || []).map { |line| BacktraceLineDecorator.new(line) } end # Group lines into sections of in-app files and external files def grouped_lines lines.chunk do |line| line.in_app? || false ...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/issue_tracker_field_decorator.rb
app/decorators/issue_tracker_field_decorator.rb
# frozen_string_literal: true class IssueTrackerFieldDecorator < Draper::Decorator attr_reader :object, :field_info def initialize(field, field_info) @object = field @field_info = field_info end alias_method :key, :object def label field_info[:label] || object.to_s.titleize end def input(...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/issue_tracker_type_decorator.rb
app/decorators/issue_tracker_type_decorator.rb
# frozen_string_literal: true # Decorates an IssueTracker class class IssueTrackerTypeDecorator < Draper::Decorator delegate_all # return hash of icons as data URIs def icons return unless object.icons object.icons.reduce({}) do |c, (k, v)| c[k] = "data:#{v[0]};base64,#{Base64.encode64(v[1])}" ...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/app_decorator.rb
app/decorators/app_decorator.rb
# frozen_string_literal: true class AppDecorator < Draper::Decorator decorates_association :issue_tracker delegate_all def email_at_notices object.email_at_notices.join(", ") end def use_site_fingerprinter return true if object.notice_fingerprinter.nil? return true if object.notice_fingerprint...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/decorators/notice_decorator.rb
app/decorators/notice_decorator.rb
# frozen_string_literal: true class NoticeDecorator < Draper::Decorator decorates_association :backtrace delegate_all end
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/jobs/destroy_problems_by_id_job.rb
app/jobs/destroy_problems_by_id_job.rb
# frozen_string_literal: true class DestroyProblemsByIdJob < ApplicationJob queue_as :default # @param problem_ids [Array<String>] def perform(problem_ids) bson_problem_ids = [] problem_ids.each do |id| bson_problem_ids << BSON::ObjectId.from_string(id) end problems = Problem.find(bson_p...
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false
errbit/errbit
https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/app/jobs/application_job.rb
app/jobs/application_job.rb
# frozen_string_literal: true class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
0f325841e2e723f662e2b0ec4ede3d5c30136fa0
2026-01-04T15:46:48.143000Z
false