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
6aeba6be0c119682d570a260aec9aaba8bcee8e4
686
## # This file is part of WhatWeb and may be subject to # redistribution and commercial restrictions. Please see the WhatWeb # web site for more information on licensing and terms of use. # http://www.morningstarsecurity.com/research/whatweb ## Plugin.define "Intrinsyc-deviceWEB" do author "Brendan Coles <bcoles@gmail....
25.407407
81
0.739067
6a481560bb3f5b51cd940b8bd9884423314c5abf
421
# frozen_string_literal: true # os detection module OS def self.windows? (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil end def self.mac? (/darwin/ =~ RUBY_PLATFORM) != nil end def self.unix? !OS.windows? end def self.linux? OS.unix? && !OS.mac? end end def get_node...
13.580645
67
0.624703
e9d47764a916ea6a4ea6d88135d92485dd757a03
1,714
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{statsd-ruby} s.version = "0.3.0.github.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :re...
29.551724
105
0.607351
18270f19d0b429ef539fedeb28c8e10662b01622
2,138
# frozen_string_literal: true require_relative '../../../step/buy_sell_par_shares' require_relative 'par_and_buy_actions' module Engine module Game module G1893 module Step class BuySellParSharesFollowingSr < Engine::Step::BuySellParShares def can_buy?(_entity, bundle) super ...
32.393939
103
0.527128
f852e425891ed8e350cb702e4b5d99093b926a5b
1,895
class SnippetsController < ApplicationController before_filter :authenticate_user! before_filter :project before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] layout "project" # Authorize before_filter :add_project_abilities # Allow read any snippet before_filter :authorize_read_snipp...
20.376344
77
0.698681
185e426012b403b172fd6141a331b1106091d978
5,381
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. require 'date' # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength module OCI # Specifies the compartment to move the dedicated virtual machine host to. class Core::Models::ChangeDedicatedVmHostCompartmentDetails ...
34.49359
147
0.674596
2888cedcc2b4bb4df0b33dc61986f9c2ba999f31
523
class AuthenticationToken < ApplicationRecord DEFAULT_TTL = 2.weeks belongs_to :user validates :id, presence: true, length: {is: 8} validates :secret_digest, presence: true, length: {is: 64} before_create :set_expiration def expired? expires_at <= Time.zone.now end def revoked? revoked_at? ...
18.678571
78
0.718929
61d66d774749016d806d099fcb4192376a1d3174
5,421
class Passenger < Formula desc "Server for Ruby, Python, and Node.js apps via Apache/NGINX" homepage "https://www.phusionpassenger.com/" url "https://github.com/phusion/passenger/releases/download/release-6.0.6/passenger-6.0.6.tar.gz" sha256 "fbf89ebfacc079bdf6466567eabc9eb741a5abd8f230133311f7a40fff763842" l...
38.721429
104
0.685482
0809bcecbdf41e4b7cf9957bd8151cd27d9213dd
239
require 'rails' require 'bootstrap/glyphicons/version' module Bootstrap module Glyphicons if ::Rails.version < '3.1' require 'bootstrap/glyphicons/railtie' else require 'bootstrap/glyphicons/engine' end end end
19.916667
44
0.711297
18f168fb41cb5c0cf9ab31c04c961793cd0465d1
1,225
require "benchmark" require "sshkit/formatters/pretty" # Capistrano v3 uses Rake's DSL instead of its own module Rake class Task alias old_invoke invoke def invoke(*args) result = nil reporter = Capistrano::Datadog.reporter task_name = name reporter.current_task = task_name tim...
21.12069
103
0.663673
4a4a6e75cb32c426194c5e4cc55af50f78767c45
744
# gem install benchmark_suite require 'benchmark/ips' require 'hamster/list' Benchmark.ips do |b| sml_list = Hamster.list(1) # med_list = Hamster.iterate(1, &:next).take(100) # lrg_list = Hamster.iterate(1, &:next).take(10000) med_list = Hamster.list 100.times {|i| med_list = med_list.cons(i)} lrg_list = ...
17.714286
53
0.563172
1a67aaf429087774204506f32a5bcecdde46687f
398
# frozen_string_literal: true class DropRepositoriesFromJobs < ActiveRecord::Migration[4.2] def up remove_foreign_key :jobs, column: :repository_id remove_column :jobs, :repository_id, :integer end def down add_column :jobs, :repository_id, :integer add_foreign_key :jobs, :repositories, column: ...
28.428571
117
0.761307
2632601f11ef7705ab86399432ab83eb04cb2a00
701
module Time_to # Based on @jorgeepunan's 18.js def self.september x = Date.new(2019, 9, 18) y = Time.now.to_date d = (x - y).to_i if d == 0 return ':chile: ¡Hoy es 18! ¡A emborracharte!' else return ":chile: Quedan #{d} días pa'l 18 de septiembre." end end # Based on @hec...
20.617647
79
0.569187
38bcef232e10fec759600adfb2fc28225d069bd0
1,535
# frozen_string_literal: true require_relative 'helper' require 'query' describe Query do it 'returns given amount' do query = Query.new(amount: '100') query.amount.must_equal 100.0 end it 'defaults amount to nothing' do query = Query.new query.amount.must_be_nil end it 'returns given base...
21.928571
73
0.670358
ed3feba2c3a9c3ad2f31f82540f592fd103b0443
1,095
class User < ActiveRecord::Base has_many :viewed_homes has_many :homes, through: :viewed_homes # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, ...
32.205882
103
0.691324
18a06e7a70da9d6611518c162fec2d705e68aa65
79
# frozen_string_literal: true module Apiomatic VERSION = '0.0.1'.freeze end
13.166667
29
0.746835
bf0dc7ca8e6efd7a94fe4c4bb1eac0b297550211
20,557
module LVGL [ :ANIM, :BTN_STYLE, :BORDER, :CONT_STYLE, :CURSOR, :EVENT, :FIT, :KB_MODE, :KB_STYLE, :LABEL_ALIGN, :LABEL_LONG, :LABEL_STYLE, :LAYOUT, :PAGE_STYLE, :PROTECT, :SHADOW, :SW_STYLE, :TASK_PRIO, :TA_STYLE, ].each do |enum_name| ...
27.930707
109
0.602277
e8ff484146fa1d51aa4674140d9e48706be7e7d8
1,779
cask 'unity-webgl-support-for-editor@5.6.0f3' do version '5.6.0f3,497a0f351392' sha256 '77f16eaaec847b5afc7795924b2561a8ce16aca132ebe973790b584f7d0aa96e' url "http://download.unity3d.com/download_unity/#{version.after_comma}/MacEditorTargetInstaller/UnitySetup-WebGL-Support-for-Editor-#{version.before_comma}.pkg...
32.345455
162
0.72063
8792ed665934aabb86109b42c4442c88fa6810ac
707
require_relative '../../algorithms/rate_limiter' describe 'RateLimiter' do let(:rate_limitor) { RateLimiter.new } specify '#hit_endpoint does not allow 11 requests within 10 seconds' do request_statuses = [] 11.times do request_statuses << rate_limitor.hit_endpoint end request_statuses[0..9]...
23.566667
73
0.698727
6a188641c58f9252f29899cbb4af92594ed254b6
609
require 'rails_helper' RSpec.describe "home/index.html.haml" do it "displays a new poll form" do assign(:poll, Poll.new(answers: ['',''])) render expect(rendered).to have_selector("form#new_poll") expect(rendered).to have_selector("input[name='poll[question]']") expect(rendered).to have_select...
38.0625
80
0.706076
877fc810e1a64ca4ffa88303c2c3468b2301415a
9,780
require 'spec_helper' describe "RailsAdmin Basic List" do include Warden::Test::Helpers before(:each) do RailsAdmin::AbstractModel.new("Division").destroy_all! RailsAdmin::AbstractModel.new("Draft").destroy_all! RailsAdmin::AbstractModel.new("Fan").destroy_all! RailsAdmin::AbstractModel.new("Leagu...
35.955882
188
0.653579
f7149c5de5902318e9040193b918644686dfef2a
1,686
# frozen_string_literal: true module DiscourseReactions::TopicViewSerializerExtension def posts if SiteSetting.discourse_reactions_enabled posts = object.posts.includes(:post_actions, reactions: { reaction_users: :user }) post_ids = posts.map(&:id).uniq posts_reaction_users_count = TopicViewSe...
40.142857
143
0.718861
e996b9931169d006799bc2bb3fd154cbdbddaf96
453
class Hbc::Container::Naked < Hbc::Container::Base # Either inherit from this class and override with self.me?(criteria), # or use this class directly as "container :type => :naked", # in which case self.me? is not called. def self.me?(*) false end def extract @command.run!("/usr/bin/ditto", args: ...
26.647059
93
0.671082
e93caeee4534e6c13ed26d809dcdeee253d310da
2,514
# rubocop:disable Metrics/BlockLength Rails.application.routes.draw do get "/autoyast", to: "dashboard#autoyast" devise_for :users, controllers: { registrations: "auth/registrations", sessions: "auth/sessions" } resource :dashboard, only: [:index] resource :updates, on...
30.658537
78
0.682578
28a39e98179fdb2ad1a429f8825b5d8ef8072198
1,490
require 'rails/generators' module Inky module Generators class InstallGenerator < ::Rails::Generators::Base desc 'Install Foundation for Emails' source_root File.join(File.dirname(__FILE__), 'templates') argument :layout_name, type: :string, default: 'mailer', banner: 'layout_name' class...
31.041667
126
0.667785
e27ebe50ccd893e232fe93117631dd217517e083
828
module Uniquify def self.included(base) base.extend ClassMethods end def ensure_unique(name) begin self[name] = yield end while self.class.exists?(name => self[name]) end module ClassMethods def uniquify(*args, &block) options = { :length => 8, :chars => ('a'..'z').to_a ...
23
104
0.571256
f725a16bdc0431f6d8c15d53718723cfc280a128
2,621
module Packet module NbioHelper def packet_classify(original_string) word_parts = original_string.split('_') return word_parts.map { |x| x.capitalize}.join end def gen_worker_key(worker_name,worker_key = nil) return worker_name if worker_key.nil? return "#{worker_name}_#{worker_ke...
30.126437
110
0.66158
2683d702b1ca1918d7aef6717f8be69ab2fd883d
305
require "domain/shared/callable" require "domain/customers/services/create_customer" module Carpanta module Commands class CreateCustomer extend Domain::Shared::Callable def call(params = {}) Domain::Customers::Services::CreateCustomer.call(params) end end end end
20.333333
64
0.711475
bb901bd598934058cf80441d7236b3a2d993e9f7
1,466
require 'workers/event_catcher' describe BlacklistedEvent do let(:total_blacklist_entry_count) { ExtManagementSystem.descendants.collect(&:default_blacklisted_event_names).flatten.count } before do MiqRegion.seed end context '.seed' do it 'loads event filters' do described_class.seed expec...
31.869565
128
0.680764
08eb649f20e38a2f2f64a576e8dd252fb8abd843
87
CouponsCode::Engine.routes.draw do resources :coupons root to: "coupons#index" end
17.4
34
0.758621
21eb09e5cefb87762662eda59dabfbe1eae13dcf
12,526
=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product...
33.491979
365
0.630289
d5b0c0dff5f88ead17561af3c04b97cd43ce64b3
6,625
# 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...
41.149068
111
0.638491
ff9005c0d780fae19b8c28ade85aa11f7a20c149
2,339
require File.expand_path(File.dirname(__FILE__) + "/test_helper") class OutputCommandTest < Test::Unit::TestCase context "A plain command" do setup do @output = Whenever.cron \ <<-file every 2.hours do command "blahblah" end file end should "output the ...
26.885057
86
0.575887
bb2b728cc49131b9d9bc56d26667faf7625569f1
1,732
class Covid19CDC::Scraper @@all = [] @@search_array = [] def self.all @@all end def self.search_array @@search_array end #total_cases: total_cases, total_deaths: total_deaths, new_cases: new_cases, new_deaths:new_deaths def self.mass_create_from_api(newsarr, second_array) ...
19.908046
115
0.567552
1a5afd856df62f5d991a5d8aac135dbdfbe842f1
922
module ErrorMethods extend ActiveSupport::Concern included do # Return a 404 for any routing issues rescue_from ActionController::RoutingError, with: :not_found end # Utility function to return a 403 header def forbidden render_error( :forbidden ) end # Utility function to return a 404 ...
17.730769
116
0.687636
1da651531636b1178d644d4e2ced393429e07178
655
# This is the Ruby 1.9-specific kernel file. # Thread features are always available in 1.9. require 'thread.jar' # These are loads so they don't pollute LOADED_FEATURES load 'jruby/kernel19/thread.rb' load 'jruby/kernel19/kernel.rb' load 'jruby/kernel19/proc.rb' load 'jruby/kernel19/process.rb' load 'jruby/kernel19/j...
31.190476
73
0.783206
1a65bab1d7b22d4e568367c85b5528723bdd0c66
5,999
$LOAD_PATH << Rails.root.join("tools").to_s require "fix_auth/auth_model" require "fix_auth/auth_config_model" require "fix_auth/models" RSpec.describe FixAuth::AuthModel do let(:v0_key) { ManageIQ::Password::Key.new("AES-128-CBC", Base64.encode64("9999999999999999"), Base64.encode64("5555555555555555")) } let(:...
35.708333
136
0.670278
4a39e304f643fa0a963efeb1a972fb0c9a3038dc
497
module SpreeSalesPricing class Engine < Rails::Engine require 'spree/core' isolate_namespace Spree engine_name 'spree_sales_pricing' # use rspec for tests config.generators do |g| g.test_framework :rspec end def self.activate Dir.glob(File.join(File.dirname(__FILE__), '../../...
23.666667
88
0.665996
b9abf12ee35f442bda4eebaf6f3255e03802a2ac
14,300
require 'spec_helper' describe 'cis_hardening::logaudit::accounting' do on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } # Check for default class it { is_expected.to contain_class('cis_hardening::logaudit::accounting') } # Ensure Auditing is enabled...
33.806147
182
0.533706
33b79b41233353e480f210d43cfd7cdaf76773ce
73,429
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::DataFactory::Mgmt::V2018_06_01 # # The Azure Data Factory V2 management API provides a RESTful set of web # services that interact with Azure Data Factory...
53.441776
219
0.701943
e2a3846531e1113889acad8485da48d5606ed117
3,394
class Libressl < Formula desc "Version of the SSL/TLS protocol forked from OpenSSL" homepage "https://www.libressl.org/" # Please ensure when updating version the release is from stable branch. url "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.2.3.tar.gz" mirror "https://mirrorservice.org/pub/OpenB...
33.27451
95
0.696818
edd31ec06e6d81b4469cd3b1a7f3df6fb2762887
384
require 'fix/protocol/messages/md_entry' module Fix module Protocol module Messages # # A market data entry type component, see http://www.onixs.biz/fix-dictionary/4.4/tagNum_269.html # class MdEntryType < MessagePart field :md_entry_type, tag: 269, required: true, mapping: FP::...
20.210526
103
0.677083
08bf9a3a06c00fc7204ed55e13357a98ce1ce8b0
1,371
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ApiManagement::Mgmt::V2017_03_01 module Models # # Defines values for TemplateName # module TemplateName ApplicationApprovedNotification...
48.964286
109
0.817651
5d66f755c232a7775c33ff48dfa8c366eed8dad4
1,887
class XboxLiveApi class Achievement # @return [String] the name of the achievement attr_reader :name # @return [Fixnum] a unique identifier attr_reader :id # @return [Boolean] true if the achievement has been unlocked by the player attr_reader :is_unlocked # @return [String] the url for i...
34.944444
106
0.682035
1ad4585d2537fd48a967db818bceef8c8f9d126e
67,667
# frozen_string_literal: true describe Grape::Validations do subject { Class.new(Grape::API) } def app subject end def declared_params subject.namespace_stackable(:declared_params).flatten end describe 'params' do context 'optional' do before do subject.params do opti...
33.715496
213
0.565342
1a5b1a057eb8090fb43b8c98796a5d84df60d567
115
# frozen_string_literal: true Rebrandly.configure do |config| config.api_key = Darjeelink.rebrandly_api_key end
19.166667
47
0.817391
d5be4a877b862fe101634e59a30ee6d7eed1280f
1,352
cask "gitkraken" do arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64" version "8.6.0" if Hardware::CPU.intel? sha256 "ec32e4d887c4af155a2d70087cfc6c1a524b3c1eb8f7a7efc66f46b394318a8e" else sha256 "4297f729aba0101ca8f93f80f910eb4a3433542a4f007736abea3e8139cd8a53" end url "https://release.axo...
30.727273
77
0.714497
1805b6b78b069a9ab01e0f56c7d92f59598d4f12
568
require 'spec_helper' describe Angus::SDoc::HtmlFormatter do subject(:formatter) { Angus::SDoc::HtmlFormatter } describe '.format_service' do let(:service) { FactoryGirl.build(:full_service) } context 'when "en" language' do subject { formatter.format_service(service, 'en') } it { should b...
21.037037
57
0.658451
21e72f510f45df3cc4c62205ef549f1e7719ae40
1,656
# frozen_string_literal: true require 'gruff' # Helpers for generating graphs module GraphUtil # Applies a basic theme to a given graph # @param g [Gruff::Base] Graph def self.apply_theme(graph) graph.hide_legend = true graph.hide_dots = true graph.marker_font_size = 18 graph.font = 'DejaVu-Sans...
30.109091
78
0.664251
f80821ee6583f9731d79ecc3bbef51b6a56605c8
5,552
#! /usr/bin/env ruby # frozen_string_literal: false # check-kube-pods-running # # DESCRIPTION: # => Check if pods are in a running state # # OUTPUT: # plain text # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: sensu-plugin # gem: kube-client # # Usage: ./check-kube-pods-running.rb (options) # --ca-fi...
33.445783
100
0.596182
e230ae571d1e61946017c0751041359a52de71f5
4,832
require File.join(File.dirname(__FILE__), %w[.. setup]) module TestLogging module TestAppenders class TestBufferedIO < Test::Unit::TestCase include LoggingTestCase def setup super ::Logging.init @levels = ::Logging::LEVELS @appender = ::Logging::Appenders::StringIo.new( 't...
28.591716
101
0.629139
d5939419c690576a41782b043c669b526048fa97
5,854
require 'rails_helper' describe Nu::ScoresController do include_context "signed up developer" include_context "authenticated user" include_context "bearer token authentication" let! (:pasta_corn_cooked) { FactoryGirl.create :pasta_corn_cooked } let! (:eat) { FactoryGirl.create :eat, user: oauth_user } le...
34.034884
195
0.689101
bba52ff9fcee2453a5f40a675044068651f199e0
758
class ComfortableMexicanSofa::Tag::Asset include ComfortableMexicanSofa::Tag def self.regex_tag_signature(identifier = nil) identifier ||= IDENTIFIER_REGEX /\{\{\s*cms:asset:(#{identifier}):?(.*?)\s*\}\}/ end def content return unless (layout = Cms::Layout.find_by_identifier(identifier)) type ...
29.153846
108
0.609499
28592c7b27e7d192cc84b7389066f5bbb491861d
1,515
# frozen_string_literal: true require 'rails_helper' RSpec.describe AssessmentQuestions::Importer do subject(:importer) { described_class.new } context 'with no existing records' do it 'creates all the input items' do expect { importer.call }.to change(AssessmentQuestion, :count).by(17) end it...
29.134615
119
0.684488
ff637b55cef6b019e3835c4a037babaaf1c94ce6
692
class YoutubeVideoRenderer < ResourceRenderer::AttributeRenderer::Base def display(attribute_name, label, options = {}, &block) options.reverse_merge!(width: 640, height: 480, aspect_ratio: '16by9') aspect_ratio = options.delete(:aspect_ratio) # width = options.delete(:width) # height = options.delete...
34.6
86
0.677746
7a0c09c1693dca210f04821a7b769081797a32de
884
# lib/breadcrumbs/builders/structured_data_breadcrumbs_builder.rb class Breadcrumbs::Builders::StructuredDataBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder def render @elements.collect do |element| render_element(element) end.join(@options[:separator] || " &raquo; ") end def render_...
28.516129
117
0.661765
2616ca3388c3f6be18a2bbd7bfd9cd281e23b535
207
class CurrentUserController < ApplicationController # before_action :authenticate_user! def index # byebug render json: UserSerializer.new(current_user).serializable_hash, status: :ok end end
25.875
80
0.777778
61a4fbc268905b88fba6348ab635251728b78e55
507
cask 'bloodhound' do version '1.5.2' sha256 'a2090197c5cf82c6799cf7f8f7f1d0d42436882c67814b70d458c4ae8e9c7e32' url "https://github.com/BloodHoundAD/BloodHound/releases/download/#{version}/BloodHound-darwin-x64.zip" appcast 'https://github.com/BloodHoundAD/BloodHound/releases.atom', checkpoint: '3043e...
39
105
0.798817
1c131ae8fdf62edb2925b22852057aade4611d33
4,622
# The controller for serving cms content... class ComatoseController < ActionController::Base unloadable before_filter :handle_authorization, :set_content_type after_filter :cache_cms_page helper :application # Render a specific page def show page_name, page_ext = get_page_path page = Coma...
32.780142
181
0.690177
0810c35078afab00a18b6ea366a667f603aa4b9c
787
# Cookbook Name:: vagrant # Recipe:: fedora # Author:: Joshua Timberman <opensource@housepub.org> # Copyright:: Copyright (c) 2014, Joshua Timberman # 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 ...
37.47619
75
0.738247
266310c1e38a5441b11d450f00429aea92926a8a
1,210
module Query # Observations of a given name. class ObservationOfName < Query::ObservationBase include Query::Initializers::OfName def parameter_declarations super.merge(of_name_parameter_declarations) end def initialize_flavor give_parameter_defaults names = target_names ch...
26.304348
77
0.684298
d5969f29455071d4feb420e8c2c1dccb7b3a0e30
2,303
## # 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::Tcp include Msf::Exploit::Remote::HttpClient def ini...
29.909091
120
0.568389
b943235b76acbf9e68b201a9b9608d7b4cc786da
987
# frozen_string_literal: true require_relative '../../../bolt/error' require_relative '../../../bolt/config/transport/base' module Bolt class Config module Transport class Orch < Base OPTIONS = %w[ cacert host job-poll-interval job-poll-timeout rea...
23.5
85
0.539007
bf6b367492600c112982a2d8ca61880c1c7d8ec1
261
module Figma class Rectangle attr_reader :x, :y, :width, :height def initialize(raw) @x = raw['x'] @y = raw['y'] @width = raw['width'] @height = raw['height'] end end end
18.642857
43
0.429119
38152801136856348b85f604f2b7e74982769aee
1,893
class EmsStorageController < ApplicationController include Mixins::GenericListMixin include Mixins::GenericShowMixin include Mixins::EmsCommon include Mixins::GenericSessionMixin include Mixins::BreadcrumbsMixin include Mixins::DashboardViewMixin include Mixins::GenericFeatureActionMixin before_action ...
23.962025
126
0.744849
4a890799f7070681ecdd1908bdec1f1f7c40e3d2
1,769
# Copyright 2015 Google 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 writing,...
38.456522
96
0.747315
622d2293cb6eae4207f26257136ce29cebab6025
1,733
require 'core_ext/hash/compact' class Build module Json all_attrs = [:id, :repository_id, :parent_id, :number, :commit, :branch, :message, :status, :log, :started_at, :finished_at, :committed_at, :committer_name, :committer_email, :author_name, :author_email, :compare_url, :config] JSON_ATTRS = { ...
43.325
160
0.601269
e8c4ab158a95e0ee4b1ddf03ebbc66836e05fb4d
1,716
class ArmLinuxGnueabihfBinutils < Formula desc "FSF/GNU binutils for cross-compiling to arm-linux" homepage "https://www.gnu.org/software/binutils/binutils.html" url "https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.xz" mirror "https://ftpmirror.gnu.org/binutils/binutils-2.36.tar.xz" sha256 "5788292cc5bbcca...
36.510638
95
0.631119
87898dfcd43e5a26f06080b8254d29160a5a70fe
1,390
module SocialStream module Views module Location # Renders the location stack for your view. You can add as many stack levels as you wish. # # Usage: # <%= location(level1,leve2,level3,level4,....) %> # # Output: # base > level1 > level2 > level3 > level 4 # ...
28.367347
95
0.543165
aca8b4303b4fd0fd2d97bc58897389dcbe1779da
483
# Cribbed from http://stackoverflow.com/questions/7749568/how-can-i-do-standard-deviation-in-ruby module MathHelper def sum(values) values.inject(0){|accum, i| accum + i } end def mean(values) sum(values)/values.length.to_f end def sample_variance(values) m = mean(values) sum = values.injec...
21.954545
97
0.687371
7a3f4b4226210646cbdd098d5594ff354f42778e
8,039
require 'rubygems' require 'active_support/inflector' require 'json' require 'fileutils' require 'andand' require 'arvados/google_api_client' ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'specimen', 'specimens' inflect.irregular 'human', 'humans' end module Kernel def suppress_warnings ...
30.221805
88
0.619231
f7a2640884b546da0e57c4a815515a3c02a447cc
10,140
require 'rails_helper' RSpec.feature 'viewing metrics', type: :feature do before do department1 = FactoryGirl.create(:department, name: "Department for Business, Energy & Industrial Strategy") department2 = FactoryGirl.create(:department, name: "Department for Communities and Local Government") departmen...
53.93617
166
0.722091
f87060fec087a126515416165d85ec02e37c0ef3
6,012
# # Copyright 2012-2016 Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
37.811321
103
0.707585
e2e82d8fa7dac28655789c4804de59ebbbba7740
83
class IssueComment < ActiveRecord::Base belongs_to :issue belongs_to :user end
16.6
39
0.783133
189ca5fe3aed89a71094f4590562ce9ef0baedb8
620
require 'benchmark' iterations = 100_000 Benchmark.bm do |bm| bm.report('define_method') do class NullOrder ['usd', 'euro', 'yen'].each do |method| define_method "price_#{method}".to_sym do 0.0 end end end iterations.times do o = NullOrder.new o.price_eur...
16.315789
48
0.583871
284504d7a1b3d03fe22855ba39412917309ac769
3,164
class RubyMotionQuery::Device class << self def fake_height(value) @_three_point_five_inch = nil @_four_inch = nil @_four_point_seven_inch = nil @_five_point_five_inch = nil s = size_a @_size_a[1] = value end def reset_fake_caches @_three_point_five_inch = nil ...
29.296296
80
0.659924
1adbaea70283745e54af840932b3796950ebfbd3
3,335
require 'helper' class TestFakerNamePL < Test::Unit::TestCase include DeterministicHelper assert_methods_are_deterministic( FFaker::NamePL, :name, :name_with_prefix, :last_name, :first_name, :female_name_with_prefix, :male_name_with_prefix, :female_full_name, :male_full_name, :female_first_name, :...
30.318182
90
0.771214
d52d1d05771a7e9a246618d58fdb4d5e997cdedf
4,349
require File.expand_path('../../../spec_helper', __FILE__) describe "Integer#divmod" do context "fixnum" do it "returns an Array containing quotient and modulus obtained from dividing self by the given argument" do 13.divmod(4).should == [3, 1] 4.divmod(13).should == [0, 4] 13.divmod(4.0).shou...
36.855932
110
0.618763
79373ce48972e2ef02accfc6fe4e90f746a458f9
6,725
require 'test_helper' class DocumentsControllerTest < ActionController::TestCase def test_routing assert_recognizes( { controller: 'documents', id:'1', action: 'send_pdf', slug:'a_simple_image_named' }, { path: '/documents/1/a_simple_image_named.pdf', method: :get } ) assert_recognizes( {...
30.990783
126
0.705576
ac9326ced197b865925039447de6eb9d04a54664
256
class NdlStatCheckout < ActiveRecord::Base belongs_to :ndl_statistic validates_presence_of :checkout_type_id, :carrier_type_id, :users_count, :items_count validates_numericality_of :checkout_type_id, :carrier_type_id, :users_count, :items_count end
36.571429
91
0.835938
7a26b55ac625b9ac50d3a521587fa41d62d291c2
770
# frozen_string_literal: true require 'rubygems/command' require 'rubygems/query_utils' require 'rubygems/deprecate' class Gem::Commands::QueryCommand < Gem::Command extend Gem::Deprecate rubygems_deprecate_command include Gem::QueryUtils def initialize(name = 'query', summary = 'Query gem ...
26.551724
83
0.645455
5d4b8682b19ae921aa46bd1057f5145fb73b89cb
416
# frozen_string_literal: true require 'spec_helper' RSpec.describe NilSolrEndpoint do let(:instance) { described_class.new } describe "#ping" do subject { instance.ping } it { is_expected.to be false } end describe "#persisted?" do it { is_expected.not_to be_persisted } end describe "#url"...
17.333333
51
0.685096
210568f7631ae0ef3379a56c075fcb8bd22f98c0
1,234
# encoding: utf-8 require 'spec_helper' describe RuboCop::Cop::Style::ParameterLists, :config do subject(:cop) { described_class.new(config) } let(:cop_config) do { 'Max' => 4, 'CountKeywordArgs' => true } end it 'registers an offense for a method def with 5 parameters' do inspect_sou...
27.422222
65
0.585089
114ad50dd37dce70d85633adf2d92f50c978a4c9
1,092
require_relative 'safe/format' class String alias :old_method_missing :method_missing alias :old_respond_to? :respond_to? def method_missing(method, *args) name = method.to_s colors = 'black|red|green|yellow|blue|purple|cyan|white|none' if (name =~ /format(_bold)?(_underline)?(?:_fg_(#{colors}))?(...
32.117647
158
0.673993
f7a3204eba7fcc4c3702e8d6fad1e747d75c2eef
53
json.partial! "companies/company", company: @company
26.5
52
0.773585
1a6d54651c06fa8058b48292b96cbe54acee2b36
955
# 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 `rails #...
43.409091
86
0.770681
e2c8712bc2966d1486041e025f8eaf2170db0149
221
worker_processes 2 pid "tmp/pids/unicorn.pid" working_directory ENV["UNICORN_PWD"] stderr_path "log/unicorn.stderr.log" stdout_path "log/unicorn.stdout.log" listen File.join(ENV["SHARED_PATH"], "tmp/sockets/unicorn.sock")
36.833333
64
0.800905
bb02325f8429b3adb5cff8381acc0a7460801e1f
992
# 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...
41.333333
86
0.765121
1a264f73a975b09dba0e3578eaab10d5c08d35fc
26
# typed: true { foo: 2 }
6.5
13
0.5
4a80e0df3389d16d88e7cafb34f7e58b9bbd5a69
5,516
require 'rails_helper' RSpec.describe Admin::TeamsController, type: :controller do let(:admin) { create(:admin) } describe "GET index" do it "assigns all teams as @teams" do sign_in admin team = create(:team) get :index expect(assigns(:teams)).to eq [team] end end describe "GE...
30.815642
85
0.624365
39b8b17a763137750cd82a4b140836cbc6cc4603
160
class AddAdminNameColumnToSpreeStockLocations < ActiveRecord::Migration[4.2] def change add_column :spree_stock_locations, :admin_name, :string end end
26.666667
76
0.80625
abbad6c1924a872bebd4cb5f0eb58771bafa7f4d
55,378
# 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...
57.327122
488
0.650999
e8b27eb8583c951d33099dc095a51708201e78e0
779
ActiveAdmin.register ExpertDetail do actions :all, except: [:new, :destroy] permit_params :category_ids form do |f| inputs 'Details' do input :category_ids, label: 'Category', as: :select, collection: Category.where(profession_id: f.object.profession_id).all.map{|c| [c.name, c.id]} end ...
20.5
101
0.63543
18115c956ea778d059cda0cb568eceafb9ae7fc9
932
=begin This class represnets Turn Model. =end class Turn include CustoraQueue include Common attr_accessor :game =begin This function is used to initialize turn. =end def initialize(game) @game = game next_turn end =begin This function is used to switch to next turm. =end def next_turn gam...
21.674419
73
0.699571
1a5af10e072f0d98f43d3a3a38173d62597c3554
144
class AddSubmissionIdToTestResults < ActiveRecord::Migration[4.2] def change add_column :test_results, :submission_id, :integer end end
24
65
0.784722
1d09c720bf7a47df86675f9c3b2dc695ec186bdf
3,451
# frozen_string_literal: true require 'fast_spec_helper' require 'rubocop' require 'rubocop/rspec/support' require_relative '../../../../rubocop/cop/gitlab/module_with_instance_variables' RSpec.describe RuboCop::Cop::Gitlab::ModuleWithInstanceVariables do include CopHelper subject(:cop) { described_class.new } ...
21.56875
80
0.53202
bb87f69469aaa76bf9d7c71e9d0850d89dbbbc06
21
class Invitation end
7
16
0.857143
bbf7232c5839b8587a9ca897c595b4ddcfa6b313
1,257
# frozen_string_literal: true require "rails_helper" RSpec.describe Types::Resource do describe "fields" do subject { described_class } it { is_expected.to have_field(:id).of_type(String) } it { is_expected.to have_field(:url).of_type(String) } it { is_expected.to have_field(:label).of_type(String) }...
38.090909
100
0.722355
5da35a972eab4d407362744c30f974ea269f52fa
386
module ApplicationMeritsTask class StatementOfCase < ApplicationRecord belongs_to :legal_aid_application belongs_to :provider_uploader, class_name: 'Provider', optional: true def original_attachments legal_aid_application.attachments.statement_of_case end def pdf_attachments legal_ai...
25.733333
73
0.795337
0823bf11a39b0d2bb6966a2bf94637a217601d16
559
module SupportInterface class ActiveProviderUsersExport def data_for_export(*) active_provider_users = ProviderUser.includes(:providers).where.not(last_signed_in_at: nil) active_provider_users.find_each(batch_size: 100).map do |provider_user| { provider_full_name: provider_user.full...
32.882353
97
0.711986