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 |
|---|---|---|---|---|---|
1ad71f89528a8b27a1c2ee3952957cef0b019a13 | 450 | cask 'ipvanish-vpn' do
version '2.2.1_234'
sha256 '0f44ac51d46c5fa09131719548dc73760a4db7005a999b1f9cc4c295f37e15b8'
url "https://www.ipvanish.com/software/osx/IPVanish_v#{version}.zip"
appcast 'https://www.ipvanish.com/software/osx/updates.xml',
checkpoint: '999bcbe8e257f51dd07573199541e90c7fd130db7... | 32.142857 | 88 | 0.771111 |
7943f4121e396016ce7fb0ce808bdd62ea6ecd69 | 213 | class RemoveHasPrivateAccessAndSignInCountFromUsers < ActiveRecord::Migration[4.2]
def change
remove_column :users, :has_private_access, :boolean
remove_column :users, :sign_in_count, :integer
end
end
| 30.428571 | 82 | 0.793427 |
18f6bc64e0e2dd146134889c2a256c567312e3e1 | 5,267 | require "optparse"
require "rubygems"
require "tmpdir"
require "pathname"
require "rexml/document"
class MD2XML
def add_header(text, level, body)
@in_list = false
node = REXML::Element.new("w:p", body)
pPr = REXML::Element.new("w:pPr", node)
REXML::Element.new("w:pStyle", pPr).add_attribute("w:val", ... | 30.445087 | 98 | 0.618568 |
1816163b2c9dba1fc04e39468c70124842d97a16 | 309 | require "fog/xml/version"
require "nokogiri"
module Fog
autoload :ToHashDocument, "fog/to_hash_document"
module XML
autoload :SAXParserConnection, "fog/xml/sax_parser_connection"
autoload :Connection, "fog/xml/connection"
end
module Parsers
autoload :Base, "fog/parsers/base"
end
end
| 19.3125 | 66 | 0.744337 |
f71fae79348266d1964259ece0e7738d9817dae4 | 1,319 | # -*- encoding: utf-8 -*-
# stub: liquid 3.0.6 ruby lib
Gem::Specification.new do |s|
s.name = "liquid".freeze
s.version = "3.0.6"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.7".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tobias Luetke".... | 35.648649 | 116 | 0.661107 |
28cf7c95e5ca6f6ad9fb96c2a9f1c760668ef509 | 658 | module Sinatra
module MercuryImages
# register app
def self.registered(app)
# stream images
app.get %r{(.gif|.jpg|.png|.jpeg)$} do
content_type get_image_type(request.path_info)
File.open(options.views + request.path_info, 'rb') do |file|
file.read
end
end... | 21.933333 | 69 | 0.56383 |
08a8726280286b575aa7ac5b6be3497b84f118df | 3,633 | # Copyright © 2011-2020 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this l... | 36.33 | 163 | 0.734104 |
bb5963b22e2c2365c086b29f789ceda930bbccb5 | 573 | # This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2009-2013, Sebastian Staudt
# This module is used as a wrapper around Steam Condenser's classes
#
# It does not provide any own functionality, but this file is used as an entry
# point whe... | 30.157895 | 78 | 0.769634 |
034e8a6a4e55ce4b4c2e393090282245f1eba600 | 1,425 | # encoding: utf-8
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20170313133418_rename_more_reserved_project_names.rb')
# This migration uses multiple threads, and thus different transactions. This
# means data created in this spec may not be visible to some threads. To work
# around this we use... | 28.5 | 101 | 0.686316 |
e98a4cb47577be20533ad4e4870fe0cedfece359 | 3,603 | ##
# 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 'net/ssh'
class Metasploit3 < Msf::Exploit::Remote
... | 27.090226 | 101 | 0.547322 |
1132bf61875d6cdf29c8216cb39c3cad4f049ff2 | 128 | class CloseAllTaxAdjustments < ActiveRecord::Migration
def up
Spree::Adjustment.tax.update_all(finalized: true)
end
end
| 21.333333 | 54 | 0.78125 |
1a02e7c41c5313fd0bcc7d248e1e4e1d7d026c68 | 1,478 | require 'rails_helper'
RSpec.describe Herstory::RecordCallbacks do
before :all do
Arrival.logs_changes includes: {users: {}, shipments: {superordinate: :record}}
Thread.current[:current_user] = User.create({name: 'Joanne Doe'})
end
context "when included in a class" do
it "doesn't log a creation ev... | 25.050847 | 83 | 0.654939 |
7aaaa57bde3a6d1ce4d7cccdf8d30abaa5a839c5 | 581 | require "test_helper"
class ReadableTest < MiniTest::Spec
Credentials = Struct.new(:password)
class PasswordForm < TestForm
property :password, readable: false
end
let(:cred) { Credentials.new }
let(:form) { PasswordForm.new(cred) }
it {
assert_nil form.password # password not read.
form.va... | 18.741935 | 57 | 0.655766 |
1d0a4e9b200624df94ce7193c314b209d885b46c | 2,613 | class FortniteNewsAndInfo::Fortnite
attr_accessor :brNews, :statsV2, :battle_royale_news, :creative_news, :save_the_world_news, :lifetime_keyboard, :lifetime_gamepad, :lifetime_touch, :lifetime_all
require 'pry'
def initialize
####
#is there a better place to do this????
##... | 31.481928 | 165 | 0.511672 |
3944565badb086ad3ca62e0608396a8c5db2cc3e | 9,069 | # -*- encoding: utf-8 -*-
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/common', __FILE__)
describe "File.expand_path" do
before :each do
platform_is :windows do
@base = `cd`.chomp.tr '\\', '/'
@tmpdir = "c:/tmp"
@rootdir = "c:/"
end
p... | 34.222642 | 95 | 0.605469 |
f887dc569acf91cc6354b4f5e2adb06531544b91 | 10,155 | # frozen_string_literal: true
# encoding: utf-8
module Mongoid
module Validatable
# Validates whether or not a field is unique against the documents in the
# database.
#
# @example Define the uniqueness validator.
#
# class Person
# include Mongoid::Document
# field :title
... | 31.933962 | 103 | 0.593895 |
280036f9057beecc97706606d1288e7bf63756a4 | 263 | Rails.application.routes.draw do
resources :todos
get 'hello_world', to: 'hello_world#index'
put '/todos', to: 'todos#massUpdate'
root 'todos#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 32.875 | 101 | 0.741445 |
6a6a109dbbe8386cd230301fa0ff5b294f78d7b6 | 1,230 | class ExercisesController < ApplicationController
before_action :set_exercise, only: [:show, :update, :destroy]
# GET /exercises
def index
@exercises = Exercise.all
render json: ExerciseSerializer.new(@exercises).serializable_hash[:data].map{|hash| hash[:attributes] }
end
# GET /exercises/1
def s... | 23.653846 | 107 | 0.692683 |
e9971a0d18dd0e81f4f63828335ce2c69abc531e | 8,949 | require 'test/unit'
require 'ox'
require 'set'
require_relative '../../lib/ez7gen/service/2.5/field_generator'
class FieldGenerator25Test < Test::Unit::TestCase
# 27
vs =
[
# {:std=>"2.4", :path=>"../../test/test-config/schema/2.4", :profiles=>[{:doc=>"2.4.HL7", :name=>"2.4", :std=>"1", :path=>".... | 41.050459 | 359 | 0.649123 |
f89732ab6c0006cdea4a6bc878d919503c30d058 | 13,088 | # frozen_string_literal: false
require_relative "utils"
class OpenSSL::TestSSLSession < OpenSSL::SSLTestCase
def test_session_equals
session = OpenSSL::SSL::Session.new <<-SESSION
-----BEGIN SSL SESSION PARAMETERS-----
MIIDFgIBAQICAwEEAgA5BCCY3pW6iTkPoD5SENuztz/gZjhvey6XnHbsxd22k0Ol
dgQw8uaN3hCRnlhoIKPWInCFzrp/t... | 34.901333 | 91 | 0.709658 |
268f3b717170ea5124bff77fdb45b42e43490b52 | 624 | # frozen_string_literal: true
module QA
module Page
module Trials
class New < Chemlab::Page
path '/-/trials/new'
# TODO: Supplant with data-qa-selectors
text_field :first_name, id: 'first_name'
text_field :last_name, id: 'last_name'
text_field :company_name, id: 'co... | 26 | 58 | 0.649038 |
39dfcd94ee0dfb28770ed687886b99a140b3d4f4 | 1,585 | require 'dbcode/graph'
require 'dbcode/sql_file'
describe DBCode::Graph do
def file_double(methods)
double DBCode::SQLFile, methods
end
it 'sorts two interdependent files' do
file_1 = file_double name: 'file_1', dependency_names: ['file_2'], to_sql: 'file 1'
file_2 = file_double name: 'file_2', depe... | 39.625 | 96 | 0.692114 |
f8345eff4d221eb9c7bcf53f16202e21ad8196d9 | 431 | class MoveTrixEditorValueFromTangibleThingsToActionText < ActiveRecord::Migration[6.1]
def change
Scaffolding::CompletelyConcrete::TangibleThing.find_each do |tangible_thing|
if tangible_thing.trix_editor_value.present?
tangible_thing.update(action_text_value: tangible_thing.trix_editor_value)
... | 35.916667 | 86 | 0.812065 |
ed6786486fc53319b9e14bc5e47b7793c482bf54 | 3,434 | # rubocop:disable Lint/MissingCopEnableDirective, Metrics/BlockLength
Rails.application.routes.draw do
draw(:old_route_redirects)
ActiveAdmin.routes(self)
require 'sidekiq/web'
authenticate :user, ->(user) { user.admin? } do
mount Sidekiq::Web => '/sidekiq'
end
resource :github_webhooks, only: :create... | 32.396226 | 94 | 0.701514 |
1d0827ba8998d57c3ff7c2d913c2c8fb3c1e8b25 | 2,267 | # encoding: utf-8
module Rack
class Webconsole
# Helper module to encapsulate the asset loading logic used by the {Assets}
# middleware.
#
# For now, the strategy is reading the files from disk. In the future, we
# should come up with a somewhat more sophisticated strategy, although
# {Webcons... | 30.635135 | 119 | 0.595942 |
4ac020d5499212d2abd625347526266b93563437 | 2,872 | require 'nokogiri'
require 'docx/elements'
require 'docx/containers'
module Docx
module Elements
module Element
DEFAULT_TAG = ''
# Ensure that a 'tag' corresponding to the XML element that defines the element is defined
def self.included(base)
base.extend(ClassMethods)
... | 29.306122 | 112 | 0.571379 |
7a6dddd26d99107322cf3681048c06d9bf664cfd | 142 | class AddProfileToShirts < ActiveRecord::Migration
def change
add_reference :shirts, :profile, index: true, foreign_key: true
end
end
| 23.666667 | 67 | 0.767606 |
5df108da2a018a69e0efe67dc71d0d30de766503 | 478 | require 'stringio'
module Puppet::Parser::Functions
newfunction(:generate_options, type: :rvalue) do |args|
options = args[0]
buffer = StringIO.new
buffer << "options {\n"
indent = ' '
return '' if options.empty?
options.keys.sort.each do |option|
value = options[option]
buff... | 19.916667 | 57 | 0.575314 |
183321c9b7a3897c9040915f3c396b098fe7942e | 230 | # frozen_string_literal = true
require './lib/todoable'
require 'minitest/autorun'
require 'webmock/minitest'
require 'vcr'
require 'pry'
VCR.configure do |c|
c.cassette_library_dir = "test/fixtures"
c.hook_into :webmock
end | 19.166667 | 42 | 0.76087 |
6a3f8c95cdfb1e945603f8600188259f7683ac07 | 356 | require "indicator.rb"
ActionView::Base.send(:include, Indicator::InstanceMethods)
# install files
%w[/public/images /public/javascripts /public/stylesheets].each{|dir|
source = File.join(directory,dir)
dest = RAILS_ROOT + dir
FileUtils.cp_r(Dir.glob(source+'/*.*'), dest)
} unless File.exists?(RAILS_ROOT... | 35.6 | 70 | 0.719101 |
ed1a07e24bafa327a3b84ba2337bc15fbb52687f | 152 | require 'test_helper'
module EventLogger
class EventTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
end
| 15.2 | 43 | 0.677632 |
e9fca6e3abb59eab298e07f0d792cfebc8a29be7 | 1,344 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Kernel.binding" do
it "returns a binding for the caller" do
Kernel.binding.eval("self").should == self
end
end
describe "Kernel#binding" do
it "is a private method" do
Kernel.should have_private_instance_method(:binding)
... | 25.846154 | 73 | 0.65625 |
913dea7615c7a8027b88d1eda24ab6f59b1fb234 | 188 | class ChangeTypeNameFieldToString < ActiveRecord::Migration
def change
remove_column :quotation_prices, :name
add_column :quotation_prices, :name, :string, default: ""
end
end
| 26.857143 | 61 | 0.765957 |
6a82cb9fabb3571ffa6c7b04f2b1d7ad6e32a631 | 53 | module SqlOptimizer
VERSION = '0.1.3'.freeze
end
| 8.833333 | 26 | 0.698113 |
4aa2cd6c5f58efaac3c9cea3061791730a2cd6ea | 1,894 | module JSONAPI
class Formatter
class << self
def format(arg)
arg.to_s
end
def unformat(arg)
arg
end
# :nocov:
if RUBY_VERSION >= '2.0'
def formatter_for(format)
formatter_class_name = "#{format.to_s.camelize}Formatter"
Object.const_... | 19.729167 | 71 | 0.635692 |
acc054eb9ed8ec6a0331061e39adc9502429326c | 6,683 | module Onebox
module Engine
class GoogleMapsOnebox
include Engine
class << self
def ===(other)
if other.kind_of? URI
@@matchers && @@matchers.any? { |m| other.to_s =~ m[:regexp] }
else
super
end
end
private
def ma... | 37.127778 | 220 | 0.546611 |
ab09f41612313913f1f80fbc521b5376711af842 | 140,382 | survey 'UY',
:full_title => 'Uruguay',
:default_mandatory => 'false',
:status => 'alpha',
:description => '<p><strong>This has been generated based on a default and needs to be localised for Uruguay. Please help us! Contact <a href="mailto:certificate@theodi.org">certificate@theodi.org</a></strong></p><p>This s... | 54.45384 | 727 | 0.690886 |
28dd5148950d07000c4516c18d1a338b1154d6d7 | 2,815 | class GitlabGem < Formula
desc "Ruby client and CLI for GitLab API"
homepage "https://github.com/NARKOZ/gitlab"
url "https://github.com/NARKOZ/gitlab/archive/v4.18.0.tar.gz"
sha256 "6967bbf68ebff61714d855da950cfac4c8c3825a80d79f9210b40e37f6ba752c"
license "BSD-2-Clause"
bottle do
sha256 cellar: :any_sk... | 41.397059 | 123 | 0.7627 |
0124f38e190c9171c8db3af7abbb88b8039ba241 | 9,883 | # encoding: UTF-8
require 'spec_helper'
require 'yt/models/channel'
describe Yt::Channel, :device_app do
subject(:channel) { Yt::Channel.new id: id, auth: $account }
context 'given someone else’s channel' do
let(:id) { 'UCxO1tY8h1AhOz0T4ENwmpow' }
it 'returns valid metadata' do
expect(channel.title... | 40.670782 | 105 | 0.691187 |
edaecc05f1f94bac7ceb608ee99bd033c1319704 | 1,538 | # 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... | 38.45 | 74 | 0.780884 |
bf103678a870fc499b17ebf4c2f1c1f44dc6567e | 1,721 | #
# Author:: Tyler Cloke (tyler@chef.io)
# Copyright:: Copyright (c) 2015 Chef Software, Inc
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | 25.308824 | 92 | 0.661243 |
e8e1740ca5a7f76fc5842ae40bee3aa9bcec7f35 | 473 | #
# To run:
# clear; ruby extconf.rb ; make; ruby RubyTestSharedMemoryModuleGPIO2.rb
#
require_relative 'SharedMemoryGPIO2'
#WriteDataToSharedMemory("abcd12345")
smgpio2 = SharedMemoryGpio2.new
fromSharedMem = smgpio2.GetData()
puts "Content of fromSharedMem=#{fromSharedMem}"
# newData = "abcd12345"
# SharedMemoryGpi... | 29.5625 | 72 | 0.784355 |
6106c4ff78070cb0860073aa6ac4da5432ae4cab | 421 | require 'digest/md5'
class MerbSlicePayson::Response
attr_reader :paysonref
def initialize(params, key = nil)
@ok_url = params['OkURL']
@paysonref = params['Paysonref']
@md5 = params['MD5']
@ref_nr = params['RefNr']
@fee = params['Fee']
@key = key || Payson[... | 18.304348 | 62 | 0.574822 |
5d5f41faa0bb9ccca87fff4f9d69dc5c5ed3ba36 | 306 | class MigrateCalculatedAvailabilityValues < ActiveRecord::Migration
def up
Programmer.all.each do |programmer|
programmer.calculate_calculated_availability
# Do not force a successful save, as incomplete programmers are not valid
programmer.save
end
end
def down
end
end
| 23.538462 | 79 | 0.751634 |
1c0f303bca0e83e7f48b071ee982ee0fa7f34e43 | 444 | module Faye
class Transport::Local < Transport
def self.usable?(dispatcher, endpoint, &callback)
callback.call(Server === endpoint)
end
def batching?
false
end
def request(messages)
EventMachine.next_tick do
@endpoint.process(messages, nil) do |replies|
recei... | 18.5 | 53 | 0.641892 |
7a964e118baa57708d4c4a74d920c03df57faf74 | 248 | require "openxml/drawingml/properties/paragraph_properties"
module OpenXml
module DrawingML
module Properties
class Level3ParagraphProperties < ParagraphProperties
namespace :a
tag :lvl3pPr
end
end
end
end
| 17.714286 | 59 | 0.717742 |
0839ceb7e6fe3c8e63c0710c3f8542c95d36257a | 1,078 | module SixSaferpay
module SixTransaction
class AssertRefundResponse
attr_accessor(:response_header,
:transaction_id,
:order_id,
:status,
:date
)
def initialize(response_header:,
... | 26.95 | 101 | 0.548237 |
01c740b3afdaf92112db7b0dd8d5107042e663ac | 3,547 | # frozen_string_literal: true
require "rails_helper"
describe "api/v1/plans/_show.json.jbuilder" do
before(:each) do
@plan = create(:plan)
@data_contact = create(:contributor, data_curation: true, plan: @plan)
@pi = create(:contributor, investigation: true, plan: @plan)
@plan.contributors = [@data_... | 34.105769 | 91 | 0.670426 |
e827f69faa0b839c3d9be4d880a793bb292498ee | 104 | class DebugMigration < ActiveRecord::Migration[4.2]
def change
puts "RUNNING MIGRATION"
end
end
| 17.333333 | 51 | 0.740385 |
21e53e1efa4742e652301c0cf1740c6a58d31c5e | 355 | module Ctgov
class OutcomeAnalysis < Ctgov::StudyRelationship
belongs_to :outcome, inverse_of: :outcome_analyses, autosave: true
has_many :outcome_analysis_groups, inverse_of: :outcome_analysis, autosave: true
has_many :result_groups, :through => :outcome_analysis_groups
def groups
outcome_... | 27.307692 | 86 | 0.757746 |
2683884486ab4d91790cf6dce26cc054c3ec12ee | 4,373 | module StripeMock
module TestStrategies
class Base
def list_skus(limit)
Stripe::SKU.list(limit: limit)
end
def create_sku(params={})
Stripe::SKU.create create_sku_params(params)
end
def create_sku_params(params={})
currency = params[:currency] || StripeMock... | 28.581699 | 148 | 0.57512 |
7a87661e14a23dc098d38982b95aa8d6289e9f20 | 693 | module ErrorMessagesHelper
# Render error messages for the given objects.
# The :message option is allowed.
def error_messages_for(*objects)
options = objects.extract_options!
options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "One or more fields need to be supplied or corrected.")... | 36.473684 | 132 | 0.701299 |
3820cef88363da2d5e4ed9f832eb1581cf976944 | 124 | # frozen_string_literal: true
class Admin::BaseController < ApplicationController
before_action :authenticate_admin!
end
| 20.666667 | 51 | 0.83871 |
216420990304eaf9af5cf25955c96d3142ce21d3 | 1,900 | # frozen_string_literal: true
module Beta
module Types
module Objects
class WorkImageType < Beta::Types::Objects::Base
implements GraphQL::Relay::Node.interface
global_id_field :id
field :anikuto_id, Integer, null: true
field :work, Beta::Types::Objects::WorkType, null: tr... | 25.675676 | 68 | 0.626316 |
bf4bd053e4d262bebeec3fa79ac373f45828f7e8 | 599 | # -*- encoding : utf-8 -*-
class UserObserver < ActiveRecord::Observer
observe :user
def before_validation(user)
user.password = SecureRandom.hex(4) unless user.password || user.persisted?
end
def after_initialize(user)
if not user.name.nil?
user.name.force_encoding(Encoding::UTF_8)
end
en... | 21.392857 | 79 | 0.691152 |
9166e33401464a0b48d8579bf677ff63d7485e61 | 1,044 | class CLI
def call
welcome
puts "************************************************************"
title_list
get_user_input
display_articles
done
end
def welcome
puts "Welcome informed citizen!"
end
def title_list
Scraper.scrape
AllTop.all.each_with_index do |alltop_obj, i|
puts "#{i+1}. #{alltop_ob... | 17.694915 | 69 | 0.627395 |
3814c8e6509ea523dca4a887d9071e85933a7ab4 | 2,538 | # frozen_string_literal: true
require "secp256k1"
module CKB
module Utils
def self.hex_to_bin(hex)
hex = hex[2..-1] if hex.start_with?("0x")
[hex].pack("H*")
end
def self.bin_to_hex(bin)
bin.unpack1("H*")
end
def self.bin_to_prefix_hex(bin)
"0x#{bin_to_hex(bin)}"
en... | 28.516854 | 75 | 0.633964 |
e95d2eb2ba82f867d88961de49493d48d183820b | 161 | # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Pmacctstats::Application
| 32.2 | 67 | 0.776398 |
ab2f55ef0de5b09f80d8fc7ab06e666d5c43fac4 | 1,404 | module Commissioner
class ToolsController < ApplicationController
before_action :commissioner_required
def index
end
# NEW SEASON
# Creates new players, deletes inactive players and players not in league, updates player if new team, adds cbs data
def update_available_players
... | 32.651163 | 125 | 0.660969 |
4a50a54c3e5aed41e0b3de74d5c5bc445abe93b6 | 26 | module HangoutsHelper
end
| 8.666667 | 21 | 0.884615 |
61c21d7a7d349a4c6e5e67b0f9cc905f4c681966 | 3,032 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requ... | 39.894737 | 86 | 0.746042 |
7a0c7fe27861ea5d37ff627ecfbf050c785ef39c | 245 | class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :username
t.string :password_digest
t.string :email
t.integer :admin, default: 0
t.timestamps
end
end
end
| 18.846154 | 48 | 0.644898 |
8756a71c4def18e0703b922ed6ed95e47ce24918 | 177 | class SolvemediaConfigGenerator < Rails::Generator::Base
def manifest
record do |m|
m.file "solvemedia_config.yml", "config/solvemedia_config.yml"
end
end
end
| 22.125 | 68 | 0.723164 |
7a160ef513fc1a5d1d6ed6923dcd14bb5cb07415 | 321 | class Food < ApplicationRecord
belongs_to :user
validates :name, presence: true
validates :measurement_unit, presence: true
validates :user_id, presence: true
validates :price, numericality: { greater_than_or_equal_to: 1, only_integer: true }
def name_with_unit
"#{name} (#{measurement_unit})"
end
end... | 26.75 | 85 | 0.747664 |
6186bd88ef46d6a7be675ddcd7ff0a326d59dc35 | 19,155 | # frozen_string_literal: true
class CatalogController < ApplicationController
include BlacklightRangeLimit::ControllerOverride
include Blacklight::Catalog
include Arclight::Catalog
include Arclight::FieldConfigHelpers
configure_blacklight do |config|
## Class for sending and receiving requests from a s... | 48.371212 | 193 | 0.728583 |
0838b9a881b855bee8eff97b05abccaf4ae1f157 | 1,613 | require 'iolaus'
require 'iolaus/util/adapter'
# Base class for handlers
#
# Handlers are attached to requests added to instances of the
# {Iolaus::Client} class. Handlers may implement either
# the {#handle_request} or {#handle_response} methods.
class Iolaus::Handler
include Iolaus::Util::Adapter
# @!method han... | 28.803571 | 76 | 0.699318 |
e9a96af51dfb814bd17c1ab0af54e73f0c4cd4bf | 1,240 | require 'spec_helper'
Obfuscator ||= Ingenico::Direct::SDK::Logging::Obfuscator
ValueObfuscator ||= Ingenico::Direct::SDK::Logging::ValueObfuscator
describe Obfuscator do
subject(:sample) { Obfuscator.new(obsfs, case_insensitive) }
context 'initialize' do
let(:obsfs) { { 'k1' => ValueObfuscator.INSTANCE,
... | 28.181818 | 67 | 0.635484 |
7a80551282475d849ece98ec3b9a80f66f91cb3f | 1,634 | require 'test_helper'
class DinosaursControllerTest < ActionDispatch::IntegrationTest
setup do
@dinosaur = dinosaurs(:one)
end
test "should get index" do
get dinosaurs_url, as: :json
assert_response :success
end
test "should create dinosaur" do
assert_difference('Dinosaur.count') do
p... | 41.897436 | 468 | 0.753978 |
5d7d5caef39ac85677c2bd639d9853c6a0b7be12 | 120 | # Preview all emails at http://localhost:3000/rails/mailers/rd_mailer
class RdMailerPreview < ActionMailer::Preview
end
| 30 | 69 | 0.816667 |
2145e9f64677105010270f61f81043b556413108 | 3,397 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
module Renalware
module Pathology
# Renders a pathology sparkline - a small graph of patient results for a particular
# OBX (observation_description) over time.
# TODO: Move the graph config into JS. Possibly use a stimulus controller
... | 25.350746 | 87 | 0.431557 |
08fe83e895095c0a9c1481ea51d853fff783581f | 1,699 | require "que"
# This job can optionally be scheduled to clear down the que-scheduler audit log if it
# isn't required in the long term.
module Que
module Scheduler
module Jobs
class QueSchedulerAuditClearDownJob < Que::Job
class << self
def build_sql(table_name)
<<~SQL
... | 36.934783 | 97 | 0.618011 |
ed0ee0c2c9ac5bcedce485c587db687d2636296b | 12,495 | require_relative '../helper'
require 'fluent/config/element'
require "fluent/config/dsl"
TMP_DIR = File.dirname(__FILE__) + "/tmp/config_dsl#{ENV['TEST_ENV_NUMBER']}"
def write_config(path, data)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, "w") {|f| f.write data }
end
def prepare_config1
write_config ... | 30.036058 | 129 | 0.62385 |
1de006a8902ac72e0aa2a6cd5ef2882966c0308b | 8,534 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Using the Service API", :reset_redis => false, :populate_sample_data => true do
before(:all) do
@sample_host = {:name => 'rspec_sample_host', :status => 'up'}
@sample_service = {:name => 'rspec_sample_service', :status => 'up'}
@... | 44.915789 | 133 | 0.608156 |
1daea8a8328be22d9cefec01b68c714bda4ea5f4 | 821 | Pod::Spec.new do |s|
s.name = "OneSignalXCFramework"
s.version = "3.4.4"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = ... | 48.294118 | 147 | 0.606577 |
03bcdc14d6852538a62ceac3d4c5b3bf713f5b2b | 874 | # Builds the Hub in a temp directory for use by several tests.
#
# Just adding `require_relative 'site_builder'` at the beginning of the test
# file is all that's required.
module Hub
class SiteBuilder
BUILD_DIR = File.join(Dir.pwd, '_test', 'tmp')
unless system(
"bundle exec jekyll build --destination ... | 33.615385 | 77 | 0.639588 |
f7a25a668f6b09da6ebd1dceaba36ee63958926b | 7,073 | # 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.513966 | 101 | 0.545737 |
ac12dfeeef10a54d528fc04291b4dec8b835b804 | 1,030 | module Vtex
class SpecificationResource < ResourceKit::Resource
resources do
action :specification_by_category_id, 'GET /api/catalog_system/pub/specification/field/listByCategoryId/:category_id' do
handler(200) { |response| SpecificationMapping.extract_collection(response.body, :read) }
end
... | 46.818182 | 135 | 0.756311 |
ff2a3514ee5255bd68941c2ecd1385d0b20e9ca4 | 43,947 | require File.expand_path(File.join(File.dirname(__FILE__), 'authenticated_controller_test'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper'))
require 'shoulda'
class ResultsControllerTest < Authent... | 42.33815 | 120 | 0.566592 |
28fd43f16db8935a87bd01410d0b407ac42d3363 | 3,914 | module Ruspea::Language
RSpec.describe Core do
subject(:core) { described_class.new }
let(:reader) { Ruspea::Interpreter::Reader.new }
let(:evaler) { Ruspea::Interpreter::Evaler.new }
let(:list) { Ruspea::Runtime::List }
let(:sym) { Ruspea::Runtime::Sym }
let(:form) { Ruspea::Interpreter::Form... | 27.370629 | 76 | 0.525805 |
f8bd52e8f6a38b12a0bdca41cf7227b114f8bc39 | 448 | class CreateInfoSources < ActiveRecord::Migration
def self.up
create_table :info_sources, :force=>true do |t|
t.column :code, :string, :null=>false
t.column :title, :string
t.column :agent, :string
t.column :date_published, :date
t.timestamps
end
add_index :info_sources,... | 23.578947 | 51 | 0.65625 |
5da14740f6bc7ff5cb7c62fe4d55e5a31d660bc6 | 726 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Kernel#exec" do
it "is a private method" do
Kernel.should have_private_instance_method(:exec)
end
it "raises a SystemCallError if cmd cannot execute" do
lambda { exec "" }.should rais... | 29.04 | 108 | 0.702479 |
18d8ccae165a91f8f1a4e7b2e8d15d94fdbce6ae | 1,596 | require 'spec_helper'
describe 'ironic::inspector::cors' do
shared_examples_for 'ironic inspector cors' do
it 'configure cors default params' do
is_expected.to contain_oslo__cors('ironic_inspector_config').with(
:allowed_origin => '<SERVICE DEFAULT>',
:allow_credentials => '<SERVICE DEFAUL... | 30.113208 | 74 | 0.592105 |
871a311e467657e1efad63e97d12083f3e545819 | 621 | class CreateSchoolBattles < ActiveRecord::Migration[5.1]
def change
opts = { id: :uuid, default: -> { "uuid_generate_v4()" } }
create_table :school_battles, opts do |t|
t.string :event_name, null: false, default: ''
t.string :course, null: false
t.date :started_date, null: false
t.dat... | 27 | 76 | 0.657005 |
612459e104f3a491395f22a0d465991ac7c310e0 | 2,207 | require 'spec_helper'
describe Listen do
describe '#to' do
let(:listener) { mock(Listen::Listener) }
let(:listener_class) { Listen::Listener }
before { listener_class.stub(:new => listener) }
context 'with one path to listen to' do
context 'without options' do
it 'creates an inst... | 32.455882 | 96 | 0.590847 |
2188888069d6ca87f1593c4c206d847333eb6b34 | 574 | # typed: true
module KubeDSL::DSL::V1
class PodTemplateSpec < ::KubeDSL::DSLObject
object_field(:metadata) { KubeDSL::DSL::Meta::V1::ObjectMeta.new }
object_field(:spec) { KubeDSL::DSL::V1::PodSpec.new }
validates :metadata, object: { kind_of: KubeDSL::DSL::Meta::V1::ObjectMeta }
validates :spec, ob... | 24.956522 | 80 | 0.646341 |
ed2c04c4b09bcd85afde8e026bfa902b7d27903f | 304 | # Copyright (c) Universidade Federal Fluminense (UFF).
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.
require 'test_helper'
class EnrollmentStatusTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
| 25.333333 | 84 | 0.753289 |
1adafeb7706d5ea582873a48c98c1ed845d60370 | 500 | # frozen_string_literal: true
require 'vk/api/responses'
module Vk
module API
class Video < Vk::Schema::Namespace
module Responses
# @see https://github.com/VKCOM/vk-api-schema/blob/master/objects.json
class AddResponse < Vk::Schema::Response
# @return [API::Base::OkResponse] @see... | 29.411765 | 112 | 0.67 |
b967130baacdc8e1ed477b778a42c825df23e89f | 628 | # Test-only pub/sub API that sense whether events have been published without
# actually contacting a remote service.
class SpyPubSubApi
attr_reader :publish_history
def initialize
@publish_history = []
end
# Pretends to publish an event to a a channel using the Pub/Sub system.
#
# @param [String] cha... | 33.052632 | 86 | 0.729299 |
f82ab71b6ce08977c7c5092eae93de1118e44b40 | 2,012 | # 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... | 38.692308 | 104 | 0.680915 |
ed40c33ad23bcf20621058f9c5645594926a3322 | 1,184 | # Unlight
# Copyright(c)2019 CPA
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
module Unlight
# パーツのインベントリクラス
class MonsterTreasureInventory < Sequel::Model
# 他クラスのアソシエーション
many_to_one :cpu_card_data # アバターを持つ
many_to_one :treasure_data # アバターパーツを持つ... | 26.311111 | 120 | 0.650338 |
f852e6071e626a5c3e38605f3d7e858c23fae9f3 | 1,053 | module Nokogiri
module XML
class Node
###
# Save options for serializing nodes
class SaveOptions
# Format serialized xml
FORMAT = 1
# Do not include delcarations
NO_DECLARATION = 2
# Do not include empty tags
NO_EMPTY_TAGS = 4
#... | 24.488372 | 59 | 0.496676 |
e96cd1c858e9890ffdf6fc3c74702d241a835529 | 50,204 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 47.362264 | 136 | 0.650725 |
91b2e79155d00126880da9cab64d7b802da9c50a | 215 | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_enum :shirt_size, %w[small medium large]
create_table :shirts do |t|
t.string :name
t.enum :size, enum_type: :shirt_size
end
end
| 19.545455 | 49 | 0.72093 |
79a04cf64b9222e969148427e8f9946bdcc86fae | 2,744 | require 'spec_helper'
module Omnibus
describe ManifestDiff do
def manifest_entry_for(name, dv, lv)
Omnibus::ManifestEntry.new(name, {:described_version => dv,
:locked_version => lv,
:locked_source => {
... | 37.081081 | 97 | 0.448251 |
6182200c855bce91919b07c6a0915616fddd20a6 | 1,295 | # frozen_string_literal: true
require "spec_helper"
describe Mongoid::Matchable::Regexp do
let(:matcher) do
described_class.new(attribute)
end
let(:attribute) do
'Emily'
end
describe '#_matches?' do
context 'when a BSON::Regexp::Raw object is passed' do
let(:regexp) do
BSON::R... | 20.887097 | 78 | 0.609266 |
218dab2d72a2b24f2c72ef55a49300bf6cdca15a | 372 | class AddMsgParametersToProviderAccounts < ActiveRecord::Migration
def self.up
add_column :provider_accounts, :msg_account_id, :string
add_column :provider_accounts, :auto_lock_instances, :boolean, :default => false
end
def self.down
remove_column :provider_accounts, :msg_account_id
remove_column... | 31 | 84 | 0.790323 |
91312dd1e9b849f9aca9337f8fcec7d87fd46910 | 77 | module Cmor::Rbac
class RolePolicy # < Itsf::Backend::BasePolicy
end
end
| 15.4 | 48 | 0.727273 |
330f778f6089b6a806c2fd1614537396ddae26f2 | 561 | require 'fileutils'
require 'test/unit'
module Multiverse
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
$: << File.expand_path(File.join(ROOT, 'lib'))
# Include from our unit testing path to share fake_collector and fake_service
$: << File.expand_path(File.join(ROOT, '..', 'new_relic')... | 33 | 79 | 0.720143 |
f737f7b289c7359e787c116b6784002c98892cf1 | 2,373 | =begin
Copyright 2010-2014 Tasos Laskos <tasos.laskos@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requi... | 26.965909 | 84 | 0.597134 |
b98c7dcae4895f64d8e4feceabf63ee4b4514a5a | 21,375 | require 'pathname'
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
require ROOT_DIR + 'lib/data_mapper'
begin
require 'do_postgres'
DataMapper.setup(:postgres, ENV["POSTGRES_SPEC_URI"] || "postgres://postgres@localhost/dm_core_test")
describe DataMapper::Adapters::DataObjectsAdapter do
... | 33.928571 | 136 | 0.600889 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.