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
e8b8b9099d89aedfebecd7f0f942f408074c0e62
1,144
require 'redcarpet' require 'coderay' module Highlighter class << self def registered(app) app.helpers Helpers end alias :included :registered end module Helpers def _highlight(string, language, class_name=nil) result = %Q{<div class="highlight #{language} #{class_name}">} resu...
25.422222
112
0.624126
d5b679a34ce6e1b4b32ea27553e2212671fe9edc
198
require 'togostanza' require_relative '../stanza' FindSentenceFromTermStanza.root = File.expand_path('../..', __FILE__) TogoStanza.sprockets.append_path File.expand_path('../../assets', __FILE__)
28.285714
75
0.762626
269ec469fa287ced1a2e1c789bf0153c7d538f56
1,454
class Libice < Formula desc "X.Org: Inter-Client Exchange Library" homepage "https://www.x.org/" url "https://www.x.org/archive/individual/lib/libICE-1.0.10.tar.bz2" sha256 "6f86dce12cf4bcaf5c37dddd8b1b64ed2ddf1ef7b218f22b9942595fb747c348" license "MIT" bottle do cellar :any sha256 "4c5c97814304360...
27.433962
94
0.688446
1a869063189cf84c1d6830c183aa079c4ee6e93e
1,532
#!/usr/bin/env ruby # coding: utf-8 # Proxy for this gdbstub + EverDrive-64 # usage: ruby $0 /dev/ttyUSB0 [port] require 'io/console' require 'socket' def read_whole_timeout io, size, timeout buf = ''.b while buf.size < size rs, _, _ = IO.select([io], nil, nil, timeout) rs.nil? or rs.size == 0 and return buf ...
22.202899
75
0.578982
7a10398d67a6dfff822e1949be9621459ee7cd18
1,196
# # Copyright:: Copyright (c) 2012-2014 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://www.apache.org/licenses/LICE...
27.181818
74
0.728261
edbc049092cc05a8982bbde8294cbdce0a0a0803
269
class CreateMaterialSheets < ActiveRecord::Migration def change create_table :material_sheets do |t| t.string :material_id t.integer :cantidad t.references :sheet, index: true, foreign_key: true t.timestamps null: false end end end
22.416667
57
0.698885
3861549459c286a4126c9022abbd5a8a4d2e363e
468
# Copyright (c) 2016 Jasper Lievisse Adriaanse <j@jasper.la> # See LICENSE for details require 'dockertags/version' require 'dockertags/log' require 'dockertags/db' require 'dockertags/utils' require 'dockertags/cli' require 'dockertags/commands' module DockerTags unless defined? @@database_path @@database_path...
19.5
60
0.745726
79264e0933d3c92d30837d66b73abf50ee4f42b8
2,681
# frozen_string_literal: true require 'uri' # A parser and emitter for Problem Details for HTTP APIs. # @see https://tools.ietf.org/html/rfc7807 module ProblemDetail # This document defines a "problem detail" as a way to carry machine-readable # details of errors in a HTTP response, to avoid the need to define ne...
33.098765
80
0.651623
bb42fdd21101c68ed65661361bbe95bc06443e27
3,959
require 'spec_helper' describe Admin::NomenclatureChanges::StatusSwapController do login_admin include_context 'status_change_definitions' describe 'GET show' do context 'primary_output' do before(:each) do @status_change = create(:nomenclature_change_status_swap) end it 'renders t...
33.550847
95
0.65951
385a9d227eaaa009a7d5775b802818d2467ad25e
23,867
require 'test_helper' class VersionTest < ActiveSupport::TestCase should belong_to :rubygem should have_many :dependencies context "#as_json" do setup do @version = create(:version) end should "only have relevant API fields" do json = @version.as_json assert_equal %w[number built_...
39.449587
355
0.653496
e80936d31844d6e358e06c51c8cb3391d29fb58d
3,881
class StudentTaskController < ApplicationController include AuthorizationHelper helper :submitted_content def action_allowed? current_user_has_student_privileges? end def impersonating_as_admin? original_user = session[:original_user] admin_role_ids = Role.where(name:%w[Administrator Super-Admi...
38.04902
226
0.737954
d5710c0cb6a6be5da31c71a18d41271f30faac46
225
require "test/unit" require_relative "./part1" class Part1Test < Test::Unit::TestCase def test_solve input = File.read(File.expand_path("../input.txt", __FILE__)) assert_equal 807, Part1.new.solve(input) end end
22.5
65
0.72
e9b11a66a271bcbfbec1a3c9e7645f6df18c7e53
200
Dir[File.expand_path("../../../app/jobs/**/*.rb", __FILE__)].each do |file| require file end class LocalQueue < Struct.new(:config) def to_s "cc-#{config[:name]}-#{config[:index]}" end end
20
75
0.625
2651ab0e9d8011f734d6e7563cc18c59b254f636
401
require 'cli/murakumo_options' require 'srv/murakumo_server' # オプションをパース options = murakumo_parse_args # サーバの初期化 Murakumo::Server.init(options) if options[:daemon] # デーモン化する場合 # RExecに処理を委譲するのでARGVの先頭にdaemonizeのコマンドを格納 ARGV.unshift options[:daemon].to_s Murakumo::Server.working_directory = options[:working_...
19.095238
60
0.78803
e8f049c9ec9f43426cf05cd5243498e05218286c
16,324
# # 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 # distributed under t...
35.486957
227
0.582639
b9fd435d93900bad34970dda98e11329e1f99761
1,126
Rails.application.routes.draw do get 'signup', to: 'users#new' get 'login', to: 'sessions#new' post 'login', to: 'sessions#create' post 'logout', to: 'sessions#logout' get 'welcome', to: 'sessions#welcome' root 'sessions#welcome' get 'username_or_email_exists', to: 'users#name_or_email_exists?' get 'mod...
40.214286
81
0.709591
aba05a31f4a2c688ed1002af83779eefec25e78d
354
# frozen_string_literal: true require 'spec_helper' describe Poker::OnePair do [ [0, 1, 2, 9, 9], [0, 10, 10, 11, 12], [11, 12, 10, 11, 0], [1, 1, 2, 3, 2], [3, 4, 5, 3, 3] ].each do |cards| it "detects pair for #{cards}" do hand = described_class.new(cards) expect(hand.check)....
18.631579
40
0.550847
797fdd908dfcfddfbf49919ab383000b158ef63b
1,744
require 'cancan' require 'state_machine' module Pageflow class ApplicationController < ActionController::Base layout 'pageflow/application' before_filter do I18n.locale = current_user.try(:locale) || I18n.default_locale end # Prevent CSRF attacks by raising an exception. # For APIs, you m...
27.25
104
0.676032
e8f7d22bf778a5e26e2c0a6c79f9302f2d195245
2,868
# frozen_string_literal: true class ApplicationExperiment < Gitlab::Experiment def publish(_result) track(:assignment) # track that we've assigned a variant for this context Gon.global.push({ experiment: { name => signature } }, true) # push to client end def track(action, **event_args) return if ex...
34.142857
87
0.683403
4a48e2a9ea017d8b6bfd476e361768c65998729a
3,289
# frozen_string_literal: true shared_examples "a controls config" do let(:param) { :button_text } let(:name) { nil } describe "#param" do it "can be set" do subject.param(:name) expect(subject.param).to eq(:name) end it "set returns the control" do expect(subject.param(:name)).to...
23.833333
108
0.638492
f8bf51155971200d301a28e2d650a61aa64b94cd
15,447
# frozen_string_literal: true require_relative "../helpers/debug" # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/ModuleLength # rubocop:disable Metrics/ParameterLists # rubocop:disable Metrics/PerceivedComplexity modul...
47.529231
118
0.66822
874596812b524847a801db76e1a4599bcb6649e1
2,395
class Stolon < Formula desc "Cloud native PostgreSQL manager for high availability" homepage "https://github.com/sorintlab/stolon" url "https://github.com/sorintlab/stolon.git", tag: "v0.16.0", revision: "920fe4b83c158a6fe496dd6427a3715b84c0b4e2" license "Apache-2.0" bottle do cellar :an...
43.545455
100
0.664718
7a8d611aff56c10318f3fa52c71f77ee864266fa
1,080
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'omniauth-healthvault/version' Gem::Specification.new do |gem| gem.name = "omniauth-healthvault" gem.version = Omniauth::Healthvault::VERSION gem.authors = ["A...
45
111
0.675
1d6b3a777431872629077ec3d79c9590204ff066
6,791
require 'i18n' module Lit class I18nBackend include I18n::Backend::Simple::Implementation include I18n::Backend::Pluralization attr_reader :cache def initialize(cache) @cache = cache @available_locales_cache = nil @translations = {} reserved_keys = I18n.const_get(:RESERVED_K...
35.005155
116
0.629657
62a9f594d5abd2f049fc94b6ca1bee0f271397b4
1,181
class Bard::CLI < Thor class Data < Struct.new(:bard, :from, :to) def call if to == "local" data_pull_db from.to_sym data_pull_assets from.to_sym end if from == "local" data_push_db to.to_sym data_push_assets to.to_sym end end private def data_...
23.62
87
0.595258
264832f83593ff19bcffbb26f53f91ed15aec136
58
# frozen_string_literal: true WillPaginate.per_page = 15
14.5
29
0.810345
39769f7e0e7185f8baf3d23dcd2d4d71e62e6312
3,008
############################### # to run use: # $ ruby girls.rb $LOAD_PATH.unshift( "../cryptopunks/lib" ) require 'cryptopunks' FEMALE3 = Punks::Sheet.find_by( name: 'Female 3', size: 's' ) COWBOY_HAT = Punks::Sheet.find_by( name: 'Cowboy Hat', gender: 'f', size: 's' ) HEADBAND = Punks::Sheet.find_by( na...
21.485714
79
0.622008
012f460953761846493bc2cc882c9f2711027e1e
6,080
class SampleTypesController < ApplicationController respond_to :html, :json include Seek::UploadHandling::DataUpload include Seek::IndexPager before_filter :samples_enabled? before_filter :find_sample_type, only: [:show, :edit, :update, :destroy, :template_details] before_filter :check_no_created_samples, ...
34.157303
132
0.680263
b9c537b30cb642215e7980d6521aacbd0e4be40a
1,934
# frozen_string_literal: true RSpec.describe Miteru::Feeds do subject { described_class } describe "#breakdown" do context "when given an url without path" do it "returns an Array (length == 1)" do results = subject.new.breakdown("http://test.com") expect(results).to be_an(Array) ...
34.535714
105
0.650465
e951f7b4410fa8e0c30b2f110b2f5d2039e182b6
765
class UsersController < ApplicationController before_action :require_logged_in_user, only: [:edit, :update] def new @user = User.new end def create @user = User.new(user_params) if @user.save flash[:success] = 'Usuario cadastrado com sucesso' redirect_t...
20.131579
90
0.571242
edd3fe13e954e106209755279312d8bdd02e0e39
417
# frozen_string_literal: true source 'https://rubygems.org' gemspec group :ci do gem 'simplecov', '~> 0.16.0', require: false end group :development do gem 'bump', '~> 0.6.0', require: false gem 'bundler', '~> 1.8', require: false end group :ci, :development do gem 'rake', '~> 12.0', require: fal...
19.857143
46
0.609113
08dff2ec3086dc8ff8d37d78868e07bf907821ca
3,571
TaxonWorks::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 s...
38.815217
104
0.755531
183073bc13f2d0fd868aebcfb1eb9a7db61b92a7
576
require_relative './helper.rb' describe 'adapter_cassandra_with_default_expires', isolate: true, retry: 3, adapter: :Cassandra do let(:t_res) { 1 } let(:min_ttl) { 2 } include_context :global_cassandra_cluster moneta_build do Moneta::Adapters::Cassandra.new( cluster: cluster, keyspace: 'adapt...
30.315789
134
0.763889
79454a75eca51174ddfc9c3af0bf2930d77949ec
691
# frozen_string_literal: true class DigitalProject < ApplicationRecord include Csv serialize :author_first_name, Array serialize :author_last_name, Array has_and_belongs_to_many :colleges validates :author_first_name, presence: true validates :author_last_name, presence: true validates :work_title, prese...
30.043478
165
0.756874
e8b2ffe1f14d824f76e035a5b709fa4d8f69e271
3,554
# frozen_string_literal: true module QA RSpec.describe 'Create' do describe 'Version control for project snippets' do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } let(:added_content) { 'updated ' } let(:bran...
32.907407
169
0.650816
e213bb7e12b9965cd0fd4fbb00ba6dede44d5309
1,291
# 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/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE Gem::Specification.new do |spec| spec.name = 'aws-sdk-ec2instancec...
40.34375
141
0.676995
03b7140266036e3ea8a30d03f42f8c99989f0ae6
2,951
module Fog module Storage class AWS class Real require 'fog/aws/requests/storage/acl_utils' # Change access control list for an S3 object # # @param [String] bucket_name name of bucket to modify # @param [String] object_name name of object to get access control list...
36.432099
123
0.540834
ed6ba221ae92bdbac5bfa4978d0aaaacf25c73e9
562
require 'waiting/constant_wait_strategy' require 'waiting/exponential_backoff_wait_strategy' require 'waiting/incremental_wait_strategy' require 'waiting/random_wait_strategy' module Waiting module Strategies def build(type) strategy = case type when :constant ConstantWaitStrategy when ...
21.615385
51
0.717082
1c32e862120deea6e08efaa47025b57ee3f47d7a
944
Pod::Spec.new do |spec| spec.name = 'TradPlusMaioAdapter' spec.version = '7.6.0' spec.summary = 'TradPlus Maio Adapter' spec.description = <<-DESC Maio Adapter used for mediation with the TradPlusAd SDK DESC spec.homepage = 'https://github.com/tradplus/pod_tradplus_sdk_adapters' spec.license = { :type ...
49.684211
159
0.722458
1cbf69a7b9635ab57ae6d9c92f7e49fe9d3ad469
265
class Profile < SimpleDB::Base set_domain Panda::Config[:sdb_profiles_domain] properties :title, :player, :container, :width, :height, :video_codec, :video_bitrate, :fps, :audio_codec, :audio_bitrate, :audio_sample_rate, :position, :updated_at, :created_at end
53
180
0.769811
ffaa7c0229294b4743bc7f03a1240e83630afd1b
2,415
# -*- encoding: utf-8 -*- # stub: json 2.1.0 ruby lib # stub: ext/json/ext/generator/extconf.rbext/json/ext/parser/extconf.rbext/json/extconf.rb Gem::Specification.new do |s| s.name = "json".freeze s.version = "2.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required...
58.902439
749
0.689855
616f2ff50b7edf2db11a7bfd71a69f603241330f
5,624
require 'fog/hp' module Fog module HP class BlockStorage < Fog::Service requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone recognizes :hp_auth_uri recognizes :persistent, :connection_options recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent recognizes :hp_...
32.888889
146
0.580725
7ad118ef38882deac88d77e8658a0ffe41621a87
1,947
class API::V3::CatalogPolicy < CatalogPolicy include CatalogAdmin::CatalogsHelper def initialize(user, catalog) super raise Pundit::NotAuthorizedError unless catalog.not_deactivated? end def user_requirements_according_to_visibility? return true if user.system_admin? case catalog_access(catal...
34.157895
84
0.802773
084fa1666cd37bd297da17ceba27a0cf41860c8f
436
#!ruby require "benchmark" expr = %(10000000.times { :a.to_s }) Benchmark.bm(ARGV.max_by { |mruby| mruby.size }&.size || 0) do |bm| meas = 5.times.map { ARGV.map { |mruby| bm.report(mruby) { system *%W(#{mruby} -e #{expr}) } } } meas = meas.transpose meas.each do |mm| mm.sor...
16.769231
67
0.541284
38b29871b5c7623a786873d2d5963a2f4154d9e0
432
#!/usr/bin/env ruby class Gender def self.for_options options role = options[:role] all.select{ |gender| role.genders.include?(gender.hotkey) } end def self.all DataLoader.load_file('genders').map do |data| new(data) end end attr_reader :name, :hotkey def initialize data data.e...
15.428571
63
0.643519
acc4b0a9ab736821d902892435d1764370d9d777
5,100
# == Schema Information # # Table name: legacy_os_records # # id :bigint not null, primary key # owner_username :string(255) not null # owner_full_name :string(255) not null # phone :string(255) # additional_dept_co...
48.571429
138
0.602745
b9f0caa681c1499427b7ef554f573e361002b907
130
class AddContractIdColumnToCards < ActiveRecord::Migration[5.2] def change add_column :cards, :contract_id, :integer end end
18.571429
63
0.784615
e2b22c2dc5ef30ea82c1623467f9e99295b30c67
3,871
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/foundation # frozen_string_literal: true require 'pagy/extras/shared' class Pagy module Frontend # Pagination for Foundation: it returns the html with the series of links to the pages def pagy_foundation_nav(pagy) link = pagy_link_pr...
47.790123
202
0.602687
01d28c43b5c69379962cef9a39f3f7aa72b213be
906
require_relative "lib/relaxo/version" Gem::Specification.new do |spec| spec.name = "relaxo" spec.version = Relaxo::VERSION spec.summary = "Relaxo is versioned document database built on top of git." spec.authors = ["Samuel Williams"] spec.license = "MIT" spec.homepage = "https://github.com/ioquatix/relaxo" ...
27.454545
76
0.747241
4a1ae326b8f055803d414e904d17dea3f92428c3
2,966
require "test_helper" class PrettyrbTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Prettyrb::VERSION end def test_breaks_up_long_conditionals source = <<~RUBY if "hello" != "foo bar baz" && "foo" != "hello world" && "wow" != "okay this might be long" && "wow this is really ...
21.338129
166
0.626433
e21312eaf59a9b59a45cbc0d0e255a562fa5fa4e
2,006
module Nanoc::Helpers # @see http://nanoc.ws/doc/reference/helpers/#rendering module Rendering include Nanoc::Helpers::Capturing # @param [String] identifier # @param [Hash] other_assigns # # @raise [Nanoc::Int::Errors::UnknownLayout] # @raise [Nanoc::Int::Errors::CannotDetermineFilter] ...
29.940299
110
0.648056
3993d9aec3d2a234c3bf46728456c4228581626a
930
module Users class ConfirmationsController < Devise::ConfirmationsController def show super do |user| if user.is_role_vendor? vendor_invite = VendorInvite.for_user(user) vendor_invite.set_status_to_invite_accepted! end end end protected def after_c...
26.571429
65
0.662366
6aefde73d5d11fcaab2c6cf798d8c128cd3eca46
3,969
# encoding: UTF-8 # This file contains data derived from the IANA Time Zone Database # (http://www.iana.org/time-zones). module TZInfo module Data module Definitions module Asia module Krasnoyarsk include TimezoneDefinition timezone 'Asia/Krasnoyarsk' do |tz| ...
43.141304
72
0.563366
bb8e5f61e8ed3b04466e8528200fc2772fe0451b
403
class CreateTopics < ActiveRecord::Migration def self.up create_table :topics do |t| t.string :slug, :null => false t.string :name, :null => false t.text :description, :null => false t.timestamps end add_index :topics, :slug, :unique => true add_index :topi...
21.210526
45
0.598015
f829d918018728ad6aacf1967aadd839c2ab93da
1,958
## # This module requires Metasploit: http//metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Auxiliary # Exploit mixins should be called first include Msf::Exploit::Remote::SMB include Msf::Auxiliary::Report # Aliases f...
27.971429
101
0.627171
f81a2fa45f3f1977c8eb83c86caee5ca0205cebe
266
module MedlineplusRuby module API module ResponseMessage ERROR_NO_RESPONSE = 'No response from National Library of Medicine API.'.freeze ERROR_NO_PARSE = 'Unable to parse response from National Library of Medicine API.'.freeze end end end
29.555556
98
0.744361
edf291ecd13cf426be2adbf5fb5271e8e76ecbfc
395
# Copyright (c) 2021-present, Facebook, Inc. name 'fb_yum_repos' maintainer 'Facebook' maintainer_email 'noreply@facebook.com' license 'Apache-2.0' description 'Installs/Configures yum repos' source_url 'https://github.com/facebook/chef-cookbooks/' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')...
30.384615
72
0.782278
e26159b2b72d2c0f719335374d97c5d90c8efcc8
35,253
# frozen_string_literal: true require "formula" require "formula_versions" require "utils/curl" require "utils/notability" require "extend/ENV" require "formula_cellar_checks" require "cmd/search" require "style" require "date" require "missing_formula" require "digest" require "cli/parser" require "json" module Home...
34.292802
118
0.61938
ac8fd29817f47638a19523e203a9b628195c7177
504
class Boris < Coder def initialize @name = '丁博约' @salary = 100000 end def work(remain_difficulty) if rand(10) > 4 forward = rand(100...500) puts "#{name} 灵感大发,成功将项目推进#{forward}" remain_difficulty - forward else bugs = rand(1...5) fallback = bugs * rand(0...50) puts "#{...
20.16
47
0.630952
ed11699e494a315b9e53b7df396a379a383910c3
3,314
# frozen_string_literal: true require 'spec_helper' RSpec.describe Gitlab::Database::LooseForeignKeys do describe 'verify all definitions' do subject(:definitions) { described_class.definitions } it 'all definitions have assigned a known gitlab_schema and on_delete' do is_expected.to all(have_attribu...
38.988235
111
0.652384
e8c315c54a36052dfcc74251e0569a306fec0b8b
2,005
require "gitlab/ci/lint/yml" require "gitlab/ci/lint/log" require "gitlab/ci/lint/system" require "gitlab/ci/lint/actions" require "gitlab/ci/lint/configuration" module Gitlab module Ci module Lint def self.validate values, configuration, options system = GitLab::CI::Lint::System.new actio...
35.175439
149
0.630923
1a211f0279a34d40d3c29c5e99b235d9049e2581
378
cask "timelane" do version "2.0" sha256 "3334fbb6945d1f0cb8f535c399297356037f4fdd5c570fd7a7325f5b4bd8b57a" url "https://github.com/icanzilb/Timelane/releases/download/#{version}/Timelane.app-#{version}.zip", verified: "github.com/icanzilb/Timelane/" name "Timelane" homepage "https://timelane.tools/" ...
27
102
0.738095
e9a2da7504201778ddfbaa0505e9f052b0927740
2,824
require 'spec_helper' describe FarmEvents::Create do let(:seq) { FakeSequence.create() } it 'Builds a farm_event' do device = seq.device start_time = '2027-02-17T15:16:17.000Z' end_time = '2029-02-17T18:19:20.000Z' farm_event = FarmEvents::Create.run!(device: device, ...
47.066667
76
0.472734
abe08c50f363fc7004f3ae8dfc2bab3817f1041f
574
class Post < ActiveRecord::Base belongs_to :user has_many :comments, dependent: :destroy has_many :hidden_posts has_many :users, through: :hidden_posts as_enum :category, everyday_life: 1, dreams_and_hopes: 2, regrets: 3, thoughts: 4, other: 5 acts_as_likeable validates :content, presence: {message: ...
22.076923
94
0.714286
39f769705ba81bae896c9e7e71d06d75d95b1c76
7,872
def create_standard_decomposition(standard_decomposition_object, options = {}) default_params.merge(options) standard_decomposition_object.create(params) end describe Pbl::Models::Projects::StandardDecomposition do shared_examples 'collect standard_decomposition' do it { expect(standard_decomposition.role)....
37.665072
124
0.669842
e2b5977667007d4c588ce3105916dade218d124d
384
class DiscussionPolicy < ApplicationPolicy def show? return true unless record.committee.private? return false unless user user.is_in_committee(record.committee) end def close? return false unless record.active? record.owner == user || admin? || committee_admin?(record.committee) end d...
20.210526
72
0.729167
1ae3ae84b31011eeac48068288871d61b2a5bebf
356
## # Kernel # # ISO 15.3.1 module Kernel def print(*a) raise NotImplementedError.new('print not available') end def puts(*a) raise NotImplementedError.new('puts not available') end def p(*a) raise NotImplementedError.new('p not available') end def printf(*args) raise NotImplementedError.ne...
18.736842
57
0.69382
b962b2836626fa8c35adea4089e1337159e7dc55
2,094
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...
36.736842
85
0.743075
399241cda0602ae07ee478183262f128dc530dc0
2,233
require 'spec_helper_acceptance' apply_manifest_opts = { catch_failures: true, debug: true, trace: true, } describe 'Centreon host group resource:' do before(:each) do end describe 'Manage With minimal parameter' do it 'create successfully' do pp = <<-EOS centreon_host_group{'test_rspec...
26.270588
54
0.580385
1c54267f8b700ff96844296df61fd500b6220812
484
# frozen_string_literal: true class Folio::Console::Form::ErrorsCell < Folio::ConsoleCell def show render if errors.present? end def full_messages @full_messages ||= errors.full_messages end def errors options[:errors] || model.object.errors end def field_name(key) key # *parts, fi...
18.615385
59
0.609504
bb840be283c6cae98ceb8f6c592ca116ee675b61
139
require File.expand_path('../../../spec_helper', __FILE__) describe "Array#size" do it "needs to be reviewed for spec completeness" end
23.166667
58
0.726619
219826edd760613ad1a4dd5582f77bfe45e58659
3,420
# frozen_string_literal: true # Cloud Foundry Java Buildpack # Copyright 2013-2020 the original author or authors. # # 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....
34.545455
116
0.676608
6aa1280fdb929e33286b23d5dd63e803c4c16ba2
1,547
module Moveable attr_reader :speed, :heading attr_writer :fuel_efficiency, :fuel_capacity def range @fuel_capacity * @fuel_efficiency end end class WheeledVehicle include Moveable def initialize(tire_array, km_traveled_per_liter, liters_of_fuel_capacity) @tires = tire_array self.fuel_efficien...
20.626667
76
0.751778
1a5d4783ef79dbc5ae7ccb3518fb62e334fc6850
1,640
module Alchemy module Custom module Model class Cloner < ::ActiveType::Object attribute :language_id, :integer attribute :site_id, :integer validates :language_id, :site_id, presence: true validate :check_lang_in_site, unless: -> {site_id.blank?} ### # r...
24.117647
121
0.534756
6a69031a5d4fbc8e987d4512af81b1fb5a8fae92
853
class CreateInvoices < ActiveRecord::Migration def self.up begin create_table(:accounts, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8') do |t| t.timestamps end rescue ActiveRecord::StatementInvalid => e if e.message =~ /Table .* already exists/ puts "accounts table already...
25.848485
87
0.644783
f891499c71dc237664802b29e532804a1175a1ca
137
require "test_helper" class AdminControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end end
17.125
59
0.737226
e8a8174f1edb08064779c1ecb6d29896184b78c1
2,261
class Jeweler class GemSpecHelper attr_accessor :spec, :base_dir def initialize(spec, base_dir = nil) self.spec = spec self.base_dir = base_dir || '' yield spec if block_given? end def valid? begin parse true rescue false end end ...
25.693182
142
0.623618
03d7c1661745c2e8a920cff7f7666bfadaf18196
343
class Question < ApplicationRecord belongs_to :student belongs_to :course has_many :comments validates :content, presence: true def asked_by self.student.preferred_name end def asked_when date_time = self.created_at date_time.strftime("Asked %m/%d/%Y at...
20.176471
55
0.635569
f71fcdb3336819ff50dca06681457f34500af406
858
class PDFWriter attr_reader :user, :table_array def initialize(user, years:) @user = user @years = years @table_array = user.table_array(readings) end def self.new_from_user_id(user_id, years:) new(User.find(user_id), years: years) end def filename user.last_name end def readings...
20.428571
90
0.671329
bb17a30f7cceeb345904bbee3e039380704d1e31
347
module Moneybird::Service class Webhook include Moneybird::Traits::AdministrationService include Moneybird::Traits::Service include Moneybird::Traits::FindAll include Moneybird::Traits::Delete def resource_class Moneybird::Resource::Webhook end def path "#{administration_id}/...
21.6875
52
0.714697
7999c2ed5a9938e7dd9a2fa4b540a56d28666fc4
128
require 'test_helper' class CheckedOutItemTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
16
50
0.71875
2899327eac980b7bcfc02924f0d8b6432e7b60be
226
class Api::ApiController < ApplicationController before_action :ensure_logged_in private def ensure_logged_in unless logged_in? render json: ["You must be logged in to do that"], status: 401 end end end
20.545455
68
0.730088
ff25118fdaeb63a7cc6b5556c447b61e45b4489a
1,965
# encoding: utf-8 require 'travis/client' require 'travis/tools/safe_string' module Travis module Client class Artifact < Entity CHUNKED = "application/json; chunked=true; version=2, application/json; version=2" # @!parse attr_reader :job_id, :type, :body attributes :job_id, :type, :body ...
26.2
88
0.569466
269233b456a77a14854c233dfac30dc3d6a34216
1,265
module Fog module Parsers module Compute module AWS class DescribeSubnets < Fog::Parsers::Base def reset @subnet = { 'tagSet' => {} } @response = { 'subnetSet' => [] } @tag = {} end def start_element(name, attrs = []) sup...
26.354167
107
0.403162
ed6ceedc10fd10c9cfe31e23a8e46fb055517764
223,901
# 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, ...
43.400078
130
0.636786
7a766d0dcaaa514919b36b260e220c5edf590f60
3,053
# # Cookbook Name:: hdf-chef # Recipe:: hdf_cluster # # The MIT License (MIT) # # Copyright:: 2018, Ryan Hansohn # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
40.171053
97
0.719948
26545ecc1bfc5d802a98c57e3d4a3d7cecb39c54
2,272
# frozen_string_literal: true module RuboCop module Cop module Performance # This cop identifies unnecessary use of a regex where `String#end_with?` would suffice. # # This cop has `SafeMultiline` configuration option that `true` by default because # `end$` is unsafe as it will behave inc...
30.293333
94
0.53037
bb22a3f841527da45b081c3b4e150c9441c4f89c
1,734
require 'puppet/dsl/blank_slate' require 'puppet/dsl/resource_reference' module Puppet # @since 3.1 # @status EXPERIMENTAL module DSL # Thin decorator layer for accessing attributes of array/hash-like objects. # @see Puppet::DSL::Context#create_resource Context#create_resource for examples of usage ...
30.421053
94
0.60323
6af8d37ef245d93653dc55f65bbaa0f19a9698ce
4,412
require 'cgi' require 'uri' require 'rollbar/language_support' module Rollbar module Scrubbers class URL SCRUB_ALL = :scrub_all def self.call(*args) new.call(*args) end def call(options = {}) url = ascii_encode(options[:url]) filter(url, build_re...
33.679389
118
0.633726
e892c736c69f6698775975b7ec7d3b88e150faf6
19,496
# frozen_string_literal: true require 'spec_helper' describe SnippetsController do let(:user) { create(:user) } describe 'GET #index' do let(:user) { create(:user) } context 'when username parameter is present' do it_behaves_like 'paginated collection' do let(:collection) { Snippet.all } ...
30.557994
114
0.616537
b9321f66836279f13c0317e91bbea38634f6821b
111
class Settings < Settingslogic source Rails.root.join('config', 'application.yml') namespace Rails.env end
22.2
53
0.765766
21fe5dfe20f87509072467b4a4497051d6a9df92
1,452
require 'spec_helper' describe "JudgeAbility" do let(:judge) { Fabricate :judge } subject(:ability) {JudgeAbility.new(judge)} describe "contest" do let(:contest) { Fabricate.build(:contest) } it{ should be_able_to(:manage, contest) } end describe "problem" do let(:problem) { Fabricate.build(:...
25.928571
95
0.65427
abaadc80b5e843e49c8c85eb3eeaef6da1fc75b6
1,442
module Transparam class FactCollector attr_reader :project_path def initialize(project_path:) @project_path = project_path end def call write_helper perform_fact_collection collect_facts ensure cleanup end def self.call(*args) self.new(*args).call ...
21.848485
140
0.656727
38556e23525f3aefee6c2f43816157605d7bd1a0
594
# frozen_string_literal: true module Generator # Defines a method that can be used in rake tasks to generate user accounts. module Accounts def self.create_account(name, email, password, admin: false) if User.where(email: email).count.positive? Rails.logger.info "Account #{email} already exists."...
29.7
78
0.659933
ff8b397b4eb6ff837c97cf6777baf1a27017010f
1,257
module Cubic # All classes generated by Cubic inherit from CubicController class CubicController extend Logable class << self attr_accessor :namespace # Allows for namespacing within controllers who inherit # from CubicController def namespace(name, &b) @namespace = name ...
22.052632
63
0.577566
610b272b06c5760b3142c678320d86cd0889bbe4
593
require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) Pod::Spec.new do |s| s.name = "react-native-qiyu" s.version = package["version"] s.summary = package["description"] s.homepage = package["homepage"] s.license = package["license"] s.authors =...
25.782609
105
0.58516
6273a2383e5f15220bc1b0b14e22ffddc951774f
1,718
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'phraseapp-in-context-editor-ruby/version' Gem::Specification.new do |s| s.name = "phraseapp-in-context-editor-ruby" s.version = PhraseApp::InContextEditor::VERSION s.platform = Gem::Platform::RU...
39.045455
132
0.671129
0302dde8f0df245f065efa81b77551077cd831cf
2,849
# frozen_string_literal: true # require "spec_helper" # # describe Mongoid::Relations::Proxy do # # describe '#with', if: non_legacy_server? do # # let(:circus) do # Circus.new # end # # let(:animal) do # Animal.new # end # # before do # circus.animals << animal # circus.s...
22.433071
64
0.570727
6a2e28d74cb997dc9fc8f1139d30b44c61a6759b
325
require "danbooru/resource" class Danbooru::Resource::Posts < Danbooru::Resource def search(workers: 2, by: :page, **params) all(workers: workers, by: by, **params) end def tag(id, tags) tags = tags.join(" ") if tags.is_a?(Array) update(id, "post[old_tag_string]": "", "post[tag_string]": tags) end...
25
68
0.655385
186848ae47b78063b19be3bc934e6c00cadfec73
3,560
module Koyori class Toc include HtmlBuilder attr_reader :chapters, :preface_heading def initialize @chapters = [] @chapter_number = 0 @section_number = 0 @subsection_number = 0 @preface_heading = nil end def add_chapter(heading) @chapters << { heading...
29.666667
108
0.470506