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
5db94f1394475959500c4887306e1f80afba5ac6
806
# frozen_string_literal: true describe RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout, :config do subject(:cop) { described_class.new(config) } let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit defs' do expect_no_offenses(<<-RUBY.strip_indent) def foo a: 1, ...
21.210526
79
0.626551
edd0d64f3149c7ca090d5db5f4036209fc21dee3
711
require 'test_helper' class MicropostTest < ActiveSupport::TestCase def setup @user = users(:michael) @micropost = @user.microposts.build(content: "Lorem ipsum") end test "should be valid" do assert @micropost.valid? end test "user id should be present" do @micropost.user_id = nil ...
22.935484
63
0.687764
38a2e55ed1ac8b0042334f6f9d5b10c04c56c979
400
module Sinatra module Param module Coercions class IntegerCoercion < BaseCoercion Coercions.register(:integer, self) def apply return value if value.is_a?(Integer) Integer(value, 10) rescue ::ArgumentError raise InvalidParameterError, %(Parameter #{nam...
22.222222
95
0.62
799b2dbd12c8c3ad4f898c92e86ecba47f93bc6a
3,439
require "spec_helper" describe Mongoid::Relations do before(:all) do Person.field( :_id, type: BSON::ObjectId, pre_processed: true, default: ->{ BSON::ObjectId.new }, overwrite: true ) end describe "#embedded?" do let(:person) do Person.new end let(:doc...
18.1
63
0.597848
33b15d0b67364893b8ea9bb082724d1156be62e0
49
module SamplePrivateLib1 VERSION = "0.1.0" end
12.25
24
0.734694
793d5dc4dc05fd7702fb17907141b23b5e6d715a
1,301
require_relative "spec_helper" describe LineUnit do it "parses nested italic and bold" do assert_equal 'outside<b><i>i</i>b</b>', parse('outside***i*b**').join end it "parses code" do assert_equal '<code class="highlight">\\\\code</code>', parse('`\\\\code`').join assert_equal '<code class="highligh...
31.731707
85
0.624135
6ad65a8c5c72b5436bbf571e6bdec40917fea26b
2,880
# coding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper') feature "Credits Feature" do before do fake_login user.update_attribute :credits, 60 @backers = [ Factory(:backer, user: user, confirmed: true, can_refund: true, requested_refund: false, refunded: false, value...
35.121951
148
0.686458
33b1894606c3c8fa3feb4719d07aa086d42dc510
3,368
# frozen_string_literal: true require "hanami/application/settings/dotenv_store" require "dotenv" RSpec.describe Hanami::Application::Settings::DotenvStore do def mock_dotenv(store) dotenv = spy(:dotenv) allow(store).to receive(:require).and_call_original stub_const "Dotenv", dotenv end describe "#...
28.066667
93
0.626781
385544d0ffc49d9d19fcfd60f8382fff0b26bec8
856
# == Schema Information # # Table name: locations # # id :bigint not null, primary key # city :string not null # name :string not null # state :string not null # street_address :string not null # zip_code :string ...
29.517241
78
0.591121
1d9731f755b09f58a65d9ab72be45884ee46b96d
3,020
# Copyright (c) 2007 Blaine Cook, Larry Halff, Pelle Braendgaard # # 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, cop...
34.318182
108
0.70894
2649c2647c3d59493f2752050fe8af98b6adc57d
4,645
require_relative '../system/repositories/proposals' require_relative '../system/repositories/votes' require_relative '../system/models/vote' require_relative 'test_support/fixture' describe 'Vote' do before(:each) do Repository::Votes.clear end after(:each) do Repository::Votes.clear end it 'saves ...
40.043103
113
0.746609
ab329958cc99291f054fde42dbd6c4886347801e
348
Rails.application.routes.draw do resources :projects resources :projects do resources :comments end root 'projects#index' get 'project_comments_path' => "comments#create" devise_for :project_users do get '/project_users/sign_out' => 'devise/sessions#destroy' end get 'projects/image/:id' ...
19.333333
62
0.706897
62f5910475176765d66dab67bfda82d411baaba8
1,207
# This file is based on https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/spinach.rake # Authored by Kamil Trzcinski <ayufan@ayufan.eu> require 'colorize' namespace :spinach do desc 'run spinach tests with rerun reporter' task :rerun do run_spinach_tests end end def tags ENV['SPINACH_RERUN_TAG...
22.351852
98
0.710025
f77f36f07e012ec2ae9c607a906c6e38380702a6
1,082
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'opal/version' Gem::Specification.new do |s| s.name = 'opal' s.version = Opal::VERSION s.author = 'Adam Beynon' s.email = 'adam.beynon@gmail.com' s.homepage ...
34.903226
83
0.655268
3953f497197516eca41749b8aabcb62ed7b8298b
313
cask "font-almendra-sc" do version :latest sha256 :no_check url "https://github.com/google/fonts/raw/main/ofl/almendrasc/AlmendraSC-Regular.ttf", verified: "github.com/google/fonts/" name "Almendra SC" homepage "https://fonts.google.com/specimen/Almendra+SC" font "AlmendraSC-Regular.ttf" end
26.083333
87
0.731629
bbddb30b5dc15177671eb513515d7b9dfd6c83f0
6,784
## # 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::HttpClient def initialize(info={}) super(update_in...
29.241379
142
0.563384
bf3de36eb45f244cb65023a633838c0158a250b5
4,371
# frozen_string_literal: true module Ser class Ializer # rubocop:disable Metrics/ClassLength @@method_registry = {} # rubocop:disable Style/ClassVars class << self def config @config ||= if equal? Ser::Ializer ::Ializer.config else superclass.config ...
24.835227
115
0.607184
18a6450223b3560b664de1da78d3af9f2d1bb715
1,148
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The # ASF licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not u...
38.266667
84
0.777003
5dead2acbfef62ee0968630839413d0658e74820
47,875
# 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 # # ApiManagement Client # class EmailTemplate include MsRestAzure # # Creates and initializes a new insta...
53.017719
233
0.7247
ac0e829882497f931bf74ade5bee013ed3d9ffee
10,998
require 'spec_helper' describe Arango::Edge do before :all do @server = connect begin @server.drop_database(name: "EdgeDatabase") rescue end @database = @server.create_database(name: "EdgeDatabase") end before :each do begin @database.drop_collection(name: "DocumentCollection...
41.501887
147
0.647027
4a487435022af80b91ba5b9900988e7f7a088b22
1,066
module Warden module OAuth # # Contains methods from Rails to avoid unnecessary dependencies # module Utils # # Fetched from ActiveSupport::Inflector.camelize to avoid dependencies # def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if fi...
26
115
0.599437
f841deed9470e3c5f9f57add67e1d8915148b153
1,612
class BoardsController < ApplicationController before_action :set_target_board, only: %i[show edit update destroy] def index @boards = params[:tag_id].present? ? Tag.find(params[:tag_id]).boards : Board.all @boards = @boards.page(params[:page]) end def new if @current_user @board = Board.new(...
21.493333
85
0.639578
ac8d36890b72c199dce172aff5aad96f50b380f1
1,622
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "abstract_bundle/version" Gem::Specification.new do |spec| spec.name = "abstract_bundle" spec.version = AbstractBundle::VERSION spec.authors = ["Douglas Rossignolli"] spec.email ...
37.72093
132
0.695438
086cb779020f8c9809806579f6a64a09fd377419
1,438
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rbac/version' Gem::Specification.new do |spec| spec.name = "rbac" spec.version = Rbac::VERSION spec.authors = ["Sandip Karanjekar"] spec.email = ["sandipkaran...
43.575758
160
0.680807
ff009b387ef111ad860d125a5eeedcbf30b6b479
1,742
require File.join( File.dirname(__FILE__), 'test_helper' ) require 'globalize/load_path' class LoadPathTest < ActiveSupport::TestCase def setup @plugin_dir = "#{File.dirname(__FILE__)}/.." @locale_dir = "#{File.dirname(__FILE__)}/data/locale" @load_path = Globalize::LoadPath.new end test "returns ...
34.84
103
0.61194
01b25583685103cbdbe1e20ea3059287418a251b
1,051
require_relative 'spec_helper' describe 'openstack-network::server' do ALL_RHEL.each do |p| context "redhat #{p[:version]}" do let(:runner) { ChefSpec::SoloRunner.new(p) } let(:node) { runner.node } cached(:chef_run) do node.override['openstack']['compute']['network']['service_type'] = ...
33.903226
104
0.659372
bb5956aa6de5b14aa3ea6de5a27b1f18ff52ba24
346
class CreateStashEngineManuscripts < ActiveRecord::Migration[5.2] def change create_table :stash_engine_manuscripts do |t| t.belongs_to :journal t.belongs_to :identifier, optional: true t.string :manuscript_number t.string :status t.text :metadata, limit: 16.megabytes - 1 t.tim...
26.615385
65
0.699422
91064322f43654c9b6596620fe610e04775a7346
471
FactoryGirl.define do factory :registry_metadata do digital_signature { { key_location: ['http://example.org/pubkey'] } } terms_of_service do { submission_tos: 'http://example.org/tos' } end identity do { submitter: 'john doe <john@example.org>', signer: 'Alpha Node <admini...
26.166667
73
0.641189
d511eae7a3fe8a134086798d46c50d5a5980c406
5,369
class Milestone < ActiveRecord::Base # Represents a "No Milestone" state used for filtering Issues and Merge # Requests that have no milestone assigned. MilestoneStruct = Struct.new(:title, :name, :id) None = MilestoneStruct.new('无里程碑', 'No Milestone', 0) Any = MilestoneStruct.new('任何里程碑', '', -1) Upcoming ...
25.8125
100
0.638294
d527a290b68d77b7841f0fc04623a20d01cd25da
45
module LicenseFinder VERSION = "2.1.2" end
11.25
20
0.711111
917aca3a064d3c63c9d42529898d0e43b4035e75
1,234
class ActionEvent::Message cattr_accessor :default_queue, :instance_writer => false @@default_queue = :medium def self.deliver(queue_name, event, params = {}) with_queue(queue_name) { |queue| queue.publish(Marshal.dump({:event => event, :params => params})) } end def self.try_to_get_next_message(*que...
30.85
135
0.662885
e9260bfc9f21ca45101820bde928ce44c371ae69
684
namespace :db do task import_executive_board: :environment do if File.exist?(Rails.root.join('lib/assets/executive_seeds.csv')) User.import(File.open(Rails.root.join('lib/assets/executive_seeds.csv')), %w(admin executive_board)) else puts 'Executive Board file does not exist!' end end task...
38
106
0.722222
e8700f3977964806fda4f09a65fc8d5daba998ec
3,779
module Trello # A Custom Field can be activated on a board. Values are stored at the card level. # # @!attribute id # @return [String] # @!attribute model_id # @return [String] # @!attribute model_type # @return [String] # @!attribute field_group # @return [String] # @!attribute name # ...
33.149123
123
0.607833
f8d078f03924911c88dae61bdc0747d721f57581
1,553
require 'bundler/setup' require 'simplecov' require 'coveralls' formatters = [SimpleCov::Formatter::HTMLFormatter] if ENV["TRAVIS"] formatters << Coveralls::SimpleCov::Formatter end SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters] SimpleCov.start do add_filter "/spec/" end require 'pry' ...
24.650794
74
0.710238
79f47f405c9ac536993bc24c03c9d4f278c9adb4
7,013
# Phusion Passenger - https://www.phusionpassenger.com/ # Copyright (c) 2013-2017 Phusion Holding B.V. # # "Passenger", "Phusion Passenger" and "Union Station" are registered # trademarks of Phusion Holding B.V. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software an...
37.908108
92
0.630971
79a6bbf8292a4bf39043ed913840a8898557f2fd
835
Puppet::Functions.create_function(:is_numeric) do dispatch :deprecation_gen do param 'Any', :scope repeated_param 'Any', :args end # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff # -c937cc584953271bb3d3b3c2cb141790R221) to support...
46.388889
252
0.760479
7ac69f4870837a5264e14bf720183a1bec384438
7,549
# 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 #...
48.391026
111
0.72195
1c81ddcfba832da19bc90722ccfb6d8b8396a785
4,485
class Typhon class Heads # these methods are here to help the DSL have somewhere to # store instances of the heads and some utilities to manage # them. This is effectively a global named scope that just # holds blocks of codes class << self def register_head(name, files, head) @head...
26.538462
101
0.57971
01d5d895d31f1b222b66a5875ce6d7597749c408
460
class Twing module Modules class CustomLogger attr_reader :logger def initialize(logger, prefix) @logger = logger @prefix = prefix end [:fatal, :error, :warn, :info, :debug].each do |method| define_method method do |message| @logger.send(method, @prefix)...
20
61
0.578261
e9ff0c5f525300a0826ce5168b0c399d37b43a86
137
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_zappa_session'
34.25
75
0.80292
abde382c4f2f5056102619666a373f48d6ea2969
1,330
# frozen_string_literal: true # Copyright 2022 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...
39.117647
80
0.789474
082778f63ecf51593be252536f11241c87ad8ebb
2,174
# encoding: utf-8 require "logstash/plugin_mixins/aws_config/generic" module LogStash::PluginMixins::AwsConfig::V1 def self.included(base) # Make sure we require the V1 classes when including this module. # require 'aws-sdk' will load v2 classes. require "aws-sdk-v1" base.extend(self) base.send(:...
38.140351
116
0.715271
1c500bd7c35cf3ab713246b786019c8ab8e89816
221
require "headline_sources/scraper" require "headline_sources/fetchers/gawker_fetcher" module HeadlineSources class DefamerFetcher < RSSFetcher def feed_url "http://defamer.gawker.com/rss" end end end
17
50
0.760181
d58978df255755c42f9a324fc93a635b1c25fc52
1,270
# frozen_string_literal: true require 'telegram/core_ext' module Telegram module API module Bot module Methods # See the {https://core.telegram.org/bots/api#getuserprofilephotos official documentation}. # # @!attribute [rw] user_id # @return [Integer] # @!attribut...
25.4
99
0.496063
f7f970e657f2cb277ed573894605981360693c26
1,227
Gem::Specification.new do |s| s.name = 'logstash-filter-publicsuffix' s.version = '1.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "Parses a domain name using Mozilla's Public Suffix List." s.description = "This gem is a logstash plugin required to be installed o...
42.310345
197
0.649552
1a20f8e7c2a2d7551b6af437501a45ad9a710f77
1,531
# # Cookbook Name:: libevent # Recipe:: default # # Copyright 2012, Takeshi KOMIYA # # 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 # # Unles...
32.574468
97
0.718485
e2e924e43bb83eee51b4633cd3730657132f54e0
97
class Tag < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name end
19.4
31
0.814433
03374043a472ec7144043a0428049ff11fbd6715
791
require 'test_helper' class TaxJp::GengouTest < ActiveSupport::TestCase def test_令和 assert_equal '令和元年05月01日', TaxJp::Gengou.to_wareki('2019-05-01') assert_equal '01年05月01日', TaxJp::Gengou.to_wareki('2019-05-01', only_date: true) assert_equal '2019-05-01', TaxJp::Gengou.to_seireki('令和', Date.new(1, 5, ...
35.954545
103
0.701643
bb312cdbe78eed55e8d4ce47ad72ed46fa8da7ef
130
require 'rails_helper' RSpec.describe SlackMessage, type: :model do pending "add some examples to (or delete) #{__FILE__}" end
21.666667
56
0.753846
5dee7041ed4f08f9a92f2cf5dd13d15da0e62d08
1,446
Given(/^hew is installed$/) do steps %Q{ Given I run `gem install rails --no-ri --no-rdoc` And I run `rails new . --skip-spring --skip-sprockets` And I append to "Gemfile" with "gem 'hew', path: '../..'" And I run `bundle install` } end Given(/^hew, rspec-rails and capybara are installed$/) d...
25.368421
77
0.580221
5d13c38af45bf12f2cfcb462776621b4bff02b72
2,958
require 'rails_helper' module CCMS module Parsers RSpec.describe ApplicantAddResponseParser, :ccms do let(:expected_tx_id) { '20190301030405123456' } context 'successful response' do describe '#success?' do let(:response_xml) { ccms_data_from_file 'applicant_add_response_success.xm...
33.235955
124
0.609195
5d3c0bdbaae84d8f00740cc8d7d9a983ab3d2403
3,115
# Encoding: utf-8 # # This is auto-generated code, changes will be overwritten. # # Copyright:: Copyright 2018, Google Inc. All Rights Reserved. # License:: Licensed under the Apache License, Version 2.0. # # Code generated by AdsCommon library 1.0.1 on 2018-02-07 17:20:46. require 'ads_common/savon_service' require '...
32.789474
85
0.765971
286d256e91b97d87b60e5f909f5c85cb7bbc2e71
1,401
# frozen_string_literal: true require 'spec_helper' module Cucumber describe Runtime do subject { Runtime.new(options) } let(:options) { {} } describe '#features_paths' do let(:options) { { paths: ['foo/bar/baz.feature', 'foo/bar/features/baz.feature', 'other_features'] } } it 'returns the...
30.456522
116
0.640971
0306908be5f23a833a6297bc507c8fd50a02082d
71
module Moysklad::Entities class Characteristic < Attribute end end
14.2
34
0.788732
3942ead75b8a4c738cf15d0d3c863bbee6c7e8fe
1,426
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "health-data-standards" s.summary = "A library for generating and consuming various healthcare related formats." s.description = "A library for generating and consuming various healthcare related formats. These include HITSP C32, QRDA Category I, a...
43.212121
178
0.6669
1debd0f8f83c689671679642f1784f6343330366
1,647
module Supergroups class GuidanceAndRegulation < Supergroup attr_reader :content def initialize super('guidance_and_regulation') end def tagged_content(taxon_id) @content = MostPopularContent.fetch(content_id: taxon_id, filter_content_purpose_supergroup: @name) end def promoted_...
29.410714
105
0.664845
e98425f4997cffa4e8840950108082fc7083a19e
6,418
require 'spec_helper' describe Puppet::Type.type(:cs_clone) do subject do Puppet::Type.type(:cs_clone) end it "has a 'name' parameter" do expect(subject.new(name: 'mock_clone', primitive: 'mock_primitive')[:name]).to eq('mock_clone') end describe 'basic structure' do it 'is able to create an in...
34.880435
103
0.704581
4a00ae856cb93efa95f918c9ccbb7b5692d52311
2,973
class TbbAT2020 < Formula desc "Rich and complete approach to parallelism in C++" homepage "https://github.com/oneapi-src/oneTBB" url "https://github.com/intel/tbb/archive/v2020.3.tar.gz" version "2020_U3" sha256 "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3" license "Apache-2.0" bott...
36.703704
139
0.662967
03ead5be37eb0f24832a7cc7fb9ec8ece86563cd
56
# typed: false module Foo module Opus::Bar end end
8
18
0.678571
7af60cd4a60a6f5965595194ac9f552e293eba1b
1,490
require 'test_helper' class UsersLoginTest < ActionDispatch::IntegrationTest def setup @user = users(:michael) end test "login with invalid information" do get login_path assert_template 'sessions/new' post login_path, params: { session: { email: "", password: "" } } assert_template 'sessions/new' as...
29.215686
67
0.669799
ac44640304adb7bbcb92553db0deebc6b738e0f9
445
module UploadsHelper def generate_link_with_thumbnail(upload) # Using the same check that we use in the model to see if we need to post process # We see if this is an image and needs a thumbnail if upload.image? link_to '<img src="/'.html_safe + upload.upload.url(:preview) + '>"'.html_safe, home_pat...
37.083333
115
0.707865
d5e462bd6f2d85e43eda3bf1c0e866a581961101
15,002
module Crucible module Tests class ConnectathonPatientTrackTest < BaseSuite def id 'Connectathon Patient Track' end def description 'Connectathon Patient Track tests: registering, updating, history, and search' end def initialize(client1, client2=nil) super...
40.219839
234
0.639181
ed2fa9b424d0f0326c648c62f4c2cfc9338251a5
361
class SplashtopStreamer < Cask version '2.4.5.3' sha256 '07fd11f7c19ce0c7c29e65d5182532940f74e6e4512b696c19e58389d5e86357' url "https://d17kmd0va0f0mp.cloudfront.net/mac/Splashtop_Streamer_MAC_v#{version}.dmg" homepage 'http://www.splashtop.com/downloads' pkg 'Splashtop Streamer.pkg' uninstall :pkgutil =>...
32.818182
88
0.792244
7a9712a25cdf0ce6f91d2c266dde234b3528b538
1,195
class PgpoolIi < Formula desc "PostgreSQL connection pool server" homepage "https://www.pgpool.net/mediawiki/index.php/Main_Page" url "https://www.pgpool.net/mediawiki/images/pgpool-II-4.2.1.tar.gz" sha256 "98938af9fccc37bcea76e6422e42ce003faedb1186cdc3b9940eb6ba948cdae1" livecheck do url "https://www.pg...
36.212121
92
0.720502
b974661ffab6a4383c200600bf786554cf957d5d
3,172
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::Tcp def initialize(info = {}) super(update_info(info, 'Name' ...
29.64486
101
0.550757
08e1d224852a11ccb4fa81e78aea46f935a31bed
200
module PayoneerApiClient class PayeeDetails class << self def status(payee_id) PayoneerApiClient.make_api_request("payees/#{payee_id}/details", :get) end end end end
16.666667
78
0.675
ffe541369b6b14aa03bce7304b9d2c51848f5842
1,223
module Spree class Promotion module Actions class CreateLineItems < PromotionAction has_many :promotion_action_line_items, :foreign_key => :promotion_action_id attr_accessor :line_items_string def perform(options = {}) return unless order = options[:order] promo...
33.054054
128
0.619787
abaab14fb707715351cbb4b99f7b54e592892fb6
3,944
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
41.515789
102
0.758621
f7909cdb0571a901b4b8a28c85ff5d2af71da979
1,253
# encoding: UTF-8 # frozen_string_literal: true # Requirements # ======================================================================= # Project / Package # ----------------------------------------------------------------------- # Extending {Callable} require_relative './callable' # Describes {Instance} require_r...
20.883333
76
0.415004
7aade82874324ba0e2db5399617b8b09d5abfd1c
636
module VCAP::CloudController class BuildpackBitsDelete def self.delete_when_safe(blobstore_key, staging_timeout) return unless blobstore_key blobstore = CloudController::DependencyLocator.instance.buildpack_blobstore blob = blobstore.blob(blobstore_key) return unless blob attrs = b...
39.75
125
0.77044
5d5dc3525b3dd037d07b9a9afd62a1a502c626d1
451
# $postmark_client = Postmark::ApiClient.new(ENV['POSTMARK_API_TOKEN']) # def send_email(to, subj, html_body) # $postmark_client.deliver( # from: 'sella@rafaeli.net', # to: to, # subject: subj, # html_body: html_body, # track_opens: true # ) # end # def send_default_email #for testing # subj...
25.055556
93
0.662971
bb1add8271fb880796d6cd75d757bd609ceb80fb
215
Rails.application.routes.draw do devise_for :users resources :test_models root to: 'test_models#index' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
30.714286
101
0.776744
1adfe4edf406fab6c08983e6b285bf94b36b4a3a
3,818
require 'abstract_unit' class GrandParent include ActiveSupport::Callbacks attr_reader :log, :action_name def initialize(action_name) @action_name, @log = action_name, [] end define_callbacks :dispatch set_callback :dispatch, :before, :before1, :before2, :if => proc {|c| c.action_name == "index" || c...
21.570621
127
0.710058
61640be0315313e6e5a5d996106d98f4f1d827ce
464
module MITS module V4_1 class Address include SimpleObjects::Base attribute :address1 attribute :address2 attribute :city attribute :country attribute :county_name attribute :description attribute :email attribute :latitude attribute :longitude at...
20.173913
33
0.659483
6aae22e70cd663f1ec8bb13381387eab4866b204
4,053
## # ## 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' require 'rex' class Metasploit3 < Msf::Post include Msf...
24.269461
80
0.566987
b99581eeed582d5011bb227943d832b3380fce5b
831
# For the noop suite, currently-installed and target Chef versions are equal. gem_path = '/opt/chef/embedded/bin/gem' chef_version = Gem::Version.new(ENV['CHEF_VERSION'] || '12.22.5') describe command("#{gem_path} -v") do # First version of Chef with bundled Rubygems >= 2.0.0. min_chef_version = '11.18.0' min_r...
30.777778
79
0.718412
87928d4f3383913571e972e198cb919b22b9706a
679
Pod::Spec.new do |s| s.platform = :ios s.ios.deployment_target = '10.0' s.name = "PheSyncedUser" s.summary = "PheSyncedUser creates a unique id for user and syncs it across all PHE apps." s.requires_arc = true s.version = "1.0.4" s.license = { :type => "MIT" } s.author = { "Mohamad Saeedi" => "mo.saeedi@phe.gov.uk" ...
28.291667
90
0.662739
39c1ea991aef49aa66c1e1f8338066274d770374
1,569
class Boot2docker < Formula homepage "https://github.com/boot2docker/boot2docker-cli" # Boot2docker and docker are generally updated at the same time. # Please update the version of docker too url "https://github.com/boot2docker/boot2docker-cli.git", :tag => "v1.5.0", :revision => "ccd9032caf251ca63edaf3a08...
29.603774
106
0.662205
38996ba1a85166bc1b277630f19fba25d4735912
4,246
require 'rails_helper' require 'huginn_scheduler' describe HuginnScheduler do before(:each) do @rufus_scheduler = Rufus::Scheduler.new @scheduler = HuginnScheduler.new stub(@scheduler).setup {} @scheduler.setup!(@rufus_scheduler, Mutex.new) end after(:each) do @rufus_scheduler.shutdown(:wait...
28.689189
126
0.680641
618b5af296f55171a2524117306469fc35ef040c
842
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "lagrange" spec.version = "4.0.0" spec.authors = ["Paul Le"] spec.email = ["hello@paulle.ca"] spec.summary = "A minimalist Jekyll theme for running a personal blog" spec.homepage = "https://g...
36.608696
142
0.65677
791904f863a94b0c726de88963e58771acfa0eb9
79
class ApplicationController < ActionController::Base protect_from_forgery end
26.333333
52
0.873418
bf8ca82c6f583f4a0f765e6673fa6ca3f811b412
998
class Kdiagram < Formula desc "Powerful libraries for creating business diagrams" homepage "https://www.kde.org" url "https://download.kde.org/stable/kdiagram/2.7.0/kdiagram-2.7.0.tar.xz" sha256 "63a2eabfa1554ceb1d686d5f17ed6308139b6d9155aaf224e0309585b070fbdd" head "git://anongit.kde.org/kdiagram.git" dep...
27.722222
76
0.677355
7af3572f9bdbbaf040b50d04616167cfd881f389
3,140
module Neo4j::Server class CypherRelationship < Neo4j::Relationship include Neo4j::Server::Resource include Neo4j::Core::CypherTranslator include Neo4j::Core::ActiveEntity def initialize(session, value) @session = session @response_hash = value @rel_type = @response_hash['type'] ...
23.787879
96
0.617834
1122cdbfbfb5dc1fd9d2317dc7c287e0e59e2963
104
def sum(num) num.to_s.split.sum end puts sum(23) == 5 puts sum(496) == 19 puts sum(123_456_789) == 45
14.857143
27
0.663462
1c5eebdfbe31f091592374131c3e38339cb5b8cf
124
require 'test_helper' class SimulationTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
15.5
46
0.709677
62a08bca5a619ab666e5830a6a57824445bf97be
4,938
require 'panoptimon/util/string-with-as_number' class Array; def to_h; Hash[self]; end; end module Panoptimon module Collector class HAProxy attr_reader :collector, :stats_url def initialize(options={}) url = options[:stats_url] || '/var/run/haproxy.sock' @stats_url = url.sub(%r{^s...
32.92
73
0.466181
87615de71d479ac0efac1f7773439ee700934753
1,338
# # Copyright (C) Business Learning Incorporated (www.businesslearninginc.com) # Use of this source code is governed by an MIT-style license, details of # which can be found in the project LICENSE file # module ClientConfig # --------------------------------------------------------------------------- # enable (1) ...
30.409091
79
0.494021
9125fe2498d48c6e33b46e3b86c162f909e0b050
577
Rails.application.routes.draw do get "/api/v1/get_articles", to: "api/v1/articles#index" get "/api/v1/get_articles/:id", to: "api/v1/articles#show" post "/api/v1/login", to: "api/v1/sessions#create" post "/api/v1/signup", to: "api/v1/users#create" delete "/api/v1/logout", to: "api/v1/sessions#destroy" get "...
38.466667
72
0.674177
ed35739e057289c6134bccad37b6480fba7034c3
330
class CreateGuests < ActiveRecord::Migration[6.1] def change create_table :guests do |t| t.string :email t.string :password_digest t.string :password_confirmation t.string :phone_number t.string :first_name t.string :last_name t.string :avatar t.timestamps end ...
20.625
49
0.657576
8746405824ee5c92fa16d2c28d2edebed84f82b5
1,072
# 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...
32.484848
111
0.655784
bb220fef89aa113fd4d07c0dce66bdc00e20932d
6,968
# encoding: utf-8 module AssLauncher # Code partly copied from sources [FFI::Platform] module # Module provides some functional like [FFI::Platform] # Gem +ffi+ builds binary extension and decided don't use it module Platform # :nocov: OS = case RbConfig::CONFIG['host_os'].downcase when /linux...
26.29434
80
0.547646
0108f6feae3df3daa2be5c2c5db5738f15673c76
5,072
# frozen_string_literal: true module API class GroupClusters < Grape::API include PaginationParams before { authenticate! } # EE::API::GroupClusters will # override these methods helpers do params :create_params_ee do end params :update_params_ee do end end pre...
35.222222
191
0.664826
1d4b034f0f9828a12eb855601343587fa8d145f2
362
class City attr_accessor :x attr_accessor :y def initialize( x = nil, y = nil) self.x = x || rand * 200 self.y = y || rand * 200 end def distance_to( city ) x_distance = (self.x - city.x).abs y_distance = ( self.y - city.y).abs Math.sqrt( x_distance.abs2 + y_distance.abs2 ) end def ...
18.1
50
0.588398
28f03c32bc39fc023eed9253c148d2f54910b781
517
require 'minitest/autorun' require_relative '../lib/music_collection' class FakeTrack def to_s return 'Amin' end def bpm return '120' end end describe MusicCollection do let(:mc) { MusicCollection.new } it "should start empty" do assert_equal 0, mc.length assert_equal 0, mc.count_for['Am...
17.233333
42
0.678917
4ae5b3db436f819e0eef0ef4f9dbf7289d8bd4f9
698
module Icy class Form class Input attr_reader :namespace, :key, :value, :messages, :options def initialize(namespace: nil, key:, value:, messages:, **options) @namespace = namespace @key = key @value = value @messages = messages @options = options end ...
21.151515
85
0.553009
627de7bf20fb8fe1b83558b367c97762a7fbfd6a
96
class Administrate::Field::ActionText < Administrate::Field::Base def to_s data end end
16
65
0.729167
3301252c4302cd3168f3b3a0f44870a97cf8023e
638
# frozen_string_literal: true module Users class UnlocksController < Devise::UnlocksController # GET /resource/unlock/new # def new # super # end # POST /resource/unlock # def create # super # end # GET /resource/unlock?unlock_token=abcdef # def show # super # ...
19.333333
62
0.653605
39050be70bd8eef557e237b89ad982dc8de04489
5,746
require_dependency 'letter_avatar' class UserAvatarsController < ApplicationController skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show, :show_letter, :show_proxy_letter] def refresh_gravatar user = User.find_by(username_lower: params[:use...
29.772021
155
0.690741
084a24babbac7fa5ca78e6a15102a7bd8deec76e
3,878
# 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 = "sofa" s.version = "0.1.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_ve...
33.145299
105
0.638731
4ab88e9137c7cd9c4acca669a8a7e653e535c995
1,634
# frozen_string_literal: true module EditorJs module Blocks # quote block class QuoteBlock < Base def schema YAML.safe_load(<<~YAML) type: object additionalProperties: false properties: text: type: string caption: ...
24.38806
90
0.490208