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
1d47020598f7bf5d6470393f22c98625a4745629
812
def read_file(file_name) file = File.open(file_name, "r") data = file.read file.close return data end file_name = "input.txt" arr = read_file(file_name).split("\n") res = [] total = 0 arr.each do |line| points = line.split(" -> ") p1 = points[0].split(",").map(&:to_i) p2 = points[1].split(",").map(&:to_...
21.945946
39
0.466749
bf7c52640bb6685e80b4a928dcf16288446900be
1,514
# # Be sure to run `pod lib lint YMSymbolFont.podspec' to ensure this is a # valid spec and remove all comments before submitting the spec. # # Any lines starting with a # are optional, but encouraged # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name ...
33.644444
107
0.607001
398b63a39dd19b0c59f86c94d10c2825d71a5e71
1,914
require 'nats/client' require_relative '../spec_helper' module NATSHelper def nats_stub ::NATS.stub(:start) do |_, &blk| return if blk.nil? blk.call end ::NATS.stub(:stop) ::NATS.stub(:request).with('vcap.component.discover') do |_, &blk| return if blk.nil? blk.call(nats_clo...
21.75
70
0.565831
3839954bf0bb2f694276087219f3b2c5ea99efab
1,054
# frozen_string_literal: true module Epilog module ContextLogger def with_context(context) push_context(context) yield ensure pop_context end def push_context(context) formatter.push_context(context) end def pop_context formatter.pop_context end end mo...
17.864407
68
0.650854
03939067c5e6e567480ef80642dc2390cf8135bc
268
cask 'invalid-two-version' do version '1.2.3' version '2.0' sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" homepage 'https://example.com/local-caffeine' app 'Caffeine.app' end
24.363636
75
0.757463
ed30d9e27a4fa637ebc36d8a80f765b991c459ec
1,330
require 'spec_helper' describe 'selinux::port' do let(:title) { 'myapp' } include_context 'RedHat 7' %w(tcp udp tcp6 udp6).each do |protocol| context "valid protocol #{protocol}" do let(:params) do { context: 'http_port_t', port: 8080, protocol: protocol }...
26.078431
147
0.592481
e907f456b4b436f15707861a639afbd0ac9c5cf5
103
class Persistence::AverageSnapshotsGeneratorService < Cosmoslike::AverageSnapshotsGeneratorService end
34.333333
98
0.902913
212fb0e62460c5f5a66cf05247762bb28184f714
1,680
# Copyright © 2011-2020 MUSC Foundation for Research Development~ # All rights reserved.~ # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~ # 1. Redistributions of source code must retain the above copyright notice, this l...
62.222222
146
0.794643
626f1c71e849e595df06697889324521826f8877
3,252
HabitHub::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web ser...
40.148148
104
0.756765
9101e284e8858cea65910dab375b9cbcfda6b9bc
332
cask 'sr' do version '1.0.0' sha256 '0ceb12f56974b916d186ce3c475750b5e0f010f2733dde8d25bfb48f42b0ecce' url "https://github.com/merikan/nativefier-apps/releases/download/sr-v#{version}/sr-v#{version}-darwin-x64.tgz" name 'Massenger' homepage 'https://github.com/merikan/nativefier-apps' app 'sr-darwin-x64/s...
27.666667
113
0.759036
61300ff5da266dc60680b447f1e86ddb8bf5cd14
28,150
# 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 Azure::ApiManagement::Mgmt::V2017_03_01 # # ApiManagement Client # class ApiIssue include MsRestAzure # # Creates and initialize...
55.304519
233
0.693606
1d4264c98aa7189fa59767f3ea15a25c464fef41
1,763
require "webrat/integrations/rails" require "action_controller/record_identifier" module Webrat class RailsAdapter #:nodoc: include ActionController::RecordIdentifier attr_reader :integration_session def initialize(session) @integration_session = session end def get(url, data, headers = ...
23.824324
82
0.647192
39cca27ad2199cc7f339ee88ade9bbb3333c7eb8
386
class AuthorSessionsController < ApplicationController def new; end def create if login(params[:email], params[:password]) flash.notice = 'Successfully Logged in.' redirect_to(articles_path) else flash.now.alert = 'Login failed.' render action: :new end end def destroy ...
20.315789
54
0.670984
4a7cf91926dcc8a78ff54faca847d407578c1132
5,682
require "test_helper" require "remotable" require "support/bespoke" require "rr" class BespokeTest < ActiveSupport::TestCase include RR::Adapters::TestUnit teardown do def model.new_resource BespokeResource.new end def model.find_by(remote_attr, value) nil end end # ==========...
28.69697
104
0.57163
6214cfba71349b40070cd6909243a4b405b842a0
14,564
=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'date' module UltracartClient class Cart attr_accessor :affiliate ...
31.52381
313
0.625034
62dff1a79bf593913007189d1d0f9742a9eadbd5
3,143
# frozen_string_literal: true require "octicons" module Primer # `Octicon` renders an <%= link_to_octicons %> with <%= link_to_system_arguments_docs %>. # `Octicon` can also be rendered with the `primer_octicon` helper, which accepts the same arguments. class OcticonComponent < Primer::Component status :bet...
36.126437
162
0.655743
1de92f56b3333ff08916837c9df89ecb3150ddea
277
# frozen_string_literal: true FactoryBot.define do factory :x509_commit_signature, class: 'CommitSignatures::X509CommitSignature' do commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } project x509_certificate verification_status { :verified } end end
25.181818
83
0.768953
bf18332a8eb0c0f3f621ad08238106b4e89e7c40
994
# frozen_string_literal: true return if Rails.env.production? namespace :spec do desc 'GitLab | RSpec | Run unit tests' RSpec::Core::RakeTask.new(:unit, :rspec_opts) do |t, args| require_dependency 'quality/test_level' t.pattern = Quality::TestLevel.new.pattern(:unit) t.rspec_opts = args[:rspec_opts] ...
31.0625
67
0.705231
2108a8677aa5fc1caf27db2d632866e8abe399fb
11,282
require 'base64' require 'ws/dummy_ws' require 'time' module Ldash # The unix timestamp Discord IDs are based on DISCORD_EPOCH = 1_420_070_400_000 # Format time to Discord's format def self.format_time(time) time.iso8601 end # Generic data base class, so I don't have to write the same kind of initial...
24.262366
159
0.603262
399688c6f109fad0aea121033aebb260689046a7
420
cask 'waterfox' do version '53.0.3' sha256 'b3ba545beeb1383f90a9bad90704848cb71a517356e14ca1e77db565efd43f07' # storage-waterfox.netdna-ssl.com was verified as official when first introduced to the cask url "https://storage-waterfox.netdna-ssl.com/releases/osx64/installer/Waterfox%20#{version.before_comma}%20S...
35
119
0.785714
e83fe99754116fe1ce85bbc5fbcfb9d6ad2b9394
37,470
# frozen_string_literal: true require "generators/generators_test_helper" require "rails/generators/rails/app/app_generator" require "generators/shared_generator_tests" DEFAULT_APP_FILES = %w( .gitignore .ruby-version README.md Gemfile Rakefile config.ru app/assets/config/manifest.js app/assets/images...
32.190722
172
0.720763
7af0b2de6d00db5aea8f34e00a08c482d90c7f58
466
class Terraspace::CLI::New class Module < Sequence component_options.each { |args| class_option(*args) } argument :name def create_module puts "=> Creating test for new module: #{name}" plugin_template_source(@options[:lang], "module") # IE: plugin_template_source("hcl", "module") dest...
29.125
101
0.645923
18e6baaf8f1a19bb089b851388d147b5012a3013
644
# == Schema Information # # Table name: signatures # # id :integer not null, primary key # created_at :datetime # updated_at :datetime # name :text not null # source :string(255) # description :text # category :string(255) # line_type :string(255) # risk ...
23.851852
86
0.645963
4a571bc061b1c497a425e446fe87ac782981469c
1,060
module FactoryGirl module Syntax # Extends ActiveRecord::Base to provide a make class method, which is a # shortcut for FactoryGirl.create. # # Usage: # # require 'factory_girl/syntax/make' # # FactoryGirl.define do # factory :user do # name 'Billy Bob' # ...
23.043478
86
0.590566
1a3abca8f9e76c20e26ccffe4ae3134749fb7490
1,381
# encoding: UTF-8 require_dependency "cor1440_gen/concerns/controllers/proyectosfinancieros_controller" module Cor1440Gen class ProyectosfinancierosController < Heb412Gen::ModelosController include Cor1440Gen::Concerns::Controllers::ProyectosfinancierosController before_action :set_proyectofinanciero, ...
23.40678
85
0.611151
3380eae097a9e39a8e3bf4702f6958bc9bb5af85
1,114
# frozen_string_literal: true require "spec_helper" require_relative "./../../lib/bu_pr/configuration" describe BuPr::Configuration do let(:opts) { {} } let(:config) { described_class.new(opts) } describe "attr_accessors" do subject { config } it "responds to accessors" do is_expected.to resp...
19.892857
50
0.61939
ab9d1406941370d2310616c5eed62d0131c9e0b6
133
class ApplicationController < ActionController::Base def fallback_index_html render :file => 'public/index.html' end end
16.625
52
0.744361
abc63d661b33ae708f634a98ba8f8dd7bd18a634
544
# 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 bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # ...
36.266667
115
0.674632
87bf1b92720b4ada9426c11482b813cba3a01da0
1,256
# # Be sure to run `pod lib lint LYViewKit.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'LYViewKit...
33.052632
98
0.618631
b9f00baf9a7f914fbff72d84fbe5b266f7a846ad
4,191
require File.dirname(__FILE__) + '/spec_helper' include Babygitter::FolderAnalysisMethods describe Babygitter::FolderAnalysisMethods do before(:each) do Babygitter.marked_folders = [] Babygitter.use_whitelist = false end it "should create usuable regexs by level" do "folder_level_1/folder_level...
59.871429
132
0.619423
1143d10c4918a704ac15ab21436ba103bf154b47
2,072
class Bsdsfv < Formula desc "SFV utility tools" homepage "https://bsdsfv.sourceforge.io/" url "https://downloads.sourceforge.net/project/bsdsfv/bsdsfv/1.18/bsdsfv-1.18.tar.gz" sha256 "577245da123d1ea95266c1628e66a6cf87b8046e1a902ddd408671baecf88495" bottle do sha256 cellar: :any_skip_relocation, arm64_bi...
43.166667
139
0.772683
38fefe988365747e63238bd263bab10bd150f220
4,098
# encoding: utf-8 require 'spec_helper' describe 'hidden input' do include FormtasticSpecHelper before do @output_buffer = '' mock_everything @form = semantic_form_for(@new_post) do |builder| concat(builder.input(:secret, :as => :hidden)) concat(builder.input(:author_id, :as => :hidden, ...
39.028571
132
0.693265
389e10e807777f123a8787d6a0811097fc7da2b7
618
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: flow/entities/event.proto require 'google/protobuf' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("flow/entities/event.proto", :syntax => :proto3) do add_message "flow.entities.Event" do optional :type, :string, 1 ...
29.428571
98
0.723301
edd51ca3236290bf1530b5ff1c954462fb62f054
1,104
module Gamefic module World module Players include Gamefic::World::Entities include Gamefic::World::Commands # An array of entities that are currently connected to users. # # @return [Array<Gamefic::Actor>] def players @players ||= [] end def player_class ...
29.052632
113
0.639493
9184c565617d577940c1769983173fca43b1abaa
703
require "qup" describe Qup do let( :path ) { temp_dir( "qup" ) } let( :uri ) { "maildir://#{path}" } it "should have a version" do Qup::VERSION.should =~ ( %r[\A\d+\.\d+\.\d+\Z] ) end describe '#open' do it 'returns a new session' do s = Qup.open( uri ) s.closed?.should be_fal...
18.5
52
0.544808
ff5237893a4b4ae6f3f69f92ab1b90b5376bdc1e
3,871
require_relative '../../../spec_helper' require 'rexml/document' module Aws module Stubbing module Protocols describe EC2 do describe '#stub_data' do def normalize(xml) result = String.new # REXML only accepts mutable strings REXML::Document.new(xml).write(result,...
36.518868
94
0.366055
d552caa9b161f09f976cd26aeddf2f14c2253a9d
1,497
# frozen_string_literal: true module CarrierWave module Storage class AWSOptions MULTIPART_TRESHOLD = 15 * 1024 * 1024 attr_reader :uploader def initialize(uploader) @uploader = uploader end def read_options aws_read_options end def write_options(new_...
22.681818
71
0.617902
e945079eff5a6fe9b792583c7129bd8e0623bf1d
120
class AddCasaToRegistrant < ActiveRecord::Migration def change add_column :registrants, :casa, :boolean end end
20
51
0.766667
7a7f2671cb961da12450e62a16976ec64c98977e
1,107
Pod::Spec.new do |s| s.name = "MLSModel" s.version = "1.0.0" s.summary = "统一模型管理" s.description = <<-DESC 统一管理模型,提供便捷方法 DESC s.homepage = "http://www.minlison.cn" s.license = "MIT" s.author = { "Minlison" => "yuanhang.1991@163.com...
30.75
98
0.588979
11353a67413dfa910f7fbbf805d085f7b14636c0
702
class ApplicationHelper::Toolbar::MiqPoliciesCenter < ApplicationHelper::Toolbar::Basic button_group('miq_policy_vmdb', [ select( :miq_policy_vmdb_choice, nil, t = N_('Configuration'), t, :items => [ button( :miq_policy_new, 'pficon pficon-add-circle-o fa-...
28.08
87
0.507123
1cf0681a1c00a6f3449ce630aff5b5a89396db60
161
module Profilum module Landing class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' end end end
17.888889
48
0.689441
acc8a3f2daccd191d563fd18695a92553cf13358
10,260
require 'rhoconnect-adapters' require 'vendor/sugar/sugar' module RhoconnectAdapters module CRM module Sugar class Adapter < SourceAdapter attr_accessor :crm_object attr_accessor :fields def initialize(source) super(source) @fields = {} @crm_o...
33.096774
141
0.533041
385a077532e4126bd09bece5714e2b80427a9951
1,880
class CoursesController < ApplicationController authorize_resource def new @course = Course.new end def create @course = Course.new(course_params) if @course.save redirect_to @course else render 'new' end end def show if Course.exists?(params[:id]) @course = Cour...
24.736842
89
0.681383
266ebfcfb2020e462927bd4309630e0a1df0a6b1
1,761
require_domain_file describe ManageIQ::Automate::Cloud::VM::Provisioning::Naming::VmName do let(:provision) { MiqProvision.new } let(:root_object) { Spec::Support::MiqAeMockObject.new.tap { |ro| ro["miq_provision"] = provision } } let(:service) { Spec::Support::MiqAeMockService.new(root_object).tap { |s| s.objec...
34.529412
114
0.637706
e91b0bf429178203ddd6a164d463686cad493822
3,045
class Zurl < Formula desc "HTTP and WebSocket client worker with ZeroMQ interface" homepage "https://github.com/fanout/zurl" url "https://dl.bintray.com/fanout/source/zurl-1.4.7.tar.bz2" sha256 "ffe8bb1268c62241050e8d57472a0877e1374db31e6777c5498693685770a90e" bottle do cellar :any sha256 "87d3d44429...
29.563107
104
0.643021
1d34f63a46835e185f28ed92195d0afb3a604dd4
58
# this is a comments # this is another comment ; ;
4.833333
25
0.603448
0151ca161ff10c69655c233d59d20a7a6ca99486
299
module YidunContentModeration class SyncVideosResultJob < ApplicationJob def perform # TODO 暂时只处理只有一个Application的场景 application = Application.first application.video_callback_results! if application.tasks.pending.where("created_at >= ?", 1.days.ago).first end end end
27.181818
113
0.752508
eda11575c6ccf615c028dccba27eac8f1d95a983
260
require "lita" Lita.load_locales Dir[File.expand_path( File.join("..", "..", "locales", "*.yml"), __FILE__ )] require "lita/handlers/lookup_host" Lita::Handlers::LookupHost.template_root File.expand_path( File.join("..", "..", "templates"), __FILE__ )
20
58
0.676923
91fb67d1d49660ac5bd8429c0304060b98f59e63
192
# db/migrate/02_add_favorite_food_to_artists.rb class AddFavoriteFoodToArtists < ActiveRecord::Migration[4.2] def change add_column :artists, :favorite_food, :string end end
21.333333
61
0.755208
1dfb2c8200d3dd019028fb70fba2037f8a5462ad
1,685
require_relative "helper" module Ruby class TestAssignmentRuby < MiniTest::Test include RubyTests def test_local lst = compile( "foo = bar") assert_equal LocalAssignment , lst.class end def test_local_name lst = compile( "foo = bar") assert_equal :foo , lst.name end d...
23.732394
58
0.640356
5dc84e29ad6f4e39eb3340724d3f45e89d09cd0a
801
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration modul...
30.807692
77
0.739076
6aa29082c4226ec559d00b3e94c57f45f73b2a4a
406
require_relative "./test_helper" require "text/porter_stemming" class PorterStemmingTest < Test::Unit::TestCase def test_cases inputs = data_file('porter_stemming_input.txt').split(/\n/) outputs = data_file('porter_stemming_output.txt').split(/\n/) inputs.zip(outputs).each do |word, expected_output| ...
25.375
67
0.738916
1de931287d05a3e377faeb4343b3980db390f9b3
1,053
# frozen_string_literal: true $LOAD_PATH.push File.expand_path('lib', __dir__) require_relative 'lib/apex_charts/version' Gem::Specification.new do |spec| spec.name = 'apexcharts' spec.version = ApexCharts::VERSION spec.authors = ['Adrian Setyadi'] spec.email = ['a.styd@yahoo.com'] spe...
32.90625
68
0.716049
0854be9b8ce5fe2310f49d95acd21e093e221a6d
2,169
require 'rest-client' require 'nokogiri' require_relative '../sentry_helper' require_relative './base_clinic' module HeywoodHealthcare SIGN_UP_URL = 'https://gardnervaccinations.as.me/schedule.php'.freeze API_URL = 'https://gardnervaccinations.as.me/schedule.php?action=showCalendar&fulldate=1&owner=21588707&templ...
27.807692
128
0.640848
bbb520bb8650cd29aee45c0b8cf8538b21720e1d
1,073
class Encounter < Entry field :admitType, as: :admit_type, type: Hash field :dischargeDisposition, as: :discharge_disposition, type: Hash field :admitTime, as: :admit_time, type: Integer field :dischargeTime, as: :discharge_time, type: Integer field :principalDiagnosis, as: :principal_diagnosis, type: Hash ...
33.53125
89
0.745573
5dc3f960e38fd424d4a19e3708253245855f5a16
844
require "jwt" module AuthToken # More information on jwt available at # http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#rfc.section.4.1.6 def self.issue_token(payload, exp = 24.hours.from_now, secret = nil, aud = nil, header_fields = {}) payload["iat"] = DateTime.now.to_i # issued at cl...
31.259259
101
0.680095
08383dc48cce18efdcea6af672f1a34eab102e5a
875
class Mas < Formula desc "Mac App Store command-line interface" homepage "https://github.com/mas-cli/mas" url "https://github.com/mas-cli/mas/archive/v1.4.1.tar.gz" sha256 "4fd91c13b46d403b52dbee3891adb3cd6571e07ad20cf58de0100c9f695e6c24" head "https://github.com/mas-cli/mas.git" bottle do cellar :any_...
31.25
93
0.705143
913cce3096852546c7ef88693366fdf0dd6346f7
2,592
require 'spec_helper' describe "configuration" do let(:config) { Geolocal.configuration } it "has the right defaults" do # reset the configuration so we get the default configuration, # not the test configuration that the spec_helper has set up. Geolocal.reset_configuration defaults = Geolocal.co...
28.173913
93
0.667052
1df2dfe0c9e796336730a563ac51f3fcd274f739
993
# -*- encoding: utf-8 -*- # stub: naught 1.1.0 ruby lib Gem::Specification.new do |s| s.name = "naught" s.version = "1.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Avdi Grimm"] s.date = "2015-09-08" s...
30.090909
105
0.654582
e8181a5999021b12f8026acdbf2f858aec4698d4
1,480
# frozen_string_literal: true module Logux module Process class Batch attr_reader :stream, :batch def initialize(stream:, batch:) @stream = stream @batch = batch end def call last_chunk = batch.size - 1 preprocessed_batch.map.with_index do |chunk, index| ...
24.666667
69
0.537162
1dbebfe125b40cd58056332aa9bc1d173709bb76
857
# frozen_string_literal: true # require 'rails/generators/base' # require 'securerandom' module OidcProvider class InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) desc "Creates a OIDCProvider initializer." def copy_initializer_file copy_fi...
23.805556
84
0.635939
79643c70f3aef05b9e2a2805ab249ee5585e824f
13,174
# 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...
46.224561
134
0.596326
08986839ca2fc8805b99cc2b05fd08aa3555e7d9
1,786
module Raddocs # Configure Raddocs # @see Raddocs.configure Raddocs.configure # @example # Raddocs.configure do |config| # # config is this class # config.api_name = "My API" # end class Configuration # Configures a new setting, creates two methods # # @param name [Symbol] name o...
28.349206
66
0.632139
d51fca4568e3b7e065f349f230406a4848a6a06a
606
class TagsController < ApplicationController def show @tag = Tag.where(id: params[:id]).to_a[0] @blogposts = @tag.blogposts.paginate(:page => params[:page]) end def index @tags = Tag.order("name") end def search @tags = "" @results = [] end def find @tags = params[:tags] #TODO: use database opera...
25.25
74
0.669967
395eddf61ff062ebd857025f692058beea89fcab
949
require "serverspec" set :backend, :exec describe "Redis client installation" do describe package("redis-tools") do it { should be_installed } end end describe "Redis server installation" do describe package("redis-server") do it { should be_installed } end describe file("/var/lib/redis") do i...
22.595238
47
0.667018
ed3aa26505b1005ce863232fb15f827f3ad1462f
3,311
#!/usr/bin/env ruby # Encoding: utf-8 # # Copyright:: Copyright 2011, Google Inc. All Rights Reserved. # # License:: 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 # # ...
33.785714
79
0.691332
6afa3541b16db860ec3504103b33c8bbbaef39b3
11,734
# frozen_string_literal: true RSpec.shared_context 'mock swagger example' do before :all do module Entities class Something < OpenStruct class << self # Representable doesn't have documentation method, mock this def documentation { id: { type: Integer, ...
35.450151
227
0.453042
abeb302b8c4b03acd845885ff86a0aebfc4bc02f
119
class AddUsersToProjects < ActiveRecord::Migration def change add_column :projects, :user_id, :integer end end
19.833333
50
0.764706
1db5591cb3a0d551c6224d54b8d861317e9a1898
1,812
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...
38.553191
85
0.773731
1ca1fe15495dfe774f46944728ece602468a4034
748
require 'cloud_controller/structured_error' class HttpResponseError < StructuredError attr_reader :uri, :method, :status, :response def initialize(message, method, response) @method = method.to_s.upcase @response = response @status = response.code.to_i begin source = MultiJson.load(response...
23.375
101
0.679144
629c4a57a6a5ac1eb430121579d59c185740d899
1,899
class TwitterService class Error < Exception ; end extend Memoist def enabled? Danbooru.config.twitter_api_key.present? && Danbooru.config.twitter_api_secret.present? end def client raise Error, "Twitter API keys not set" if !enabled? rest_client = ::Twitter::REST::Client.new do |config| ...
26.013699
91
0.658768
281654cab9a4799a15d9ca5d87782407ed2634ce
149
class User < ActiveRecord::Base has_many :user_events has_secure_password validates :email, uniqueness: true validates :name, presence: true end
21.285714
35
0.798658
f836113f8e51e75a0399d3087ba3ad98708dcae7
357
cask "aerial" do version "2.3.2" sha256 "34fdbd5ec7ca087e3bea72c421947f38e43b0f62992caa532157c29b0f3e9ff1" url "https://github.com/JohnCoates/Aerial/releases/download/v#{version}/Aerial.saver.zip" name "Aerial Screensaver" homepage "https://github.com/JohnCoates/Aerial" screen_saver "Aerial.saver" zap ...
27.461538
91
0.770308
7a6c64a94da1ff14cd961dfdfa81de419d23fd12
29,767
# Comprehensively test a formula or pull request. # # Usage: brew test-bot [options...] <pull-request|formula> # # Options: # --keep-logs: Write and keep log files under ./brewbot/ # --cleanup: Clean the Homebrew directory. Very dangerous. Use with care. # --clean-cache: Remove all cached downloads. Use wit...
31.973147
122
0.598683
3831867cd53f8e362b336857bb23f1fa596dcc69
7,500
# coding: utf-8 Pod::Spec.new do |s| s.name = "WeexSDK" s.version = "0.28.0" s.summary = "WeexSDK Source." s.description = <<-DESC A framework for building Mobile cross-platform UI DESC s.homepage = "https://github.com/alibaba/weex" s.licens...
55.147059
178
0.549867
1127ddbef66f020186f2b8abcc143a41f8dd0857
6,071
=begin #OpenAPI Petstore #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.1.2-SNAPSHOT =en...
29.470874
201
0.617691
bf7c30d8a18e96747c33498c63470b2b827609be
2,161
require 'spec_helper' describe Spree::ReturnItem::EligibilityValidator::NoReimbursements do let(:validator) { Spree::ReturnItem::EligibilityValidator::NoReimbursements.new(return_item) } describe "#eligible_for_return?" do subject { validator.eligible_for_return? } context "inventory unit has already be...
25.127907
115
0.646923
e27a4a80e20988538c75279e3c382d01562d2f6a
659
module Edmunds class Style < API def find_by_id(style_id) @url = "/stylerepository/findbyid?id=#{style_id}&" call_style_api end def find_styles_by_make_model_year(make, model, year) @url = "/stylerepository/findstylesbymakemodelyear?make=#{make}&model=#{model}&year=#{year}&" call...
22.724138
99
0.6783
bf13834889ca778177ba0dd0d6008b3f47da21d8
1,149
# bandwidth # # This file was automatically generated by APIMATIC v2.0 # ( https://apimatic.io ). module Bandwidth # TwoFactorVoiceResponse Model. class TwoFactorVoiceResponse < BaseModel SKIP = Object.new private_constant :SKIP # TODO: Write general description for this method # @retu...
22.529412
65
0.614447
1a0f9feb2380464a9138e282559f601d49f8cdae
4,447
require 'spec_helper' require File.expand_path('../shared_examples', __FILE__) describe GlobalSession::Session::V4 do subject { GlobalSession::Session::V4 } include SpecHelper context 'given an EC key' do let(:key_generation_parameter) { 'prime256v1' } let(:signature_method) { :dsa_sign_asn1 } let(...
31.992806
105
0.621992
1da8a49699b0be040f9a5a8eb43d5c7f46272723
2,668
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'User activates Jira', :js do include_context 'project service activation' let(:url) { 'http://jira.example.com' } let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' } def fill_form(disable: false) click_active_toggle if di...
30.318182
105
0.674288
e88bed96b3b1807341fc3614dc19eeb93cac568a
4,311
require 'cxxstdlib' require 'ostruct' require 'options' require 'utils/json' # Inherit from OpenStruct to gain a generic initialization method that takes a # hash and creates an attribute for each key and value. `Tab.new` probably # should not be called directly, instead use one of the class methods like # `Tab.create...
22.689474
85
0.63396
8728fce7c44eb60230fba091ed1c6f18aa66040f
199
class AddEmployeeRepresentativeNotifiedAtToSupervisorReports < ActiveRecord::Migration[5.2] def change add_column :supervisor_reports, :employee_representative_notified_at, :datetime end end
33.166667
91
0.844221
acb1f75734bc2c1574d0efbd0620fa450ab287c9
642
cask "xbar" do version "2.1.7-beta" sha256 "0a7ea7c40e4d4e2ecce0dae3c9c3773d459ddf5af86744f70c44b9f9901bc73f" url "https://github.com/matryer/xbar/releases/download/v#{version}/xbar.v#{version}.dmg", verified: "github.com/matryer/xbar/" name "xbar" desc "View output from scripts in the menu bar" home...
23.777778
91
0.690031
08c6d8cef6405242e065e9433624571384a156e8
1,022
class Object def blank? respond_to?(:empty?) ? empty? : !self end def present? !blank? end def boolean? [true, false].include? self end end class String def to_bool return true if self == true || self =~ (/(true|t|yes|y|x|1)$/i) return false if self == false || self.blank? || self ...
20.857143
82
0.636986
edee0d1957b1d3badff324907bb68798353c4769
1,125
class Thing < ActiveRecord::Base include Geokit::Geocoders require 'libxml' validates_presence_of :lat, :lng belongs_to :user has_many :reminders def self.find_closest(lat, lng, limit=10) query = <<-SQL SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(RADIANS(lng) - RADIANS(?)) + ...
18.442623
149
0.691556
6ac414384907a7f29e09b21569f53b6d986f1233
806
require "bundler/setup" require "active_storage/engine" Bundler.require :default, :development require "support/blob_helper" Combustion.initialize! :active_record, :active_job do if ActiveRecord::VERSION::MAJOR < 6 && config.active_record.sqlite3.respond_to?(:represent_boolean_as_integer) config.active_record.sq...
29.851852
112
0.784119
01b3fd5aa0afd7f7d5d690f5f39e5aea31ee963e
51,140
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
63.135802
229
0.676339
ff8e12f281449b729117bd45bd52436ad605bffb
1,143
$:.push File.expand_path('../lib', __FILE__) require 'backport_yield_self/version' Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'backport_yield_self' s.summary = 'backport_yield_self is the backport of Kernel#yield_self in Ruby 2.5 to older Ruby versions.' s.version = BackportYield...
28.575
108
0.708661
62a933b2239e87b75d4db56c141acd7d2844f85f
479
class TravelLeisure::Scraper def self.get_page Nokogiri::HTML(open("https://www.travelandleisure.com/travel-guide")) end def self.scrape_destinations destinations = get_page.css("ul.grid li") destinations.collect do |destination| destination_hash = { city: destination.css("span.grid__i...
28.176471
73
0.686848
e8b21684b24a4311e54b460a04764186adc90f65
1,591
class Libsodium < Formula desc "NaCl networking and cryptography library" homepage "https://libsodium.org/" url "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz" sha256 "6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1" license "ISC" revision 1 livecheck do u...
29.462963
94
0.661848
913865c5f285842a875683feae0cbe004287db77
21
require 'esnek/base'
10.5
20
0.761905
879f86a3979508704ab42b14b576f56d51336ebe
236
# frozen_string_literal: true module Unused module Integration module CsvOutput class Child < Parent # override parent method def base_method; end def unused_method; end end end end end
15.733333
32
0.648305
1c2c4f836c1307c34d8bf86bc256a276f1879f3c
3,612
require 'thor' require "dokku_cli/version" require "dokku_cli/config" require "dokku_cli/domains" require "dokku_cli/nginx" require "dokku_cli/ps" require "dokku_cli/events" require "dokku_cli/certs" require "dokku_cli/keys" module DokkuCli class Cli < Thor class_option :remote desc "logs [-n num] [-p ps] ...
28.21875
117
0.587209
e847654f6ccd588a67d8748cbee32a9d2fb076f8
2,866
# encoding: UTF-8 # # 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 # dist...
32.942529
84
0.687369
1daad6d270319f4880af223b6d0eeda87cebfa5f
169
require 'html/sanitizer' module SanitizeHelper def strip_tags(html) (@full_sanitizer ||= HTML::FullSanitizer.new).sanitize(html) end end World(SanitizeHelper)
16.9
64
0.757396
ed47f96072c567359f2bc83add77774bc999a8e4
406
module Beacon module States # Wait 5 intervals. class Five def call blink wait next_state end private def blink Leds.blink! 5 end def wait Log.debug { "Waiting because I'll retry in 5 intervals" } Sleep.call Beacon.config.d...
14.5
65
0.534483
e28486239eebfc9e05fdd4e3e97e3ed6eb4bd91e
362
class CreateSamuraiContactsContacts < ActiveRecord::Migration[5.1] def change create_table :samurai_contacts_contacts do |t| t.string :first_name t.string :last_name t.string :company t.string :email t.string :phone t.references :user, foreign_key: {to_table: :samurai_users} ...
24.133333
66
0.674033
26ff3ef9f765f009caea050b877ec549d609e3e6
512
require 'reach/extensions/git' module Reach module Extension module Yarn def yarn_install(force = false) requires_setting :deploy_to if force || files_have_changes?(%w[package.json yarn.lock]) within fetch(:deploy_to) do execute :yarn, 'install', '--production' ...
17.066667
67
0.578125
015aca8161942bab4623cf7cbafe7c1a4d957d89
1,211
require './lib/second_curtain/path_utils.rb' describe PathUtils do before(:each) do end describe "composing a path" do it "yields a concatenation of these components without leading and trailing slashes" do expect(PathUtils.pathWithComponents(["component1", "component2"])).to eq("component1/component2...
36.69697
131
0.717589