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
f7197a762be2f4aa838e004763b62fd2a2d4fdb2
4,305
class Opendata::Dataset include Cms::Model::Page include ::Workflow::Addon::Approver include Opendata::Addon::Resource include Opendata::Addon::UrlResource include Opendata::Addon::Category include Opendata::Addon::Area include Opendata::Addon::DatasetGroup include Opendata::Reference::Member include ...
26.90625
123
0.636702
6a03f0c3df4c963c113cda2ec6cf87357ef5948b
131
class RenameNameAddress < ActiveRecord::Migration def change rename_column :spree_addresses, :full_name, :user_name end end
21.833333
57
0.793893
019f208903bad49eb2ae13ed7c769c615e0aa95a
26,302
require 'spec_helper' require 'digest/md5' describe 'nginx::resource::location' do let :title do 'rspec-test' end let :facts do { :osfamily => 'Debian', :operatingsystem => 'debian', } end let :pre_condition do [ 'include ::nginx::params', 'include ::nginx::conf...
38.285298
239
0.518326
4aa8907f5788c187f53352b2f61bbb6dca551be9
775
# frozen_string_literal: true module Analytics module UniqueVisitsHelper extend ActiveSupport::Concern def visitor_id return cookies[:visitor_id] if cookies[:visitor_id].present? return unless current_user uuid = SecureRandom.uuid cookies[:visitor_id] = { value: uuid, expires: 24.mo...
25
114
0.683871
6a828836622f0f09bfc3563cb57a2349a529a6cb
138
# A simple pingtest gem module Pingtest # Ping test # # @return [String] "pong" # def self.ping return "pong" end end
11.5
27
0.601449
03841339ce5ef90b7e3743cad2abe16dd2c0d7c3
155
class CreateTopics < ActiveRecord::Migration[5.0] def change create_table :topics do |t| t.string :title t.timestamps end end end
15.5
49
0.658065
f75d3d6d39082524ae87cebf5f9b4caec2f74ef4
281
workers Integer(ENV['WEB_CONCURRENCY'] || 3) threads_count = Integer(ENV['MAX_THREADS'] || 5) threads threads_count, threads_count preload_app! port ENV['PORT'] || 3000 environment ENV['RACK_ENV'] || 'development' on_worker_boot do ActiveRecord::Base.establish_connection end
21.615385
48
0.765125
ff3de493c406d4a4ab5c81f0f9b8d14cee483ecb
4,396
require 'support/config' require 'support/test_helper' require 'phusion_passenger/railz/application_spawner' require 'ruby/rails/minimal_spawner_spec' require 'ruby/spawn_server_spec' require 'ruby/rails/spawner_privilege_lowering_spec' require 'ruby/rails/spawner_error_handling_spec' include PhusionPassenger include...
27.475
115
0.717243
3856da150b05089167cefeb46c8a7f531fcdc4cd
224
desc 'Continuous Integration task' task 'ci' do derive_versions sh "bundle exec buildr package doc jacoco:report PRODUCT_VERSION=#{ENV['PRODUCT_VERSION']} PREVIOUS_PRODUCT_VERSION=#{ENV['PREVIOUS_PRODUCT_VERSION']}" end
37.333333
153
0.799107
8779c227578fdbf82d2757c2b35a34e7d9101925
2,049
require 'thread' require 'listen/internals/thread_pool' module Listen module Adapter # Adapter implementation for Mac OS X `FSEvents`. # class Darwin < Base OS_REGEXP = /darwin(1.+)?$/i # The default delay between checking for changes. DEFAULTS = { latency: 0.1 } private ...
28.458333
86
0.603221
2114db12ef1c6594f0c2bf1c9f44c28c378143ac
524
class ApplicationController < ActionController::Base protect_from_forgery with: :exception helper_method :current_user helper_method :users_daily_activities def current_user @current_user ||= User.find_by_id(session[:user_id]) unless session[:user_id] == nil end def logged_in? !!session[:user_...
18.714286
88
0.742366
ff6965a211c4e33035fceb4d65780b111773c275
494
class CreateMeritBadges < ActiveRecord::Migration def change create_table :merit_badges do |t| t.string :name t.string :year_created t.boolean :eagle_required, default: false t.boolean :discontinued, default: false t.string :bsa_advancement_id t.string :patch_image_url t....
26
49
0.700405
616e70d1731111a71af54ee78969dc238171ba02
74
class NonDefaultDirCell < Cell::ViewModel def show render end end
12.333333
41
0.72973
2176cad22e1db8c3d04ecd2bad34c97bb4aa7c5b
379
# == Schema Information # # Table name: societes # # id :integer not null, primary key # name :string # created_at :datetime not null # updated_at :datetime not null # class Societe < ApplicationRecord has_many :ticket def make_exists(name) find_or_create_by(name: nam...
18.95
53
0.643799
87ea7578dce9af0f28e375ea720cdd251b5605aa
189
require_dependency 'support/application_record' module Support module Common class ActivityType < ApplicationRecord self.table_name = 'common.activity_types' end end end
18.9
47
0.767196
6218b8eb5d2fca56de5e3cce1469e17a1cc6a02b
1,631
# # Be sure to run `pod lib lint SignalBox.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 = 'SignalBox...
37.930233
99
0.635806
bb7061ceeac4ac8fe60b5ad090b1785518dd5ebf
1,238
# frozen_string_literal: true require 'rails_helper' RSpec.describe V0::FeedbacksController, type: :controller do let(:params) do { description: 'I liked this page', target_page: '/some/example/page.html', owner_email: 'example@email.com' } end let(:missing_params) { params.reject { |k...
31.74359
92
0.705977
21a39ae70a353fe84db43caefebfd40a24d692de
12,731
require File.expand_path("../../base", __FILE__) require "pathname" require 'tempfile' describe Vagrant::BoxCollection, :skip_windows do include_context "unit" let(:box_class) { Vagrant::Box } let(:environment) { isolated_environment } subject { described_class.new(environment.boxes_dir) } it "should t...
32.23038
92
0.632001
392e755d019a1665d39b12299c80b62e374a0c6b
552
module QDM # app/models/qdm/patient_characteristic_payer.rb class PatientCharacteristicPayer < DataElement include Mongoid::Document embedded_in :patient field :relevantPeriod, type: QDM::Interval field :qdmTitle, type: String, default: 'Patient Characteristic Payer' field :hqmfOid, type: String...
39.428571
76
0.733696
392a0b935ba4d3bbb0881c82b9e851194ba75159
253
require 'rack/test' require 'rspec' require 'pry' ENV['RACK_ENV'] = 'test' require File.expand_path '../../app.rb', __FILE__ module RSpecMixin include Rack::Test::Methods def app() MakeChange end end RSpec.configure { |c| c.include RSpecMixin }
16.866667
49
0.711462
21cf147abba5e82308bb45118c95d846b8e69d17
665
# # Cookbook Name:: runit_test # Recipe:: default # # Copyright 2012, Opscode, 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 # # Unle...
31.666667
74
0.75188
e93bdab8284a1df3668dcbaf775879d7d6eb4dd3
706
cask 'hockey' do version '2.0.14' sha256 '4cd6dc945378a520818ace687c89dd1356d5f975731a7848e37cad2e12278a31' url 'https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1/app_versions/396?format=zip' appcast 'https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1', checkp...
37.157895
112
0.793201
ff368d18cedc015541c3657b66a460ec67d86d76
1,404
#-- encoding: UTF-8 #-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2021 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProj...
33.428571
91
0.757835
7aaf357dc7eb8bfe2350df2e0252b740689a76d3
1,105
require 'rails/generators' require 'rails/generators/migration' require 'rails/generators/active_record' class VanityGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __dir__) def self.next_migration_number(path) ::ActiveRecord::Generators:...
33.484848
168
0.786425
d500df2c5c4471d62a01280cca33012a07533b8b
292
# frozen_string_literal: true class ConferenceScheduleUpdateMailJob < ApplicationJob queue_as :default def perform(conference) conference.subscriptions.each do |subscription| Mailbot.conference_schedule_update_mail(conference, subscription.user).deliver_now end end end
24.333333
88
0.804795
7a527b219820e57389866fe6960b0716142e848b
497
class Hash def to_ostruct convert_to_ostruct_recursive(self) end private def convert_to_ostruct_recursive(obj) result = obj if result.is_a? Hash result = result.dup.symbolize_keys result.each do |key, val| result[key] = convert_to_ostruct_recursive(val) en...
20.708333
67
0.639839
e8f882f17e199a907036c64f8fe604a10c683311
334
module Util module Hashname def self.calc_hashname(name) name.chars.inject(5381) do |hash, ch| max_int = (hash << 5) + hash + ch.ord force_overflow_unsigned(max_int.to_f) end end def self.force_overflow_unsigned(i) i % (2**32).to_f # or equivalently: i & 0xffffffff e...
20.875
56
0.625749
26fbb4f2df8b2bd7aedc1099b71f2b3d9ed53d53
163
module CommonModels class Reminder < ActiveRecord::Base self.table_name = 'project_service.reminders' belongs_to :project belongs_to :user end end
20.375
49
0.748466
39765ceeb69b54d7e3f59e08d77290f753f7a46d
67
module PolymerGoldRails class Engine < ::Rails::Engine end end
13.4
32
0.746269
013bf3a3dcc201429aa06c576e4f0af515c5f40e
273
def filter_by_prev_char(s, prev = 'a') s.chars.each_cons(2).map do |p, c| c if p == prev end.compact.join end def filter_file(f_file, h_file, filter_prev_char = 'a') f_file.each_line do |line| h_file.puts filter_by_prev_char(line, filter_prev_char) end end
24.818182
59
0.714286
01fdb1d872c04a49d8428285f7ca883711076546
8,584
## NewRelic instrumentation for DataMapper # # Instrumenting DM has different key challenges versus AR: # # 1. The hooking of SQL logging in DM is decoupled from any knowledge of the # Model#method that invoked it. But on the positive side, the duration is # already calculated for you (and it happens insid...
37.160173
112
0.675792
e97fd97456685a889b97f43df22d20543960c2f7
2,022
#! /usr/bin/env ruby require 'spec_helper' require 'puppet_spec/files' describe Puppet::Settings do include PuppetSpec::Files def minimal_default_settings { :noop => {:default => false, :desc => "noop"} } end def define_settings(section, settings_hash) settings.define_settings(section, minimal_defau...
22.466667
109
0.610287
edc0c37a82237b020fff1e6b4af176fe5caff79b
193
require_relative '../../spec_helper' require_relative '../../shared/queue/num_waiting' describe "Queue#num_waiting" do it_behaves_like :queue_num_waiting, :num_waiting, -> { Queue.new } end
27.571429
68
0.751295
398a8fc17196266abbe1224a5d7da8de1e61acb7
124
require 'test_helper' class AttractionTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
15.5
46
0.709677
bfc04845c9c684824f6a8c96dc1a3f063952c92c
163
# frozen_string_literal: true require_relative "irb/version" module All module Irb class Error < StandardError; end # Your code goes here... end end
14.818182
36
0.717791
1dfb725b44c4674e634a4d15b360eba07774dcf2
2,315
class PreprocessinatorIncludesHandler constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper # shallow includes: only those headers a source file explicitly includes def invoke_shallow_includes_list(filepath) @task_invoker.invoke_test_shallow_i...
41.339286
137
0.711015
bf9b322f19912f136ced712279a504228be9da28
4,776
Rails.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 threaded web serve...
45.056604
114
0.762353
e84e9477a6ac75bc7a4fab12961eff2c53f6a0ab
178
class CreateMuscleGroups < ActiveRecord::Migration[5.0] def change create_table :muscle_groups do |t| t.string :name t.timestamps null: false end end end
19.777778
55
0.691011
38b6448fc7c4070bf0bcd76d15c540f601082384
529
require "quandl/data/version" require 'quandl/support' require "quandl/operation" require 'quandl/babelfish' require 'quandl/error/date_parse_error' require 'quandl/data/attributes' require 'quandl/data/cleaning' require 'quandl/data/operations' require 'quandl/data/format' require 'quandl/data/validations' require ...
21.16
69
0.799622
e994819a4fa123346fb051060c950e07ad799f73
968
class VariantDetailPresenter < VariantIndexPresenter def as_json(opts = {}) super.merge( { evidence_items: variant.evidence_items.map { |ei| EvidenceItemIndexPresenter.new(ei) }, variant_groups: variant.variant_groups.map { |vg| VariantGroupIndexPresenter.new(vg) }, assertions: varia...
46.095238
95
0.716942
38f6db2e8bffff170d01bc33b07730811cddc1d3
128
module Approvals module DSL def verify(object, options = {}) Approval.new(object, options).verify end end end
16
42
0.664063
28eb0d064349c0bafd6121004b70c63e8f270072
825
# frozen_string_literal: true # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
26.612903
74
0.72
e9eda2feee75e9e109f492e161edfc3d3f1bc1fc
2,427
require "test_helper" class LinkValidatorTest < ActiveSupport::TestCase class Dummy include Mongoid::Document field "body", type: String field "assignee", type: String GOVSPEAK_FIELDS = [:body].freeze validates_with LinkValidator end context "links" do should "not be verified for blank...
28.552941
80
0.649361
62d4579df3f8e2778911383b76a3bddefbb3a6fb
1,141
class Libtirpc < Formula desc "Port of Sun's Transport-Independent RPC library to Linux" homepage "https://sourceforge.net/projects/libtirpc/" url "https://downloads.sourceforge.net/project/libtirpc/libtirpc/1.3.1/libtirpc-1.3.1.tar.bz2" sha256 "245895caf066bec5e3d4375942c8cb4366adad184c29c618d97f724ea309ee17" ...
27.829268
96
0.644172
21d0b7801d929b81a28f813c7dcdf0d7593643f5
147
# frozen_string_literal: true module DropboxApi::Metadata class MetadataV2 < Base field :metadata, DropboxApi::Metadata::Resource end end
18.375
51
0.768707
8767042950fd217cfe3986a966136475dc537868
13,153
# frozen-string-literal: true # # The pg_hstore_ops extension adds support to Sequel's DSL to make # it easier to call PostgreSQL hstore functions and operators. # # To load the extension: # # Sequel.extension :pg_hstore_ops # # The most common usage is taking an object that represents an SQL # expression (such as a ...
31.770531
189
0.632479
91b4e023c067a06a2838498101b0a5fc472a5d30
3,337
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper") context "A paginated dataset" do before do @d = Sequel::Dataset.new(nil) @d.meta_def(:count) {153} @paginated = @d.paginate(1, 20) end specify "should raise an error if the dataset already has a limit" do proc{@d.l...
33.37
98
0.682349
f7440a5865c4eec0ad77a97f2f025703d8bf3f6a
39,945
module Sequel class Dataset # --------------------- # :section: 2 - Methods that execute code on the database # These methods all execute the dataset's SQL on the database. # They don't return modified datasets, so if used in a method chain # they should be the last method called. # ----------...
38.00666
143
0.607861
261a4f07e816791defc3b8c6d9c0ba46fee529d6
794
# compute NPV given cash flows and IRR def npv (cf, irr) (0...cf.length).inject(0) { |npv, t| npv + (cf[t]/(1+irr)**t) } end # compute derivative of the NPV with respect to IRR # d(C_t * (1+IRR)**t)/dIRR = -t * C_t / (1+IRR)**(t-1) # def dnpv (cf, irr) (1...cf.length).inject(0) { |npv, t| npv - (t*cf[t]/(1+irr)**(t-...
21.459459
70
0.573048
1d3ee9334bf4d5fbffc4b38b239b6dbe30228f10
2,454
module Providers class EditInitialAllocationsController < ApplicationController def edit flow = EditInitialRequestFlow.new(params: params) if request.post? && flow.valid? redirect_to flow.redirect_path else render flow.template, locals: flow.locals end end def upd...
29.566265
118
0.684597
e9d197956687a3e19e46b38b697c0e88e7d753e5
12,137
# frozen_string_literal: true shared_examples 'event subscriber component' do describe 'subscriber component behavior' do describe '#subscribe_to_scope' do let!(:deposit_event) { build_event_class('deposit') } let!(:deposit_created_event) { build_event_class('deposit.created') } let!(:deposit_c...
43.192171
100
0.702398
f819df03b1980e6f56705d26fb45cfbaf6838118
37
class UnzipError < StandardError end
12.333333
32
0.837838
b95b046adecdb921320e209653b5a25cb182fa38
500
# frozen_string_literal: true require File.expand_path('boot', __dir__) require "rails" require "active_model/railtie" require "action_controller/railtie" require "action_view/railtie" require "action_view/storybook/engine" require "sprockets/railtie" # Require the gems listed in Gemfile, including any gems # you've...
23.809524
56
0.784
bb24b10db132b15a9b14fe2218f68aa690128cd0
2,417
# frozen_string_literal: true require 'injection_vulnerability_library' module ApiTester # Tests injection cases module InjectionModule def self.go(contract) reports = [] contract.endpoints.each do |endpoint| endpoint.methods.each do |method| reports.concat inject_payload contrac...
30.594937
75
0.609433
1d01a3b29eae5741830d97e381f5873b3e966443
1,158
# frozen_string_literal: true module Masterfiles module TargetMarkets module Country class New def self.call(parent_id, form_values: nil, form_errors: nil, remote: true) ui_rule = UiRules::Compiler.new(:country, :new, form_values: form_values, region_id: parent_id) rules = ui_...
32.166667
110
0.588083
1858420c3dcf9a2ad6954ba7144e3cbcdf56c5c1
1,908
require "spec_helper" require "json" describe PastInterlibraryLoans do let(:query) { {"$filter" => "RequestType eq 'Loan' and (TransactionStatus eq 'Request Finished' or startswith(TransactionStatus, 'Cancelled'))", "$top" => "15"} } context "three loans" do before(:each) do stub_illiad_get_request(url: ...
31.278689
166
0.627883
b9b22f93959109db2f4d0989fac72bd58dd1d5fc
2,029
require 'test_helper' class TxnTest < Test::Unit::TestCase def setup mkdir File.join(File.dirname(__FILE__), 'tmp') @env = Bdb::Env.new(0) env_flags = Bdb::DB_CREATE | # Create the environment if it does not already exist. Bdb::DB_INIT_TXN | # Initialize transactions ...
27.053333
93
0.59931
f795ef7fe3dc59d587e2feeab377f850a61562fd
934
class Unshield < Formula desc "Extract files from InstallShield cabinet files" homepage "https://github.com/twogood/unshield" url "https://github.com/twogood/unshield/archive/1.4.3.tar.gz" sha256 "aa8c978dc0eb1158d266eaddcd1852d6d71620ddfc82807fe4bf2e19022b7bab" license "MIT" revision 1 head "https://gith...
32.206897
93
0.770878
ed675718f2682e55e5cf26bfe147a9b023f915ba
393
class HelpController < ApplicationController skip_before_filter :authenticated?, :only => [:master_authentication] before_filter :authenticated_master?, :only => [:master_authentication] def authentication respond_with(["authorized"], :status => 200, :location => nil) end def master_authentication ...
32.75
73
0.732824
398e5c5259d218839bc67378d100de26118e835e
4,807
# 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 source for your # dat...
44.509259
129
0.722696
e8efe55c2363f61f906b4a55390b2707c930898a
237
class Ping < SlackRubyBotServer::Events::AppMentions::Mention mention 'ping' def self.call(data) client = Slack::Web::Client.new(token: data.team.token) client.chat_postMessage(channel: data.channel, text: 'pong') end end
26.333333
64
0.725738
abd66340419cc34857f925ef1ad6961075aba2fa
159
# frozen_string_literal: true require_relative "utilities/enum" require_relative "utilities/boolean_attributes" require_relative "utilities/common_functions"
26.5
47
0.867925
e28dc30a8c95ed81de20d28ed56de5decc99f7ae
38
module WebStat VERSION = "0.5.1" end
12.666667
19
0.684211
26f5f3ead567a255dbb1f2dfa8893cadc828873d
210
class String def robust_split case self when /,/ self.split(/,/).collect(&:strip) when /\s/ self.split(/\s/).collect(&:strip) else [self.strip] end end end
16.153846
41
0.514286
333c8a2508cca75ea970cd1b1b0d4c739627779a
871
# frozen_string_literal: true class Survey::OptionsType @@options_types = { multi_choices: 1, single_choice: 2, number: 3, text: 4, multi_choices_with_text: 5, single_choice_with_text: 6, ...
22.921053
81
0.576349
1a497e0f3045d0c2aa187c7a6e992183cf749244
1,084
require_dependency 'google_sign_in/redirect_protector' class GoogleSignIn::CallbacksController < GoogleSignIn::BaseController def show redirect_to flash[:proceed_to], flash: { google_sign_in: google_sign_in_response } rescue GoogleSignIn::RedirectProtector::Violation => error logger.error error.message ...
28.526316
107
0.70572
1c82b116550f9ba1a858737dd9893e0a7a591eef
794
# frozen_string_literal: true class Accounts::SessionsController < Devise::SessionsController # before_action :configure_sign_in_params, only: [:create] # GET /resource/sign_in # def new # super # end # POST /resource/sign_in # def create # super # end # DELETE /resource/sign_out # def des...
21.459459
79
0.711587
7aca467dfbc68f16d52559107023101ea2931cc6
923
# coding: utf-8 # vim: et ts=2 sw=2 require 'hrr_rb_ssh/logger' module HrrRbSsh class Authentication class Method class Password < Method NAME = 'password' PREFERENCE = 10 def initialize transport, options @logger = Logger.new(self.class.name) @authenticator = ...
28.84375
112
0.664139
1a3bdb5ced26658a558fb07c6d4eb26fb7a11328
2,167
class MasterMind #Written by Jeremy Herzberg; jeremy.herzberg@gmail.com; www.jeremyherzberg.com #MasterMind algorithm derived by notable researchers (https://en.wikipedia.org/wiki/Mastermind_(board_game)#Algorithms) #This algorithm works by first producing all permutations of possible answers and then eliminatin...
30.097222
204
0.721274
ac40aa58832e89767482a038dbec1490f157a08f
9,767
=begin #Custom Workflow Actions #Create custom workflow actions The version of the OpenAPI document: v4 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'date' module Hubspot module Automation module Actions class ExtensionActionDefinitionPatch # The U...
35.007168
242
0.576738
790f72264229808f76ba55feb7bb325f649c685e
3,786
Rails.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 threaded web serve...
41.152174
102
0.756999
7a7f98d2af1d5b5e66ec2c8d0889ca2717df7a0a
1,359
#!/usr/bin/env ruby require "bundler/setup" require "ray_tracer" require 'benchmark/ips' SPINNER = '+/-\|/-\\'.split("").cycle module RT module_function def render_sphere_ch06 light_source = RT::Light.new(RT::Point[10, 10, -10], Color[1.0, 0.2, 1.0]) canvas = Canvas.new(200, 200, default_color: RT::Colo...
26.647059
80
0.628403
e21b922e833706b2d7b17019fd372a098530bb47
8,823
require 'rails_helper' RSpec.describe Bookings::ProfileAttributesConvertor, type: :model do subject { described_class.new({}) } # Default empty profile describe "#profile_attrs" do context 'with completed profile' do let(:completed_attrs) do build(:school_profile, :completed).attributes en...
56.197452
127
0.725377
bf1446c50ed77627eb2fb02911af78e2ec94965d
3,731
module ActiveRecord module Associations class Preloader class Association #:nodoc: attr_reader :owners, :reflection, :preload_scope, :model, :klass def initialize(klass, owners, reflection, preload_scope) @klass = klass @owners = owners @reflecti...
30.581967
120
0.590458
e8bb7ab71a7c508537986ea494027c42fffb4b4e
213
class CreateVisitors < ActiveRecord::Migration[5.2] def change create_table :visitors do |t| t.string :remote_ip t.timestamps end add_index :visitors, :remote_ip, unique: true end end
19.363636
51
0.685446
391444d1d4f2f69b06ee87528ed31590480b5823
1,151
class Pmd < Formula desc "Source code analyzer for Java, JavaScript, and more" homepage "https://pmd.github.io" url "https://github.com/pmd/pmd/releases/download/pmd_releases/6.36.0/pmd-bin-6.36.0.zip" sha256 "a3aa27cfa8f72ca56aaaa1f56468ea1decfb1b0d1b57005b4f3c386cb80be7fe" license "BSD-4-Clause" bottle d...
27.404762
121
0.664639
ab902b4702e6bfb814a79d2970dc1b47836a29ec
3,707
=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed ...
27.664179
232
0.652279
e8ffd15c76e7d0e71e703b71caadc27a6ae2889a
354
# coding : utf-8 # 負の整数・小数点も入力可能にする require 'quickpack/validation' class DecimalNumericCheckValidator < ActiveModel::EachValidator include Quickpack::Validation def validate_each(record, attribute, value) record.errors.add(attribute, I18n.t('errors.messages.decimal_numeric_check')) unless value =~...
25.285714
118
0.714689
0155fab90ceaa01183cd4e46120476e9aeebf457
6,982
require 'rails_helper' context 'when NOMIS is missing information' do let(:prison_code) { 'LEI' } let(:offender_no) { 'A1' } let(:stub_keyworker_host) { Rails.configuration.keyworker_api_host } let(:staff_id) { 111_111 } describe 'when logged in as a POM' do before do stub_poms = [{ staffId: staff...
35.262626
160
0.631911
6132eb6142787c548697f6ee2ae3b35645be1b38
2,874
# 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 source for your # dat...
40.478873
97
0.724426
aba26e8b5c8e9eb31fe8de4fbfb92d113885fa87
7,950
require "test/unit" require_relative "../lib/more_ruby" class TestArray < Test::Unit::TestCase def test_random a = (1 .. 20).to_a randoms = [] count = 20 count.times do randoms << a.random end assert_equal(count, randoms.size) r...
41.19171
162
0.639245
392e876b64ba9aa4c2d4126bb946e4cdc5cf8da8
417
require_relative '../achievement' class TopTenMonth < Achievement def initialize super 'Top 10 month', 'top_ten_month', 'Place yourself top 10 for a month', 'Hardcore', 25 end def achieved? user from = Date.today.last_month.beginning_of_month to = Date.today.last_month.end_of_month Us...
27.8
98
0.707434
ace62e1191cc8c52e2116584fd687fb894c324d7
1,155
cask 'unity-facebook-games-support-for-editor@2018.4.13f1' do version '2018.4.13f1,497f083a43af' sha256 :no_check url "https://download.unity3d.com/download_unity/497f083a43af/MacEditorTargetInstaller/UnitySetup-Facebook-Games-Support-for-Editor-2018.4.13f1.pkg" name 'Facebook Gameroom Build Support' homepag...
32.083333
150
0.722078
28cc7a280e7979d42e17ac0f2fc0c092f99cf725
4,137
require File.join(File.dirname(__FILE__), "spec_helper") describe "::ORI::Tools" do mod = ::ORI::Tools describe ".ansi" do meth = :ansi it "returns empty string if no attrs are given" do mod.send(meth).should == "" end it "refuses to take unknown attributes" do proc do mod.se...
37.609091
157
0.624365
6ab8ec00e44adf89bf912b266a9974070d67260e
812
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core/handler/bind_tcp' require 'msf/core/payload/windows/bind_tcp' module MetasploitModule CachedSize = 285 include Msf::Payload::Stager include Msf::Payload::...
27.066667
66
0.610837
110a3e2a93bf44fd62cb0548f75a9dc5f51ee5ef
192
class CreateDentists < ActiveRecord::Migration[5.2] def change create_table :dentists do |t| t.string :name t.string :email t.string :password_digest end end end
19.2
51
0.666667
6ab12b883ad0e2e8c4fb80ddb9ad91abcb2a3631
3,316
class ConsensusGenomeCoverageService include Callable # Maximum number of bins (will be used) MAX_NUM_BINS = 500 class NoDepthDataError < StandardError def initialize(workflow_run) super("No depth data available for workflow_run #{workflow_run.id}.") end end def initialize( workflow_run...
30.145455
105
0.675513
1c4e01c4a3826b3276045460e8b0c24ea314a90c
119
# frozen_string_literal: true require 'rails_helper' RSpec.describe User::AuthenticateFromSSO, type: :service do end
17
59
0.806723
ac5f11f59e35268b466fcef244338539941f44de
10,232
require 'test_helper' class BeanstreamTest < Test::Unit::TestCase def setup Base.mode = :test @gateway = BeanstreamGateway.new( :login => 'merchant id', :user => 'username', :password => 'password' ) @credit_card = credit_card @chec...
42.811715
965
0.718041
1d9dc792313d6778346de919e4e6ab19e4bac1d4
375
# encoding: utf-8 #gem style #require 'prawn_report.rb' #dev style require File.expand_path(File.dirname(__FILE__) + "/simple_listing_people.rb") require 'yaml' data = YAML::load( File.open( File.expand_path(File.dirname(__FILE__) + "/data/people.yml") ) ) f = PeopleListing.new f.params[:filters] = [['Somente Ati...
20.833333
95
0.693333
394f7cbacdb9a42e6842583e1973b9b7d3b30f4d
3,372
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../spec/dummy/config/environment', __dir__) ActiveRecord::Migrator.migrations_paths = [File.expand_path('../spec/dummy/db/migrate', __dir__)] ActiveRecord::Migrator.mig...
41.121951
97
0.759193
bfa38bf3368cbf592cdf8d6878fd491f91dc9222
501
# frozen_string_literal: true module ActiveAuthorization module ControllerConcern module ClassMethods private def authorize_before_action!(**filter_options, &block) before_action(**filter_options) do params = AuthorizationParams.new( seeker: current_user, me...
21.782609
60
0.622754
62ae027667f9a72416ad5387e24891383e8359bf
1,126
class Mutations::BaseRejectOffer < Mutations::BaseMutation null true argument :offer_id, ID, required: true argument :reject_reason, Types::CancelReasonTypeEnum, required: false field :order_or_error, Mutations::OrderOrFailureUnionType, 'A union of success/failure', null: false def resolve(offer_id:, rejec...
29.631579
109
0.762877
91b5e5ad16c137cca12434ba928187c008e2eaad
13,415
require 'net/http' require 'json' require 'open-uri' ##Init Vars $insuff_globe = "9062058446" $insuff_tm = "9368723185" $address = "9175744034" $smart = "9213151819" $sun = "9423532715" $message = "TEST" ##SMS Normal APP $uri = URI.parse("http://devapi.globelabs.com.ph/smsmessaging/v1/outbound/7117/requests...
42.053292
152
0.58196
e840e4f7cfc1d5a9c4f7880a579f36183a5f34df
1,913
class GoogleCalendar def initialize(config, logger) @config = config @key = Google::APIClient::PKCS12.load_key(@config['google']['key_file'], @config['google']['key_secret']) @client = Google::APIClient.new(application_name: "Huginn", application_version: "0.0.1") @client.retries = 2 @logger ||= l...
30.365079
109
0.64506
e8d5ca819f6a7ec3259026aabd2f5a81ec3d9576
652
class AddReferenceToProductLists < ActiveRecord::Migration def up add_column :stall_product_lists, :reference, :string add_index :stall_product_lists, :reference, unique: true # Migrate all references stored in the JSON data columns to the new # reference column ProductList.update_all("reference ...
34.315789
71
0.73773
394488034e93c1029f4b4cdd71fdc44ee62c7765
2,337
class LoggedException < ActiveRecord::Base class << self def create_from_exception(controller, exception, data) message = exception.message.inspect message << "\n* Extra Data\n\n#{data}" unless data.blank? create! \ :exception_class => exception.class.name, :controller_name => co...
34.880597
141
0.638425
91ad88928ff381473de1d59a7e9db4acb851fb80
5,977
module Watir class Capabilities attr_reader :options def initialize(browser, options = {}) @options = options.dup Watir.logger.info "Creating Browser instance of #{browser} with user provided options: #{@options.inspect}" @browser = if browser == :remote && @options.key?(:browser) ...
39.846667
113
0.641292
79a647f8bb2613c18b3bceb4c2232ffc9971db9d
22,767
require 'spec_helper' require 'request_spec_shared_examples' RSpec.describe 'v3 service bindings' do let(:app_model) { VCAP::CloudController::AppModel.make } let(:space) { app_model.space } let(:user) { make_developer_for_space(space) } let(:user_headers) { headers_for(user, user_name: user_name) } let(:user...
39.321244
171
0.526552
112b6c94437d301bca0da2163cf85e95a9b24c75
367
module Fog module Hadoop class HDFS class Namenodes < Fog::Collection model Fog::Hadoop::HDFS::Namenode def all namenodes = [] service.list_namenodes.each do |namenode| namenodes << Fog::Hadoop::HDFS::Namenode.parse(namenode) end load(name...
20.388889
68
0.564033