hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
b915991a504b2fccf2582293f1ea54ef98d377ec | 937 | require 'application_system_test_case'
class PostsTest < ApplicationSystemTestCase
setup do
@post = posts(:one)
end
test 'visiting the index' do
visit posts_url
assert_selector 'h1', text: 'Posts'
end
test 'creating a Post' do
visit posts_url
click_on 'New Post'
fill_in 'Content', ... | 20.369565 | 49 | 0.683031 |
e253c81b6f3be0d8790905d69e0d2361ae8a49bf | 393 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
namespace :api do
namespace :v1 do
resources :posts, only: %i[create show destroy update] do
member do
get :export_to_xlsx
end
end
res... | 26.2 | 101 | 0.669211 |
5d994a37ef5e3003c6f857c1afc5e688376bd1ad | 1,987 | require 'simplecov'
SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../dummy/config/environment', __FILE__)
require 'rspec/rails'
require 'database_cleaner'
require 'ffaker'
require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'
Dir["#{File.dirname(__FILE__)}/... | 30.106061 | 104 | 0.745848 |
91801d688e6ac76abfe99e2e50e18e9c7ad68f09 | 256 | class Coactors::CInteractor < IIInteractor::Base
context_in :stop, :fail
context_out :results, default: []
def call
stop! if @stop == 'C'
fail! if @fail == 'C'
@results << 'C'
end
def rollback
@results << 'rollback C'
end
end
| 17.066667 | 48 | 0.609375 |
383a764c40a86dfb5ce2c4449d59622e20012163 | 864 | require 'formula'
class RakudoStar < Formula
homepage 'http://rakudo.org/'
url 'http://rakudo.org/downloads/star/rakudo-star-2013.12.tar.gz'
sha256 '6a257e5f7879e0a9d7199edcfd47bd5a09dc4d9f5d91f124429af04974a836d3'
conflicts_with 'parrot'
depends_on 'gmp' => :optional
depends_on 'icu4c' => :optional
de... | 30.857143 | 92 | 0.696759 |
e8af7028e4dd08d72ab1eb77d1ad923238d40a97 | 1,831 | require 'bundler'
begin
Bundler.require(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts 'Run `bundle install` to install missing gems'
exit e.status_code
end
require 'pg'
require 'pg_ltree'
require 'minitest/autorun'
class BaseTest < ActiveSupport::TestCase
def ... | 23.177215 | 115 | 0.677226 |
e2295e9b05fc26884d4da050083816f95bd66f9b | 1,290 | class Models::ApiClient
def get_stacks_from_api
return [FIRST_STACK,
SECOND_STACK,
LAST_STACK,GOOD_STACK,
BUSY_STACK,BUSY_TO_GOOD_FOREVER_BUSY_STACK,
BUSY_TO_GOOD_FOREVER_GOOD_STACK,
BUSY_TO_GOOD_FOREVER_BUSY_STACK_SET_LOCAL_STATUS_TO_CANCELLING_BUSY,
... | 35.833333 | 123 | 0.760465 |
4af02828ae568e80207dacd5cdef0a8bc3ab93d4 | 646 | require 'active_support'
require 'active_record'
require 'active_record_nearest_neighbor/railtie' if defined?(Rails)
class ActiveRecord::Base
module NearestNeighbor
require 'active_record_nearest_neighbor/scopes'
require 'active_record_nearest_neighbor/close_to'
extend ActiveSupport::Concern
incl... | 17.459459 | 67 | 0.705882 |
ed3901efe02f481f77ce6923fb83b55accea0c97 | 681 | require 'spec_helper'
describe GistHistory do
it 'is available' do
gist_history = create(:gist_history)
gist_history.user.should_not be_nil
gist_history.gist.should_not be_nil
gist_history.gist_files.should_not be_nil
end
it 'returns headline' do
gist_history = create(:gist_file).gist_histo... | 21.28125 | 65 | 0.71072 |
91842ce022d28397a0faadcfad119be337859e16 | 2,785 | module ActiveSupport
module Cache
module Strategy
module LocalCache
# this allows caching of the fact that there is nothing in the remote cache
NULL = 'remote_cache_store:null'
def with_local_cache
Thread.current[thread_local_key] = MemoryStore.new
yield
... | 26.52381 | 99 | 0.51526 |
089cda72cbf74ea05ab3af664472850fb16d1ef3 | 109,485 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::GlueDataBrew
module Types
# Access to the specified resource w... | 30.82348 | 124 | 0.583404 |
26e7a0243f1c3f29c310a10d104ec1619a445773 | 4,474 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'formnestic'
s.version = '1.0.12'
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_ruby... | 38.904348 | 185 | 0.651542 |
ac56f91e44c366e42aab47a6931a5b01dde0842c | 315 | class CreatePolicyManagerTermsTranslations < ActiveRecord::Migration[5.0]
def change
create_table :policy_manager_terms_translations do |t|
t.integer :term_id, index: true
t.string :title
t.text :content
t.text :content_html
t.string :locale
t.timestamps
end
end
end
| 24.230769 | 73 | 0.695238 |
ed03dd09b02883694728558d552feb2cf9796aee | 132 | class AddDragons < ActiveRecord::Migration
def change
add_column :comments, :is_dragon, :boolean, :default => false
end
end
| 22 | 65 | 0.734848 |
e94f97c5a2a188936317d6cbe9c5921feaa514ff | 35 | module Mapi
VERSION = '1.5.2'
end
| 8.75 | 18 | 0.657143 |
d50cab382aed1d57adc796869f77d133959dbdb2 | 572 | CurationConcerns.configure do |config|
# Location on local file system where uploaded files will be staged
# prior to being ingested into the repository or having derivatives generated.
# If you use a multi-server architecture, this MUST be a shared volume.
config.working_path = Rails.env.production? ? '/tmp/wo... | 47.666667 | 102 | 0.77972 |
f732b11cfd4a9ea4e4d9d9e5b3019f8a00bfb57e | 69 | class PagesController < ApplicationController
def discover
end
end
| 13.8 | 45 | 0.84058 |
bb4e7dfb8ed4f7b87a005905d6067a81dd377abf | 278 | # frozen_string_literal: false
#
# version.rb - shell version definition file
# $Release Version: 0.7$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#
#
class Shell # :nodoc:
@RELEASE_VERSION = "0.7"
@LAST_UPDATE_DATE = "07/03/20"
end
| 16.352941 | 47 | 0.625899 |
b922ffb34a8e91b44a1625e9ea37a9ea8355dae5 | 48,938 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::ACM
module Types
# @note When making an API call, you may pass AddTagsToCertificateRequest
... | 36.010302 | 265 | 0.642364 |
ff3ccf9b25bdce015a87fe756360ab908145a9b7 | 2,115 | # encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-dashboard::neutron-fwaas-dashboard' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)
end
include_context 'non_re... | 33.571429 | 141 | 0.671868 |
38edf3f5fc8e1e1bdaa31591c7381ea1d7722f4f | 452 | class CreatePromotionalCodes < ActiveRecord::Migration
def change
create_table :promotional_codes do |t|
t.string :code, null: false
t.integer :limit, null: false, default: 0
t.integer :claimed, null: false, default: 0
t.float :discount, null: false, default: 0.0
... | 28.25 | 55 | 0.643805 |
3818d4c06daf302f579b8df5af8cf3c43e3f94c5 | 505 | class FederalState < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: :slugged
belongs_to :country, touch: true
has_many :events, -> {order('events.starts_on')}, as: :eventable, dependent: :destroy
has_many :days, through: :events
has_many :cities, -> { order('cities.name') }, dependent: :dest... | 22.954545 | 87 | 0.661386 |
261e0364bdfc8c0da18026e8b28588ab5ede390a | 105,360 | require './lib/omop_abstractor/setup/setup'
require './lib/tasks/omop_abstractor_clamp_dictionary_exporter'
namespace :biorepository_breast do
desc 'Load schemas CLAMP biorepository breast'
task(schemas_clamp_biorepository_breast: :environment) do |t, args|
date_object_type = Abstractor::AbstractorObjectType.wh... | 99.396226 | 389 | 0.844989 |
7a76d8edd955fe96cf7abe8e8a9a4b0c4e14d8f5 | 1,165 | 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 Stuckdo
class Application < Rails::Application
# Settings in config/environments/* take prece... | 41.607143 | 99 | 0.736481 |
acce6064e5548e6d10087264ed7b54e446c1f230 | 829 | # frozen_string_literal: true
require_relative '../../../step/dividend'
module Engine
module Game
module G1877StockholmTramways
module Step
class Dividend < Engine::Step::Dividend
def share_price_change(entity, revenue = 0)
if revenue.positive?
price = entity.sh... | 26.741935 | 59 | 0.52111 |
ac0d89588b1dc6c6b2b80f568b6ba87b77a231ab | 267 | Spree::OptionValue.class_eval do
default_scope { order("#{quoted_table_name}.position") }
scope :for_product, lambda { |product| select("DISTINCT #{table_name}.*").where("spree_option_values_variants.variant_id IN (?)", product.variant_ids).joins(:variants) }
end | 66.75 | 171 | 0.7603 |
33ddade7f3ec62edae5a6f961c7fb95148d7fb2f | 3,922 | require 'spec_helper'
describe MongoPercolator::Addressable::Diff do
before :all do
::MP = MongoPercolator unless Object.const_defined? :MP
class Queen
include MongoMapper::EmbeddedDocument
key :weight, String
end
class Hive
include MongoMapper::Document
one :queen
key... | 28.014286 | 81 | 0.63794 |
387667bd4a4fa12a00471a5a369b65f7136f6c21 | 888 | # frozen_string_literal: true
require 'gecko/record/base'
module Gecko
module Record
class PurchaseOrderLineItem < Base
belongs_to :purchase_order, writeable_on: :create
belongs_to :variant, writeable_on: :create
belongs_to :procurement
belongs_to :tax_type
attribute :quantity, ... | 28.645161 | 62 | 0.657658 |
bb68c17e8240b34f07ca205a9b1f2897f879972b | 16,738 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Local
Rank = ManualRanking
WIN32K_VERSIONS = [
'6.3.9600.17393',
'6.3.9600.17630',
'6.3.9600.17694',
'6.3.9600.17796',
... | 42.590331 | 178 | 0.567272 |
186326f6a0948256b62af2f507265fa5d689acf3 | 1,535 | require "simplecov"
SimpleCov.start "rails"
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RACK_ENV"] = ENV["RAILS_ENV"] ||= "test"
ENV["GOVUK_APP_DOMAIN"] ||= "dev.gov.uk"
require File.expand_path("../config/environment", __dir__)
require "rspec/rails"
# Requires supporting ruby fil... | 35.697674 | 79 | 0.731596 |
bfc926ff3277c6972990d88c5b9c83513fd51cf3 | 2,669 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Post do
context 'with slug' do
subject { build :post_with_slug }
its(:link) { should eq('/welcome-lokka') }
context 'when permalink is enabled' do
before do
Option.permalink_format = "/%year%/%month%/%day%/%slug... | 27.234694 | 129 | 0.607718 |
1a93358d5c9c724430b867797f000836c594a395 | 257 | class AddGradeSpanExpectationIdToInvestigations < ActiveRecord::Migration[5.1]
def self.up
add_column :investigations, :grade_span_expectation_id, :integer
end
def self.down
remove_column :investigations, :grade_span_expectation_id
end
end
| 25.7 | 78 | 0.801556 |
d5d980a9ac0589d1fc04ba626cd0e0457deb3be1 | 1,751 | require File.dirname(__FILE__) + '/spec_helper.rb'
include RR
describe TypeCastingCursor do
before(:each) do
Initializer.configuration = standard_config
end
it "initialize should cache the provided cursor and the retrieved Column objects" do
cursor = TypeCastingCursor.new Session.new.left, 'extender_ty... | 34.333333 | 104 | 0.696745 |
7ababfc390287eb2d883039adacfbf6990f67e0c | 1,097 | module Clubhouse
class Epic < BaseResource
resource :epics
attributes :archived, :created_at, :deadline, :description, :external_id,
:follower_ids, :name, :owner_ids, :state, :updated_at, readonly: [:id, :comments, :position]
attributes_for_create :created_at, :deadline, :description, :external_id... | 28.128205 | 98 | 0.666363 |
d548272414ad44380fe563bbcc802204e1a628d4 | 2,361 | module Extract
module Tree
module Math
def get_math_exp
if respond_to?(:math_exp)
math_exp
elsif respond_to?(:math_exp_full)
math_exp_full
elsif respond_to?(:num)
num
elsif respond_to?(:primary)
primary
else
nil
... | 22.273585 | 91 | 0.466328 |
bf01129c06284a2ad3879306422f28af4e0663d3 | 210 | module Ordering
class OrderSubmitted < Infra::Event
attribute :order_id, Infra::Types::UUID
attribute :order_number, Infra::Types::OrderNumber
attribute :customer_id, Infra::Types::UUID
end
end
| 26.25 | 54 | 0.742857 |
3379c347d2cbd83431aa511beb464ae83d81e74b | 248 | File.readlines('./data/contacts.csv').each do |line|
email, mobile = line.split ','
employee_name = email.split('@').first
filename = "./data/contacts/#{employee_name}.txt"
puts "#{filename} #{mobile}"
File.write(filename, mobile)
end
| 22.545455 | 52 | 0.669355 |
089e0104194f1f527d295d902c309feb5fd518a8 | 1,746 | class CreateSupervisorReports < ActiveRecord::Migration[5.1]
def change
create_table :supervisor_reports do |t|
t.integer :incident_id
t.integer :user_id
# t.text :witnesses TODO
t.boolean :hard_drive_pulled
t.datetime :hard_drive_pulled_at
t.string :hard_drive_removed
t.... | 32.943396 | 77 | 0.733104 |
b944451cbde36dc996c3de5d6f3abf8638654948 | 17,507 | require 'puppet/external/dot'
require 'puppet/relationship'
require 'set'
# A hopefully-faster graph class to replace the use of GRATR.
class Puppet::Graph::SimpleGraph
include Puppet::Util::PsychSupport
#
# All public methods of this class must maintain (assume ^ ensure) the following invariants, where "=~=" m... | 32.181985 | 136 | 0.639915 |
397dab4c7b31ecbd0a813ff659b4c92c49b9bc3e | 1,272 | # frozen_string_literal: true
require 'common/models/concerns/cache_aside'
module EVSS
module Dependents
##
# Model for caching a user's retrieved info.
#
# @!attribute user
# @return [User] User object.
#
class RetrievedInfo < Common::RedisStore
include Common::CacheAside
... | 24 | 87 | 0.625 |
f840380065d1f045b0b753ddaabab5e3cbc85c09 | 247 | require 'spec_helper'
RSpec.describe PJBank::Client do
describe "#recebimentos" do
it "returns an instance of PJBank::Recebimento::Controller" do
expect(subject.recebimentos).to be_a(PJBank::Recebimento::Controller)
end
end
end
| 24.7 | 75 | 0.744939 |
bb1ce8ed6c601d4defc9851b8de76da13c34ef7a | 3,053 | # frozen_string_literal: true
require 'facets/file/atomic_open'
require 'facets/file/atomic_write'
require 'xezat/variables'
module Xezat
class UnregeneratableConfigurationError < StandardError
end
class AutotoolsFileNotFoundError < StandardError
end
module Generator
class Pkgconfig
include Xeza... | 32.478723 | 121 | 0.655421 |
4af31cd48c2f3be18cc7bff807049753e4e32719 | 1,416 | class Feed < ActiveRecord::Base
attr_accessible :etag, :feed_url, :title, :url, :category_id
belongs_to :category
has_many :entries, dependent: :delete_all
validates_uniqueness_of :feed_url
def get_entries
feed = Feedzirra::Feed.fetch_and_parse(self.feed_url)
feed.entries.each do |e|
entry = E... | 27.764706 | 100 | 0.637006 |
e913cab070cf65b691df725af1eda9967902ebef | 973 | require 'sequel'
require 'uri'
def sequel_connect(host, port, user = :me)
login = Rake.context[:users][user.to_sym]
adapter = Rake.context[:adapter]
db = case adapter.to_sym
when :mysql2
Sequel.connect(adapter: adapter, host: host, port: port, user: login[:username], password: login[:pa... | 36.037037 | 197 | 0.649538 |
338eb144398e222139598276effaaf7e09d93ef7 | 43,748 | require "spec_helper"
require "fileutils"
RSpec.describe Asciidoctor::Iec do
before(:all) do
@blank_hdr = blank_hdr_gen
end
it "has a version number" do
expect(Metanorma::Iec::VERSION).not_to be nil
end
it "processes a blank document" do
input = <<~INPUT
#{ASCIIDOC_BLANK_HDR}
INPUT
... | 41.232799 | 120 | 0.539339 |
1ceb051ed3b2955a4421622dce6e69c12b95b09d | 47 | module Aact
class Condition < Aact
end
end
| 9.4 | 24 | 0.723404 |
e867f1ede2a481e2b78700423c2322d44fb1e777 | 7,616 | require 'helper'
require 'flipper/cloud'
require 'flipper/adapters/instrumented'
require 'flipper/instrumenters/memory'
RSpec.describe Flipper::Cloud do
before do
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
end
context "initialize with token" do
let(:token) { 'asdf' }
... | 37.517241 | 128 | 0.686581 |
87cd540131ea8b4d18474ead9574c5e6a08e7cf7 | 1,243 | # frozen_string_literal: true
RSpec.shared_context "changeset / seeds" do
before do
jane_id = conn[:users].insert name: "Jane"
joe_id = conn[:users].insert name: "Joe"
conn[:tasks].insert user_id: joe_id, title: "Joe Task"
task_id = conn[:tasks].insert user_id: jane_id, title: "Jane Task"
conn[... | 37.666667 | 102 | 0.695093 |
bffd5c73279f4d15f341ab8c2cd92ec08b7074cf | 150 | FactoryBot.define do
factory :user do
name { Faker::Name.name }
email { Faker::Internet.email }
nickname { Faker::Name.name }
end
end
| 18.75 | 35 | 0.653333 |
3904562f9ec2181d8631f184ccab36dca5e8e569 | 263 | class HiringController < ApplicationController
def overview
@resume_submitted = Candidate.resume_submitted(25)
@pending = Candidate.pending(10)
@archived = (Candidate.rejected(5) + Candidate.accepted(5)).sort_by{|c| c.updated_at }.reverse
end
end
| 32.875 | 98 | 0.749049 |
39f305afa9a61e487caa6fe79f1f8cd69117fe5d | 1,020 | class GstPython < Formula
desc "GStreamer Python overrides for gobject-introspection-based pygst bindings"
homepage "http://gstreamer.freedesktop.org/modules/gst-python.html"
url "http://gstreamer.freedesktop.org/src/gst-python/gst-python-1.4.0.tar.xz"
sha256 "b1e40c29ceb41b03f08d38aca6056054f0341d0706276326dce... | 35.172414 | 95 | 0.711765 |
bbce3ee032bd37189a1d342b43b11a236ce1bc1d | 429 | require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'
RSpec.configure do |config|
Capybara.javascript_driver = :poltergeist
Capybara.register_driver(:poltergeist) do |app|
Capybara::Poltergeist::Driver.new app, js_errors: true, timeout: 90
end
config.before(:each, :js) do
i... | 23.833333 | 71 | 0.745921 |
f89bdd9fda61795fae32fad9d066a34e66b41c5c | 9,315 | require 'thread'
require 'ddtrace/diagnostics/health'
require 'ddtrace/context_flush'
require 'ddtrace/context_provider'
module Datadog
# \Context is used to keep track of a hierarchy of spans for the current
# execution flow. During each logical execution, the same \Context is
# used to represent a single logi... | 30.441176 | 132 | 0.643693 |
1deff5497f84c2812e45776e3e09688a789348a4 | 632 | # frozen_string_literal: true
class SendWelcomeEmailService
include ServicePattern
def initialize(current_user:)
@current_user = current_user
end
def call
return unless FeatureService.enabled?(:send_emails)
return if current_user.welcome_email_sent_at
return unless lead_school_user?
Welc... | 19.151515 | 55 | 0.75 |
39a2e53b98fc6da74b9a6f5144ae859246256777 | 68,559 | # -*- coding: binary -*-
require 'json'
require 'rexml/document'
require 'rex/parser/nmap_xml'
require 'msf/core/db_export'
require 'msf/ui/console/command_dispatcher/db/analyze'
require 'metasploit/framework/data_service'
require 'metasploit/framework/data_service/remote/http/core'
module Msf
module Ui
module Consol... | 30.688899 | 159 | 0.595443 |
03d4711c2cfbc6f864e255a27df965470539c3db | 2,612 | require 'rails_helper'
require_relative '../version'
describe "Service finds a single recipe via service auth key" do
# URL: /api/recipe/:id
# Method: GET
# Get a specific recipe belonging to the current account
# curl -H "Content-Type: application/json, Accept: application/vnd.ink.v1, uid: account@example.c... | 29.022222 | 171 | 0.632848 |
d50d969467926075126cefaee387eaf6412cf042 | 1,210 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/iteration'
require_relative '../enumerable/shared/enumeratorized'
describe "Hash#keep_if" do
it "yields two arguments: key and value" do
all_args = []
{ 1 => 2, 3 => 4 }.keep_if { |*args| all_args << args }
... | 31.842105 | 88 | 0.638017 |
e2905580140b0e6934377e74cf28869b686e847a | 1,609 | # a manual class for importing a file list from an atom feed from Merritt.
# Useful so that we can use the ActiveRecord connection for whatever environment to populate it from the atom feed.
class ImportFileList
def initialize(atom_url: 'https://merritt.cdlib.org/object/recent.atom?collection=ark:/13030/m5q82t8x',
... | 32.836735 | 115 | 0.624612 |
6ac633e4a6a246eb937bf4099a808130d8ba36e2 | 1,577 | require "cli/parser"
module Homebrew
module_function
def find_not_bottled_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`find-not-bottled` [`--must-find=`<pattern>] [`--must-not-find=`<pattern>]
Output a list of formulae that do not have a bottle.
EOS
flag "--must-... | 25.031746 | 96 | 0.617628 |
6a229cc187a7db9aeccbe7a5a5e23208bf2d9390 | 30,698 | # Copyright 2014, Dell
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | 35.285057 | 405 | 0.638967 |
1dfcba8da4ac1d13665315d16d375084733635a4 | 897 | require "test_helper"
class AirportTest < ActiveSupport::TestCase
test "must have required elements" do
airport = Airport.new
assert_not airport.save, "Saved an airport without a lat, lon, city, or airport_name"
end
test "IATA code is proper format" do
airport = Airport.new
airport.iata = "ABCD"
... | 33.222222 | 89 | 0.701226 |
1db8547304ce577c312adf3e3c7d1cd28422aebb | 96 | # desc "Explaining what the task does"
# task :activeadmin-cancan do
# # Task goes here
# end
| 19.2 | 38 | 0.697917 |
870ec614b76e25f158bbcf7db5e34ba355ed4846 | 1,302 | # encoding: utf-8
#--
# Copyright 2013-2015 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 30.27907 | 108 | 0.695853 |
f84add02b42e2a1e8e05fa971bb2ffca017e9658 | 2,280 | # frozen_string_literal: true
RSpec.describe 'locking' do
include Dry::Effects.Lock
include Dry::Effects::Handler.Lock
it 'sets locks' do
locked = with_lock do
lock(:foo)
unlock(lock(:bar))
[locked?(:foo), locked?(:bar), locked?(:baz)]
end
expect(locked).to eql([true, false, fals... | 20.540541 | 94 | 0.584649 |
910e1a591c1b126c2b46fbfa658849f95237a912 | 6,486 | # frozen_string_literal: true
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | 36.033333 | 107 | 0.686093 |
7a4c5becb2710bd95db5aac8f12025d195368e97 | 1,403 | require "spec_helper"
RSpec.describe LearnToRank::DataPipeline::RelevancyJudgements do
subject(:judgements) do
described_class.new(queries: queries).relevancy_judgements.force
end
let(:queries) do
{
"micropig" => [
{ link: "1", rank: 1, views: 100, clicks: 20 },
{ link: "2", rank: ... | 31.177778 | 81 | 0.536707 |
08e79b51f31643ad390a43e8da6c45f8a4232b55 | 796 | class Libiptcdata < Formula
desc "Virtual package provided by libiptcdata0"
homepage "https://libiptcdata.sourceforge.io/"
url "https://downloads.sourceforge.net/project/libiptcdata/libiptcdata/1.0.4/libiptcdata-1.0.4.tar.gz"
sha256 "79f63b8ce71ee45cefd34efbb66e39a22101443f4060809b8fc29c5eebdcee0e"
revision 1... | 36.181818 | 104 | 0.762563 |
e2cf5ca016b810b860aaf5066aa4a15fd427def8 | 2,541 | cask 'wine-devel' do
version '4.2'
sha256 '67f0c34bdd2881d39798af37475e34555e64722ffe4417bcdb155d97c28cdb55'
url "https://dl.winehq.org/wine-builds/macosx/pool/winehq-devel-#{version}.pkg"
appcast 'https://dl.winehq.org/wine-builds/macosx/download.html'
name 'WineHQ-devel'
homepage 'https://wiki.winehq.org... | 45.375 | 104 | 0.639512 |
26b0d55f74ab8e3980583e972083e8542ad28ee8 | 1,083 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Storage
module Models
#
# Model object.
#
#
class StorageAccountRegenerateKeyParameters
include MsRestAzure
inclu... | 23.042553 | 76 | 0.56048 |
4a235bc7cfb129810daa0fb23f2026ba97b27a51 | 1,256 | module Webspicy
class Tester
class Fakesmtp
class Email
def initialize(data)
@data = data
end
attr_reader :data
def from
@from ||= data["headerLines"]
.select{|h| h["key"] == "from" }
.map{|h| h["line"][/From:\s*(.*)$/, 1] }
... | 23.698113 | 76 | 0.414809 |
79f87326dc342bd135fc93a30a692360422e8558 | 2,747 | require "twitter"
module Agents
class TwitterUserAgent < Agent
include TwitterConcern
cannot_receive_events!
description <<-MD
The TwitterUserAgent follows the timeline of a specified Twitter user.
Twitter credentials must be supplied as either [credentials](/user_credentials) called
... | 33.096386 | 142 | 0.622133 |
111ae6e3e28548a2924f05aaca785db8345cde0e | 84 | class Goal < ActiveRecord::Base #:nodoc:
self.inheritance_column = "sti_id"
end
| 14 | 40 | 0.72619 |
1dfa4db7372b4e12761d72f3758040019c183956 | 3,021 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 37.7625 | 87 | 0.621317 |
1de0c23c0d26b646d2bd2720fd3f5a06b3446183 | 409 | # frozen_string_literal: true
require 'test_helper'
class ModeratorTest < ActiveSupport::TestCase
def test_email_presence_validation
assert_validates_presence_of Moderator, :email
end
def test_email_uniqueness_validation
assert_validates_uniqueness_of Moderator, :email
end
def test_email_format_va... | 22.722222 | 69 | 0.819071 |
086faecc2b2b597c5716ef0470587bc2754c89f4 | 850 | # encoding: utf-8
require 'test_helper'
module Nls
module EndpointInterpret
class TestSpeed < NlsTestCommon
def setup
super
Nls.remove_all_packages
Interpretation.default_locale = "fr"
Nls.package_update(create_package())
end
def create_package()
... | 18.085106 | 131 | 0.594118 |
d594fffc14f694d34029b6084fa3addea2c0d324 | 2,123 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... | 33.698413 | 88 | 0.674517 |
62df2faee5ab46bde618df6e701f5f5a92255a5c | 843 | module RSpec
module Http
class ResponseCodeMatcher
def initialize(expected_code)
@expected_code = expected_code
end
def matches?(target)
@target = target
@target.status == @expected_code
end
def description
"Response code should be #{@expected_code}"... | 24.085714 | 89 | 0.595492 |
b90ff36abd622c7c711600f93fb59bb7a9ca153c | 101 | json.array!(@moves) do |move|
json.extract! move, :id
json.url move_url(move, format: :json)
end
| 20.2 | 40 | 0.683168 |
1cecc7df73713472d707c0041508f1a5eb84ec9d | 961 | # frozen_string_literal: true
require 'omniauth/fishbrain/jwks'
require 'jwt'
module OmniAuth
module Fishbrain
module VerifiesIdToken
def id_token
@_id_token ||= if raw_id_token&.strip&.empty?
{}
else
JWT.decode(raw_id_token,... | 22.880952 | 93 | 0.527575 |
6aa25a5b047dcb08dca9d3d2ce4dfecfc8c42c30 | 209 | class AddCustomerBillableField < ActiveRecord::Migration
def self.up
add_column :customers, :billable, :boolean, :default => true
end
def self.down
remove_column :customers, :billable
end
end
| 20.9 | 64 | 0.736842 |
e9bee0f991e78aa1355e44fd700ddb05b54dfb96 | 1,329 | class Tfsec < Formula
desc "Static analysis powered security scanner for your terraform code"
homepage "https://github.com/tfsec/tfsec"
url "https://github.com/tfsec/tfsec/archive/v0.37.1.tar.gz"
sha256 "b05a70b267f055619c5950ed8d6c49310b5851b352739ef651bc34c3468d1c2d"
license "MIT"
livecheck do
url :s... | 34.973684 | 122 | 0.771257 |
87ea34f3a474a7d0c99192ecc68ce826e6ee83d9 | 621 | module ConnectionDefinitions
def prepare_for_database_connection
ENV['ENVIRONMENT'] = 'test'
ENV['PROTOCOL'] = 'mongodb'
ENV['HOST'] = '127.0.0.1'
ENV['PORT'] = '27017'
@temp_db_dir = "#{Dir.pwd}/db"
FileUtils.mkdir(@temp_db_dir)
FileUtils.cp(
File.join(Dir.pwd, 's... | 24.84 | 65 | 0.608696 |
4a0b200ff27561b6dac2cd3107bff4a7fef13cde | 667 |
require 'opal'
require 'opal-parser'
# require 'opal-jquery'
DEFAULT_TRY_CODE = <<-RUBY
class User
attr_accessor :name
def initialize(name)
@name = name
end
def admin?
@name == 'Admin'
end
end
user = User.new('Bob')
puts user
puts user.admin?
RUBY
puts DEFAULT_TRY_CODE
class TryOpal
class Ed... | 15.159091 | 78 | 0.673163 |
014b00b65cdda01d8c0b180eac35a515551ed54b | 131 | class AddNameToVisualizations < ActiveRecord::Migration[5.1]
def change
add_column :visualizations, :name, :string
end
end
| 21.833333 | 60 | 0.763359 |
5d9ee9643a59a80d39001f551a35bdb1f54cfb6b | 626 | class CreateJobListingsAndJobApplications < ActiveRecord::Migration
def change
create_table :job_listings do |t|
t.string :title
t.string :description
t.integer :client_id
t.integer :min_hours_per_week
t.integer :max_hours_per_week
t.string :duration
t.string :visibility
... | 26.083333 | 67 | 0.691693 |
bb7085811a5ca7d084f3dad2138f538acfdf0b67 | 839 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::OneOfinlineResponse4035
# ... | 23.971429 | 85 | 0.75447 |
bbe8672ad37a3cdc006d969d8e16c303cb98d925 | 2,122 | require 'rubygems'
require 'rake'
# Note that Haml's gem-compilation process requires access to the filesystem.
# This means that it cannot be automatically run by e.g. GitHub's gem system.
# However, a build server automatically packages the master branch
# every time it's pushed to; this is made available as the ham... | 43.306122 | 121 | 0.679076 |
1a037e06679445ee213c0adfc77a3499b581d844 | 58 | require "kraken_ruby/version"
require "kraken_ruby/client" | 29 | 29 | 0.844828 |
abada2a17a19ae3c0521a70c3cbe8fe422bd7307 | 784 | # frozen_string_literal: true
require 'spec_helper'
describe RubyWarrior::Abilities::Walk do
before(:each) do
@space = stub(empty?: true, unit: nil)
@position = stub(relative_space: @space, move: nil)
@walk = RubyWarrior::Abilities::Walk.new(stub(position: @position, say: nil))
end
it 'should move ... | 28 | 81 | 0.688776 |
1a35bf7db2c83c65f1cd6a85b4faff03132704fa | 373 | class Incident::TypeIncident < ApplicationRecord
self.table_name = "type_incidents"
# Validações
validates :name, presence: true
# Associações
has_many :incidents
# Retorna um vetor contendo os nomes e seus respectivos IDs
#
# @return [Array] contendo nomes e seus IDs
def self.get_all
order('... | 21.941176 | 61 | 0.699732 |
7980ec25aec1e246a0910db16466826f5751ebde | 10,090 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
include Msf::Exploit:... | 37.232472 | 184 | 0.585629 |
e2ecdb09523fbfc978577c62598baa5316a8bc09 | 11,336 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 38.297297 | 87 | 0.609915 |
9176cc704e449fb4a558474327477fac5f9eebf6 | 181 | class AddDateToPieceReleases < ActiveRecord::Migration[4.2]
def change
add_column :piece_releases, :date, :date
add_column :piece_releases, :date_mask, :integer
end
end
| 25.857143 | 59 | 0.756906 |
5d958c552bcf0cf578ce3050b60d484ba1dd2436 | 1,498 | require "spec_helper"
require "generators/administrate/views/new_generator"
require "support/generator_spec_helpers"
describe Administrate::Generators::Views::NewGenerator, :generator do
describe "administrate:views:new" do
it "copies the new template into the `admin/application` namespace" do
expected_con... | 32.565217 | 78 | 0.728972 |
03529ad8ff855e6dcaf92f47c1ab7bb40e6f52ac | 1,600 | # spec/Dockerfile_spec.rb
require_relative "spec_helper"
describe "Dockerfile" do
before(:all) do
load_docker_image()
set :os, family: :debian
end
describe "Dockerfile#running" do
it "runs the right version of Debian" do
expect(os_version).to include("Debian")
expect(os_version).to incl... | 26.666667 | 62 | 0.629375 |
1cea153e0a97918555f9e6bcb7efdca2a7dbb54b | 1,099 | # == Schema Information
#
# Table name: favorite_friendships
#
# id :bigint(8) not null, primary key
# from_uid :bigint(8) not null
# friend_uid :bigint(8) not null
# sequence :integer not null
#
# Indexes
#
# index_favorite_friendships_on_friend_uid (friend_uid)
# index... | 27.475 | 95 | 0.685168 |
0379de6cf76e0c146937d5b720944f15235cace7 | 3,235 | class Tracker
URL = NSURL.URLWithString("https://api.bitcoinaverage.com/ticker/USD")
def self.dateFormatter
@dateFormatter ||= NSDateFormatter.new.tap { |df| df.dateFormat = 'HH:mm' }
end
def self.priceFormatter
@priceFormatter ||= begin
formatter = NSNumberFormatter.new
formatter.currency... | 24.884615 | 79 | 0.637713 |
7a89c5313d78eee872fb190033515f543e61e69e | 7,540 | namespace :gitlab do
namespace :db do
desc 'GitLab | DB | Manually insert schema migration version'
task :mark_migration_complete, [:version] => :environment do |_, args|
unless args[:version]
puts "Must specify a migration version as an argument".color(:red)
exit 1
end
vers... | 41.202186 | 115 | 0.687135 |
d5bc28732d565e50dc0fdef9dee2f2cf1684a3a1 | 2,553 | 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 on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 35.458333 | 86 | 0.75754 |
03912d2037483bf12d620771cda5e67924e963e7 | 192 | class AddPasswordTokenToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :password_reset_token, :string
add_column :users, :password_reset_date, :datetime
end
end
| 27.428571 | 59 | 0.770833 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.