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
38f33169b0fc597d6ff0752722b05fe2b2dffea0
595
require 'logger' require 'active_record/base' module TestHelper module ActiveRecord private def setup_schema ::ActiveRecord::Base.class_eval do connection.instance_eval do create_table :users, :force => true do |t| t.string :name t.string :email ...
20.517241
80
0.642017
61a2be692d7e32091d679a53f0ffa4f38120275f
558
# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE $:.unshift(File.expand_path('../../lib', __FILE__)) $:.unshift(File.expand_path('../../../aws-sdk-core/features'...
32.823529
74
0.713262
0329717448016423a657b296c209c9db9966fee9
965
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "httparty/version" Gem::Specification.new do |s| s.name = "httparty" s.version = HTTParty::VERSION s.platform = Gem::Platform::RUBY s.authors = ["John Nunemaker", "Sandro Turriate"] s.email = ["nunemaker@gm...
38.6
91
0.639378
1a895fc0989504e6e6f862e52b843296e55333e5
1,131
# encoding: utf-8 require 'spec_helper' describe Github::Activity::Starring, '#list' do let(:user) { 'peter-murach' } let(:repo) { 'github' } let(:request_path) { "/user/starred/#{user}/#{repo}" } after { reset_authentication_for subject } context "with username ane reponame passed" do context "this r...
29
71
0.64191
1cfcb18a2714d8118150d71286103a219b9a0531
579
class AddTrophiesTable < ActiveRecord::Migration def change create_table :trophies do |t| t.string :name t.string :image_name t.timestamps end create_table :user_trophies do |t| t.references :user, null: false t.references :trophy, null: false t.references :concept, n...
24.125
83
0.682211
26cab7b637c4c02b6c49a8d0ae4cf5b509e62999
691
class Sec < Formula desc "Event correlation tool for event processing of various kinds" homepage "https://simple-evcorr.sourceforge.io/" url "https://github.com/simple-evcorr/sec/releases/download/2.9.1/sec-2.9.1.tar.gz" sha256 "63a4125930a7dc8d71ee67f2ebb42e607ac0c66216e1349f279ece8f28720a34" license "GPL-2....
31.409091
115
0.746744
bfd7499893f3b751ca18027ce477d30b65a017c9
659
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
50.692308
174
0.814871
1d4b0430931de760d8cfe5329c87affb006fdf54
1,683
shared_examples_for "a baza indexes driver" do let(:driver) { constant.new } let(:db) { driver.db } let(:test_table) do db.tables.create( "test", columns: [ {name: "id", type: :int, autoincr: true, primarykey: true}, {name: "text", type: :varchar}, {name: "email", type: :va...
25.119403
76
0.621509
f836d45d0e88285d6968321c42cd70847e6f555c
34,377
module ActiveRecord module Associations # Association proxies in Active Record are middlemen between the object that # holds the association, known as the <tt>@owner</tt>, and the actual associated # object, known as the <tt>@target</tt>. The kind of association any proxy is # about is available in <t...
34.935976
104
0.49792
ed23c8a4a2c2f9be31e6d5d6e511898cb07a69c3
305
module Ecommerce class Wishlist < ApplicationRecord belongs_to :user, optional: true has_many :wishlist_items enum status: {active: 1, closed: 2} def add_wishlist_items(item_params) WishlistItem.create(user_id: current_user, product: item_params[:product_id]) end end end
21.785714
83
0.731148
bfde964b1a8c73af3de5b218cfb3be5d86ac8093
348
cask 'font-noto-sans-devanagari' do version :latest sha256 :no_check url 'https://noto-website-2.storage.googleapis.com/pkgs/NotoSansDevanagari-unhinted.zip' name 'Noto Sans Devanagari' homepage 'https://www.google.com/get/noto/#sans-deva' license :ofl font 'NotoSansDevanagari-Bold.ttf' font 'NotoSans...
26.769231
90
0.758621
6abd2ab80fb3090e2aebb9981e6e3e0b2b534dfa
278
module PeopleApiStub module_function def setup(attributes = {}) attributes.reverse_merge! FactoryBot.attributes_for(:ldap_entry) WebMock. stub_request(:get, Regexp.new(PeopleApi::URI.host)). to_return(status: 200, body: [attributes].to_json) end end
23.166667
68
0.723022
ed7523d963c4d5dbf2c9e6d624a4d3c344fcc304
590
# frozen_string_literal: true describe 'Sles MemorySwapAvailableBytes' do context '#call_the_resolver' do it 'returns a fact' do expected_fact = double(Facter::ResolvedFact, name: 'memory.swap.available_bytes', value: 1024) allow(Facter::Resolvers::Linux::Memory).to receive(:resolve).with(:swap_free)...
39.333333
118
0.744068
616358a589753b4ccc54ee6ef751063fb3ee5f13
203
class AddMeetingsTextToCommittees < ActiveRecord::Migration def self.up add_column :committees, :meetings_text, :text end def self.down remove_column :committees, :meetings_text end end
20.3
59
0.763547
2676bf19bc9fa91104cf0def9db85cc83ecede56
1,714
module Appsignal class Hooks # @api private class DelayedJobPlugin < ::Delayed::Plugin extend Appsignal::Hooks::Helpers callbacks do |lifecycle| lifecycle.around(:invoke_job) do |job, &block| invoke_with_instrumentation(job, block) end lifecycle.after(:execute) ...
31.163636
94
0.582264
0867cdd422a5a1565aa1fa842b0ebd071b114826
661
require 'spec_helper' describe RailsBestPractices::Core::Nil do let(:core_nil) { RailsBestPractices::Core::Nil.new } context "to_s" do it "should return self" do core_nil.to_s.should == core_nil end end context "hash_size" do it "should return 0" do core_nil.hash_size.should == 0 ...
18.361111
54
0.662632
1c1b775632078b918d9c6545ff50bb6148c5b257
260
require 'test_helper' describe Merit::Score do it 'Point#sash_id delegates to Score' do score = Merit::Score.new score.sash_id = 33 point = Merit::Score::Point.new point.score = score point.sash_id.must_be :==, score.sash_id end end
18.571429
44
0.680769
918a1fb3ad276d06de5b6ef825aa1d3bc3c6d7ec
95
# frozen_string_literal: true class HelloWorld def self.hello 'Hello, World!' end end
11.875
29
0.715789
62a4e9bd8a64f334e26d4f05145582ba65453bcd
940
Pod::Spec.new do |s| s.name = "GzipSwift" s.version = "4.0.4" s.summary = "Swift framework that enables gzip/gunzip Data using zlib." s.homepage = "https://github.com/1024jp/GzipSwift" s.license = { :type => "MIT", :file => "LICENSE" } s.author =...
32.413793
79
0.58617
264ffe1f3255dc0c32bd57a06f5141d69e1da52c
185
require 'rubygems' require 'sinatra' get '*' do ip = request.env['REMOTE_ADDR'] "<html><head><title>#{ip}</title></head><body><h1>Your IP Address is #{ip}</h1></body></html>" end
23.125
96
0.632432
61f3e6601fb891af7a3e494855fca1b167cd8c43
223
require 'socket' s = TCPServer.new(3939) while (conn = s.accept) Thread.new(conn) do |c| c.print "Hi. What's your name? " name = c.gets.chomp c.puts "Hi, #{name}. Here's the date." c.puts `date` c.close end end
18.583333
40
0.632287
03f7573d59bb8bbcbe1bfc6b9ae7ebb40fb0e341
20,008
describe FastlaneCore do describe FastlaneCore::Project do describe 'project and workspace detection' do def within_a_temp_dir Dir.mktmpdir do |dir| FileUtils.cd(dir) do yield(dir) if block_given? end end end let(:options) do [ F...
38.256214
218
0.659936
6a6429246d8fdfe517eb53093004ec4527e7b02c
185
class RemoveIndexOnPostIdInTopics < ActiveRecord::Migration[6.0] disable_ddl_transaction! def change remove_index :topics, column: :post_id, algorithm: :concurrently end end
23.125
68
0.783784
39ca9f4ace5e178e60271f244844d59eba595410
1,463
require 'spec_helper' describe Breathing do it 'has a version number' do expect(Breathing::VERSION).not_to be nil end describe 'change_logs' do before { Breathing::Installer.new.install } after do Breathing::Installer.new.uninstall if ActiveRecord::Base.connection.adapter_name == "Mysql2" ...
31.804348
103
0.666439
2615bb1379bcfc45b1859315fd351ad32bedbd25
149
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'multiset'
29.8
67
0.724832
e9b27b1185b915ecbbd6a69a5c084d271534129e
1,107
require 'formula' class Goffice < Formula homepage 'http://projects.gnome.org/gnumeric/' url 'http://ftp.gnome.org/pub/GNOME/sources/goffice/0.8/goffice-0.8.17.tar.bz2' sha256 'dd8caef5fefffbc53938fa619de9f58e7c4dc71a1803de134065d42138a68c06' depends_on 'pkg-config' => :build depends_on 'intltool' => :build...
27
81
0.68112
281c2da6ac86e9a3f70f32f6bdb9fa5311af32db
2,305
DEFAULT_RAILS_DIR = File.join('..', 'rails') DEFAULT_ADAPTERS = %w(MySQL SQLite3 Postgres) namespace :rails do namespace :test do task :all do driver = ENV['DRIVER'] || ENV['ADAPTER'] raise "need a DRIVER (DRIVER=mysql)" unless driver rails_dir = _rails_dir ENV['ARCONFIG'] = File.join(_ar...
28.45679
79
0.606074
e920ac13b1da834f841da6605e5ebf6ee3a65d95
567
require_dependency 'fieri/application_controller' module Fieri class JobsController < ApplicationController def create MetricsRunner.perform_async(job_params) render json: { status: 'ok' }.to_json rescue ActionController::ParameterMissing => e render status: 400, json: { status: 'error', ...
24.652174
81
0.652557
d5a6bd061473f8915a09a60b738c99665538f588
6,297
require 'spec_helper' require 'john-hancock/request_proxy/uri' module Devise::Models describe JohnHancockAuthenticatable do before(:each) do @model_class = Devise::Mock::ApiKey @model = @model_class.new end def signature(uri) request = Rack::Request.new(Rack::MockRequest.env_for(uri)...
36.398844
110
0.67016
11151d9486099ffb4c1557f3cc46e256a0e6ad7e
313
class CreatePosts < ActiveRecord::Migration def change create_table :posts do |t| t.string :meetings_attended t.string :current_projects t.string :expenditures t.string :other t.belongs_to :user t.timestamps null: false end add_index :posts, :user_id end end
19.5625
43
0.667732
336b2902b556583111a0aea2cfb2a0d95d8ca96b
7,702
# frozen_string_literal: true require 'test_helper' class TransactionControllerTest < ActionDispatch::IntegrationTest test 'create new transaction should work' do stub_request(:any, %r{transactions/watch}) .to_return(body: { result: { seen: [attributes_for(:transaction)], confi...
28.316176
79
0.62724
1abb6ce4b48a8981c8943278cf8f927d06c3d4e4
1,330
module Xremap module KeyExpression class << self # @param [String] exp # @return [Xremap::Config::Key] key def compile(exp) keyexp, modifiers = split_into_key_and_mods(exp) Config::Key.new(to_keysym(keyexp), modifier_mask(modifiers)) end private def split_int...
24.62963
75
0.521053
117e55bdfe5dc457973e8f3bec0e347fe86d766f
623
module Fog module Parsers module DNS module Bluebox class GetZones < Fog::Parsers::Base def reset @zone = {} @response = { 'zones' => [] } end def end_element(name) case name when 'serial', 'ttl', 'retry', 'expires', 'r...
20.096774
90
0.428571
1ded889d2d158454a1427dda2288a3e8f6dc85d9
14,110
require_relative '../../../shared/spec_helper.rb' describe 'tomcat/init.sls' do case os[:family] when 'debian' pkgs_installed = %w(tomcat8 haveged tomcat8-admin) pkgs_not_installed = [] main_config = '/etc/default/tomcat8' catalina_logfile = '/var/log/tomcat8/catalina.out' service = 'tomcat8' ...
34.498778
286
0.654571
1a8c756323f5d31521621199261415a9a7186a24
97,050
require 'spec_helper' require 'puppet/pops' module Puppet::Pops module Types describe 'The type calculator' do let(:calculator) { TypeCalculator.new } def range_t(from, to) PIntegerType.new(from, to) end def pattern_t(*patterns) TypeFactory.pattern(*patterns) end def regexp_t(pattern) TypeFac...
38.680749
145
0.649098
4a936fd9eadf7266e6eeda9dd57bd78ba7af8efa
828
# frozen_string_literal: true require 'rexml/document' actions :create, :delete, :create_if_missing default_action :create attribute :name, kind_of: String, name_attribute: true attribute :retry_count, kind_of: Integer attribute :timeout, kind_of: Integer attribute :username, kind_of: String attribute :domain, kind_o...
37.636364
172
0.684783
4a0d845dfed86f445b4c67daecdd2d78cc8524a6
140
class AddGoldOnLeftToTournaments < ActiveRecord::Migration[5.1] def change add_column :tournaments, :gold_on_left, :boolean end end
23.333333
63
0.778571
f717d30d0b78de1b620318329fa7dd5659d6be54
18,946
require 'active_support/logger' namespace :shf do ACCEPTED_STATE = 'accepted' unless defined?(ACCEPTED_STATE) LOG_FILE = 'log/shf_tasks.log' unless defined?(LOG_FILE) # TODO removed shf:dinkurs_load task once response condition (DinkursFetch) is deployed desc 'load Dinkurs events for companies' task...
33.592199
316
0.627573
287fc397151c28256f01f60ad774b2b5c95973c0
264
require 'database_cleaner' DatabaseCleaner.strategy = :truncation RSpec.configure do |config| # == Truncate database after suite # config.before :suite do DatabaseCleaner.clean end # == gem mongoid-rspec # config.include Mongoid::Matchers end
16.5
38
0.727273
1a54ef93ed815ddb868094648fc6022282986e57
192
module Backend module PaginationHelper def udongo_paginate(collection, options = {}) will_paginate(collection, Udongo::WillPaginate::Options.new(options).values) end end end
24
82
0.744792
e9e25e7271af6083a0e874ee66e140c88a131bc6
156
Rails.autoloaders.each do |autoloader| autoloader.inflector.inflect( 'gov_uk_helper' => 'GovUKHelper', 'update_fc_data' => 'UpdateFCData' ) end
22.285714
38
0.711538
bf25a8e04d77c39ab33e71547743388debeeb5c0
3,760
require 'rails_helper' RSpec.describe SendReplyJob, type: :job do subject(:job) { described_class.perform_later(message) } let(:message) { create(:message) } it 'enqueues the job' do expect { job }.to have_enqueued_job(described_class) .with(message) .on_queue('high') end context 'when the...
48.205128
114
0.736436
4a8184f4628effd83fb652fc93230616017db67a
1,172
module Kublog module XhrUpload module FileHelper protected # Gets the file received throug Rack Environment def received_file if env['rack.input'] make_tempfile(env['rack.input'], :filename => env['HTTP_X_FILE_NAME'], :type => env["CONTENT_TYPE"]) end en...
32.555556
110
0.612628
08f6a54776f7d4f32ae95c7005b9884bbf43f865
1,446
module Gitlab class ProjectTemplate attr_reader :title, :name, :description, :preview def initialize(name, title, description, preview) @name, @title, @description, @preview = name, title, description, preview end alias_method :logo, :name def file archive_path.open end def...
30.125
207
0.666667
1a0afea1e7812eb3ecc364f0b554f8e73a8a64f8
1,014
module SessionsHelper # 渡されたユーザーでログインする def log_in(user) session[:user_id] = user.id end # ユーザーのセッションを永続的にする def remember(user) user.remember # => DB: remember_digest cookies.permanent.signed[:user_id] = user.id # signedでuser_idを暗号化 cookies.permanent[:remember_token] = user.remember_token ...
22.043478
70
0.686391
e2ba9921a93dcb273249424a696667726754f22c
995
#!/usr/bin/env ruby require 'webrick' require 'webrick/https' require 'openssl' private_key_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "server.key")) cert_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "server.crt")) pkey = OpenSSL::PKey::RSA.new(File.read(private_k...
34.310345
97
0.675377
21ae29e9f21b5492fcfadfba3a52e7117f160e8c
182
class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select {|attr| attr.reference? }.each do |attribute| -%> belongs_to :<%= attribute.name %> <% end -%> end
30.333333
70
0.642857
87903a1570da1e2cacbe055836ac0eb248313a73
3,564
module PaypalHelper TxApi = TransactionService::API::Api module_function # Check that we have an active provisioned :paypal payment gateway # for the community AND that the community admin has fully # configured the gateway. def community_ready_for_payments?(community_id) account_prepared_for_communi...
37.515789
126
0.729517
1ccc6a67ec53460ab1adf5fa1ef346b847e635a3
305
class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) controller = GameViewController.alloc.init @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.rootViewController = controller @window.makeKeyAndVisible true end end
30.5
75
0.796721
ab032509182e2a656a230bd3afee254a79683dc1
2,872
cask 'little-snitch-nightly' do version '4.3,5260' sha256 'ff2a894bc1f14fff02875aab3ce7d647c11863a19cbb26514692d800725158aa' url "https://obdev.at/downloads/littlesnitch/nightly/LittleSnitch-#{version.before_comma}-nightly-(#{version.after_comma}).dmg" appcast 'https://www.obdev.at/products/littlesnitch/releas...
50.385965
134
0.658078
5d8ab75aa8aee6faefe27724f21981211fc733dd
8,083
# frozen_string_literal: true require 'spec_helper' describe RuboCop::AST::IfNode do let(:if_node) { parse_source(source).ast } describe '.new' do context 'with a regular if statement' do let(:source) { 'if foo?; :bar; end' } it { expect(if_node).to be_a(described_class) } end context '...
22.390582
63
0.533342
3857c3192453b766e22218ae97575d214658b603
1,730
# FilesController class FilesController < ApplicationController # We manually add the authorize the calling of actions using the authorize_action method below... def create if params.has_key?(:Filedata) success, message = process_files else success = false message = "You must specify a f...
26.615385
107
0.675723
1c0f99dac701c9fbeafb3de0f4d8b6c481d5a36e
1,201
require 'rails_helper' RSpec.describe Organisation, type: :model do let(:organisation) { build(:organisation) } let(:program_service_accomplishment) { build(:program_service_accomplishment)} let(:revenue) { build(:revenue)} describe "attributes" do it { should have_db_column(:name) } it { should have_...
31.605263
80
0.706911
bf187c8407884e3f817fea8d9f69e2f8b3af3129
7,412
describe EmbeddedAnsibleWorker do subject { FactoryGirl.create(:embedded_ansible_worker) } context "ObjectManagement concern" do let(:provider) { FactoryGirl.create(:provider_embedded_ansible) } let(:api_connection) { double("AnsibleAPIConnection", :api => tower_api) } let(:tower_api) do me...
39.636364
100
0.66109
d57e5591f1e6f645a94830c53f05959da7fe98d7
281
# frozen_string_literal: true module Faker class Pokemon < Base class << self def name fetch('pokemon.names') end def location fetch('pokemon.locations') end def move fetch('pokemon.moves') end end end end
14.05
34
0.565836
117344847cff213603c52906ae359bceac1fe5f1
4,372
# frozen_string_literal: true module ShipEngine module Domain class Addresses module AddressValidation class Response attr_reader :status, :original_address, :matched_address, :messages # type ["unverified" | "verified" | "warning" | "error"] status # @param [Normalize...
43.72
149
0.602242
b9b8df187ef4ee92a6c95b9b75b4cdfb758d988c
1,811
# # Copyright (c) 2017 Red Hat, 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 # # Unless required by applicable law or agreed to in wri...
34.826923
118
0.764219
ed3b551a1ccbf7b10bcfd2dbd1ed365957adc520
289
# frozen_string_literal: true require 'pathname' module PathHelper module_function def project_root_path Pathname.new(File.expand_path('../..', __dir__)) end def tmp_path project_root_path.join('tmp') end def dest_path project_root_path.join('dest') end end
14.45
52
0.719723
26dd51afa960890fb135590846c899054caaa076
910
# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}PrivateConstantHandler" do before(:all) { parse_file :private_constant_handler_001, __FILE__ } it "handles private_constant statement" do expect(Registry.at('A:...
35
98
0.71978
18a1434dc2c6b46105b16775fedfa269687d480d
616
module Goosi # User device and its capabilities class Device # Read device capabilities def initialize(device) @capabilities = [] return if device[:capabilities].nil? device[:capabilities].each do |c| @capabilities << c[:name] end end # Does that device supports au...
20.533333
63
0.636364
62aa0e34406c0b016e162f54cbb8ff48d84d352a
1,272
class Project < ActiveRecord::Base include ProjectValidations include ProjectAssociations include ProjectCallbacks acts_as_paranoid serialize :builder_options, JSON serialize :execution_variables, JSON delegate :requires_build?, :target, to: :script, allow_nil: true after_initialize :set_default_ex...
36.342857
193
0.813679
4ab0cf728bf0610d2c7b3ca2100538913c00f3ee
201
class CreateGenericPractises < ActiveRecord::Migration[6.1] def change create_table :generic_practises do |t| t.string :name t.integer :position t.timestamps end end end
18.272727
59
0.686567
bbbeee27d0e0cb08b7bf81eb7dffea0a5d2d6e37
30
module AdminpromoteHelper end
10
25
0.9
ff7ecc39b77814aa3bdfb54ba2ffcf1aadf1826c
559
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "obsidian-theme" spec.version = "0.1.0" spec.authors = ["Matt Coley"] spec.email = ["mcoley2@gmu.edu"] spec.summary = %q{A simplistic dark theme} spec.homepage = "https://github.com/Col-E/Jeky...
39.928571
145
0.618962
e98bcb89eece483bd3e063efee8cf8f378960fd5
2,973
## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # http://metasploit.com/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank ...
27.527778
93
0.607804
91103a2ad0ea61462ec2ae6e2d62ec5b4e0ece4d
584
FROM centos:7 MAINTAINER "Aslak Knutsen <aslak@redhat.com>" ENV LANG=en_US.utf8 # Some packages might seem weird but they are required by the RVM installer. RUN yum --enablerepo=centosplus install -y \ findutils \ git \ golang \ make \ procps-ng \ tar \ wget \ which \ ...
23.36
107
0.660959
21779d50e52431c2963b751abd793d263a65d5b6
1,905
class HowardHinnantDate < Formula desc "C++ library for date and time operations based on <chrono>" homepage "https://github.com/HowardHinnant/date" url "https://github.com/HowardHinnant/date/archive/v3.0.1.tar.gz" sha256 "7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538" license "MIT" bott...
44.302326
123
0.654068
f878ea1f02045b401592a437833b958111f47820
4,185
class ObservationsController < ApplicationController before_action :authenticate_user! before_action :set_grow, only: [:index, :new, :show, :edit, :create, :update, :destroy] before_action :set_subject, only: [:index, :new, :show, :edit, :create, :update, :destroy] before_action :set_observation, only: [:show, ...
27.532895
111
0.626284
39d1e0e00c38fee59b6fe45c8f8baa6baab4b893
301
class CreatePermissions < ActiveRecord::Migration[6.1] def change create_table :permissions do |t| t.string :name, null: false t.string :description, null: false t.string :code, null: false t.timestamps end add_index :permissions, :code, unique: true end end
21.5
54
0.667774
ed5b6d044fe75ca855dd4dab55b3abf20f2cd1f6
874
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sortable_columns/version' Gem::Specification.new do |spec| spec.name = "sortable_columns" spec.version = SortableColumns::VERSION spec.authors = ["Daniel LaBare"] spe...
36.416667
74
0.657895
26154dab7de0a1b11d7397805dad43fd2b808253
123
class RemovePublicFromGroups < ActiveRecord::Migration def change remove_column :groups, :public, :boolean end end
20.5
54
0.772358
0109c8a01bb6882ad041a03cf15d3ca0972d25ad
326
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :authenticate_person! def user_for_paper_trail current_person.nil? ? "" : current_person.id en...
27.166667
56
0.773006
280cb05d58069c1c439e64800b64753e8bf7a144
1,323
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core/handler/reverse_https' require 'msf/base/sessions/meterpreter_options' require 'msf/base/sessions/mettle_config' require 'msf/base/sessions/meterpreter_armle_linux...
28.148936
98
0.631897
edc5ec74d1c7a09db468deae18413bb00a6b0af3
441
class MessageMailer < ActionMailer::Base default from: 'no-reply@mentoring.io' def notify(member, message) @message = message @member = member mail(mail_args(member, "You have a new message")) do |format| format.html end end helper do def full_url_for path "#{@host}#{path}" ...
17.64
65
0.630385
f7f32473e1343f9f87f66ac3c167e43070bc8946
390
class Api::V1::AuthenticationController < ApiController skip_before_action :authenticate_token! def create user = User.find_by(email: params[:user][:email]) if user.valid_password? params[:user][:password] render json: {token: JsonWebToken.encode(sub: user.id)} else render json: {errors: ["...
30
81
0.707692
1cfdaf0ed470633e9ab90834f3a34685ea029370
16,208
=begin This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services. Copyright © 2011 Dan Wanek <dan.wanek@gmail.com> 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 ...
76.815166
113
0.613956
269e34133c299da1a6624afb4c6eea555ac39c14
1,106
# 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...
28.358974
74
0.676311
384e793dfa538578d5386f0ec955fe58079d963a
808
require 'spec_helper' require 'r10k/puppetfile' describe R10K::Puppetfile do subject do described_class.new( '/some/nonexistent/basedir' ) end describe "the default moduledir" do it "is the basedir joined with '/modules' path" do expect(subject.moduledir).to eq '/some/nonexistent/basedi...
26.933333
84
0.712871
e98205b0602336160f31956f5bc72067eddc8b1c
2,552
require "byebug" ENV["RACK_ENV"] = "test" SPEC_ROOT = Pathname(__FILE__).dirname Dir[SPEC_ROOT.join("support/*.rb").to_s].each(&method(:require)) Dir[SPEC_ROOT.join("shared/*.rb").to_s].each(&method(:require)) require SPEC_ROOT.join("../system/streakist/container") RSpec.configure do |config| config.disable_monk...
38.089552
78
0.740204
1c051e86c50ea3209bf2c84e93bc24f59afc9155
334
class CreateJudgeTeamRoles < ActiveRecord::Migration[5.1] def change create_table :judge_team_roles, comment: "Defines roles for individual members of judge teams" do |t| t.string :type t.column :organizations_user_id, :integer t.index :organizations_user_id, unique: true t.timestamps ...
30.363636
105
0.724551
62b1b0705bf7a0c8d24d782fb01783707a755dda
25,731
require 'spec_helper' require 'yaml' describe PDK::Module::TemplateDir do subject(:template_dir) do described_class.new(uri, module_metadata, true) do |foo| # block does nothing end end let(:path_or_url) { File.join('/', 'path', 'to', 'templates') } let(:uri) { PDK::Util::TemplateURI.new(path_or...
45.62234
193
0.617077
b9624c158aa8092cb746f0a4e4e154e6359a464c
1,570
# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'carrierwave/google/storage/version' Gem::Specification.new do |spec| spec.name = 'carrierwave-google-storage' spec.version = Carrierwave::Google::Storage::VERSIO...
39.25
148
0.67707
e279813abf508bd11bdb3967e25180e298b3f3f6
804
# frozen_string_literal: true module FriendlyShipping class Carrier attr_reader :id, :name, :code, :shipping_methods, :balance, :data # @param [Integer] id The carrier's ID # @param [String] name The carrier's name # @param [String] code The carrier's unique code # @param [Array] shipping_method...
29.777778
95
0.656716
21128b52cb44f7fed6ae17ef3c643db743a5e409
11,245
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
43.416988
245
0.725389
4a2b671da1ae86cb2f95eda33d01f176cd076580
1,946
require 'open3' module OFlow module Actors # class ShellOne < Actor attr_reader :dir attr_reader :cmd attr_reader :timeout def initialize(task, options) super @dir = options[:dir] @dir = '.' if @dir.nil? @dir = File.expand_path(@dir.strip) ...
24.325
75
0.44296
010f6f19cdc45b3082e063f359c8d0e9e7958d31
14,820
require 'rails_helper' require 'sunspot/rails/spec_helper' describe ClassificationTypesController do fixtures :all disconnect_sunspot def valid_attributes FactoryBot.attributes_for(:classification_type) end describe 'GET index' do before(:each) do FactoryBot.create(:classification_type) e...
33.2287
106
0.671727
ab4c7cb5f4d144101f867241ba8ad350e0a336e6
157
json.array!(@users) do |user| json.extract! user, :id, :state, :name, :description, :email, :username, :roles json.url user_url(user, format: :json) end
31.4
81
0.681529
87e1c11ce195287879614b03aa173a41d80cf3bb
1,056
# frozen_string_literal: true require 'spec_helper' RSpec.describe GitlabSchema.types['ContainerRepository'] do fields = %i[id name path location created_at updated_at expiration_policy_started_at status tags_count can_delete expiration_policy_cleanup_status project] it { expect(described_class.graphql_name).to ...
33
157
0.786932
879a6e6b7546fb40b8050fb474b7dca5824c76e2
610
# frozen_string_literal: true module Schemas module Static class Generate module NGLP # @api private class Journal < Schemas::Static::Generator def generate set! "publisher.name", Faker::Book.publisher set! "publisher.email", Faker::Internet.safe_email, sk...
22.592593
79
0.604918
0375e4ba9d6260ae9cacf156892279aa116fc726
998
describe PipelineService::V2::Nouns::User do include_context "stubbed_network" subject { described_class.new(object: noun) } let(:active_record_object) { ::User.create } let!(:pseudonym) { ::Pseudonym.create(user_id: active_record_object.id, sis_user_id: '1234') } let(:noun) { PipelineService::V2::Noun.ne...
30.242424
99
0.677355
38d0bfce96154cd8e4767c0214e56913377d58e1
2,854
# # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) # Copyright:: Copyright 2008-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...
30.042105
88
0.686055
269410bc04de07867beee3bb94e15b29bfc9bc0d
1,848
class Atomicparsley < Formula desc "MPEG-4 command-line tool" homepage "https://bitbucket.org/wez/atomicparsley/overview/" url "https://bitbucket.org/wez/atomicparsley/get/0.9.6.tar.bz2" sha256 "e28d46728be86219e6ce48695ea637d831ca0170ca6bdac99810996a8291ee50" revision 1 head "https://bitbucket.org/wez/atom...
38.5
108
0.735931
1dea0f6ef45ab7c17387094c4b5c06f092300a05
1,767
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'departure/version' # This environment variable is set on CI to facilitate testing with multiple # versions of Rails. RAILS_DEPENDENCY_VERSION = ENV.fetch('RAILS_VERSION', ['>= 5.2.0', '< 6.1'])...
49.083333
198
0.696095
f7e690aef264ba76ce9fa034392e554dafbb40d8
517
class FeedPresenter < BasePresenter presents :feed def feed_link(&block) args = [ @template.feed_entries_path(feed), remote: true, class: "feed-link", data: { behavior: "selectable show_entries open_item feed_link renamable user_title", feed_id: feed.id, mark_rea...
20.68
85
0.5706
112b6299f95c93749d6082fa44e038e28da83ad2
2,866
require "simphi/request" require "spec_helper" describe Simphi::Request do context "#normalize_hash_params" do let(:request) { Simphi::Request.new(double) } before do allow_any_instance_of(Simphi::Request).to receive(:POST).and_return(params_before) allow_any_instance_of(Simphi::Request).to rece...
24.084034
88
0.43859
1ccba0f7680950eb7cae949d74e7a9d8d0324a44
576
Pod::Spec.new do |s| s.name = "DDNavText" s.version = "1.1.1" s.summary = "Easily show additional text in your UINavigationBar title." s.homepage = "http://github.com/Dids/DDNavText" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Pau...
38.4
91
0.53125
62b8f0360a331471e882fdc63d334e67a973843a
586
require_relative '../lib/envo' require 'test/unit' include Envo class TestStringVal < Test::Unit::TestCase def test_casts s = StringVal.new('xyz') assert_equal s.type, :string assert !s.list? assert_equal s.value, 'xyz' s.clean! assert_equal s.value, 'xyz' assert_same s.to_s, s.value ...
18.3125
54
0.662116
e97aaaebf7981e3a8f70a8dbf0ce20fd962b4d42
526
# encoding: UTF-8 require 'spec_helper' describe NanoApi::Model do let(:model) do Class.new do include NanoApi::Model attribute :name attribute :count, default: 0 end end specify{model.i18n_scope.should == :nano_model} specify{model.new.should_not be_persisted} specify{model.inst...
22.869565
67
0.707224
380d55b7a52d68cdce2de17fc9e6eedb6ce24375
325
module Ricer4::Plugins::Hash class Hash < Ricer4::Plugin trigger_is "hash.algo" has_usage '<string|named:"hash">' def execute(hash) end has_usage '<hash_algo> <message|named:"plaintext">', function: :execute_with_algo def execute_with_algo(algo, hash) end en...
19.117647
85
0.627692
ed8d53ab510543de9172a311a8696cf292842261
583
require 'wargaming_api/world_of_tanks/authentication' module WargamingApi class WargamingApi::WorldOfTanks::Authentication class WargamingApi::WorldOfTanks::Authentication::OpenIDLogin < WargamingApi::WorldOfTanks::Authentication attr_accessor :expires_at, :redirect_uri, :display, :nofollow def ini...
30.684211
110
0.720412