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
abd678d2a15af58ef155a3381c5c409a339437e5
98
# frozen_string_literal: true class HelpController < ApplicationController def index end end
14
44
0.806122
1aecfbbe4343a08281d098e95c79ef36a7ac29ff
349
Execute.define_task do desc "secret", "Generate a cryptographically secure secret session key" def secret begin require 'securerandom' puts SecureRandom.hex(64) rescue LoadError puts "Missing secure random generator. Try running `rhoconnect secret` in a rails application instead." end...
31.727273
110
0.724928
1a6b432a50596871932c096400228e6741888fc4
88
# frozen_string_literal: true class Profile < ApplicationRecord belongs_to :user end
14.666667
33
0.806818
4ae99f3fd1f6076a9991aca8a4371ad886d56d1f
109
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "harvest/api" require "minitest/autorun"
21.8
58
0.743119
7a29f4ae1e07b40cecc7453ed452fdea4878eb40
370
begin require 'spec' rescue LoadError require 'rubygems' gem 'rspec' require 'spec' end # this is my favorite way to require ever begin require 'mocha' rescue LoadError require 'rubygems' gem 'mocha' require 'mocha' end Spec::Runner.configure do |config| config.mock_with :mocha end $:.unshift(File....
15.416667
46
0.713514
b94541af0d19ff8fce372378d505764a973e92ae
1,634
require "commander" require "fastlane_core" require "supply" HighLine.track_eof = false module Supply class CommandsGenerator include Commander::Methods FastlaneCore::CommanderGenerator.new.generate(Supply::Options.available_options) def self.start new.run end def run program :nam...
25.936508
113
0.655447
33be770755233adfcabf2234337d49f8782167f5
1,396
require_relative 'docker_service' module Dory class Proxy extend Dory::DockerService def self.dory_http_proxy_image_name setting = Dory::Config.settings[:dory][:nginx_proxy][:image] return setting if setting certs_dir && !certs_dir.empty? \ ? 'codekitchen/dinghy-http-proxy:2.5.9' \...
25.851852
78
0.616046
e29347505e9fd796d062132f4e4d6ccb52a797dc
92
module Checkoutfi module Test autoload :Actions, 'checkout_fi/test/actions' end end
15.333333
49
0.75
b997f8d7b28d6abede0e2aa605bf5e543f1ea30b
11,616
# 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...
36.87619
190
0.717631
61c0e61fae96b29769f57ae74a4da3f3311bb97b
226
require 'nokogiri' require 'open-uri' class CliEplTable::Scraper # scrape premierleague.com/tables for the html def self.scrape_site doc = Nokogiri::HTML(open("https://www.premierleague.com/tables")) end end
25.111111
71
0.721239
e26b080f1540bce03f34c43477af1dc6da9068f7
922
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved. # License: Ruby License require "osx/cocoa" require "sgl/sgl-color" require "sgl/cocoa-event" require "sgl/cocoa-window" require "sgl/cocoa-draw" require "sgl/cocoa-color" require "sgl/cocoa-media" module SGL class Application def initialize i...
20.954545
73
0.698482
f8b00985ada0b2abef0c60b833c811497e42fba6
715
module HeadshotSupport def headshot_file_path file_name = "headshot_capture_#{headshot_file_timestamp}.jpg" File.join(Rails.root, 'public', 'headshots', file_name) end def headshot_image_url(file_name) 'http://' + request.host_with_port + '/headshots/' + file_name end def headshot_save_image(fil...
23.064516
94
0.672727
4a1686f131b754d51edefe876ddf016bb7118620
4,789
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::HttpServer::HTML include Msf::Exploit::EXE include Ms...
32.578231
112
0.630403
115b988b3d52bfb6951eacbaafd8a74064067775
1,443
class PhotoMigration < ActiveRecord::Base #<PhotoMigration id: 1, county_id: 149, # graveyard_id: 1, contributor_id: 1, # contributor_name: "hucke", # old_path: "/IL/Cook/qi/acaciapark.jpg", # graveyard_name: "Acacia Park Cemetery", # created_at: "2014-05-25 23:06:48", # updated_at: "2014-05-25 23:06:48">...
22.546875
60
0.638254
1c4339f338f6e313656d3bf5362e5da2b5892c15
674
#!/usr/bin/env ruby require 'ffi' module Fortran extend FFI::Library ffi_lib "./libpartitions.so" attach_function :partitions_, [ :pointer, :pointer ], :int end deck = ([4]*9) deck << 16 d = 0 for i in 0..9 # Dealer showing deck[i] = deck[i]-1 p = 0 for j in 0..9 deck[j] = deck[j]-1 cards = F...
18.722222
60
0.614243
086265de190667b8dada995acf30ec575f25d145
1,066
class AssetSubtypeReport < AbstractReport def initialize(attributes = {}) super(attributes) end def summarize(assets, subtypes) a = [] labels = ['Asset Subtype', 'Count'] subtypes.each do |x| count = assets.where(asset_subtype_id: x.id).count a << [x.name, count] unless coun...
23.173913
116
0.674484
33b0a4431fdc6ff5912c9c31a5a9a3fec05bf6ba
311
class CreateUser include Interactor delegate :user_params, to: :context def call context.user = User.new(user_params) context.fail!(error_data: error_data) unless context.user.save end private def error_data { message: "Record Invalid", detail: context.user.errors.to_a } end end
17.277778
67
0.720257
01a061c9c559105a02fe723504c12db06ad400e1
250
module Types class MutationType < Types::BaseObject field :add_book, mutation: Mutations::AddBookMutation field :update_book, mutation: Mutations::UpdateBookMutation field :delete_book, mutation: Mutations::DeleteBookMutation end end
31.25
63
0.784
62404de99f3286c08c457df9ed52ef222562d28b
567
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "component_one" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedenc...
28.35
82
0.767196
114d2ef9a167267abbcedb32a84a3f174ff5450c
2,709
class SchedulesController < ApplicationController before_filter :require_logged_user, :only => [:new, :create, :edit, :update] def new @schedule = Schedule.new auxiliary_objetcs redirect_to root_path, :notice => t("flash.unauthorized_access") unless authorized_access?(@event) end def create ...
23.763158
102
0.653008
181c1bee0e8788158525eb5f5a74a089a137bc0a
116
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "yandex/translator" require "minitest/autorun"
19.333333
58
0.75
e9be1923743fb01e90ac5a78e798a98a1f706d57
366
require 'appstore_kit_fork/models/model' module AppstoreKitFork # Simple model class for representing Apps class App < Model attr_reader :bundle_id, :name, :sku def initialize(options) super(options) attrs = options['attributes'] @bundle_id = attrs['bundleId'] @name = attrs['name'...
20.333333
44
0.655738
e26e9d710982f9a4c0ecbf1a8cee8a573711d0b2
12,751
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmat...
49.042308
152
0.750451
4aa383140d97c358a9f6b1262a4747fd89b818c5
387
cask :v1 => 'airmail-amt' do version :latest sha256 :no_check url 'https://rink.hockeyapp.net/api/2/apps/af58f04487c30ac4c1e8706aa9e41c5b?format=zip' name 'Airmail - Account Migration Toolkit' homepage 'http://airmailapp.com/amt/' license :unknown # todo: change license and remove this comment; ':unknow...
32.25
115
0.741602
629780715edd72f4c5576d261adda5e69fd7c1ef
3,455
require 'ffi-portaudio' include FFI::PortAudio # from https://github.com/corbanbrook/fourier_transform class FourierTransform attr_reader :spectrum, :bandwidth, :samplerate, :buffersize def initialize buffersize, samplerate @buffersize = buffersize @samplerate = samplerate @bandwidth = (2.0 / @buff...
24.856115
122
0.621418
acad82751435a76e30c44a0701eec0ba1d645e10
1,147
#!/usr/bin/env ruby require 'json' # filepath to the output of querying optica for all hosts # # wget http://optica.d.musta.ch/ -O ~/tmp/optica_output.txt # ruby optica_query.rb ~/tmp/optica_output.txt > /tmp/out 2> /tmp/err # # number of hosts that don't have titanic installed # cut -d, -f3 /tmp/out | rg '^$' | wc ...
27.97561
94
0.607672
ac7264970d27378d8c315825bd83a960c0c8378d
6,826
# 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::MediaServices::Mgmt::V2018_07_01 # # A service client - single point of access to the REST API. # class AzureMediaServices < MsRestAzu...
36.698925
154
0.697773
26a1aa0ad99197889d86bdf19c6be69969138e81
1,223
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
35.970588
74
0.776778
21f049d6aef55facaacafe63bc772916a2a3c4f2
13,509
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmat...
49.123636
154
0.751129
bf8201b1ac4b3f0ae70f1880725b84fd065653a9
8,687
require 'spec_helper' describe 'Resource Owner Password Credentials Flow not set up' do before do client_exists create_resource_owner end context 'with valid user credentials' do it 'does not issue new token' do expect do post password_token_endpoint_url(client: @client, resource_owner...
33.670543
116
0.672269
ab69642a4c784ff25eeb1052c75b899fb83251fb
7,234
=begin #Xero Payroll UK #This is the Xero Payroll API for orgs in the UK region. Contact: api@xero.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'time' require 'date' module XeroRuby::PayrollUk require 'bigdecimal' class EmployeeStatutoryLeavesSummaries at...
30.267782
231
0.627039
ed6ca9c9c91866eaa654edafc543724092d97a7c
118
module ActiveIdentity module AccountAdapters class AbstractAccount attr :user, true end end end
9.833333
25
0.694915
261e44bc5fa0928e65e6205b36aa85da54f06930
7,999
# frozen_string_literal: true require 'spec_helper' describe Gitlab::ProjectAuthorizations do def map_access_levels(rows) rows.each_with_object({}) do |row, hash| hash[row.project_id] = row.access_level end end subject(:authorizations) do described_class.new(user).calculate end context '...
31.742063
96
0.675834
ed1ce0a19dc9cd28a0cc1e580b99866127c55820
1,273
Gem::Specification.new do |spec| spec.name = 'lita-onewheel-slack-take-it-back' spec.version = '0.0.0' spec.authors = ['Andrew Kreps'] spec.email = ['andrew.kreps@gmail.com'] spec.description = 'Enables a "Take that back" feature on your slack bot.' spec.summary = "Just ...
43.896552
92
0.659073
2647a55aa36a6cb5f63c3f14247c47370fbc9238
674
class EventsController < ApplicationController include EventsHelper def new @event = Event.new end def show @event = Event.find(params[:id]) @attendees = @event.attendees end def create @user = User.find(session[:current_user_id]) @event = @user.created_events.build(event_params) ...
19.257143
61
0.676558
e8a13bf76ac5a574547d0235a020fc17180dafa0
1,479
# == Schema Information # # Table name: sources # # id :integer not null, primary key # type :string(255) # url :string(255) # name :string(255) # value :integer # created_at ...
37.923077
73
0.50169
aba541c4b4a1ddf82e64117fc38eb5e1b2f36681
1,882
require 'oga' require 'open-uri' require_relative 'name_mapping' module WeatherScraper # parse daily weather description from cwb website class DailyWeather include NameMapping CWB_URL = "http://www.cwb.gov.tw" CITY_WEATHER_URL = "#{CWB_URL}/V7/forecast/taiwan/" def initialize(city) @city = ...
26.885714
96
0.614772
acf7156e455b6951c94fc7c21d09a773bcb52a83
7,504
class GroupManagersController < ApplicationController before_action :authenticate_admin!, only: [:index] before_action :set_app, only: [:index] before_action :check_authenticated_admin_or_manager, only: [:show, :add_manager_permission,:is_manager_permitted, :remove_manager_permission] before_action :set_manager...
33.801802
143
0.686034
33df519bf7867c1b5eda8a250d7a0e37f38399dc
59
# frozen_string_literal: true module ActivitiesHelper end
11.8
29
0.847458
33a3c0973623af5deab04045fcafa1e388ee2b77
119,423
require 'test_helper' module Credits class CanonicalNamesTest < ActiveSupport::TestCase include AssertContributorNames test 'タコ焼き仮面' do assert_contributor_names '84403ae', 'Takoyaki Kamen' end test '松田 明' do assert_contributor_names 'bb33432', 'Akira Matsuda' end test '簡煒航' do ...
23.662176
81
0.672869
6a0c97941cda1a17dca9078f9ca3d8e659273a17
279
class AddFalseByDefaultToRetiredOnItems < ActiveRecord::Migration def change change_column :items, :retired, :boolean, :default => false Item.all.each do |item| if item.retired.nil? item.retired = false item.save end end end end
19.928571
65
0.648746
334474d7d2d37da4d40829bfbf91568af4f56648
416
module Health class AbstractHealthController < ApplicationController newrelic_ignore_apdex def index summary = health_checker.check # Add health check summary data to New Relic traces. ::NewRelic::Agent.add_custom_attributes( health_check_summary: summary.as_json, ) re...
24.470588
85
0.709135
1db5cc596d2b298768f9972394c22279b1ac4cab
244
class Author < ApplicationRecord has_one :account, dependent: :destroy has_many :posts, dependent: :destroy validates :name, presence: true validates_associated :account accepts_nested_attributes_for :account, update_only: true end
24.4
59
0.790984
1c572d6fd3f8a17f74e6e53e7019b058b5950c2c
1,931
class UsersController < ApplicationController before_action :logged_in_user, only: [:index, :edit, :update, :destroy, :following, :followers] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users =...
22.453488
73
0.611082
79e23ecc800f4f75ca25a1ac37f8dba57fd721e7
489
class Location < ApplicationRecord has_many :inventory_tallies, foreign_key: :storage_location_id has_many :meetings has_many :purchases has_many :volunteers, foreign_key: 'university_location_id', dependent: :nullify enum location_type: { # Example types from ERD storage_unit...
27.166667
64
0.693252
ac3ac9d6c31d4260e3fc01d91023cbed652b46a2
151
module IDViewTool class Renderer def self.copyright name, msg "&copy; #{Time.now.year} | <b>#{name}</b> #{msg}".html_safe end end end
21.571429
65
0.622517
e2e3c1b8b8f62cef0223c11fb5ab49cef312236f
3,335
class AddFtsToHistory < ActiveRecord::Migration[5.1] def self.up execute "SET statement_timeout = 0" execute "SET search_path = public" execute "ALTER TABLE history_changes ADD COLUMN value_index tsvector" # Is there seriously no string join function in Postgres, even though it has three # diffe...
34.739583
122
0.665967
bf4e3a23d3de4b801a4cfec7dbafee9f10267a3f
1,220
# 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, ...
32.972973
76
0.736885
ff0a44b24da7f70209027600e5edb549e515f372
451
require 'test_helper' class NotesControllerTest < ActionDispatch::IntegrationTest test "should get index" do get notes_index_url assert_response :success end test "should get create" do get notes_create_url assert_response :success end test "should get update" do get notes_update_url ...
18.04
59
0.740576
e90f1452f0bd6f828fa288093c98ce642d79718d
1,275
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "activemodel" s.version = "4.2.5" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.date = "2015-11-12" s.description = "A toolkit for building ...
37.5
185
0.66902
1cf8d940f2ac4372546fa578b39950769b2e429c
6,494
=begin #Tatum API ## Authentication <!-- ReDoc-Inject: <security-definitions> --> OpenAPI spec version: 3.9.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 3.0.31 =end require 'date' module Tatum class VetTxClauses attr_accessor :to attr_accessor :value ...
28.862222
197
0.60656
62868af78c5c4905bf98428b4eb150b117171fd5
2,194
require 'spec_helper' require 'actions/proxmox_action_shared' module VagrantPlugins::Proxmox describe Action::ShutdownVm do let(:environment) { Vagrant::Environment.new vagrantfile_name: 'dummy_box/Vagrantfile' } let(:connection) { Connection.new 'https://proxmox.example.com/api2/json' } let(:env) { {machine:...
33.242424
105
0.716044
876e2e7852ac268972ade4591d0157471fa32b9e
1,608
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
30.923077
75
0.633085
e2fe549c57918e91e6fc953dbdc8bc6c16c45d33
519
class OrderSerializer < ActiveModel::Serializer attributes :id, :product, :seller, :buyer # has_one :user # has_one :product def seller seller = User.find_by(id: object.product.user_id) return UserSerializer.new(seller) end def buyer buyer = object.user return UserSerializer.new(buyer) e...
20.76
53
0.685934
acd46e71e0f39b634b5130b8a63a3604d9a9f2a5
2,773
# -*- coding: utf-8 -*- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net> # A base class for a debugger interface. class Trepan unless defined?(NotImplementedMessage) NotImplementedMessage = 'This method must be overriden in a subclass' end # A debugger interface handles the communication ...
26.160377
78
0.617021
283273a1173a5617745d0461fb2c65cb0c405388
579
#!/usr/bin/env ruby # encoding: utf-8 $:.unshift File.dirname(__FILE__) require 'bundler' Bundler.require configure :development do require 'sinatra/reloader' end require 'lib/light' light = Light.new :default before do content_type 'application/json' end get '/' do { status: 'OK', value: light.on? ? 'on' ...
13.159091
59
0.649396
4a4de40944f50bf4eacb0747516e4f94f4b95a7b
127
require 'test_helper' class OrderTransferTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
15.875
49
0.716535
e88ec72d82bdd66ef72cb50e5c1b8278c461aec0
8,326
require File.join(File.dirname(__FILE__), 'spec_helper') describe 'Circle' do describe 'methods' do it {User.should respond_to(:has_circle)} it {Fabricate(:user).should respond_to(:befriend)} it {Fabricate(:user).should respond_to(:friends?)} it {Fabricate(:user).should respond_to(:accept_friend_req...
31.900383
103
0.652294
912cff2b7fb00e9430719db9fb9c6729c243be12
1,332
class Admin::InterestsController < ApplicationController before_action :require_admin before_action :set_interest, only: [:show, :edit, :update, :destroy] # GET /admin/interests def index @interests = Interest.all end # GET /admin/interests/1 def show redirect_to [:admin, :interests] end # ...
21.483871
84
0.692943
d5f1b6ffd63f3d7086d5c1ed1e37425341c49434
530
# frozen_string_literal: true require_relative "support/coverage" require "dry/initializer" begin require "pry" rescue LoadError nil end RSpec.configure do |config| config.disable_monkey_patching! config.order = :random config.filter_run focus: true config.run_all_when_everything_filtered = true # Pr...
18.928571
61
0.754717
ff672e567d2b1de8d8603f7a5b65232f83c23508
8,923
require 'spec_helper' describe Babushka::Prompt, "get_value" do it "should raise when not running on a terminal" do STDIN.should_receive(:tty?).and_return(false) expect { Babushka::Prompt.get_value('value') }.to raise_error(Babushka::PromptUnavailable) end it "should raise when not running on a terminal...
54.078788
151
0.678135
4adb63c8fe9289b8b5c1a09d5de5032d5bb96e55
251
require_relative "base" module Administrate module Field class Link < Field::String def link_label options.fetch(:link_label, "Link") end def target options.fetch(:target, "_blank") end end end end
16.733333
42
0.621514
ed7be9b98bff956d64bf770b3467759f00a10974
913
require 'spec_helper' module Pacto describe NativeContractFactory do let(:host) { 'http://localhost' } let(:contract_name) { 'contract' } let(:contracts_path) { %w(spec fixtures contracts) } let(:contract_path) { File.join(contracts_path, "#{contract_name}.json") }...
35.115385
85
0.657174
03fea8070d3e1b44813f02455da9fd07cb65092e
277
API.new.get_cocktails_data CocktailData.all.each do |cocktail| cock=Cocktail.create(name: cocktail.strDrink, glass: cocktail.strGlass, ingredient: cocktail.strIngredient.join(", "), instruction: cocktail.strInstructions, image: cocktail.strDrinkThumb) cock.save end
55.4
193
0.787004
e92ab2a5a730e96ab819416420ff08698628519f
312
require 'upsert/connection/jdbc' class Upsert class Connection # @private class Java_OrgPostgresqlJdbc4_Jdbc4Connection < Connection include Jdbc include Postgresql def quote_ident(k) DOUBLE_QUOTE + k.to_s.gsub(DOUBLE_QUOTE, '""') + DOUBLE_QUOTE end end end end
19.5
69
0.685897
b9e1459299aa0c74654dee2cd7a35f91fd0facbe
25
module UsersHelper end
5
18
0.8
f8c94fd65641c523c6cd47391b5d99fabee10061
7,903
=begin #Ory APIs #Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. The version of the OpenAPI document: v0.0.1-alpha.9 Contact: support@ory.sh Generated by: https://openapi-generator.tech Op...
30.164122
213
0.622928
38d8e33efd788d0d77f150d11ec053c857cb1318
5,680
require 'ansi/code' module MiniTest module Reporters # A reporter identical to the standard MiniTest reporter except with more # colors. # # Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License). # # @see https://github.com/seattlerb/minitest MiniTest class DefaultReporter in...
26.919431
99
0.555458
91bf7c049ef40b79db37fd83dd7d663d6b067f08
241
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/fixtures/classes.rb' require File.dirname(__FILE__) + '/shared/each.rb' describe "String#each_line" do it_behaves_like(:string_each, :each_line) end
30.125
55
0.751037
e251dcb2a01987bd336ee2c0b6653afecc7469ff
1,555
require "datafixes" require "datafix/version" require "datafix/railtie" if defined?(Rails) class Datafix class << self DIRECTIONS = %w[up down] def migrate(direction) raise ArgumentError unless DIRECTIONS.include?(direction) ActiveRecord::Base.transaction do send(direction.to_sym) ...
27.280702
133
0.66881
33a874ef204cbd1bacc80da64d08e884f099a119
2,156
# lib/file_size_validator.rb # Based on: https://gist.github.com/795665 class FileSizeValidator < ActiveModel::EachValidator ERROR_MESSAGES = { :is => :wrong_size, :minimum => :size_too_small, :maximum => :size_too_big }.freeze VALIDATIONS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze DEFAULT_TO...
31.246377
127
0.688312
edff7979bc6e6e6bc6c070d8942cbb3f03cfef3c
3,164
# encoding: utf-8 require "test_utils" require "logstash/filters/split" require "logstash/filters/clone" describe LogStash::Filters do extend LogStash::RSpec describe "chain split with mutate filter" do config <<-CONFIG filter { split { } mutate { replace => [ "message", "test" ] } ...
25.723577
58
0.524968
26154f8b1eca7fe4cf6088d84cdc435b627ad74e
12,654
# # Author:: Christopher Maier (<maier@lambda.local>) # Copyright:: Copyright 2011-2017, 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 Licens...
37.43787
132
0.613166
397b85c98cdcaed5f35b4a1f2eb21d26685044d7
451
module Refinery module News module Admin class ItemsController < ::Refinery::AdminController crudify :'refinery/news/item', sortable: false, order: "publish_date DESC", xhr_paging: true private def item_params params.r...
21.47619
107
0.569845
081a1b1fa978ea73308b71e28b3f8d2bfa87d647
112
# frozen_string_literal: true class CatalogController < ApplicationController include Blacklight::Catalog end
22.4
47
0.848214
6ada370c9af2f98da3e0f84e21005d33e241eb56
348
class ContainerBuildController < ApplicationController include ContainersCommonMixin before_action :check_privileges before_action :get_session_data after_action :cleanup_action after_action :set_session_data def show_list process_show_list end private ############################ def display_...
18.315789
54
0.735632
26a7cfd2ff6f22c3e7e40867031a112855b1850a
1,732
require "rails_helper" RSpec.describe CreateAuditLogsWorker, type: :job do describe "#perform_later" do let!(:user) { create :user } let(:record_class) { "Patient" } let(:records) { create_list(record_class.underscore.to_sym, 3) } let(:record_ids) { records.pluck(:id) } let(:action) { "fetch" } ...
37.652174
73
0.468822
abd6a32f9c14f02fd7f33951c85921bceb2d6bbe
990
# Wrapper method for quickly loading, rendering ERB templates # and uploading them to the server. def template(from, to) erb = File.read(File.expand_path("../templates/#{from}", __FILE__)) put ERB.new(erb).result(binding), to end # Wrapper method to set default values for recipes. def set_default(name, *args, &blo...
33
74
0.722222
f8508b5fbdfc1575714e2c728f51dd4a059e3c57
2,286
# frozen_string_literal: true # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/LineLength # rubocop:disable Style/Documentation module Gitlab module BackgroundMigration class PopulateForkNetworksRange def perform(start_id, end_id) log("Creating fork networks for forked project links...
35.169231
108
0.68154
4a1f202592374d159e8e94dda4f58daa3a25e522
596
require 'spec_helper' describe ToyAttributes::Observer do it "creates table for new models" do Warrior.table_exists?.should == true end it "creates the correct column_type" do Weapon.columns_hash['name'].type.should == :string Weapon.columns_hash['min_damage'].type.should == :integer ...
23.84
62
0.677852
ed824cf2d950e5b09692445ce44601b255c10f3e
52
all rule 'MD007', :indent => 4 exclude_rule "MD041"
13
26
0.692308
61a65e906a138d4a11b753d1afc079e144567b90
222
class Question < ActiveRecord::Base belongs_to :user has_many :answers validates :content, presence: true def self.count_today Question.where('created_at >= ?', Time.zone.now.beginning_of_day).count end end
22.2
75
0.743243
1c0b0378500d257e4660ae38f82016255d187f4a
238
class AddAreaEditorCommentsToSubmissions < ActiveRecord::Migration def change add_column :submissions, :area_editor_comments_for_managing_editors, :text add_column :submissions, :area_editor_comments_for_author, :text end end
34
78
0.827731
7a23d93565d89c7e87bd300d913515163974efc5
597
require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) Pod::Spec.new do |s| s.name = "react-native-iovation-deviceprint" s.version = package["version"] s.summary = package["description"] s.homepage = package["homepage"] s.license = package["license"] ...
29.85
123
0.61139
f7ff188044ffe3e158fdb12f9440a58ec7f923ba
1,410
require 'test_helper' class FormsControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers include ActiveModelSerializers::Test::Schema include ActiveModelSerializers::Test::Serializer setup do @form = forms(:one) sign_in users(:admin) end test 'api should get inde...
28.77551
63
0.739716
7a0420a7ebb3012dc33962d07a691f7f4a70254b
274
# frozen_string_literal: true module Lokalise module Collections class TeamUserGroup < Base DATA_KEY = 'UserGroup' class << self def endpoint(team_id, *_args) path_from teams: [team_id, 'groups'] end end end end end
17.125
46
0.616788
4a08a2eafc5f22a70ef6613e6d261094d8c13f91
8,274
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
29.870036
104
0.612159
91c033ac66551b943eea05bc00813ac951153f11
674
# frozen_string_literal: true require "forwardable" module EveOnline module ESI class UniverseGraphic < Base extend Forwardable API_PATH = "/v1/universe/graphics/%<graphic_id>s/" attr_reader :id def initialize(options) super @id = options.fetch(:id) end d...
18.216216
78
0.621662
bf05ed8a3b3e347fea9e95407f0057dc6c158c15
122
# frozen_string_literal: true module Praxis module Exceptions class StageNotFound < RuntimeError end end end
13.555556
38
0.754098
21014e81675162f51f421b9b234285b6872b2de7
594
require_dependency "cor1440_gen/concerns/controllers/proyectosfinancieros_controller" module Cor1440Gen class ProyectosfinancierosController < Heb412Gen::ModelosController include Cor1440Gen::Concerns::Controllers::ProyectosfinancierosController before_action :set_proyectofinanciero, only: [:show, :ed...
34.941176
85
0.755892
625d425e26fe14dd8871c68382dc1b861b2698bd
453
class Sub_Category extend Storable::Class include Storable::Instance extend Findable attr_accessor :name, :items attr_reader :category def initialize @items = [] end def category=(cat) @category = cat cat.add_sub_categories(self) end def add_items(ite...
15.62069
36
0.556291
4a0493412134ff670d10587bc91d20ccea64f57d
1,395
require 'test_helper' class NetworkEventsContactsServiceTest < ActiveSupport::TestCase setup do @network_event = network_events(:tuggle_network) end test "returns a special list of member groupings if the query starts with 'all'" do assert_equal([{:text=>"All", :children=>[{"id"=>NetworkEventContactsQu...
36.710526
139
0.641577
339492f690f835d82c5a091d07418f1151e7939d
2,009
## # A VendorSet represents gems that have been unpacked into a specific # directory that contains a gemspec. # # This is used for gem dependency file support. # # Example: # # set = Gem::Resolver::VendorSet.new # # set.add_vendor_gem 'rake', 'vendor/rake' # # The directory vendor/rake must contain an unpacked rake...
23.916667
76
0.652563
bf039cb31fc3e78d257c181165f51d91f3eaec1d
1,353
# -*- encoding: utf-8 -*- require File.expand_path('../lib/wrong/version.rb', __FILE__) Gem::Specification.new do |s| s.name = "wrong" s.version = Wrong::VERSION s.authors = ["Steve Conover", "Alex Chaffee"] s.email = "sconover@gmail.com" s.homepage = "http://github.com/sconover/wrong" s.summ...
41
134
0.706578
1c7c6e71000a0cae9ae551adc9b7692caa712f72
1,576
# frozen_string_literal: true require 'rails_helper' describe AlbumDetector do describe 'assigning a default album' do context 'when the photo is version 1 (newly created)' do let(:photo) do FlickrPhoto.create(id: 'newly created flickr photo', owner: 'owner1', tags: [], ...
35.818182
107
0.600254
4a8381b1df6ecb421cc4ed302dcf5cdcecfb31b9
1,089
require 'forwardable' require 'turnip_formatter/resource/step/failure_result' require 'turnip_formatter/resource/step/pending_result' module TurnipFormatter module Resource module Step class Step include ::TurnipFormatter::Resource::Step::FailureResult include ::TurnipFormatter::Resource::S...
21.352941
64
0.550964
7a31fa37f3dcc5921cb21f9af4924d4bf695239f
1,200
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require File.expand_path(File....
34.285714
103
0.675833
0112b8dcbc23d368ab817c8e73bf273951fad992
4,960
require 'test_helper' class RemoteAustraliaPostTest < ActiveSupport::TestCase include ActiveShipping::Test::Credentials include ActiveShipping::Test::Fixtures def setup @carrier = AustraliaPost.new(credentials(:australia_post)) @sydney = location_fixtures[:sydney] @melbourne = location_fixtu...
35.177305
143
0.762097
ab6c328b2e979d4416a836707e824c264ea81994
4,890
class Ability include CanCan::Ability def initialize(user) user ||= User.new permissions_for user, as: :admin do can :manage, :all end permissions_for user, as: :manager do can :first_login, User can [ :update, :update_password, :update_settings, :setup ], User, id: user.id ...
38.809524
140
0.640491
6a9bb5c8c52d6339776de90cf837d683328c441d
151
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe AmfSocket do it 'should make sure 5 == 5' do 5.should == 5 end end
18.875
65
0.695364