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
26d226dce233ab9eb1b0b199e3bee698648f08a0
130
class CategoriesController < ApplicationController def show @products = Category.find(params[:id]).products end end
16.25
51
0.730769
110340506d3a5ad65f21200a4b5f1d43fd004c53
291
module Sprout class ToolTaskModel < Rake::FileTask include DynamicAccessors def self.define_task(args, &block) t = super yield t if block_given? end end end def tool_task_model(*args, &block) Sprout::ToolTaskModel.define_task(args, &block) end
14.55
49
0.670103
912add7017d7fc543e7428615df89635cc922b3b
75
require "selenium/webdriver" Capybara.javascript_driver = :selenium_chrome
25
45
0.853333
3900e1d30d6050223a9ab5c3efec59de99ae29c7
1,320
# # Copyright 2011 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 writi...
29.333333
87
0.67197
28c49715977d27ec96bd60ca594c9ce18b53658c
163
json.extract! model, :id, :name, :resolution, :screen, :weight, :dimensions, :batery, :brand_id, :created_at, :updated_at json.url model_url(model, format: :json)
54.333333
121
0.730061
38ec094ccf0a03b4dfa1f60551988ec8c22c2761
289
require_relative "../../integration_test_helper" require_relative "../../helpers/fixture_flows_helper" class EngineIntegrationTest < ActionDispatch::IntegrationTest include FixtureFlowsHelper setup do setup_fixture_flows end teardown do teardown_fixture_flows end end
19.266667
61
0.792388
ed602c4c9374c174055108defb7f5b3d20f05aba
171
# frozen_string_literal: true class RenameMemberForeignKeys < ActiveRecord::Migration[4.2] def change rename_column :actions, :action_user_id, :member_id end end
21.375
60
0.783626
bbba60a3b5a565fb929295ee301b5a48e9f7c7c6
14,025
# Copyright 2019 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 applicable law or agreed to in writing, ...
45.241935
133
0.576827
4a8a57a8146789d3e9e011c792272fbabc0dee93
53
module EnvisiaContacts VERSION = "0.1.0.beta1" end
13.25
25
0.735849
bbed6930ce03f861b1944fc3bf7afd0b722a0951
37
module Freee VERSION = "0.3.1" end
9.25
19
0.648649
ff3605893e1f08b37105b52c0f2e7df9875a5a91
212
require 'serverspec' require 'docker' require 'spec_init' describe "Dockerfile" do before(:all) do set :docker_image, ENV['DOCKERIMAGE_ID'] end include_examples 'collection::liquibase' end
16.307692
48
0.707547
611f0e2b407d153e02aa923189b271296a7c82f3
1,066
require 'test_helper' class MembershipsControllerTest < ActionController::TestCase def test_should_get_index get :index assert_response :success assert_not_nil assigns(:memberships) end def test_should_get_new get :new assert_response :success end def test_should_create_membership a...
23.173913
64
0.730769
33d6076a9acb1db970e3b172b3ee1cc63b3fcbe1
151,903
# 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...
59.969601
183
0.540318
1c8ef9bb6f0a31df877ac235936fe1f85135c6b0
1,689
class SliceLoader # :nodoc: # Loads all slices found using slice_locations and extends relevant objects. def self.load self.slice_locations.each do |slice_location| mixin_slice_extentions slice_location end end private # Returns all the locations in which eschaton slices are located. ...
33.117647
91
0.623446
2152b443ad51257de297d2590939a376a9192a90
6,942
# frozen_string_literal: true require 'rails_helper' RSpec.describe Admin::CategoriesController, type: :controller do describe 'GET index' do context 'when there are categories' do before :each do FactoryBot.create(:session, user: organizer) login_as organizer @challenge = FactoryB...
26.7
83
0.629934
e8403da21b310b72dc12494667d2c30510ada5c5
798
Pod::Spec.new do |spec| spec.name = 'SipHash' spec.version = '1.2.0' spec.ios.deployment_target = "8.0" spec.osx.deployment_target = "10.9" spec.tvos.deployment_target = "9.0" spec.watchos.deployment_target = "2.0" spec.summary = 'Simple and secure hashing in Swift with the...
46.941176
114
0.632832
62bcb37f67c912cae4e412317cf304afbe4e750e
659
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module ItemCart class Application < Rails::Application # Initialize configuration defaults for originally generated Rails ...
32.95
82
0.764795
b9ce33023cef62989075004919e1b92681e3b607
443
# == Schema Information # # Table name: coupons # # id :integer not null, primary key # code :string not null # percents :integer not null # used :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not ...
24.611111
56
0.600451
4a363215e5a5c0afef298a60512422d2d0f2d740
1,025
# # Be sure to run `pod lib lint SwiftyVISPER.podspec' to ensure this is a # valid spec before submitting. Pod::Spec.new do |s| s.name = 'VISPER-Presenter' s.version = '4.0.1' s.summary = 'Presenter layer of the VISPER Application Framework' s.description = <<-DESC Implementa...
39.423077
123
0.628293
bf827fb3914888d96e4fb073cdaa6671cdd52aee
3,055
# frozen_string_literal: true require 'spec_helper' describe Backup::Repository do let(:progress) { StringIO.new } let!(:project) { create(:project, :wiki_repo) } subject { described_class.new(progress) } before do allow(progress).to receive(:puts) allow(progress).to receive(:print) allow(FileUti...
27.276786
109
0.648118
268fb2727a8870d55411f016f67b94c574d60c29
535
# frozen_string_literal: true require_relative '../../../step/buy_train' module Engine module Game module G1894 module Step class BuyTrain < Engine::Step::BuyTrain def setup super @exchanged = false end def buy_train_action(action, entity = ni...
19.107143
52
0.547664
118045e3af23787b9aff69ebf47a33f60247c273
6,675
# frozen_string_literal: true module API # Snippets API class Snippets < Grape::API::Instance include PaginationParams before { authenticate! } resource :snippets do helpers Helpers::SnippetsHelpers helpers do def snippets_for_current_user SnippetsFinder.new(current_user...
34.765625
104
0.644644
382327449e4f4f2894c6f7fb3ea65046aed7481d
792
module Api class ActivityReportsController class JobsFailed < AbstractData def total collection.count end def hourly_data collection.select_count.group_by_hour.map do |event| [event.date.in_time_zone("UTC").to_i * 1000, event.count.to_i] end.to_h end ...
22
72
0.632576
bb044e47757d74d2a99cd9b053f2bfe31cbc60d9
1,348
#Author: Piotr Wojcieszonek #e-mail: piotr@wojcieszonek.pl # Copyright 21.02.2016 by Piotr Wojcieszonek require_relative '../../test_helper' require 'lib/dhcp' class Option46 < Minitest::Test # Called before every test method runs. Can be used # to set up fixture information. def setup @option = Lib::DHC...
20.119403
68
0.720326
ab079ba13f77eddfa557f5150d9e3b52f0ead369
3,968
# frozen_string_literal: true require 'rails_helper' require "#{Rails.root}/lib/wiki_edits" # Wait one second after loading a path # Allows React to properly load the page # Remove this after implementing server-side rendering def js_visit(path) visit path sleep 1 end describe 'Students Page', type: :feature, js...
30.060606
91
0.576865
d5b6ede617587b3c37ee90d5bfd30acc3bd922b7
2,539
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
94.037037
453
0.774321
bff6cd34eea8e2eea5f39cf57936f597925bd468
2,180
describe BooksController do include_context 'with JSON API' # While automatically inferred, they can be also manually specified: base_path '/topics/{topic_id}/books' resource_name 'book' resource_summary 'Handles books organized by tags.' resource_description <<~HEREDOC This will fail if the topic does...
25.647059
95
0.666055
628417077d6998bff22f70bc5c7140b94b56e7eb
617
class Nextflow < Formula desc "Data-driven computational pipelines" homepage "https://www.nextflow.io/" # doi "10.1038/nbt.3820" # tag "bioinformatics" url "https://www.nextflow.io/releases/v0.25.7/nextflow" sha256 "79a1695bca00500ac4c3f7f2781835c7cc29913bf96da0b1594e0f5019cba7c0" head "https://github.co...
24.68
77
0.706645
6ab4b56e74a5f288ddc104903296899a8b17be99
1,393
class Texi2html < Formula desc "Convert TeXinfo files to HTML" homepage "https://www.nongnu.org/texi2html/" url "https://download.savannah.gnu.org/releases/texi2html/texi2html-5.0.tar.gz" sha256 "e60edd2a9b8399ca615c6e81e06fa61946ba2f2406c76cd63eb829c91d3a3d7d" license "GPL-2.0" livecheck do skip "No l...
32.395349
94
0.719311
039f3077c8f43ae814feca8c296540c372fa1887
1,120
class Plowshare < Formula desc "Download/upload tool for popular file sharing websites" homepage "https://github.com/mcrapet/plowshare" url "https://github.com/mcrapet/plowshare/archive/v2.1.7.tar.gz" sha256 "c17d0cc1b3323f72b2c1a5b183a9fcef04e8bfc53c9679a4e1523642310d22ad" license "GPL-3.0" revision 1 b...
37.333333
110
0.7875
ab52179b61ce706e9a42576f3e61bf0c0475d3b5
1,755
# Copyright © 2011 MUSC Foundation for Research Development # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this list of c...
58.5
145
0.790313
bbcc4e75468a75fadb8cdde03f06d654aa80128f
1,710
class Neomutt < Formula desc "E-mail reader with support for Notmuch, NNTP and much more" homepage "https://neomutt.org/" url "https://github.com/neomutt/neomutt/archive/neomutt-20180716.tar.gz" sha256 "bd89826980b493ba312228c9c14ffe2403e268571aea6008c6dc7ed3848de200" revision 1 head "https://github.com/neo...
34.897959
94
0.632164
01c00cf5b6535e9c746d71dfb959a4d11a4e7f00
2,174
# 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::Compute::Mgmt::V2019_03_01 module Models # # Describes a Encryption Settings for a Disk # class DiskEncryptionSettings ...
29.378378
77
0.550138
188713c38295e0c49a492af7db6cf738a3a91aaf
237
# frozen_string_literal: true RSpec.describe PolyAnalyst6API do it 'has a version number' do expect(PolyAnalyst6API::VERSION).not_to be nil end it 'does something useful' do expect(false).to eq(true) end end
19.75
51
0.700422
1c7320d9fb54f8b6aff2b882017c937d08f6ce51
5,639
require 'stringio' class WorkfileMigrator < AbstractMigrator class FakeFileUpload < StringIO attr_accessor :content_type, :original_filename end class LegacyFilePath def initialize(*args) @args = args end def path File.join(@args) end end class << self def prerequisites...
32.784884
119
0.626352
7a6bf78eae5f56b0ca599b29094b7ecb7e23843f
1,790
class Gitbucket < Formula desc "Git platform powered by Scala offering" homepage "https://github.com/gitbucket/gitbucket" url "https://github.com/gitbucket/gitbucket/releases/download/4.35.0/gitbucket.war" sha256 "931da6b27f473f8df9d4c0fc573665f6565c298f0281e2d2eff7d16f98b7bb71" license "Apache-2.0" head d...
26.716418
108
0.612291
6a499366444ab74f50591abb8571b61167cf0c08
1,022
require 'active_support/notifications' require 'active_record/explain_registry' module ActiveRecord class ExplainSubscriber # :nodoc: def start(name, id, payload) # unused end def finish(name, id, payload) if ExplainRegistry.collect? && !ignore_payload?(payload) ExplainRegistry.queri...
34.066667
105
0.710372
6a3ac300c90e48d114661d3baee81591bb5d8c48
263
module Rulers class Application def get_controller_and_action(env) _, cont, action, after = env["PATH_INFO"].split('/', 4) cont = cont.capitalize cont += "Controller" [Object.const_get(cont), action] end end end
20.230769
40
0.604563
21ae47a892b133737e0d2832db6dae4003a51371
1,559
# encoding: utf-8 require "logstash/codecs/base" require "logstash/util/charset" # Line-oriented text data. # # Decoding behavior: Only whole line events will be emitted. # # Encoding behavior: Each event will be emitted with a trailing newline. class LogStash::Codecs::Line < LogStash::Codecs::Base config_name "line...
26.423729
73
0.683772
d5e829ce142d49963f781f44b53479fc7d5e5020
1,722
class AliyunCli < Formula desc "Universal Command-Line Interface for Alibaba Cloud" homepage "https://github.com/aliyun/aliyun-cli" url "https://github.com/aliyun/aliyun-cli/archive/v3.0.49.tar.gz" sha256 "44b0788c975d519d70fd0f746ed98767d74bbffa0f1317ec1ce4442cad4aa6c4" bottle do cellar :any_skip_reloca...
39.136364
103
0.708479
edb3fc403fd24edffa55b884c5d429f32d1dae81
705
module Inciweb class Incident def initialize(id = nil) @id = id end def all fetch_incidents end def find fetch_incident end def self.all new.all end def self.find(incident_id) new(incident_id).find end def self.find_by_link(link) inc...
15.666667
64
0.587234
03a8bcbfb28d3782e147ac7e9151a956ffa3effc
332
require "#{File.dirname(__FILE__)}/test_helper" class TagListTest < Test::Unit::TestCase def test_tag_list_is_array m = Stammer::TagList.new([]) assert m.is_a?(Array) end def test_taglist_elements_become_tags m = Stammer::TagList.new({'tags' => [{'id' => 1}]}) assert m.first.is_a?(Stammer::Tag...
23.714286
55
0.674699
7aaeffecccd5a0a482f36faf5411c938ca6d84e7
82
class Gluttonberg::Application < Merb::Controller controller_for_slice end
16.4
49
0.780488
d5fd8ac9bb7c6186d522a926c895df0f7dcefded
125
class ApplicationController < ActionController::Base protect_from_forgery with: :exception # @sections = Section.all end
25
52
0.8
ff44848208fae9d481f42ba992e3ac8cb1b5cf86
1,586
# frozen_string_literal: true require 'octokit' require 'faraday-http-cache' # we don't want to forever pay the price of redirects, but make users fix them # https://github.com/octokit/octokit.rb/issues/771 # # to reproduce/remove: rename a repository and try to create a diff with the old name # it should return a Nul...
32.367347
94
0.764817
7a76a2db45f52cd2a4231230cf2f3ce31ece64ce
4,940
# 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. # # This file is the source Rails uses to define your schema when running `bin/rai...
34.305556
95
0.705263
f7630ec5eda1af328f954d3495dbf2be64ebc004
333
module Auth class SignOutAPI < Grape::API before do authenticate! end resource :sign_out do desc 'Sign out' do headers ApiDescHelper.with_common_headers end delete do current_authentication_token.expire! status 200 { success: true } end e...
16.65
49
0.60961
e24b5f05847e887e07be94f489aae8884575eadc
1,935
# Alias import callbacks under the /users/auth endpoint so that # the OAuth2 callback URL can be restricted under http://example.com/users/auth # instead of http://example.com. Devise.omniauth_providers.map(&:downcase).each do |provider| next if provider == 'ldapmain' get "/users/auth/-/import/#{provider}/callback...
24.807692
125
0.678036
39de20dad59abb07b787c21863750792713626fd
3,409
module Locomotive module Steam module Liquid module Drops class ContentEntry < I18nBase delegate :_slug, :_translated, :seo_title, :meta_keywords, :meta_description, :created_at, :updated_at, to: :@_source alias :_permalink :_slug def _id @_source._id.to_...
30.4375
127
0.519801
ff47639ca1633071bb7d2ec1b4767f696e299185
384
class ShellLogger < Formula desc "Logger for shell script." homepage "https://github.com/rcmdnk/shell-logger/" url "https://github.com/rcmdnk/shell-logger/archive/v0.2.0.tar.gz" sha256 "59897974a8d12d20f3cdbc780c6afb5a4fe9599e82a1d94952b7f9b6738d15a1" head "https://github.com/rcmdnk/shell-logger.git" def ...
29.538462
75
0.755208
d5cd0e740d1827ab884ba71030d8c775fc3f2c56
169
class AddImageUrlColumn < ActiveRecord::Migration[5.0] def change add_column :recipes, :image_url, :string, :default => 'http://i.imgur.com/VDI7NXx.jpg' end end
28.166667
90
0.721893
6225d02092b266f7c7351ca2d9d626c7b18d39ba
143
require 'spec_helper' describe "v1/default/empty.rabl" do it "renders empty JSON array" do render rendered.should == "[]" end end
15.888889
35
0.678322
18438e24adc606ad2d97b474ad24dd5bb7c0ab94
1,230
require 'test_helper' class PipelineMembersControllerTest < ActionDispatch::IntegrationTest setup do @pipeline_member = pipeline_members(:one) end test "should get index" do get pipeline_members_url assert_response :success end test "should get new" do get new_pipeline_member_url assert...
25.102041
82
0.757724
abaa94c807804ea259ebf094ca34b03a6f1f8901
645
require 'aasm/version' require 'aasm/errors' require 'aasm/configuration' require 'aasm/base' require 'aasm/dsl_helper' require 'aasm/instance_base' require 'aasm/core/transition' require 'aasm/core/event' require 'aasm/core/state' require 'aasm/core/invoker' require 'aasm/core/invokers/base_invoker' require 'aasm/core...
29.318182
44
0.815504
5d1f38547410fd4c87755ccbfe9f15412fa801f9
196
class AddUserToAttendances < ActiveRecord::Migration[5.2] def change add_reference :attendances, :user, foreign_key: true add_reference :attendances, :event, foreign_key: true end end
28
57
0.765306
ed957dc704fcf1355ad8128009298fbb78d76e31
115
require_relative 'formwandler/version' require_relative 'formwandler/form' require_relative 'formwandler/railtie'
23
38
0.86087
bf1875e8dfbb533d95337eca0c0d554e7b377d97
760
require 'sinatra' require 'csv' # I want to cache results before do cache_control :public, max_age: 60 end # I am making a transformation # on the raw data set because # I don't know my data structures up front def chart_data # This is a a reference to the file so that it can be read @data = File.new("./public/...
28.148148
174
0.705263
62579a5f6af5c5eb6708eef264691e92c8b21c1c
210
class ReAddHasLeftToGroupMemberships < ActiveRecord::Migration[5.2] def change add_column :group_memberships, :has_left, :boolean, default: false GroupMembership.update_all(has_left: false) end end
30
70
0.785714
1c6c02ffcc62361ce9fea138e448b30126271ec1
515
class FontexplorerXPro < Cask version '4.2.1' sha256 '9fd225ff73804231d094f16bdb435355a3b7557d74ec1aeb9d89e925f0673350' url "http://fast.fontexplorerx.com/FontExplorerXPro#{version.gsub('.','')}.dmg" homepage 'http://www.fontexplorerx.com/' license :unknown app 'FontExplorer X Pro.app' zap :delete => [...
30.294118
81
0.636893
7aaf0060a83bf055ff1781e8212e6524ed8d5a02
2,036
require 'spec_helper' describe 'validate_ipv6_address' do describe 'signature validation' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } describe 'valid inputs' do it { is_expected.to run.with_params('3...
61.69697
116
0.684185
e93e44048ede6506801d5c2c5c08706abd7c835d
13,301
require 'zip' require 'nokogiri' require 'octokit' require 'pathname' def expand(content, path, &get_content) content.gsub(/include::(\S+)\[\]/) do |line| if File.dirname(path)=="." new_fname = $1 else new_fname = (Pathname.new(path).dirname + Pathname.new($1)).cleanpath.to_s end new_cont...
32.283981
118
0.553643
e82368192279cc7e975e322b88ac15fdf0ed694b
5,070
require 'puppet/util/network_device' require 'puppet/util/network_device/sorter' module Puppet::Util::NetworkDevice::Dsl def register_param(params, klass = nil, &block) # Make it so that we can register multiple Params at the same time # and assign every Param an index number that must match the Regex kl...
30.727273
109
0.641617
87c62de3f2992469c919749aea1ce6ecb4f63774
620
Pod::Spec.new do |spec| spec.name = "XHMainProject-User" spec.version = "0.0.1" spec.summary = "XHMainProject" spec.description = "XHMainProject第一个" spec.homepage = "https://github.com/GSmallSea/XHMainProject-User.git" spec.license = { :type => "MIT", :file => "FILE_LICENS...
31
114
0.604839
01739498a22a8285eeb4eef0de34b3f766e6fdd7
2,239
module GOVUKDesignSystemFormBuilder module Traits module Input def initialize(builder, object_name, attribute_name, hint_text:, label:, width:, **extra_args, &block) super(builder, object_name, attribute_name, &block) @width = width @extra_args = extra_args @lab...
28.705128
108
0.522108
389a7e0217ee4322520b1e0b91ca751c9ac54d2e
197
require 'active_support/concern' module ThecoreUiRailsAdminUsedToken extend ActiveSupport::Concern included do rails_admin do visible false end end end
17.909091
35
0.670051
1d52b4ba36aade565631276d964891e37cc91aa3
3,127
=begin Copyright (c) 2009-2012 Christian Nau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dist...
39.0875
75
0.707067
bb9f72860cfd974327a583cd7a3cf8865d13053f
338
module Queries class MemberByHbxIdQuery def initialize(dcas_no) @dcas_no = dcas_no end def execute person = Person.unscoped.where("members.hbx_member_id" => @dcas_no).first return(nil) if person.blank? person.nil? ? nil : (person.members.detect { |m| m.hbx_member_id == @dcas_no}) ...
24.142857
84
0.662722
ed06533bb99244a68daaa13914baf99d760e3a91
3,638
require 'database_cleaner' # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in...
39.543478
105
0.747114
e21f0356699f48e2d9467ff31be6a57aa6f8e76f
196
class AddCustodyNumberToDefenceRequest < ActiveRecord::Migration def change add_column :defence_requests, :custody_number, :string add_index :defence_requests, :custody_number end end
28
64
0.806122
e9c49882d75e3bca685c694f6d27618e6b64511f
644
# # Copyright 2015, Noah Kantrowitz # # 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 writin...
33.894737
74
0.771739
f8d6426ad94fb5a8b239a1554490afffd887aafd
785
PRINT_OPERATION_FORMATTER = '%{operator} %{a} %{b}'.freeze def log_operation(operator, a, b) puts format(PRINT_OPERATION_FORMATTER, operator: operator, a: a, b: b) end def add(a, b) log_operation('ADDING', a, b) return a + b end def subtract(a, b) log_operation('SUBTRACTING', a, b) return a - b end def mu...
20.657895
72
0.66242
bbdb1e7dd52493290828e820ba87d4c129e51949
2,512
require 'wukong/encoding' module Wuclan module JsonModel # # The JSON tweets records come off the wire a bit more heavyweight than we'd like. # # A sample JSON file, reformatted for clarity: # # # { # "id" : 1012519767, # "created_at" ...
39.25
179
0.566083
ffec8ed77f6838b1245bd99a84e41cb63b0845d4
2,123
# frozen_string_literal: true # Helper method to add files to the work # # @return [void] def add_files click_link "Files" # switch tab expect(page).to have_content "Add files" expect(page).to have_content "Add folder" within("span#addfiles") do attach_file("files[]", Rails.root.join("spec", "fixtures", "h...
25.890244
122
0.708902
26fdeca8a3dd2c227b9974416099df588ffaf83c
542
=begin * Created by PSU Beeminder Capstone Team on 3/12/2017. * Copyright (c) 2017 PSU Beeminder Capstone Team * This code is available under the "MIT License". * Please see the file LICENSE in this distribution for license terms. =end PROVIDERS.fetch(:twitter).register_metric :total_followings do |metric| metric...
30.111111
96
0.750923
61218a95add0faf60a8de05944d6155cdd6433c9
5,214
# frozen_string_literal: true class RegistrationsController < Devise::RegistrationsController include Recaptcha::Verify include AcceptsPendingInvitations include RecaptchaHelper include InvisibleCaptchaOnSignup layout 'devise' prepend_before_action :check_captcha, only: :create before_action :ensure_de...
28.183784
129
0.761795
b92847fbef2ead10a25369403c91c1507b96b109
796
require 'utils/rust' module SortingAlgorithms ## # Implementation of Quicksort, but in Rust! # Uses FFI to cross the boundaries # @return [Array] the sorted array module Rustsort include Utils::Rust ## # Attach a function that hooks into the Rust library attach_function :rust_sort, #...
29.481481
64
0.613065
ff821ccb320be68708e6d1d180f6d0b19c31d0da
6,509
require File.join(File.dirname(__FILE__), '..', 'vcsrepo') Puppet::Type.type(:vcsrepo).provide(:p4, parent: Puppet::Provider::Vcsrepo) do desc 'Supports Perforce depots' has_features :filesystem_types, :reference_tracking, :p4config def create check_force # create or update client create_client(cli...
22.838596
88
0.587494
1db4a5e923cdd5870477baea56a514af37a786c4
270
rule "FC095", "Cookbook uses deprecated cloud_v2 ohai plugin data" do tags %w{deprecated chef14} recipe do |ast| ast.xpath('//aref[vcall/ident/@value="node"] /args_add_block/args_add/string_literal/string_add/tstring_content[@value="cloud_v2"]') end end
33.75
93
0.733333
113502b4e3c2025c9a1c1f0f02ad8c7e905d15bc
3,481
# frozen_string_literal: true module Gitlab module ImportExport module Project class TreeRestorer include Gitlab::Utils::StrongMemoize attr_reader :user attr_reader :shared attr_reader :project def initialize(user:, shared:, project:) @user = user ...
29.008333
106
0.58374
bfe711ed513bc909f614e9918a808d4820df6579
220
class ChangeSyncSourceIdOnGpCalendarEvents < ActiveRecord::Migration[4.2] def up change_column :gp_calendar_events, :sync_source_id, :string end def down fail ActiveRecord::IrreversibleMigration end end
22
73
0.786364
28c94455c2a024800e0f6d6d74e32e13dcc7a0b7
5,177
require_relative '../zabbix' Puppet::Type.type(:zabbix_host).provide(:ruby, parent: Puppet::Provider::Zabbix) do confine feature: :zabbixapi def self.instances proxies = zbx.proxies.all api_hosts = zbx.query( method: 'host.get', params: { selectParentTemplates: ['host'], selectI...
26.279188
152
0.603825
08d27079db746a638d4333ff9613eb7cbf503068
805
# frozen_string_literal: true Rails.application.routes.draw do get 'attendances/event_schedule' get '/signup', to: 'users#new' post '/signup', to: 'users#create' get '/profile', to: 'users#show' root 'static_pages#home' get '/events', to: 'events#show' get '/create', to: 'events#new' post '/create',...
23.676471
101
0.667081
1cacde14a6e4b789e4cb12ea31eff7bb31d93720
1,222
require 'spec_helper' require 'webmock_helper' describe Nem::Endpoint::Local::Account do shared_examples 'call endpoint methods' do let(:webmock) { true } let(:node) { Nem::Node.new } let(:endpoint) { described_class.new(node) } before { WebMock.disable! unless webmock } after { WebMock.enable! ...
26
74
0.679214
39920901a21dd20bbe65a1646073c529b2e44cd1
952
cask 'displaycal' do version '3.2.2.0' sha256 '9544f33d698747c385cd9d0a6eb69a2ec7e498de33ef9ee2075c8235bdada93c' # sourceforge.net/dispcalgui was verified as official when first introduced to the cask url "https://downloads.sourceforge.net/dispcalgui/release/#{version}/DisplayCAL-#{version}.dmg" appcast 'htt...
35.259259
97
0.710084
e9785c5f7d9896ec5a0c7c6388d17d62257c3b23
1,101
require_relative '../lib/responder' class GithubActionResponder < Responder keyname :github_action def define_listening required_params :workflow_repo, :workflow_name, :command @event_action = "issue_comment.created" @event_regex = /\A@#{bot_name} #{command}\.?\s*\z/i end def process_message(me...
24.466667
73
0.687557
ffb2557b01d982797c8803b284fdb12a24c76f40
1,348
# 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...
37.444444
88
0.752967
f7b5455d657c8e4b5f4f072001101529a0396ac1
42
module DoViewTool VERSION = "0.1.0" end
10.5
19
0.690476
333184d80ca50f8578d8d0469b581e9ccdc394c2
4,579
#-- 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...
32.475177
91
0.668705
6aac015ddc7d44de3500531423ad34ded070c4fd
1,286
# 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.1875
96
0.747278
2674cd8e6a08dba61c5b7f91183312602c69a5c1
2,555
require 'test_helper' class InstanceAgentConfigTest < InstanceAgentTestCase context 'The instance agent configuration' do should 'have a default configuration' do InstanceAgent::Config.init assert_equal({ :wait_between_spawning_children => 1, :log_dir => nil, :pid_dir => nil,...
37.573529
106
0.673581
1c168ea262d5011356312abe44afdd3349a245c8
1,908
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
34.690909
252
0.616876
bfef87e2bed857b36fa663833bf2b4dcfeb6619c
246
class AddAttachmentVideoAttachmentToLessons < ActiveRecord::Migration def self.up change_table :lessons do |t| t.attachment :video_attachment end end def self.down drop_attached_file :lessons, :video_attachment end end
20.5
69
0.752033
616ab537431c305b0ed5ed4b37539be9010338fd
521
module Scan class TestResultParser def parse_result(output) # e.g. ...<testsuites tests='2' failures='1'>... matched = output.match(%r{\<testsuites tests='(\d+)' failures='(\d+)'/?\>}) if matched and matched.length == 3 tests = matched[1].to_i failures = matched[2].to_i ...
23.681818
81
0.552783
d5bebdf1cfb612aafea0edec3c654ad552618d25
1,500
require "spec_helper" describe AdaptivePayments::NodeList do let(:child_model) do Class.new(AdaptivePayments::JsonModel) do attribute :example, String end end let(:model) do klass = child_model Class.new(AdaptivePayments::JsonModel) do attribute :children, AdaptivePayments::NodeList[...
25.423729
86
0.631333
6a30555fb6fe7e5251eb6ee040247f61ccc10025
5,126
#!/opt/puppetlabs/puppet/bin/ruby require 'json' require 'puppet' def packet_captures_get(*args) header_params = {} argstring = args[0].delete('\\') arg_hash = JSON.parse(argstring) # Remove task name from arguments - should contain all necessary parameters for URI arg_hash.delete('_task') operation_verb...
32.858974
237
0.672454
bf0ce95b4eafb8e7b207b4c6f22f66c902e70c09
281
class CreateLineItems < ActiveRecord::Migration[5.2] def change create_table :line_items do |t| t.datetime :post_date t.text :description t.decimal :amount, precision: 15, scale: 2 t.timestamps end add_index :line_items, :post_date end end
21.615385
52
0.676157
91bf25326fc145f8cdeecac7071b9ec50adca3c4
943
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "zeal/version" Gem::Specification.new do |s| s.name = "zeal" s.version = Zeal::VERSION s.authors = ["Ryan Fitzgerald"] s.email = ["rfitz@academia.edu"] s.homepage = "https://github.com/academia-edu/zeal" ...
37.72
137
0.656416
ac478cbb019632b60033284220be517a3635b84b
57,931
require "cases/helper" require 'models/post' require 'models/tagging' require 'models/tag' require 'models/comment' require 'models/author' require 'models/essay' require 'models/category' require 'models/company' require 'models/person' require 'models/reader' require 'models/owner' require 'models/pet' require 'model...
41.02762
212
0.72973
ab0e277249d2a5f00ce4c3ce91d1a0e55d3fe24b
5,335
require "active_support/core_ext/integer/time" 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 applica...
44.090909
114
0.765323
1a6e65d506b52f1cd9d6a1a18b7c35772a5bd28a
99
class Post < ApplicationRecord has_many :comments accepts_nested_attributes_for :comments end
16.5
41
0.828283