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 |
|---|---|---|---|---|---|
1cb5cb388284132f7e05f340b0a98fb0c1b6b95b | 1,302 | module DanbooruMaintenance
module_function
def hourly
UploadErrorChecker.new.check!
rescue Exception => exception
rescue_exception(exception)
end
def daily
PostPruner.new.prune!
Upload.where('created_at < ?', 1.day.ago).delete_all
Delayed::Job.where('created_at < ?', 45.days.ago).delete_... | 26.571429 | 84 | 0.758065 |
28ceee32ec7121488c88a5d367788957ca53529f | 786 | class MicropostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: [:destroy]
def create
@micropost = current_user.microposts.build(micropost_params)
if @micropost.save
flash[:success] = "Post successfully created"
r... | 23.117647 | 65 | 0.71374 |
d57ed3f59c2ce9e2ec22eaf9d27b466e02131f8c | 87 | require "resilient/version"
module Resilient
end
require "resilient/circuit_breaker"
| 12.428571 | 35 | 0.827586 |
1cdbb29bb824a71ad8a05dbf5bbf6a160f2b286c | 967 | cask "signal-beta" do
arch = Hardware::CPU.intel? ? "x64" : "arm64"
version "5.37.0-beta.2"
if Hardware::CPU.intel?
sha256 "3d47c433ed7fe23b96ee3d70c2a5244b39963c4a9653cc8adb91d17daf3ba045"
else
sha256 "7b881745ec38a69d18a9b6ba5655c0e851ee90224b1c29e8485294d71a98de50"
end
url "https://updates.sig... | 29.30303 | 89 | 0.720786 |
7af9b1e150a056869d3bc5f16fc84105a13c0e6f | 277 | # frozen_string_literal: true
module HykuAddons
class ContributorInstitutionalRelationshipService < HykuAddons::QaSelectService
def initialize(model: nil, locale: nil)
super("contributor_institutional_relationship", model: model, locale: locale)
end
end
end
| 27.7 | 83 | 0.787004 |
bba6a8701c9ee8302ae319882477b8d5f2d93800 | 413 | cask :v1 => 'levelator' do
version '2.1.1'
sha256 '2f22f1cf7851a987dcb194a504e43f8255261d428074ea7144e2683b79d6975d'
url "http://cdn.conversationsnetwork.org/Levelator-#{version}.dmg"
name 'Levelator'
homepage 'http://www.conversationsnetwork.org/levelator/'
license :unknown # todo: change license and r... | 34.416667 | 115 | 0.762712 |
b9cfa8f58828aff72e0988939f1f068691b5cea7 | 340 | require "japanese_number_unit/version"
module JapaneseNumberUnit
class Error < StandardError; end
end
class Integer
def 十; self * 10; end
def 百; self * 100; end
def 千; self * 1000; end
def 万; self * 10000; end
def 億; self * 1_0000_0000; end
def 兆; self * 1_0000_0000_0000; end
def 京; self * 1_0000_0000... | 21.25 | 42 | 0.708824 |
4a4aa83d97c8f913ea69739bf68bcd932746fc1c | 3,481 | require 'oai'
require 'xml'
require './lib/model'
require './lib/utilities'
class OaiHarvester
XML_PARSER = 'libxml'
def initialize(logger)
@logger = logger
end
def save_repository_record(record_set,metadata_format,repo,limit,harvest_count)
record_set.doc.find('//record').each do |rec|
r... | 36.642105 | 120 | 0.681413 |
18b018ec67b0290c2a7575e9938fce36ac9e0728 | 775 | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... | 24.21875 | 80 | 0.659355 |
1db8928db0d377e025bdaec90cc314ed0d5ebc5f | 1,115 | Hsemail::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web s... | 37.166667 | 85 | 0.772197 |
1d0f01cc601ebf42f20ba47d4e41022a39ac03e8 | 1,443 | cask 'mactex' do
version '20160603'
sha256 '34e5c48846a674e0025e92bf1ab7bb43a1108f729b4c26c61edcda24fa5383e3'
# mirror.ctan.org/systems/mac/mactex was verified as official when first introduced to the cask
url "http://mirror.ctan.org/systems/mac/mactex/mactex-#{version}.pkg"
appcast 'https://www.tug.org/mact... | 36.075 | 97 | 0.540541 |
037203413d28c842a7d148e9255767ce745b3b36 | 765 | module AriaApi
class Configuration
REQUIRED_ATTS = [ :auth_key, :client_no, :url ]
class << self
attr_writer *REQUIRED_ATTS
attr_writer :api_version
end
def self.required_attribute(*attributes) # :nodoc:
attributes.each do |attribute|
(class << self; self; end).send(:define... | 25.5 | 96 | 0.65098 |
b943e19a89311337e38c7b800f01e873472bd893 | 64 | require 'spec_helper'
describe Acquia::CloudApi::Client do
end
| 12.8 | 36 | 0.796875 |
08c553214b30da86ef797588ac3a8a866961077d | 3,721 | module AppliedInventories
module Methods
include AppliedInventories::Data
def stub_api_init(workflow)
# call in service_offering
expect(topology_api_client).to receive(:show_service_offering)
.with(workflow[:template].id.to_s)
... | 43.776471 | 132 | 0.619457 |
4abd01395d8fc7c8e2331c905eb4cf47f35c305f | 3,482 | #!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/parser/relationship'
describe Puppet::Parser::Relationship do
before do
@source = Puppet::Resource.new(:mytype, "source")
@target = Puppet::Resource.new(:mytype, "target")
@extra_resource = Puppet::Resource.new(:mytype, "extra")
@extra_reso... | 37.042553 | 97 | 0.676623 |
3348938ce4967254fc2ba9b022ed1cc4c8841123 | 538 | module Braintree
class RevokedPaymentMethodMetadata
include BaseModule
attr_reader :customer_id
attr_reader :token
attr_reader :revoked_payment_method
def initialize(gateway, attributes)
@revoked_payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes)
@customer... | 23.391304 | 93 | 0.711896 |
6a45e97ee79e44918945b6a5c77bbb4cd1b57f01 | 862 | require 'rails/generators'
class TestAppGenerator < Rails::Generators::Base
source_root File.expand_path("../../../../test_app_templates", __FILE__)
def fix_travis_rails_4
if ENV['TRAVIS']
insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
"@charset \"UTF-8\";\n"... | 24.628571 | 88 | 0.670534 |
285fcfbf38229dca419a7c0f84853c8cb0003f9d | 4,455 | require 'optparse'
require 'ostruct'
require 'netlinx/compile/extension_discovery'
module NetLinx
module Compile
# The container for the script that runs when netlinx-compile is executed.
class Script
private_class_method :new
class << self
# Run the script.
# @... | 38.405172 | 106 | 0.520763 |
284085e5badba474686d9933282fa8d01b35e7bd | 182 | class AddForeignKeyOnArguments < ActiveRecord::Migration[5.1]
def change
add_foreign_key :riews_arguments, :riews_filter_criterias, column: :riews_filter_criteria_id
end
end
| 30.333333 | 96 | 0.818681 |
ed27314519e5f8181b05aff1f14c5448f038aa10 | 779 | require 'spec_helper'
describe 'component' do
platform 'ubuntu'
step_into :android_component
default_attributes['ark']['prefix_root'] = '/usr/local/'
default_attributes['ark']['prefix_home'] = '/usr/local/'
default_attributes['android']['set_environment_variables'] = true
default_attributes['android']['jav... | 32.458333 | 149 | 0.709884 |
3363c3c02fe7c955592cc1d0f7f8a48b48d6f793 | 13,897 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Security::PipelineVulnerabilitiesFinder do
def disable_deduplication
allow(::Security::MergeReportsService).to receive(:new) do |*args|
instance_double('NoDeduplicationMergeReportsService', execute: args.last)
end
end
let_it_be(:p... | 41.360119 | 191 | 0.665323 |
e87782037c76a739c3dfecdc69c23bf7d5ea6598 | 475 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Types::Ci::TestSuiteSummaryType do
specify { expect(described_class.graphql_name).to eq('TestSuiteSummary') }
it 'contains attributes related to a pipeline test report summary' do
expected_fields = %w[
name total_time total_count succes... | 29.6875 | 108 | 0.789474 |
28df99ddbd98a1cec0896c1a421459f23c2d1f85 | 314 | include_recipe "redis::install"
redis_sentinel "sentinel" do
conf_dir node.redis.conf_dir
init_style node.redis.init_style
# user service & group
user node.redis.user
group node.redis.group
node.redis.sentinel.each do |attribute, value|
send(attribute, value)
end
end
| 20.933333 | 48 | 0.691083 |
399f76d5a99170dda537d4cfa5176f216961f7dc | 685 | # coding: utf-8
module Utils
class Logger
LOG_FILE = "./tmp/agyoh.log".freeze
def initialize
File.open(LOG_FILE, "a+").close
end
# public class methods
# level: info
def self.log_info(message = '')
Logger.new.log_info(message)
end
# level: error
def self.log_err... | 18.026316 | 39 | 0.567883 |
879614213403d1078ef19c35ad4bf0b659ecfbb9 | 575 | # Gems
require "faraday"
require "faraday_middleware"
# Standard library
require "digest/sha1"
# Gem
require "ovh/version"
require "ovh/configuration"
require "ovh/endpoints/consumer"
require "ovh/endpoints/account"
require "ovh/endpoints/ips"
require "ovh/endpoints/vps"
require "ovh/client"
module Ovh
class ... | 15.131579 | 47 | 0.726957 |
ff5c822e1676f3d2c651c893109eb4f72b631e28 | 1,457 | require 'pathname'
require 'xcodeproj'
module Xcake
class XcodeprojContext
include Context
attr_accessor :project
def create_object_for(dsl_object)
case dsl_object
when BuildPhase
create_object_for_build_phase(dsl_object)
when Project
create_object_for_project(dsl_obje... | 22.765625 | 55 | 0.698696 |
39919a31cb7014b969a5d2535a63999726d0258f | 5,122 | require 'tc_helper.rb'
class RichTextRun < Test::Unit::TestCase
def setup
@p = Axlsx::Package.new
@ws = @p.workbook.add_worksheet :name => "hmmmz"
@p.workbook.styles.add_style :sz => 20
@rtr = Axlsx::RichTextRun.new('hihihi', b: true, i: false)
@rtr2 = Axlsx::RichTextRun.new('hihi2hi2', b: false,... | 29.436782 | 128 | 0.655994 |
e871002e2be82bfe16054c37eb5cf73b017008a3 | 950 | require 'raindrops'
module LitmusPaper
module Metric
class SocketUtilization
attr_reader :weight, :maxconn
def initialize(weight, maxconn)
@weight = weight
@maxconn = maxconn
end
def current_health
stats = _stats
if stats.queued == 0
return wei... | 19.387755 | 77 | 0.524211 |
ab0fca80c189d005490c6545fb2e0030ad2d20cb | 1,579 | #
# Be sure to run `pod lib lint NNCategoryKit.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'NNCat... | 36.72093 | 105 | 0.637112 |
01e07c6118d855e1735ad58b699c82e1a3ab8fbe | 72 | module Redcarpet
module Abbreviations
VERSION = "0.1.1"
end
end
| 12 | 22 | 0.694444 |
031c55ab3aa0de0ed111a7269c01df56422a2e0a | 136 | ENV['RACK_ENV'] = 'test'
require_relative '../lib/gameon.rb'
require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
| 22.666667 | 37 | 0.727941 |
ff454fcfc8be2eaf9725790a4842b1f29df730dd | 805 | Gem::Specification.new do |s|
s.name = "committee"
s.version = "1.6.2"
s.summary = "A collection of Rack middleware to support JSON Schema."
s.authors = ["Brandur", "geemus (Wesley Beary)"]
s.email = ["brandur@mutelight.org", "geemus+github@gmail.com"]
s.homepage = ... | 33.541667 | 77 | 0.616149 |
116d1434a45fa3e0174c0b02b49ca7a5f42b1ef2 | 258 | class VirtualString
attr_accessor :value
def initialize(value)
@value = value
end
def ==(other)
(other.instance_of?(VirtualString) and
value == other.value)
end
def to_s
value.to_s
end
def reducible?
false
end
end
| 12.285714 | 42 | 0.647287 |
b96c9086129c952dbbe1ac347d6a5fa309403d39 | 299 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::DataPipeline
module Errors
extend Aws::Errors::DynamicErrors
end
end
| 19.933333 | 74 | 0.762542 |
e84c461962760b1bfcc85d8e69b55d64764ec53c | 3,896 | module Setup
class Optimizer
def initialize
@nss = Hash.new { |h, k| h[k] = {} }
end
def regist_data_types(data_types)
data_types = [data_types] unless data_types.is_a?(Enumerable)
data_types.each do |dt|
next unless dt.is_a?(Setup::DataType)
@nss[dt.namespace][dt.name]... | 31.419355 | 111 | 0.598049 |
18571c366e651e744b5d7cb6b1fdd78d0b8a9e4c | 631 | Pod::Spec.new do |s|
s.name = 'AFDownloadRequestOperation'
s.version = '0.0.1'
s.summary = "A progressive download operation for AFNetworking."
s.homepage = "https://github.com/steipete/AFDownloadRequestOperation"
s.author = { 'Peter Steinberger' => 'steipete@gmail.com' }... | 42.066667 | 148 | 0.62599 |
7abf0b1c87f67f68d1fb5a9a9a6fd72d364a262b | 1,936 | Sequel.migration do
up do
run %Q{
DROP VIEW public.measures
}
rename_column :measures_oplog, :measure_group_id, :workbasket_id
run %Q{
CREATE OR REPLACE VIEW public.measures AS
SELECT measures1.measure_sid,
measures1.measure_type_id,
measures1.geographical_area... | 35.2 | 120 | 0.668388 |
38d2663c9e566d87777df826ba32c2f32d8ae6ec | 1,762 | require 'test_helper'
class MetaTagTest < ActiveSupport::TestCase
# called before every single test
def setup
@tag = MetaTag.new(:name => 'somename')
@tag.taggable_type = 'Category'
@tag.taggable_id = 1
@tag.content = 'some content'
end
test "truth" do
assert_kind_of Class, MetaTag
end... | 24.816901 | 69 | 0.6521 |
e8344ff776e9fbcf8cfbbae559b194469888541c | 2,855 | require 'spec_helper'
describe DiscourseApi::API::Categories do
subject { DiscourseApi::Client.new("http://localhost:3000", "test_d7fd0429940", "test_user" )}
describe "#categories" do
before do
stub_get("http://localhost:3000/categories.json")
.to_return(body: fixture("categories.json"), header... | 32.443182 | 168 | 0.669702 |
036a65eba27631f2254ee4fbe67a0cd48a640ae0 | 3,521 | #
# Cookbook Name:: wordpress
# Recipe:: app
#
# Copyright 2009-2010, Opscode, 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
#
# Unle... | 39.122222 | 76 | 0.651803 |
012671d1b116f6339d6756b1fa6814661b6e92a2 | 954 | require "uri"
require "time"
require "timeout"
require "multi_json"
require "faraday"
require "elasticsearch/transport/transport/serializer/multi_json"
require "elasticsearch/transport/transport/sniffer"
require "elasticsearch/transport/transport/response"
require "elasticsearch/transport/transport/errors"
require "el... | 30.774194 | 80 | 0.808176 |
79abf4c270f9d0e79756e555fbea612f5fd55deb | 992 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::AzureStack::Mgmt::V2017_06_01
module Models
#
# Defines values for CompatibilityIssue
#
module CompatibilityIssue
HigherDeviceVersionReq... | 41.333333 | 73 | 0.796371 |
38682d68274f2193d862c53887afe084043766bd | 153 | class SubdomainConstraint
def self.matches?(request)
User.with_permalink.where("lower(permalink) = lower(?)", request.subdomain).exists?
end
end
| 25.5 | 87 | 0.751634 |
e9a526cac3c501d322787399bfcf66c7a98a50b8 | 2,428 | # frozen_string_literal: true
module Pagemaster
#
#
class Collection
attr_reader :source, :id_key, :layout, :data, :dir
#
#
def initialize(name, config)
@name = name
@config = config
@source = fetch 'source'
@id_key = fetch 'id_key'
end
#
#
def fetch(ke... | 25.557895 | 160 | 0.581549 |
21a3123e8e68e35c211d0c63ce226eb7eb365b8e | 1,353 | # run via: ruby mql4zmq_sub.rb 10.18.16.5:2027 tick [channel 2] [channel 3]...
require 'zmq'
# Check for help requested
if ARGV[0] == "-h" || ARGV[0] == "--help"
puts "Usage: ruby mql4zmq_sub.rb [MetaTrader IP Address]:[MQL4ZMQ EA Port Number default 2027] [channel 1] [channel 2] [channel 3]..."
puts "... | 39.794118 | 174 | 0.616408 |
87e6eead0481eeb983364ac98a8a89399615b320 | 532 | Pod::Spec.new do |s|
s.name = "LPTest"
s.version = "1.2.0"
s.summary = "简要介绍..."
s.description = "描述内容..."
s.homepage = "https://github.com/splsylp/MyTest"
s.license = "MIT"
s.author = { "Tony" => "961505161@qq.com" }
s.platform = :ios, "8.0"
s.source =... | 25.333333 | 87 | 0.548872 |
d50ee2099ffba6d33471f1733bd34ad61bd6da01 | 468 | class Api::V1::RegistrationsController < ApiController
skip_before_action :authenticate_request
def create
user = User.create user_params
if user.valid? && user.set_access_token
render json:
{
auth_token: user.access_token,
user_id: user.id
}
else
render_... | 19.5 | 76 | 0.66453 |
79032ce81587fa015aecc69d2ac59401a0495d95 | 287 | class StarWars::Planets
attr_accessor :name , :climate , :terrain
@@all = []
def initialize (name , climate , terrain)
self.name = name
self.climate = climate
self.terrain = terrain
@@all << self
end
def self.all
@@all
end
end | 16.882353 | 45 | 0.56446 |
1dda092ecc9ae2d4def15acf75a20c6f14f7c4fc | 280 | cask "font-telex" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/main/ofl/telex/Telex-Regular.ttf",
verified: "github.com/google/fonts/"
name "Telex"
homepage "https://fonts.google.com/specimen/Telex"
font "Telex-Regular.ttf"
end
| 23.333333 | 77 | 0.710714 |
ab4c292ad6969c24924ba010cbe10de193e84c8c | 3,181 | module Redcap2omop
class RedcapVariableMapsController < ApplicationController
before_action :set_redcap_variable_map, only: %i[ show edit update destroy ]
# GET /redcap_variable_maps or /redcap_variable_maps.json
def index
@redcap2omop_redcap_variable_maps = Redcap2omop::RedcapVariableMap.all
... | 41.855263 | 262 | 0.738761 |
d5e350713e89cc4db17e436dbbde8d9a05c8cca1 | 1,437 | class UserController < ApplicationController
get '/users/new' do
@message = session[:message]
session[:message] = nil
erb :'/users/new'
end
post '/new' do
if User.find_by(username: params[:username])
session[:message] = ">>Username is already taken. Please choose another Username<<"
... | 23.177419 | 89 | 0.595685 |
b9d26f4994684836efbe45bf8a2b3af739a104b7 | 252 | module MyJohnDeereApi::Validators
autoload :Base, 'my_john_deere_api/validators/base'
autoload :Asset, 'my_john_deere_api/validators/asset'
autoload :AssetLocation, 'my_john_deere_api/validators/asset_location'
end | 50.4 | 77 | 0.72619 |
26f73eb760d7baa37653dac4897567eee5bfcb01 | 223 | module SQLDroid
pom = File.read(File.expand_path('../../pom.xml', File.dirname(__FILE__)))
MAVEN_VERSION = pom[%r{(?<=<version>)([0-9a-zA-Z.-]*)(?=</version>)}]
VERSION = MAVEN_VERSION.gsub('-SNAPSHOT', '.alpha')
end
| 37.166667 | 76 | 0.636771 |
620d331bcf445692bef560fcdc4c1d46a3b87936 | 24 | module SlidesHelper
end
| 8 | 19 | 0.875 |
fffb7fc91d6b452118adbdb3f78eb439f3708621 | 249 | class Standup < ActiveRecord::Base
attr_accessible :title, :to_address, :subject_prefix
has_many :items, dependent: :destroy
has_many :posts, dependent: :destroy
validates :title, presence: true
validates :to_address, presence: true
end
| 24.9 | 54 | 0.763052 |
ab23eb99485c77ae65335fa796a2fc90e31212f5 | 1,231 | # 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... | 28.627907 | 74 | 0.665313 |
ed803b4dd457cccdcff212fc90ff16dc2e3053fd | 7,681 | # frozen_string_literal: true
module SAML
# rubocop:disable Metrics/MethodLength, Metrics/ModuleLength
module ResponseBuilder
MHV_PREMIUM_ATYPE = [
'{"accountType":"Premium","availableServices":{"21":"VA Medications","4":"Secure Messaging","3":"VA Allergies"'\
',"2":"Rx Refill","12":"Blue Button (a... | 41.295699 | 267 | 0.661633 |
aba2acabfd77baf6d889ca919e99f966ba81b55f | 123 | class ChangeColumnName < ActiveRecord::Migration[5.2]
def change
rename_column :comments, :body, :com_body
end
end
| 20.5 | 53 | 0.747967 |
7ac5bbc49b2cfe76693d95f6434f6d79a9770a5d | 789 | module Capistrano::DBSync
module Executor
class Base
# +side+ must be :local or :remote
def initialize(cap, config, side)
@cap = cap
@config = config
@session_id = Time.now.strftime("%Y-%m-%d-%H%M%S")
@side = side
end
def working_dir
... | 21.916667 | 80 | 0.572877 |
87fbfb8128a9cbf4865a9bb9433672a36202f294 | 529 | require 'rails_helper'
RSpec.describe UserPolicy do
before(:all) do
# create @user/@record for the 'can access thier own' shared example
# @user = FactoryGirl.create(:scout)
# @record = FactoryGirl.create(:sms_message, sender: @user)
end
def self.options
{ policy_class: UserPolicy, policy_resou... | 24.045455 | 83 | 0.680529 |
397f595815949faa48721320072b8c4683ffee07 | 6,625 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 36.005435 | 284 | 0.64966 |
794abfb4c2722540c79ca23a8c70fa3ddb3ba183 | 248 | class Condition < ApplicationRecord
has_many :stock_products
validates :name, presence: true, inclusion: { in: ["Like New", "Very Good", "Good", "Acceptable"] }
validates :buy_ratio, presence: true
validates :sell_ratio, presence: true
end
| 35.428571 | 101 | 0.733871 |
7a9e3c0d23d8040058c5334343ada61a90090020 | 15,974 | # coding: utf-8
require 'rspec'
require 'arangodb.rb'
describe ArangoDB do
prefix = "api-http"
################################################################################
## checking binary data
################################################################################
context "binary data" do
be... | 40.035088 | 272 | 0.583323 |
1c29e3b9140f1754664d9b8f4962d13a9a5767b1 | 6,562 | # Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
#
# frozen_string_literal: true
require_relative "./base_spanner_mock_server_test"
module MockServerTests
class SessionNotFoundTest < BaseS... | 45.255172 | 134 | 0.731484 |
e9f6a28adfdf7f28361a99525035ae22727d382b | 680 | class CreatePageAttachmentsExtensionSchema < ActiveRecord::Migration
def self.up
create_table "page_attachments" do |t|
t.column "content_type", :string
t.column "filename", :string
t.column "size", :integer
t.column "parent_id", :integer
t.column "thumbnail", :stri... | 29.565217 | 68 | 0.614706 |
ff40600033a622d45dd171c63ca9676f141d7a5c | 119 | json.array!(@apps) do |app|
json.extract! app, :id, :name, :body, :author
json.url app_url(app, format: :json)
end
| 23.8 | 47 | 0.655462 |
bfd88948eb9d8830d6cc69772c3efc435cbf4f38 | 1,277 | require 'pathname'
require 'uri'
require 'pstore'
require 'rubygems'
require 'mongrel/handlers'
module Rascut
module Utils
def home
if ENV['HOME']
home = Pathname.new ENV['HOME']
elsif ENV['USERPROFILE']
# win32
home = Pathname.new ENV['USERPROFILE']
else
raise '... | 19.348485 | 54 | 0.604542 |
d5376cd78fe8bd38ad4a916e129dcfbc1eeeb524 | 339 | # frozen_string_literal: true
require "#{File.dirname(__FILE__)}/recurring_at_intervals"
require "#{File.dirname(__FILE__)}/base_set_object"
require "#{File.dirname(__FILE__)}/recurring_at_intervals/minutely"
class Redis
class MinutelySet < Set
include RecurringAtIntervals
include BaseSetObject
include ... | 24.214286 | 67 | 0.787611 |
ed28ce1a69a58734565bee8484a1d152b6aeeeef | 313 | class UserMailerTest < ActionMailer::TestCase
def test_password_reset
user = create(:user)
email = UserMailer.password_reset(user).deliver
assert !ActionMailer::Base.deliveries.empty?
assert_equal [user.email], email.to
assert_equal "CatchLater Password Reset", email.subject
end
end | 28.454545 | 59 | 0.744409 |
6a9a6533071da139b9e6682c28c016a3a9fb2cfa | 4,099 | require 'test_helper'
require_relative "../lib/intcode_program"
class IntcodeProgramTest < MiniTest::Test
def test_simple_add_program
memory = [1,0,0,0,99]
p = IntcodeProgram.new(memory)
p.run!
assert_equal p.return_value, 2
end
def test_equal_to_position
# Using position mode, consider whet... | 28.268966 | 167 | 0.66626 |
f8feb7b3ee04ad83f52d6f1ae716d3fe67d6e323 | 1,438 | require 'fog/core/model'
module Fog
module Network
class OpenStack
class LbMember < Fog::Model
identity :id
attribute :pool_id
attribute :address
attribute :protocol_port
attribute :weight
attribute :status
attribute :admin_state_up
attribute... | 27.132075 | 84 | 0.493046 |
5d09eeb526f80c6487fd7be2ed26714982d2f594 | 599 | module WithModel
class ConstantStubber
def initialize const_name
@const_name = const_name.to_sym
@original_value = nil
end
def stub_const value
if Object.const_defined?(@const_name)
@original_value = Object.const_get(@const_name)
Object.send :remove_const, @const_name
... | 23.96 | 70 | 0.699499 |
18a24d35a2c8cc334f7f3e14e57824e301ed57d9 | 2,596 | RSpec.describe RavenDB::GetAttachmentOperation, database: true do
ATTACHMENT = "47494638396101000100800000000000ffffff21f90401000000002c000000000100010000020144003b".freeze
it "puts attachment" do
store.open_session do |session|
product = Product.new(nil, "Test Product", 10, "a")
session.store(pro... | 30.186047 | 108 | 0.630971 |
01435210fbe73ccdd9253a88c948174de2478a67 | 2,632 | # encoding: utf-8
#
control "V-71981" do
title "The operating system must prevent the installation of software,
patches, service packs, device drivers, or operating system components of
packages without verification of the repository metadata."
desc "
Changes to any software components can have significant eff... | 37.070423 | 79 | 0.754179 |
91a2208eeaae01dcf4fd5a8ca5f7ae455fe1a244 | 1,388 | class PhotosController < ApplicationController
before_action :logged_in_user
def show
#style = params[:style] ? params[:style] : 'med'
style = "large"
record = Photo.find(params[:id])
raise 'Error' unless record.image.exists?(style)
send_data record.image.file_contents(style),
:filename => re... | 24.350877 | 121 | 0.657061 |
ed7223cbe427934b140737c0bd61d464110fef21 | 1,021 | require File.expand_path('../../test_helper.rb', __FILE__)
require File.expand_path('../solr_stats.rb', __FILE__)
require 'open-uri'
class SolrStatisticsTest < Test::Unit::TestCase
def teardown
FakeWeb.clean_registry
end
def test_should_report
uri = 'http://localhost:8983/solr/admin/mbeans'
body = ... | 34.033333 | 82 | 0.708129 |
3811bb9035ad68f3a39bdd9686a7d5641bc68f8d | 1,011 | require 'spec_helper'
module TurboPlay
RSpec.describe Base do
class MyTestModel < TurboPlay::Base
attributes :id, :name
end
describe '.attributes' do
it 'sets the attributes' do
expect(MyTestModel.attributes_list).to eq(%i[id name])
end
end
describe '#initialize' do
... | 25.923077 | 74 | 0.562809 |
01b9006a6a17ff9afd542084d9316fafb615bd18 | 455 | cask "lyn" do
version "2.0"
sha256 "2706168da42f1302725140120eb00e9c66dfbc87ede7a7d35d2f60d00b2068d7"
url "https://www.lynapp.com/downloads/Lyn-#{version}.dmg"
appcast "https://www.lynapp.com/lyn/update#{version.major}x.xml"
name "Lyn"
homepage "https://www.lynapp.com/"
app "Lyn.app"
zap trash: [
... | 25.277778 | 75 | 0.701099 |
ac1b9b11ada9c8835e59b74fe6aecb99030ca1e4 | 973 | module ChefAPI
module Resource
autoload :Base, 'chef-api/resources/base'
autoload :Client, 'chef-api/resources/client'
autoload :CollectionProxy, 'chef-api/resources/collection_proxy'
autoload :Cookbook, 'chef-api/resources/cookbook'
autoload :CookbookVersion, 'chef-api/... | 48.65 | 68 | 0.675231 |
7ac31f1d7364a8530e9146bdff9c46159a839c98 | 124,852 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 45.31833 | 228 | 0.675544 |
ab85c9f501c0b6f89d937a4ff8723e9e50cd52fa | 4,034 | class IncludeWhatYouUse < Formula
desc "Tool to analyze #includes in C and C++ source files"
homepage "https://include-what-you-use.org/"
url "https://include-what-you-use.org/downloads/include-what-you-use-0.15.src.tar.gz"
sha256 "2bd6f2ae0d76e4a9412f468a5fa1af93d5f20bb66b9e7bf73479c31d789ac2e2"
license "NCS... | 37.351852 | 121 | 0.679474 |
879bc214dca9571afec4f0407eddfae94936536e | 782 | ##
# $Id$
##
require 'msf/core/exploit/cmdstager'
module Msf
###
#
# This mixin provides an interface for staging cmd to arbitrary payloads
#
###
module Exploit::CmdStagerVBS
include Msf::Exploit::CmdStager
def initialize(info = {})
super
register_advanced_options(
[
OptString.new( 'DECODERSTUB', [ ... | 17.772727 | 87 | 0.677749 |
e8b6c4775ed95c02d6820a6669d7127bb1d087f5 | 1,092 | #!/usr/bin/env ruby
require 'optparse'
require 'shellwords'
require 'ostruct'
opt = OpenStruct.new
parser = OptionParser.new do |op|
op.banner = "usage: #{File.basename($0)} <file>.pdf ..."
op.separator "output: <file>.txt ..."
op.on("-f", "--formfeed", "remove the formfeed lines") {|v| opt.formfeed = v }
op.... | 22.75 | 93 | 0.619048 |
21c9fffa285ceda64c34e66b9d588c2654c0ff8a | 2,282 | describe Gamefic::Scene::MultipleChoice do
before :each do
@plot = Gamefic::Plot.new
c = Class.new(Gamefic::Entity) { include Gamefic::Active }
@character = @plot.make c, :name => 'character'
@after = @plot.pause
@chooser = @plot.multiple_choice "one", "two", "three", "next" do |actor, data|
... | 29.25641 | 83 | 0.605609 |
03345858da50d4a03f611f8aa0a1ec480d1ecde6 | 481 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/monitoring/dashboard/v1/drilldowns.proto
require 'google/protobuf'
require 'google/monitoring/dashboard/v1/common_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/monitoring/dashboard/v1/drilldowns.proto", :synt... | 21.863636 | 84 | 0.733888 |
083fe00d49401c92186174e7a44ee2ab892524d7 | 1,398 | # By: Eriberto Lopez
# elopez3@uw.edu
# 03/13/19
needs "Plate Reader/PlateReaderConstants"
needs "Standard Libs/AssociationManagement"
module ExperimentalMeasurement
attr_accessor :measurement_type, :experimental_item, :measurement_item, :transfer_required, :measurement_data
def setup_experimental_measurement(ex... | 22.548387 | 111 | 0.698856 |
6ab87613713c585b7ea1c298fe12c541423d25cc | 1,616 | module Souyuz
# Responsible for building the fully working build command
class BuildCommandGenerator
class << self
def generate
parts = prefix
parts << compiler_bin
parts += options
parts += targets
parts += project
parts += pipe
parts
end
... | 23.42029 | 110 | 0.580446 |
390aa1380c1b45cae88f41ca5140698c78897950 | 3,183 | require 'formula'
class Doxygen < Formula
homepage 'http://www.doxygen.org/'
url 'http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.6.src.tar.gz'
mirror 'https://downloads.sourceforge.net/project/doxygen/rel-1.8.6/doxygen-1.8.5.src.tar.gz'
sha1 '204f1b3695c73efac44a521609c5360241d64045'
head 'https://doxyge... | 36.586207 | 100 | 0.663211 |
3378beee2a23ef8673b8165790032005f4efe910 | 343 | class Tangerine < Cask
version '1.4.8'
sha256 'dea00674331b1aa663cf00f64b0ce208638a136575987e1a7f50bd135117f2d9'
url "http://distrib.karelia.com/downloads/Tangerine!-4008.zip"
homepage 'http://www.karelia.com/products/tangerine/'
license :unknown
app 'Tangerine!.app'
postflight do
suppress_move_to_... | 22.866667 | 75 | 0.772595 |
28472966464ba522dfd2a3eef14cbbf62f7c383d | 1,867 | # frozen_string_literal: true
class PicturePhenotypeCommentsController < ApplicationController
before_filter :require_user
def new
@phenotype_comment = PicturePhenotypeComment.new
@title = 'Add comment'
respond_to do |format|
format.html
format.xml { render xml: @phenotype }
end
end
... | 34.574074 | 141 | 0.716122 |
ed51348bbd64e2c1fab9264a4e335502505f8f8f | 215 | # frozen_string_literal: true
require 'spec_helper'
describe GrapeSwagger do
it '#version' do
expect(GrapeSwagger::VERSION).to_not be_nil
expect(GrapeSwagger::VERSION.split('.').count).to eq 3
end
end
| 19.545455 | 58 | 0.739535 |
1d569c7cd2dd1b37ab70b8ee764a9077887b38cb | 2,365 | module Account::Users::ControllerBase
extend ActiveSupport::Concern
included do
load_and_authorize_resource :user, class: "User", prepend: true,
member_actions: (defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
collection_actions: (defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])
before... | 29.197531 | 116 | 0.676533 |
7a8763b2631093502fbe0af3ae17b59ff2d75425 | 38 | module Pebble
VERSION = "0.1.2"
end
| 9.5 | 19 | 0.657895 |
3806884ffbd48072423b388f0e640197c12570a6 | 933 | # == Schema Information
#
# Table name: credentials
#
# id :integer not null, primary key
# beeminder_user_id :string not null
# provider_name :string not null
# uid :string default(""), not null
# info :json not null
... | 30.096774 | 70 | 0.575563 |
1afe161375e9cceaca8679fd4443afe889d1ac8b | 380 | require 'bundler/setup'
require 'github_org_activity_devs'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config... | 25.333333 | 66 | 0.763158 |
ff3ea6f3f63117c46943328881c209e8992d10ed | 746 | #!/usr/local/bin/ruby
require 'mxx_ru/cpp'
MxxRu::Cpp::composite_target {
path = 'test/so_5/enveloped_msg'
required_prj "#{path}/simplest/prj.ut.rb"
required_prj "#{path}/adv_thread_pool/prj.ut.rb"
required_prj "#{path}/simple_timer/prj.ut.rb"
required_prj "#{path}/simple_delivery_filter/prj.ut.rb"
required_p... | 29.84 | 56 | 0.758713 |
4a91a59f371826cb84b8d23092bb8b1e100a4459 | 148 | class ChangeCodigoPostalToString < ActiveRecord::Migration[4.2]
def change
change_column :codigos_postales, :codigo_postal, :string
end
end
| 24.666667 | 63 | 0.790541 |
e97ceb48cd4c0b9877058895a7db65c31512aaae | 333 | module CampaignsHelper
def campaign_params(name, medium = 'dm')
{
via: name,
utm_source: name,
utm_medium: medium,
utm_campaign: name,
}
end
def dialog_params
{
follow_dialog: 1,
sign_in_dialog: 1,
share_dialog: 1,
purchase_dialog: 1
... | 16.65 | 42 | 0.561562 |
bf8250ff5bd54ad35775703d4a6868b146ec0de7 | 8,747 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::DCERPC
include Msf::Exploit::Remote::SMB::Client
include Msf::Exploit::Remote::SMB::Client::Authenticated... | 34.848606 | 110 | 0.625357 |
6ad0d0837188b7b2440a5e897f01e5acc5d13526 | 128 | class CreateJoinTableAssembliesParts < ActiveRecord::Migration
def change
create_join_table :parts, :assemblies
end
end
| 21.333333 | 62 | 0.804688 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.