source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/active_pdftk/form_spec.rb
Ruby
mit
47
master
17,726
require 'spec_helper' describe ActivePdftk::Form do context "new" do it "should create a ActivePdftk::Form object" do @form = ActivePdftk::Form.new(path_to_pdf('spec.fields.pdf')) @form.should be_kind_of(ActivePdftk::Form) @form.template.should == path_to_pdf('spec.fields.pdf') end end ...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/active_pdftk/xfdf_spec.rb
Ruby
mit
47
master
603
require 'spec_helper' describe ActivePdftk::Xfdf do context "generate xfdf" do before do @xfdf = ActivePdftk::Xfdf.new(:test => "one", :user => "tom") end # Similar ruby issue, I got in the Call specs, hash are not ordered with ruby 1.8.7 it { @xfdf.to_s.split('').sort.should == valid_xfdf.s...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/active_pdftk/call_spec.rb
Ruby
mit
47
master
13,668
require 'spec_helper' require 'tempfile' describe ActivePdftk::Call do context "#new" do before :all do options = {} options[:path] = ENV['path'] unless ENV['path'].nil? @pdftk = ActivePdftk::Call.new(options) end it "should set the path (not nil)"do @pdftk.default_statements[:pa...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/active_pdftk/wrapper_spec.rb
Ruby
mit
47
master
20,362
require 'spec_helper' inputs = [:path, :hash, :file, :tempfile, :stringio] outputs = [:path, :file, :tempfile, :stringio, :nil] def get_input(input_type, file_name = 'spec.fields.pdf') case input_type when :path path_to_pdf(file_name) when :hash {path_to_pdf(file_name) => nil} when :file File.new(...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/active_pdftk/field_spec.rb
Ruby
mit
47
master
15,952
require 'spec_helper' describe ActivePdftk::Field do context "aliased attributes" do before do @field = ActivePdftk::Field.new( 'FieldName' => 'test', 'FieldType' => 'Text', 'FieldValue' => '', 'FieldFlags' => 4096 ) end it "should respond to" do @field...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/support/inputs_helper.rb
Ruby
mit
47
master
2,689
def path_to_pdf(filename) File.expand_path(File.join(File.dirname(__FILE__), '../', 'fixtures', "#{filename}")) end def fixtures_path(entry, expand = false) entry_path = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '../', 'fixtures', "#{entry}"))) if expand && entry_path.directory? entry_p...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/support/xfdf_helper.rb
Ruby
mit
47
master
340
def valid_xfdf xfdf = Builder::XmlMarkup.new xfdf.instruct! xfdf.xfdf(:xmlns => "http://ns.adobe.com/xfdf/", :"xml:space" => "preserve") do xfdf.fields do xfdf.field(:name => :test) do xfdf.value "one" end xfdf.field(:name => :user) do xfdf.value "tom" end end end...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
spec/support/matchers/content_matcher.rb
Ruby
mit
47
master
3,122
RSpec::Matchers.define :have_the_content_of do |expected| match do |actual| puts actual.class.name.to_s puts expected.class.name.to_s actual_content = read_content(actual) ta = Tempfile.new('actual_data') ta.write(actual_content.to_s) actual_input = ta.path expected_content = read_content(...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/xfdf.rb
Ruby
mit
47
master
1,603
module ActivePdftk # Map keys and values to Adobe's XFDF format. # class Xfdf # Creates a new instance given the field names and values provided as a hash # # @param[Hash] A hash of fields where the key is the field name and the value is the value for the field. The value can also be a nested hash ...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/call.rb
Ruby
mit
47
master
20,382
require "open3" require "tmpdir" module ActivePdftk # Error that is raised when +pdftk+ could not be located on the system and the path to the library is not passed in class MissingLibrary < StandardError # Calls super with the message and a link to pdftk def initialize super("Pdftk library not found...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/form.rb
Ruby
mit
47
master
7,647
require 'tempfile' module ActivePdftk # Represents a fillable form on a particular PDF. # It should be your preferred abstraction layer, for editable form content # Use a ActivePdftk::Form object as an electronic document, read, edit & save it! # # @example # bic = ActivePdftk::Form.new('bic.pdf') # ...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/field.rb
Ruby
mit
47
master
8,987
module ActivePdftk # Represents a fillable form field on a PDF form # # Contains a nice wrapper to check field flags to determine possible options class Field # @return [Hash] the attributes to construct the field attr_reader :attributes # @return [String] the default value of the field attr_r...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/fdf.rb
Ruby
mit
47
master
3,739
module ActivePdftk # Map keys and values to Adobe's FDF format. # # Straight port of Perl's PDF::FDF::Simple by Steffen Schwigon. # # FDF can be returned as a string with #to_s or written to a file with #save_to('file_path') # # Parsing FDF files is not supported (yet). # class Fdf # @return [Has...
github
tcocca/active_pdftk
https://github.com/tcocca/active_pdftk
lib/active_pdftk/wrapper.rb
Ruby
mit
47
master
19,185
require 'tempfile' module ActivePdftk # Wraps calls to the ActivePdftk::Call class # # provides methods around every operation for pdftk to make constructing the call with options easier than working directly with the ActivePdftk::Call class class Wrapper attr_reader :call # Instantiates a new instan...
github
xunker/array-subindex
https://github.com/xunker/array-subindex
Gemfile
Ruby
mit
47
master
305
source 'https://rubygems.org' # Specify your gem's dependencies in array-subindex.gemspec gemspec # can't use pry on old rubies or on rubinius if RUBY_VERSION.to_f >= 2.0 && RUBY_ENGINE == 'ruby' gem 'pry', :require => false gem 'pry-byebug', :require => false gem "codeclimate-test-reporter" end
github
xunker/array-subindex
https://github.com/xunker/array-subindex
array-subindex.gemspec
Ruby
mit
47
master
1,016
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'array/subindex/version' Gem::Specification.new do |spec| spec.name = "array-subindex" spec.version = Array::Subindex::VERSION spec.authors = ["Matthew Nielsen"] spec....
github
xunker/array-subindex
https://github.com/xunker/array-subindex
Rakefile
Ruby
mit
47
master
214
require "bundler/gem_tasks" require "rspec/core/rake_task" require "rspec/core/version" task :default => :spec desc "Run all examples" RSpec::Core::RakeTask.new(:spec, :default) do |t| t.ruby_opts = %w[-w] end
github
xunker/array-subindex
https://github.com/xunker/array-subindex
lib/array/subindex.rb
Ruby
mit
47
master
4,329
require "array/subindex/version" class Array # Here is where the magic starts, where we redefine the core Array operator, # something you *should NEVER do*, but we are. I debated using `alias` to # preserve the old method and pass "regular" requests to that, but I decided # I wanted to recreate functionality ...
github
xunker/array-subindex
https://github.com/xunker/array-subindex
spec/spec_helper.rb
Ruby
mit
47
master
352
# avoid redundant reports to codeclimate for every version ruby # version run in travis. This also avoids trying to run test reporter # under 1.8.7 which will fail. if RUBY_VERSION == "2.2.1" && RUBY_ENGINE == 'ruby' require "codeclimate-test-reporter" CodeClimate::TestReporter.start end RSpec.configure do |config...
github
xunker/array-subindex
https://github.com/xunker/array-subindex
spec/lib/array/subindex_spec.rb
Ruby
mit
47
master
4,037
require 'spec_helper' require 'array/subindex' describe 'Array::subindex' do describe 'preserve previous functionality' do subject { [1,2,3] } it "returns normal index values with integer indexes" do -1.upto(2) do |i| expect( subject[i] ).to eq( subject.fetch(i) ) expect( subject[i] ).t...
github
brennandunn/preference_fu
https://github.com/brennandunn/preference_fu
Rakefile
Ruby
mit
47
master
558
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the preference_fu plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the preference_fu pl...
github
brennandunn/preference_fu
https://github.com/brennandunn/preference_fu
test/preference_fu_test.rb
Ruby
mit
47
master
1,821
require 'test/unit' require File.join(File.dirname(__FILE__), 'abstract_unit') require File.join(File.dirname(__FILE__), 'person') class PreferenceFuTest < Test::Unit::TestCase def setup setup_db @person = Person.new end def teardown teardown_db end def test_that_all_default_to_true_excep...
github
brennandunn/preference_fu
https://github.com/brennandunn/preference_fu
test/abstract_unit.rb
Ruby
mit
47
master
626
begin require File.dirname(__FILE__) + '/../../../../config/environment' rescue LoadError require 'rubygems' require 'active_record' gem 'activerecord' end require 'preference_fu' require "#{File.dirname(__FILE__)}/../init" ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:"...
github
brennandunn/preference_fu
https://github.com/brennandunn/preference_fu
lib/preference_fu.rb
Ruby
mit
47
master
3,684
module PreferenceFu def self.included(receiver) receiver.extend ClassMethods receiver.send :include, InstanceMethods end module ClassMethods def has_preferences(*prefs) alias_method_chain :initialize, :preferences class_eval do class << self alia...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
nostr_ruby.gemspec
Ruby
mit
47
master
1,028
$:.unshift File.expand_path('../lib', __FILE__) require 'version' Gem::Specification.new do |s| s.name = 'nostr_ruby' s.version = Nostr::VERSION s.summary = 'A Ruby library to interact with the Nostr protocol' s.description = 'NostrRuby is a Ruby library to interact with the Nostr protoc...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/nostr_ruby.rb
Ruby
mit
47
master
425
require_relative 'version' require_relative 'crypto_tools' require 'ecdsa' require 'schnorr' require 'json' require 'base64' require 'bech32' require 'unicode/emoji' require_relative 'bech32' require_relative 'context' require_relative 'kind' require_relative 'key' require_relative 'event' require_relative 'filter' r...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/client.rb
Ruby
mit
47
master
4,597
require_relative 'event_wizard' require 'faye/websocket' module Nostr class Client include EventWizard attr_reader :signer attr_reader :relay attr_reader :subscriptions def initialize(signer: nil, private_key: nil, relay: nil, context: Context.new(timeout: 5)) initialize_event_emitter ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/key.rb
Ruby
mit
47
master
373
module Nostr class Key def self.generate_private_key group = ECDSA::Group::Secp256k1 (1 + SecureRandom.random_number(group.order - 1)).to_s(16).rjust(64, '0') end def self.get_public_key(private_key) group = ECDSA::Group::Secp256k1 group.generator.multiply_by_scalar(private_key.t...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/bech32.rb
Ruby
mit
47
master
2,743
require 'bech32' require 'bech32/nostr' require 'bech32/nostr/entity' module Nostr class Bech32 def self.decode(bech32_entity) e = ::Bech32::Nostr::NIP19.decode(bech32_entity) case e in ::Bech32::Nostr::BareEntity { hrp: e.hrp, data: e.data } in ::Bech32::Nostr::TLVEntity ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/crypto_tools.rb
Ruby
mit
47
master
1,145
module CryptoTools def self.calculate_shared_key(priv_key_a, pub_key_b) ec = OpenSSL::PKey::EC.new('secp256k1') ec.private_key = OpenSSL::BN.new(priv_key_a, 16) pub_key_hex = "02#{pub_key_b}" pub_key_bn = OpenSSL::BN.new(pub_key_hex, 16) secret_point = OpenSSL::PKey::EC::Point.new(ec.group, pub_k...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/event.rb
Ruby
mit
47
master
4,631
module Nostr class Event include CryptoTools ATTRIBUTES = [:kind, :pubkey, :created_at, :tags, :content, :id, :sig, :pow, :delegation, :recipient] # Create attr_reader for each attribute name ATTRIBUTES.each do |attribute| attr_reader attribute end attr_reader :errors class Valid...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/message_handler.rb
Ruby
mit
47
master
2,087
module Nostr class MessageHandler def self.handle(message) message = JSON.parse(message) rescue ["?", message] type = message[0] strategy_class = case type when 'EVENT' then EventMessageStrategy when 'OK' then OkMessageStrategy when 'EOSE' then EoseMessageStrategy ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/event_wizard.rb
Ruby
mit
47
master
750
module EventWizard def initialize_event_emitter @listeners = Hash.new { |hash, key| hash[key] = [] } end def on(event, &callback) # Prevent adding the same callback multiple times unless @listeners[event].include?(callback) @listeners[event] << callback end end def emit(event, *args) ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/signer.rb
Ruby
mit
47
master
2,728
module Nostr class Signer attr_reader :private_key attr_reader :public_key def initialize(private_key:) @private_key = private_key unless @public_key @public_key = Nostr::Key::get_public_key(@private_key) end end def nsec Nostr::Bech32.encode_nsec(@private_key) ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/filter.rb
Ruby
mit
47
master
1,511
module Nostr class Filter attr_reader :id attr_reader :kinds attr_reader :authors attr_reader :tags attr_reader :since attr_reader :until attr_reader :limit attr_reader :search ('a'..'z').each { |char| attr_reader char.to_sym } ('A'..'Z').each { |char| attr_reader char.to_sym ...
github
dtonon/nostr-ruby
https://github.com/dtonon/nostr-ruby
lib/context.rb
Ruby
mit
47
master
959
class Context attr_reader :canceled, :timeout def initialize(timeout: nil) @timeout = timeout @canceled = false @mutex = Mutex.new @condition = ConditionVariable.new # Start a timer if a timeout is specified if @timeout @start_time = Time.now end end def cancel @mutex.sy...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
Gemfile
Ruby
mit
47
main
273
# frozen_string_literal: true source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem's dependencies in inner_performance.gemspec. gemspec eval_gemfile File.expand_path("spec/gemfiles/rails_8.0.gemfile", __dir__)
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
inner_performance.gemspec
Ruby
mit
47
main
1,227
# frozen_string_literal: true require_relative "lib/inner_performance/version" Gem::Specification.new do |spec| spec.name = "inner_performance" spec.version = InnerPerformance::VERSION spec.authors = ["mbajur"] spec.email = ["mbajur@gmail.com"] spec.homepage = "https://github.com/mba...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
Rakefile
Ruby
mit
47
main
216
# frozen_string_literal: true require "bundler/setup" APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__) load "rails/tasks/engine.rake" load "rails/tasks/statistics.rake" require "bundler/gem_tasks"
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
config/routes.rb
Ruby
mit
47
main
334
# frozen_string_literal: true InnerPerformance::Engine.routes.draw do resources :events, only: [:index, :show] root to: "dashboard#index" scope :frontend, controller: :frontends, defaults: { version: InnerPerformance::VERSION.tr(".", "-") } do get "static/:version/:stem", action: :static, as: :frontend_sta...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
db/migrate/20250214162622_create_inner_performance_traces.rb
Ruby
mit
47
main
371
class CreateInnerPerformanceTraces < ActiveRecord::Migration[7.1] def change create_table(:inner_performance_traces) do |t| t.references(:event, type: :bigint, null: false, foreign_key: { to_table: :inner_performance_events }) t.string(:name) t.string(:type) t.json(:payload) t.decima...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
db/migrate/20241123121600_create_inner_performance_events.rb
Ruby
mit
47
main
431
# frozen_string_literal: true class CreateInnerPerformanceEvents < ActiveRecord::Migration[7.1] def change create_table(:inner_performance_events, force: :cascade) do |t| t.string("event") t.string("name") t.decimal("duration") t.decimal("db_runtime") t.datetime("created_at", null: ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/services/inner_performance/trace_for_insert_initializer.rb
Ruby
mit
47
main
511
# frozen_string_literal: true module InnerPerformance class TraceForInsertInitializer class << self def new(trace:, event:) class_from_group(trace).initialize_for_insert(trace: trace, event: event) end def class_from_group(trace) case trace[:group] when :db then InnerPe...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/models/inner_performance/event.rb
Ruby
mit
47
main
402
# frozen_string_literal: true module InnerPerformance class Event < ApplicationRecord has_many :traces, dependent: :destroy serialize :properties, coder: JSON def self.ransackable_attributes(_auth_object = nil) ["created_at", "db_runtime", "duration", "event", "format", "id", "name"] end ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/models/inner_performance/traces/db.rb
Ruby
mit
47
main
531
# frozen_string_literal: true module InnerPerformance module Traces class Db < InnerPerformance::Trace store :payload, accessors: [:sql, :name], coder: JSON, prefix: true class << self def initialize_for_insert(trace:, event:) { type: name, name: trace[:name...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/models/inner_performance/traces/view.rb
Ruby
mit
47
main
542
# frozen_string_literal: true module InnerPerformance module Traces class View < InnerPerformance::Trace store :payload, accessors: [:identifier], coder: JSON, prefix: true class << self def initialize_for_insert(trace:, event:) { type: name, name: trace[:na...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/controllers/inner_performance/events_controller.rb
Ruby
mit
47
main
680
# frozen_string_literal: true module InnerPerformance class EventsController < ApplicationController RESULTS_PER_PAGE = 50 def index @current_page = params[:page].presence&.to_i if current_page.nil? || current_page < 1 @current_page = 1 end @q = InnerPerformance::Event ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/controllers/inner_performance/frontends_controller.rb
Ruby
mit
47
main
810
# frozen_string_literal: true module InnerPerformance class FrontendsController < ApplicationController protect_from_forgery with: :exception skip_after_action :verify_same_origin_request, raise: false before_action do expires_in 1.year, public: true end class << self def asset_path...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/controllers/inner_performance/dashboard_controller.rb
Ruby
mit
47
main
650
# frozen_string_literal: true module InnerPerformance class DashboardController < ApplicationController def index @recent_events = InnerPerformance::Event.all.order(id: :desc).limit(25) @average_req_duration = InnerPerformance::Events::ProcessActionActionController.all.average(:duration) @avera...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/jobs/inner_performance/cleanup_job.rb
Ruby
mit
47
main
446
# frozen_string_literal: true module InnerPerformance class CleanupJob < ApplicationJob def perform InnerPerformance::Trace .joins(:event) .where("inner_performance_events.created_at < ?", InnerPerformance.configuration.events_retention.ago) .delete_all InnerPerformance::Even...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/jobs/inner_performance/save_event_job.rb
Ruby
mit
47
main
828
# frozen_string_literal: true module InnerPerformance class SaveEventJob < ApplicationJob def perform(type:, created_at:, event:, name:, duration:, db_runtime:, properties: {}, traces: []) event = InnerPerformance::Event.create( type: type, created_at: created_at, event: event, ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
app/helpers/inner_performance/application_helper.rb
Ruby
mit
47
main
550
# frozen_string_literal: true module InnerPerformance module ApplicationHelper # Based on https://stackoverflow.com/a/45428183/552936 and # https://datadome.co/learning-center/how-to-reduce-server-response-time/ def row_class_from_duration(duration) medium_duration_range = InnerPerformance.configur...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/rails_helper.rb
Ruby
mit
47
main
3,386
# frozen_string_literal: true require "simplecov" SimpleCov.start do add_filter "spec" end # This file is copied to spec/ when you run 'rails generate rspec:install' require "spec_helper" ENV["RAILS_ENV"] ||= "test" require_relative "dummy/config/environment" # Prevent database truncation if the environment is prod...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/spec_helper.rb
Ruby
mit
47
main
4,791
# frozen_string_literal: true # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, withou...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/models/inner_performance/event_spec.rb
Ruby
mit
47
main
512
# frozen_string_literal: true require "rails_helper" describe InnerPerformance::Event do describe ".ransackable_attributes" do it "defines ransackable attributes" do expect(described_class.ransackable_attributes).to(eq([ "created_at", "db_runtime", "duration", "event", "format", "id", "name", ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/models/inner_performance/traces/view_spec.rb
Ruby
mit
47
main
797
# frozen_string_literal: true require "rails_helper" describe InnerPerformance::Traces::View do describe ".initialize_for_insert" do subject { described_class.initialize_for_insert(trace: trace, event: event) } let!(:time) { Time.current } let(:trace) do { name: "render_template.action_vi...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/models/inner_performance/traces/db_spec.rb
Ruby
mit
47
main
742
# frozen_string_literal: true require "rails_helper" describe InnerPerformance::Traces::Db do describe ".initialize_for_insert" do subject { described_class.initialize_for_insert(trace: trace, event: event) } let(:trace) do { name: "sql.active_record", payload: { sql: "foo" }, ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/lib/inner_performance_spec.rb
Ruby
mit
47
main
1,087
# frozen_string_literal: true require "rails_helper" describe InnerPerformance do describe ".save_event?" do subject { described_class.save_event?(event) } let(:event) do ActiveSupport::Notifications::Event.new( event_name, (Time.current - 1.minute).to_i, Time.current.to_i, ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/jobs/dummy_job_spec.rb
Ruby
mit
47
main
1,723
# frozen_string_literal: true require "rails_helper" describe DummyJob do it "enqueues InnerPerformance::SaveEventJob" do described_class.perform_now expect(InnerPerformance::SaveEventJob).to( have_been_enqueued.with( hash_including( type: "InnerPerformance::Events::PerformActiveJob...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/jobs/inner_performance/save_event_job_spec.rb
Ruby
mit
47
main
2,153
# frozen_string_literal: true require "rails_helper" describe InnerPerformance::SaveEventJob do subject { described_class.perform_now(**args) } let(:args) do { type: InnerPerformance::Events::PerformActiveJob.name, created_at: Time.current, event: "perform.active_job", name: "DummyJob...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/jobs/inner_performance/cleanup_job_spec.rb
Ruby
mit
47
main
896
# frozen_string_literal: true require "rails_helper" describe InnerPerformance::CleanupJob do subject { described_class.perform_now } let!(:old_event) { create(:event, created_at: 7.days.ago) } let!(:fresh_event) { create(:event, created_at: 6.days.ago) } let!(:old_trace) { create(:trace, event: old_event, ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/requests/dummy_request_spec.rb
Ruby
mit
47
main
2,242
# frozen_string_literal: true require "rails_helper" RSpec.describe("Dummy request", type: :request) do before do InnerPerformance.configuration.sample_rates = { "process_action.action_controller" => 100, "perform.active_job" => 100, } end describe "GET /" do subject do get "/dumm...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/db/schema.rb
Ruby
mit
47
main
1,518
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/puma.rb
Ruby
mit
47
main
1,955
# frozen_string_literal: true # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. # Puma can serve each request in a thread from an int...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/application.rb
Ruby
mit
47
main
1,089
# frozen_string_literal: true require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Dummy class Application < Rails::Application config.load_defaults(Rails::VERSION::ST...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/initializers/filter_parameter_logging.rb
Ruby
mit
47
main
480
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for ...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/environments/development.rb
Ruby
mit
47
main
2,704
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response ti...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/environments/test.rb
Ruby
mit
47
main
2,675
# frozen_string_literal: true require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test r...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
spec/dummy/config/environments/production.rb
Ruby
mit
47
main
4,318
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
lib/inner_performance.rb
Ruby
mit
47
main
3,122
# frozen_string_literal: true require "inner_performance/version" require "inner_performance/engine" require "inner_performance/configuration" require_relative "inner_performance/current_request" require "ransack" module InnerPerformance class << self def configuration @configuration ||= Configuration.n...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
lib/inner_performance/current_request.rb
Ruby
mit
47
main
867
# frozen_string_literal: true # Heavily based on RailsPerformance implementation: # https://github.com/igorkasyanchuk/rails_performance/blob/master/lib/rails_performance/thread/current_request.rb module InnerPerformance class CurrentRequest attr_reader :request_id, :traces, :ignore attr_accessor :data at...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
lib/inner_performance/configuration.rb
Ruby
mit
47
main
975
# frozen_string_literal: true module InnerPerformance class Configuration attr_accessor :sample_rates, :events_retention, :medium_duration_range, :ignore_rules, :cleanup_immediately, :traces_enabled, :ignored_event_names def initialize @sample_rates = { "pro...
github
mbajur/inner_performance
https://github.com/mbajur/inner_performance
lib/inner_performance/engine.rb
Ruby
mit
47
main
501
# frozen_string_literal: true module InnerPerformance class Engine < ::Rails::Engine isolate_namespace InnerPerformance config.generators do |g| g.test_framework(:rspec) end initializer "inner_performance.install" do InnerPerformance.install! end initializer "inner_performance....
github
capistrano/file-permissions
https://github.com/capistrano/file-permissions
capistrano-file-permissions.gemspec
Ruby
mit
47
master
701
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'capistrano-file-permissions' spec.version = '1.0.0' spec.authors = ['Peter Mitchell'] spec.email = ['peterjmit@gmail.com'...
github
capistrano/file-permissions
https://github.com/capistrano/file-permissions
lib/capistrano/tasks/file-permissions.rake
Ruby
mit
47
master
3,282
module Capistrano class FileNotFound < StandardError end end def absolute_writable_paths linked_dirs = fetch(:linked_dirs) fetch(:file_permissions_paths).map do |d| Array(linked_dirs).include?(d) ? shared_path.join(d) : release_path.join(d) end end def acl_entries(items, type = 'u', permissions = 'rwX')...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
ensure-encoding.gemspec
Ruby
mit
47
main
726
# frozen_string_literal: true require 'rake' Gem::Specification.new do |spec| spec.name = 'ensure-encoding' spec.version = '0.2' spec.author = 'Manfred Stienstra' spec.email = 'manfred@fngtps.com' spec.description = <<-DESCRIPTION Ensure the character encoding in Strings coming from untrusted sources....
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
Rakefile
Ruby
mit
47
main
891
# encoding: utf-8 unless ''.respond_to?(:encoding) puts "[!] Sorry, but this code was written for Ruby 1.9 compatible implementations." exit 1 end require 'rdoc/task' require 'rbconfig' desc 'Run specs by default' task :default => :spec desc 'Run all specs' task :spec do ruby = File.join(*RbConfig::CONFIG.val...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/start.rb
Ruby
mit
47
main
1,506
# encoding: utf-8 require 'rubygems' rescue LoadError require 'bacon' require 'mocha-on-bacon' # https://github.com/alloy/mocha-on-bacon require 'fileutils' $:.unshift(File.expand_path('../../lib', __FILE__)) require 'ensure/encoding' module EncodingTestHelpers EXAMPLES = { 'UTF-8' => 'पशुपतिरपि तान्यहा...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/api/string_spec.rb
Ruby
mit
47
main
1,168
# encoding: utf-8 require File.expand_path('../../start', __FILE__) describe "String, extended with Ensure::Encoding::String" do it "should respond to ensure_encoding" do ''.respond_to?(:ensure_encoding).should == true end it "should respond to ensure_encoding!" do ''.respond_to?(:ensure_encoding!).s...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/api/ensure_encoding_spec.rb
Ruby
mit
47
main
5,400
# encoding: utf-8 require File.expand_path('../../start', __FILE__) describe "Ensure::Encoding, concerning force_encoding with default options" do it "should change the encoding property of the string to the target encoding" do Ensure::Encoding.force_encoding('', 'UTF-8').encoding.should == Encoding::UTF_8 en...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/regression/garbled_encoding_spec.rb
Ruby
mit
47
main
840
# encoding: utf-8 require File.expand_path('../../start', __FILE__) describe "Ensure::Encoding, concerning cleanup of garbled input" do it "should be allowed to throw errors when not forced to drop invalid characters" do Dir.glob(File.expand_path('../../examples', __FILE__) + '/garbled*').each do |filename| ...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/regression/guess_encoding_spec.rb
Ruby
mit
47
main
922
# encoding: utf-8 require File.expand_path('../../start', __FILE__) describe "Ensure::Encoding, concerning guess_encoding" do it "should guess the first encoding from the list in which the data is valid" do [ ['UTF-8', ['ASCII-8BIT', 'UTF-8'], Encoding::ASCII_8BIT], ['UTF-8', ['US-ASCII'...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
spec/regression/sniff_encoding_spec.rb
Ruby
mit
47
main
444
# encoding: utf-8 require File.expand_path('../../start', __FILE__) describe "Ensure::Encoding, concerning sniff_encoding" do it "should try to sniff encodings in a sensible way" do [ ['UTF-8', Encoding::UTF_8], ['UTF-16LE', Encoding::UTF_16LE], ['UTF-16BE', Encoding::UTF_16BE] ].each do |...
github
Manfred/Ensure-encoding
https://github.com/Manfred/Ensure-encoding
lib/ensure/encoding.rb
Ruby
mit
47
main
5,055
# encoding: utf-8 module Ensure module Encoding BYTE_ORDER_MARKS = { ::Encoding::UTF_16BE => [0xfe, 0xff], ::Encoding::UTF_16LE => [0xff, 0xfe], ::Encoding::UTF_8 => [0xef, 0xbb, 0xbf] } # Tries to guess the encoding of the string and returns the most likely # encoding. ...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
Gemfile
Ruby
mit
47
master
786
source 'https://rubygems.org' gem 'rails', '4.1.1' gem 'pg' gem 'sidekiq' gem 'sinatra', '>= 1.3.0', :require => nil gem 'foreman' # Things we need for images gem 'fastimage' gem 'rmagick' # Site meta stuff gem 'public_suffix' gem 'metainspector' gem 'sanitize' # Search gem 'searchkick', '0.6.3' gem 'kaminari' gem ...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
lib/tasks/import.rake
Ruby
mit
47
master
3,824
require 'rubygems' require 'json' require 'net/http' require 'nokogiri' namespace :import do desc "Imports all the links from ProductHunt" task producthunt: :environment do body = open('http://www.producthunt.com/').read doc = Nokogiri::HTML.parse(body) links = doc.css('a.post-url') puts "Found #...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
test/test_helper.rb
Ruby
mit
47
master
450
ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration t...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
test/controllers/locations_controller_test.rb
Ruby
mit
47
master
1,199
require 'test_helper' class LocationsControllerTest < ActionController::TestCase setup do @location = locations(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:locations) end test "should get new" do get :new assert_response :success ...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
test/controllers/technologies_controller_test.rb
Ruby
mit
47
master
1,205
require 'test_helper' class TechnologiesControllerTest < ActionController::TestCase setup do @technology = technologies(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:technologies) end test "should get new" do get :new assert_respons...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
db/seeds.rb
Ruby
mit
47
master
1,783
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
db/schema.rb
Ruby
mit
47
master
1,462
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
db/migrate/20140617185434_create_locations.rb
Ruby
mit
47
master
365
class CreateLocations < ActiveRecord::Migration def change create_table :locations do |t| t.string :name t.string :url t.text :cached_results t.text :cached_source t.timestamps end create_table :locations_technologies, id: false do |t| t.integer :location_id ...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
app/models/location.rb
Ruby
mit
47
master
3,350
class Location < ActiveRecord::Base searchkick index_name: "sitelab_locations" has_and_belongs_to_many :technologies attr_accessor :skip_scan after_create :scan def should_index? return self.cached_source.present? end def search_data { name: name, technologies: self.technologies...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
app/models/technology.rb
Ruby
mit
47
master
1,082
class Technology < ActiveRecord::Base has_and_belongs_to_many :locations after_commit :queue_scan, on: :create def regex return /#{self.search_regex}/ end def queue_scan TechnologyScanWorker.perform_async(self.id) end def penetration_rate return ((self.locations_count.to_f / Location.coun...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
app/controllers/technologies_controller.rb
Ruby
mit
47
master
2,176
class TechnologiesController < ApplicationController before_action :set_technology, only: [:show, :edit, :update, :destroy, :scan] # GET /technologies # GET /technologies.json def index @technologies = Technology.order("name ASC") end # GET /technologies/1 # GET /technologies/1.json def show en...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
app/controllers/locations_controller.rb
Ruby
mit
47
master
3,263
class LocationsController < ApplicationController before_action :set_location, only: [:show, :edit, :update, :destroy, :scan] # GET /locations # GET /locations.json def index @locations = Location.order('updated_at DESC').page params[:page] @count = Location.count end def apps @links = Locatio...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
config/routes.rb
Ruby
mit
47
master
1,936
require 'sidekiq/web' Rails.application.routes.draw do resources :technologies do member do post 'scan' end end resources :locations do member do post 'scan' end collection do get 'search' get 'batch' post 'import' get 'apps' end end mount Sidek...
github
callmeed/site-lab
https://github.com/callmeed/site-lab
config/application.rb
Ruby
mit
47
master
1,041
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module SiteLab class Application < Rails::Application # Settings in config/environments/* take prece...
github
stelligent/stelligent_commons
https://github.com/stelligent/stelligent_commons
Rakefile
Ruby
mit
47
master
506
require 'rake' require 'rspec/core/rake_task' task :serverspec => 'serverspec:all' namespace :serverspec do targets = [] Dir.glob('./serverspec/*').each do |dir| next unless File.directory?(dir) targets << File.basename(dir) end task :all => targets targets.each do |target| desc "Run se...
github
stelligent/stelligent_commons
https://github.com/stelligent/stelligent_commons
Gemfile
Ruby
mit
47
master
229
source 'http://rubygems.org' gem 'aws-sdk' gem 'trollop' group :test do gem 'rspec' gem 'serverspec' gem 'serverspec-aws-resources', :github => 'stelligent/serverspec-aws-resources' gem 'rspec-collection_matchers' end