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
5dc2030e2fa406e93fb5222e55e8792a068eaf26
718
#!/usr/bin/env ruby #--- # Excerpted from "Everyday Scripting in Ruby" # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/bmsft for more book information. #--- module Gem class GemRunner def run(args) do_configuration(args) cmd = Gem::C...
21.757576
82
0.657382
914368ae8fdc2a1b7e996ae914cb7e45b791de2d
3,282
class Suricata < Formula desc "Network IDS, IPS, and security monitoring engine" homepage "https://suricata-ids.org/" url "https://www.openinfosecfoundation.org/download/suricata-4.0.4.tar.gz" sha256 "617e83b6e20b03aa7d5e05a980d3cb6d2810ec18a6f15a36bf66c81c9c0a2abb" bottle do sha256 "d01576e7a951c8909a21...
34.547368
117
0.695612
013fff990a06e94947a359e8635846711ba97072
1,110
require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' include RspecPuppetFacts if Dir.exist?(File.expand_path('../../lib', __FILE__)) && RUBY_VERSION !~ %r{^1.9} require 'coveralls' require 'simplecov' require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTM...
31.714286
177
0.730631
f8e4e4ff05a664adef27472eb6ebc0a194c8cf11
4,946
# # Copyright (C) 2011 by Dominic Graefen / http://devboy.org # # 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, including without limitation the rights # to use, copy, mo...
35.582734
129
0.597048
39447de3eff2f9541aed58cbfbfad0337de35c20
943
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'file/visitor/version' Gem::Specification.new do |spec| spec.name = "file-visitor" spec.version = File::Visitor::VERSION spec.authors = ["bonar"] spec.email = ...
36.269231
104
0.654295
03c8a36d82eb5257c802eefade8cd9e8be63373a
4,969
require 'json' require 'net/http' require 'uri' module Garage module Strategy module AuthServer extend ActiveSupport::Concern included do before_action :verify_auth, if: -> (_) { verify_permission? } end def access_token if defined?(@access_token) @access_token...
24.721393
94
0.561079
e8a0c66b1ef4ab01b05dd01e3b867f6ef558949c
7,424
=begin #Cloudsmith API #The API to the Cloudsmith Service OpenAPI spec version: v1 Contact: support@cloudsmith.io Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3 =end require 'date' module CloudsmithApi class PackagesUploadVagrant # The name of this package. ...
28.553846
153
0.613281
e2f592eb0a3ed4d7163413157598b4c37ed0c82e
871
class ProjectsController < InheritedResources::Base before_filter :authenticate_user! before_filter :pull_repo, :only => [:show, :edit] before_filter :ensure_accessibility_by_current_user, :except => [:index, :new, :new_github, :create] respond_to :json, :only => :show custom_actions :resource => :pull ...
21.243902
102
0.686567
e915262468aab364d76da73a7c58e501223d6be2
1,859
# ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** Type: MMv1 *** # # ---------------------------------------------------------------------------- # # This file is automatically generated by Magic Modules and manual # changes will be ...
45.341463
177
0.660032
4ae3bb82fadca460ed3921e33e02291ef61f3757
374
require 'spec_helper' describe Ethereum::Contract do let(:client) { Ethereum::IpcClient.new } let(:path) { "#{Dir.pwd}/spec/fixtures/TestContract.sol" } it "namespaces the generated contract class" do @works = Ethereum::Contract.create(file: path, client: client) expect(@works.parent.class_object.to_s)...
26.714286
85
0.721925
1d9eb80ceea3d75792f369111c7d8140c56d4848
905
require 'pry' class ProtestCliApp::CLI def call # binding.pry # puts "hello world" list_books menu goodbye end def list_books puts "here are some bestselling books!" @books = ProtestCliApp::Protest.today @books.each.with_index(1) do |book, i| puts "#{i}. #{book.title}-...
17.403846
82
0.60884
335cda878cb604d70efb89ee0fb8248f1b858170
768
# vulkan-ruby 0.1.0 # # => https://github.com/sinisterchipmunk/vulkan-ruby # # [NOTICE] This is an automatically generated file. module Vulkan VK_KHR_DISPLAY_SPEC_VERSION = 21 unless defined?(VK_KHR_DISPLAY_SPEC_VERSION) VK_KHR_DISPLAY_EXTENSION_NAME = "VK_KHR_display" unless defined?(VK_KHR_DISPLAY_EXTENSION_NA...
51.2
131
0.856771
87f1dc2afaecf5f9979e9c8d4ad18063909f11bd
4,248
# 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...
37.59292
120
0.682674
114872c6c8f22226f3293e57b7c0766329a31341
441
module Fog module Identity class Telefonica class V3 class Real def list_policies(options = {}) request( :expects => [200], :method => 'GET', :path => "policies", :query => options ) end ...
18.375
41
0.414966
337b90b67ee07668070e133e280a94f827b07213
214
class CreateFeatureToggle < ActiveRecord::Migration[6.0] def change create_table :feature_toggles, if_not_exists: true do |t| t.string :key t.boolean :active t.timestamps end end end
19.454545
61
0.686916
abbf522c9fa4dd0be2509c19129f89ad8aa303e3
1,112
class BotUser < User AUTH_HEADER = 'HTTP_BOT_AUTH' # Create bot user with name def self.create(name) user = find_or_initialize_by name: name, role: 'bot' token = '' if ! user.persisted? token = user.reset_token! end {user: user, token: token} end # Immediately overwrite existing t...
23.166667
68
0.673561
1891d5e50acfa22107035ad4ae28ee97ce858876
355
# encoding: utf-8 namespace :release do desc 'apply all release tasks' task :pack do on roles(:app) do within release_path do with rails_env: fetch(:rails_env) do # add test for existing db # if test execute :rake, 'release:pack' # else # end ...
19.722222
44
0.549296
7a292b9fb162ec23ea2c2dadc9f54546696cf635
222
class CreateDepartmentsTable < ActiveRecord::Migration[5.2] def change create_table :departments do |t| t.integer :organization_id t.integer :sector_id t.integer :job_id end end end
22.2
59
0.666667
4a8102474fca90a581bcf1ad9d12f8e8f3fafe3e
267
module Slugifiable module InstanceMethods def slug self.name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') end end module ClassMethods def find_by_slug(slug) self.all.find{ |instance| instance.slug == slug } end end end
20.538462
66
0.606742
21ca78eeb1358217d8e68e631c691610876260ad
1,235
# frozen_string_literal: true module Dashboard module Projects class ListService PRESELECT_PROJECTS_LIMIT = 150 def initialize(user, feature:) @user = user @feature = feature end def execute(project_ids, include_unavailable: false) return Project.none unless Lice...
25.729167
92
0.668826
d57c0880d7743bd9956e69535bbab772fcb54503
4,437
require 'pathname' Puppet::Type.newtype(:dsc_xwindowspackagecab) do require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' @doc = %q{ The DSC xWindowsPackageCab resource type. Automatically generat...
31.920863
227
0.679062
ac9436fa611769bad535f11ae92000221a416581
41
module WebShield VERSION = "0.1.2" end
10.25
19
0.682927
334bddd18c726623a24ab07ef680d76699792aff
2,890
# frozen_string_literal: true require 'spec_helper' require 'yaml' module Cucumber module Cli describe ProfileLoader do def given_cucumber_yml_defined_as(hash_or_string) allow(Dir).to receive(:glob).with('{,.config/,config/}cucumber{.yml,.yaml}') { ['cucumber.yml'] } allow(File).to receive...
43.134328
142
0.658824
87045ca8d64f7a593a6e35b2d5d38e9845aaa2e0
4,529
require "rails_helper" RSpec.describe ActivityHelper, type: :helper do let(:organisation) { create(:delivery_partner_organisation) } describe "#step_is_complete_or_next?" do context "when the activity has passed the identification step" do it "returns true for the purpose fields" do activity = b...
40.4375
168
0.702363
614f75a146ee13adec2d15e100c32356bab56c1e
2,791
class Admin::DeliveryServicePricesController < ApplicationController before_action :authenticate_user! layout "admin" def index @delivery_service = DeliveryService.includes(:active_prices).find(params[:delivery_service_id]) @delivery_service_prices = @delivery_service.active_prices end def new ...
34.036585
107
0.774633
e968155e4076e401ad9af5cb654adeda473b8b87
1,313
require "mixlib/cli" class CliConfig include Mixlib::CLI option :room, :short => "-r ROOM_NAME", :long => "--room ROOM_NAME", :description => "Use quotes if there are spaces on the room name" option :domain, :short => "-d DOMAIN_NAME", :long => "--domain DOMAIN_NAME", :description => "T...
25.25
116
0.600914
ac7bc6bc640278750f5496d10065c163c9195b48
316
class CreateAdmins < ActiveRecord::Migration[5.2] def change create_table :admins do |t| t.string :name, null: false t.string :email, null: false t.string :password_digest, null: false t.index ["email"], name: "index_admins_on_email", unique: true t.timestamps end end end
24.307692
68
0.658228
26e039ef5727cba251605e59ee6117a13a9730c0
2,157
require File.expand_path('../../../spec_helper', __FILE__) module Pod describe ExternalSources::PodspecSource do before do podspec_path = fixture('integration/Reachability/Reachability.podspec') dependency = Dependency.new("Reachability", :podspec => podspec_path.to_s) podfile_path = fixture('...
35.360656
98
0.670376
0191abf2f226c1f52057d7da0c9966e0c657f84f
166
require File.expand_path('../../../../spec_helper', __FILE__) describe "Zlib::GzipReader#external_encoding" do it "needs to be reviewed for spec completeness" end
27.666667
61
0.740964
2610813b0a4f07a298a988f47fd1d481fb36df14
751
# # Cookbook Name:: lvm # Attributes:: default # # Copyright 2009-2016, Chef Software, 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 ...
34.136364
74
0.725699
7a20d119c3394ddd513b7e4c14cad6dab1460c45
1,630
# frozen_string_literal: true #------------------------------------------------------------------------- # # Copyright (c) Microsoft and contributors. All rights reserved. # # The MIT License(MIT) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated document...
40.75
79
0.695092
034b121361e5f24053c9ef251aabf81a52f4074f
282
# Variable declaration a = 'value' # Print with NewLine puts a # Print without NewLine print a # constants are all caps WHATEVER ='constant forever!' # Global $global_here =0 # class_variable @@class_variable # instance_var @instance_var # Get input variable_name = gets
10.071429
29
0.737589
4aff9bccade826cedab71c2a3e98422825ecd0e1
1,238
module Memorandom module Plugins class DER < PluginTemplate require 'openssl' @description = "This plugin looks for DER-encoded encryption keys (RSA/DSA/EC)" @confidence = 0.90 # Scan takes a buffer and an offset of where this buffer starts in the source def scan(buffer, source_offset) buffer.scan( ...
28.136364
101
0.649435
e9e8cae02e56a5fbea63a8aad848b074b26f9c1e
1,076
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'reject_by_key/version' Gem::Specification.new do |spec| spec.name = "reject_by_key" spec.version = RejectByKey::VERSION spec.authors = ["Yusuke Nakamura"] spec.email ...
37.103448
94
0.659851
e8502a2cedd66bff5f07f978b0b366a77336ca0a
8,353
require_relative 'spec_helper' describe Hooks do include Rack::Test::Methods def app Hooks end let(:stripe_event_id) { 'xxx' } let(:metadata) {{ country_code: 'NL', vat_registered: 'false', other: 'random' }} let(:customer) do Stripe::Customer.create \ card: { number...
27.936455
164
0.580271
2651d3bbcdea5374132411f8e5f2131876306b96
1,555
# frozen_string_literal: true require 'yabeda/http_requests/version' require 'yabeda/http_requests/sniffer' require 'yabeda' require 'sniffer' module Yabeda # Common module module HttpRequests SNIFFER_STORAGE_SIZE = 0 # rubocop: disable Metrics/BlockLength Yabeda.configure do group :http ...
31.734694
75
0.570418
333221594cbfc21e3de27f0f81779c2447050d6a
450
require 'fog/core/collection' require 'fog/digitalocean/models/compute/flavor' module Fog module Compute class DigitalOcean class Flavors < Fog::Collection model Fog::Compute::DigitalOcean::Flavor def all load service.list_flavors.body['sizes'] end def get(id) ...
17.307692
49
0.588889
bb35d499504dd05090e7867a03356713d07d8950
16,792
=begin #NSX-T Manager API #VMware NSX-T Manager REST API OpenAPI spec version: 2.5.1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.7 =end require 'date' module NSXT class UpgradeUnitGroupAggregateInfo # Link to this resource attr_accessor :_self #...
33.185771
508
0.630777
ac3f9de5146d41c447ddb637c398ed6fee5fd1bf
405
require File.dirname(__FILE__) + '/braintree/braintree_common' module ActiveMerchant #:nodoc: module Billing #:nodoc: class BraintreeGateway < Gateway include BraintreeCommon def self.new(options={}) if options.has_key?(:login) BraintreeOrangeGateway.new(options) else...
22.5
62
0.649383
28d8f6e6be874381ba6410cb64ac4657260f5412
1,404
module CartoDb MAX_SQL_GET_LENGTH = 1024 TEMPLATES_PATH = Rails.root.join('lib', 'modules', 'carto_db', 'templates') SQL_URL = '/api/v2/sql' USERNAME = Rails.application.secrets.cartodb['username'] API_KEY = Rails.application.secrets.cartodb['api_key'] include HTTParty def self.query query, with_trans...
24.631579
77
0.670228
0150e5a02c3c6c9499fb5733b0180f1ba82eaf5c
146
class LatLng include Mongoid::Document field :lat, type: Float field :lng, type: Float embedded_in :geometry, class_name: "Geometry" end
18.25
47
0.732877
03443e569c8cf2782c3728c27f62df784d70db3c
330
class District < ApplicationRecord include CommonUtils belongs_to :city has_many :locations before_validation do self.code = region_code(name) if name.present? end validates :name, presence: true, uniqueness: { scope: :city_id } validates :code, presence: true, uniqueness: { scope: [:name, :city_...
23.571429
76
0.721212
5d075a8f9a2ba274f223f05e40e9ecb7ac280aba
11,500
# frozen_string_literal: true require_relative "../test_helper" SingleCov.covered! describe EnvironmentVariableGroupsController do def self.it_updates it "updates" do variable = env_group.environment_variables.first refute_difference "EnvironmentVariable.count" do put :update, params: { ...
31.593407
118
0.609739
111b45404bd9dcff50f7182c659097d4f651063d
1,847
class Dromeaudio < Formula desc "Small C++ audio manipulation and playback library" homepage "https://github.com/joshb/dromeaudio/" url "https://github.com/joshb/DromeAudio/archive/v0.3.0.tar.gz" sha256 "d226fa3f16d8a41aeea2d0a32178ca15519aebfa109bc6eee36669fa7f7c6b83" license "BSD-2-Clause" head "https://g...
45.04878
122
0.756903
d5ef0f2843d560c4ebbb119dc06e677bccb2769d
313
# encoding: utf-8 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) require 'data_objects/spec/shared/typecast/boolean_spec' describe 'DataObjects::Postgres with Boolean' do it_should_behave_like 'supporting Boolean' it_should_behave_like 'supporting Boolean autocasting' end
31.3
80
0.801917
112b6b713a7f7c58de6f383e1b46d5afc9b1889f
5,657
class MingwW64 < Formula desc "Minimalist GNU for Windows and GCC cross-compilers" homepage "http://mingw-w64.org/" url "https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v7.0.0.tar.bz2" sha256 "aa20dfff3596f08a7f427aab74315a6cb80c2b086b4a107ed35af02f9496b628" revision ...
31.780899
112
0.594485
79a1aa2dfcff99ef7630c76f3ee77855fe8308cd
621
Rails.application.routes.draw do namespace :api do namespace :v1 do resources :events, only: [:show, :create, :update, :destroy] resources :pets, only: [:create, :update, :index, :destroy] resources :users, only: [:show, :create, :update, :index] resources :user_relationships, only: [ :cre...
34.5
72
0.639291
79e434a6b5b8ea08d3dd204cb87d94fc38537edb
197
module Api class ProgressController < ApplicationController def index render json: {number_of_cities: City.count, number_of_cities_with_data_portal: CityPortal.count} end end end
24.625
102
0.77665
d56e23a74e519d444c058bdafbafb3d18f6be1bd
66
module Fog module Aliyun VERSION = '0.2.0'.freeze end end
11
28
0.651515
e2e7698189cefa199a87bc45d3213141042c3651
1,185
class AvalonDerivativeService < Hyrax::ActiveEncode::ActiveEncodeDerivativeService # HACK: Prepend this derivative service Hyrax::DerivativeService.services = [AvalonDerivativeService] + Hyrax::DerivativeService.services def create_derivatives(filename) super # Create thumbnails and posters outside of Ac...
47.4
139
0.705485
ff6c4a06517241ff4446d49dc8a630a7cf9e2c66
5,521
# 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::CognitiveServices::LuisAuthoring::V3_0_preview module Models # # Object model of an application version. # class VersionInfo...
31.016854
77
0.487412
918bd5c835fc76a1e38dc7eff01e12832690c4a7
2,827
require 'json' require 'bunny' require 'slop' #require_relative '../terminal.rb' # parsing commandline arguments OPTIONS = Slop.parse { |o| o.string '-q', '--queue-name', 'RabbitMQ queue name (default: testing)', default: 'testing' o.string '-H', '--rabbit-host', 'RabbitMQ host address (default: 127.0.0.1)', defa...
34.47561
139
0.749912
edfc54b9edf3a1081cddf656442b4fc6508bbaa4
2,526
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10 module Models # # DiskExclusionInput when doing enable protection of virtual machine in # InMage p...
32.384615
88
0.527712
e96932dfac404389a3e23a25678f2915228c11c0
805
include_recipe "git" overlay_dir = node['joe']['overlay_dir'] directory overlay_dir do owner "root" group "root" recursive true end overlay_repo_branch = "joe-3.7" overlay_repo_branch = "joe-4.4" if node['platform'] == "debian" and node['platform_version'].to_i >= 9 git overlay_dir do repository node['joe'...
20.125
102
0.700621
79696b0e8596004a559bf9c405fd2b301dd2f6da
563
# frozen_string_literal: true class User < ApplicationRecord class << User def admin User.new(ActionController::Parameters.new(:name => 'admin', :roles => [Role.admin, Role.standard])) end def standard User.new(ActionController::Parameters.new(:name => 'standard', :roles => [Role.standard]))...
22.52
105
0.662522
6a753ec71b8d21158760e74d8f6879e32beb793f
501
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails...
45.545455
122
0.764471
1cab7327d14592362a2592dfc92785cec0e87d34
4,034
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
45.840909
158
0.620476
91940830f24bf366fa3564b596f3af579f41e96b
4,147
# 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::Automation::Mgmt::V2015_10_31 module Models # # Definition of the connection type. # class ConnectionType include MsR...
29.621429
79
0.472149
21444f68ea57c6dd77bc35752aa690b342ee3c1b
6,420
module Gollum # Controls all access to the Git objects from Gollum. Extend this class to # add custom caching for special cases. class GitAccess # Initializes the GitAccess instance. # # path - The String path to the Git repository that holds the # Gollum site. # page...
26.639004
78
0.561526
bf25f712d364e778cf6ccde43ba96697a20acfe8
218
# frozen_string_literal: true class AddUserStatsTable < ActiveRecord::Migration[5.2] def change create_table :user_stats do |t| t.jsonb :data t.integer :user_id t.timestamps end end end
16.769231
54
0.683486
2675d5f0f11e9f319fac55b6fd11ebd58517eee6
2,773
class UseraccountsController < ApplicationController before_action :set_useraccount, only: [:show, :edit, :update, :destroy] # GET /useraccounts # GET /useraccounts.json def index @useraccounts = Useraccount.all insint = current_user.insints.first if insint.present? if insint.inskey.present? ...
30.141304
121
0.664263
ffcf312ff21557e7c4395484b18290a198ff10aa
1,391
class MottimagetxtsController < ApplicationController def create @motd = Motd.find(params[:motd_id]) @mott = @motd.motts.find(params[:mott_id]) @mottimage = @mott.mottimages.find(params[:mottimage_id]) @mottimage.mottimagetxts.create(mottimagetxt_params) redirect_to motd_mott_path(@motd,@mott) ...
30.911111
117
0.696621
619d51a099d72baf8ad224ae4929d6f7a127830d
380
class MigrateProviderOfficeCiudadToEnum < ActiveRecord::Migration def up say_with_time "WARNING: wiping all ciudades in provider offices" do remove_column :provider_offices, :ciudad add_column :provider_offices, :ciudad, :integer end end def down remove_column :provider_offices, :ciudad ...
27.142857
71
0.752632
1ce8f811aff0c3ac8e0a1b4df1439a0049c8276b
165
FactoryBot.define do factory :user do name { Faker::Name.name } email { Faker::Internet.unique.email } password { Faker::Internet.password } end end
20.625
42
0.678788
1a4338d9d474e698047c19f5d9cdea89ecd32fe1
1,419
require 'routemaster/jobs/client' require 'routemaster/jobs/cache_and_sweep' RSpec.describe Routemaster::Jobs::Client do let(:client) { Routemaster::Jobs::Client.new(adapter) } let(:perform) do client.enqueue('routemaster', Routemaster::Jobs::CacheAndSweep, 'https://example.com/1') end describe '#enqueue...
30.191489
109
0.625793
1ac38c4468d67d8cdce77b53953c208112548abf
406
# encoding: utf-8 require 'spec_helper' require 'ice_nine/freezer' require 'ice_nine/freezer/no_freeze' require 'ice_nine/freezer/symbol' describe IceNine::Freezer::Symbol, '.deep_freeze' do subject { object.deep_freeze(value) } let(:object) { described_class } context 'with a Symbol object' do let(:value...
21.368421
60
0.736453
e2b1fe948292aadf2dc0239ce16aedac2f795ac3
387
FactoryBot.define do factory :course do organization category { build(:category, organization: organization) } course { build(:course, organization: organization, category: category) } sequence(:name) { |n| "Course#{n}" } sequence(:description) { |n| "Description#{n}" } start_booking_hours { 2...
32.25
77
0.666667
01051ea0aa4c6816bfb6c0b1f90fd44a4176b753
207
class Model::LogicalAndExpr attr_accessor :left, :right def initialize () @template = Template.make("templates/logicalAndExpr.c.erb") end def render () @template.render(binding) end end
15.923077
63
0.700483
f70a76f978687d07f3e6bfd485cf91e3462e3825
1,607
class Chipmunk < Formula desc "2D rigid body physics library written in C" homepage "https://chipmunk-physics.net/" url "https://chipmunk-physics.net/release/Chipmunk-7.x/Chipmunk-7.0.3.tgz" mirror "https://www.mirrorservice.org/sites/distfiles.macports.org/chipmunk/Chipmunk-7.0.3.tgz" sha256 "048b0c9eff91c27...
33.479167
97
0.700685
bfad603291395bff437d7dbd03b414e4ec320585
269
class CreateContributions < ActiveRecord::Migration[5.2] def change create_table :contributions do |t| t.belongs_to :invitation, index: true t.belongs_to :user, index: true t.string :title t.text :note t.timestamps end end end
22.416667
56
0.665428
bfe5e361f015d2c4683986b9784a11430a00e241
114
# frozen_string_literal: true require 'rails_helper' RSpec.describe AccountsController, type: :controller do end
19
55
0.824561
386b99b8708a57387726f69152c57642c8c96e3f
354
class AddFinalAttributeToResults < ActiveRecord::Migration def self.up change_table :results do |t| t.boolean :final, :null => false, :default => false t.boolean :freezed, :null => false, :default => false end end def self.down change_table :results do |t| t.remove :final t....
22.125
59
0.641243
f8eb3e77734bc97355a4f10585d5038df5cc8af4
212
class CreateReviews < ActiveRecord::Migration[5.1] def change create_table :reviews do |t| t.belongs_to :medication t.integer :rating t.text :comment t.timestamps end end end
17.666667
50
0.65566
bfe39f864f4fe0c28b8bb451afbc01085077ed89
1,082
require 'rubygems' require 'ramaze' require 'sequel' require 'scaffolding_extensions' # More information on Scaffolding Extensions here: http://scaffolding-ext.rubyforge.org/ DB = Sequel.sqlite # Sequel::Model doesn't support schema creation by default # So we have to load it as a plugin Sequel::Model.plugin :schema...
23.521739
88
0.714418
21b3552668f0b6ffbd5d3478ff38e079513d129d
918
module Geokit module Geocoders # Provides geocoding based upon an IP address. The underlying web service is GeoSelect class GeobytesGeocoder < BaseIpGeocoder def self.do_geocode(ip, _=nil) process :json, ip end def self.submit_url(ip) "http://getcitydetails.geobytes.com/Get...
31.655172
91
0.599129
edf2d64f41e55a7f9b36655decaf1896fdb2d8ed
866
covers 'facets/date/cmp' test_case Time do method :<=> do test "equivalent" do time = Time.gm(2000) # 2000-01-01 00:00:00 UTC date = time.to_date datetime = time.to_datetime (time <=> date).assert == 0 (time <=> datetime).assert == 0 (date <=> datetime).assert...
22.205128
59
0.536952
877502c0798794d9bf1726ead9dcfbbd9df93b45
42
module Feedbacker VERSION = '0.1.0' end
10.5
19
0.690476
ed5b4d8dddf4c9effd9ab4e4cfe884fa535d2354
1,384
# frozen_string_literal: true # this enables activerecord, and allows us to test the auto detection logic require 'active_record' describe SqlPatches do # and patched= to some extent describe ".all_patch_files" do it "uses env variable" do with_patch_env("custom1") do expect(SqlPatches.all_patch...
27.68
77
0.679913
21b6fd573469fc3e46d52dacb1680d47114476ba
1,269
require File.join(File.dirname(__FILE__), '..', 'spec_helper') require "shared_factory_specs" require 'rubyonacid/factories/sine' include RubyOnAcid describe "SineFactory" do before :each do @page = Harmony::Page.new @page.load('lib/jsonacid.js') @page.execute_js "var it = new SineFactory();" en...
30.214286
62
0.642238
f7847c55b38a90f50faed1558487143d3c5a787b
78
class KeepItUpPlayer < ActiveRecord::Base attr_accessible :name, :score end
19.5
41
0.794872
7940479d6cac04ebdff6bcdbe231c19ac16055af
901
cask 'kubernetic' do version '2.5.0' sha256 'f426312f7191ba86c0990a31a2d831f983777c412d5a93c92356b21fc945728b' # kubernetic.s3.amazonaws.com was verified as official when first introduced to the cask url "https://kubernetic.s3.amazonaws.com/Kubernetic-#{version}.dmg" appcast 'https://kubernetic.s3.amazonaws....
34.653846
90
0.618202
5dbf0286c009094d33c9e88c7966bd0c4edea67c
230
# typed: true module Opus; end def main T.assert_type!(Opus, Module) # T.assert_type!(T::Array, Module) # temporary disabled while we polish generic syntax T.junk # error: Method `junk` does not exist on `T.class_of(T)` end
28.75
88
0.717391
1ad1855f80cbf4d4f0c584986667d39750014a05
6,408
# frozen_string_literal: true require "set" require "kafka/consumer_group/assignor" require "kafka/round_robin_assignment_strategy" module Kafka class ConsumerGroup attr_reader :assigned_partitions, :generation_id, :group_id def initialize(cluster:, logger:, group_id:, session_timeout:, rebalance_timeout:,...
28.229075
140
0.633115
21d6986ef09ff620a735a108334b2f4d03b6deff
1,259
######################################################################################################## ######################################################################################################## class NicController < ApplicationController ###############################################################...
44.964286
104
0.305798
082818c72b1e0005343026bb260832924632ada8
225
class UpdateBackpackIndices < ActiveRecord::Migration[5.2] def change remove_index :backpacks, :user_id add_index :backpacks, :user_id, unique: true add_index :backpacks, :storage_app_id, unique: true end end
28.125
58
0.751111
1a63650884458053427a66e56d0c2e06ac0a48d5
1,393
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "request_signature" Gem::Specification.new do |spec| spec.name = "request_signature" spec.version = RequestSignature::VERSION spec.authors = ["Georges Gabereau"] spec.email =...
44.935484
115
0.668342
395599312dbb873ac8afcb18e2a71a480c949067
681
# frozen_string_literal: true require "rails_helper" describe Eve::UpdateAncestriesJob do it { should be_an(ApplicationJob) } it { expect(described_class.queue_name).to eq("default") } describe "#perform" do before do # # LanguageMapper::LANGUAGES.each_key do |locale| # Eve::Ancestries...
23.482759
72
0.640235
1d1149bfa52b69c31769eb010602598e662f7497
2,188
class Openrct2 < Formula desc "Open source re-implementation of RollerCoaster Tycoon 2" homepage "https://openrct2.io/" url "https://github.com/OpenRCT2/OpenRCT2.git", :tag => "v0.2.1", :revision => "8ac731e2124ecfb43f592c7f1cc5dd6902d5d83f" revision 1 head "https://github.com/OpenRCT2/OpenRC...
33.661538
105
0.710695
26c51703a67623d89ac9417c7a92d5b45d442dcc
2,548
module Spina::Shop module Api class RecountController < ApiController before_action :set_product skip_before_action :verify_authenticity_token, only: [:create] def create if recount_params[:stock_levels].any?{|s| s[:stock_level].present?} original_stock_level = @p...
34.432432
119
0.567896
913cec9b965d432a36129c93b98184d6316c060e
1,195
require "test_helper" class OrderCustomizationSerializerTest < ActiveSupport::TestCase test "serializes correctly with deep flag off" do Random.stub :uuid, "asd" do OrderCustomizationSerializer.serialize(OrderCustomization.all).each do |serialized| order_customized_area = OrderCustomization.find(se...
42.678571
133
0.770711
edb9cb68ecb0524f81b5d29e066f946c0fdd92d2
861
require 'spec_helper' describe 'postgresql::server::database', :type => :define do let :facts do { :osfamily => 'Debian', :operatingsystem => 'Debian', :operatingsystemrelease => '6.0', :kernel => 'Linux', :concat_basedir => tmpfilename('contrib'), :id => 'root', :path =...
26.90625
95
0.636469
26d6de10941bf11130aa6d8168a8f218c3930513
608
require 'fileutils' desc "Create nondigest versions of all ckeditor digest assets" task "assets:precompile" do fingerprint = /\-[0-9a-f]{32}\./ for file in Dir["public/assets/ckeditor/**/*"] next unless file =~ fingerprint nondigest = file.sub fingerprint, '.' FileUtils.cp file, nondigest, verbose: tru...
25.333333
62
0.6875
f7b619add0e65ab5d43cef22fd8ac8ab213cf534
3,643
# frozen_string_literal: true require 'ipaddr' def logger Rails.logger end # Harvest a Web Logg, and save to mysql # class HarvestWeblogs # Util Class that parses a single line class LineRecord attr_accessor :agent, :event, :event_time, :ip, :method, :path, :pid, :status # parse the ...
24.782313
139
0.648641
e241aa77805abbb9ec861f3d94bb3d019d80210d
2,669
# frozen_string_literal: true require 'fast_spec_helper' RSpec.describe Gitlab::APIAuthentication::Builder do describe '#build' do shared_examples 'builds the correct result' do |token_type:, sent_through:, builds:| context "with #{token_type.size} token type(s) and #{sent_through.size} sent through(s)" d...
34.662338
147
0.630573
61bbad4bfcbdf502a61face433620dfb8c57ccd9
1,050
########################################################################## # Copyright 2016 ThoughtWorks, 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/li...
35
123
0.645714
87628a707c83f002473755a684d411aaf184014f
7,150
describe MiqAeEngine::MiqAeMethod do describe ".invoke_inline_ruby (private)" do let(:workspace) do Class.new do attr_accessor :invoker # rubocop:disable Style/SingleLineMethods, Style/EmptyLineBetweenDefs def persist_state_hash; end def disable_rbac; end def current_...
31.919643
146
0.615105
e924a0bfa4c1574038a73416a2828cdcff879d39
63
FactoryBot.define do factory :user_setting do end end
10.5
26
0.714286
1d7b73f6fd021acc4e62dbbcc5896c26300450cb
255
class CreateTuesdayReaders < ActiveRecord::Migration def change create_table :tuesday_readers do |t| t.references :person t.string :email t.timestamps end add_index :tuesday_readers, [:person_id], :unique => true end end
23.181818
61
0.694118
d5e9669a916fa8ebd9695197f0a1cd72fdb4af04
1,995
# mdJson 2.0 writer tests - vector representation # History: # Stan Smith 2018-06-08 refactor to use mdJson construction helpers # Stan Smith 2017-03-15 original script require 'adiwg-mdtranslator' require_relative '../../helpers/mdJson_hash_objects' require_relative '../../helpers/mdJson_hash_functions' require_re...
33.25
98
0.737845
bf6f963c0dc9fbe6218a43c9942eef889309efa1
1,749
class SNail < Formula desc "Fork of Heirloom mailx" homepage "https://www.sdaoden.eu/code.html" url "https://www.sdaoden.eu/downloads/s-nail-14.9.3.tar.gz" sha256 "9048abe94c8b732ddefcd70b9f6052da16977de76b07598790e4c763e97f911d" bottle do sha256 "bab3491cd174beab7597ac7009237def73badd8e0b403712d1970f1c7...
33.634615
93
0.635792