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 |
|---|---|---|---|---|---|
1a6e860777d76e698cc4a41f26a0b14e964d0dd9 | 3,753 | require "spec_helper"
require "net/http"
require "securerandom"
require "timeout"
require "support/test_env"
require "support/app_crud_helpers"
describe "App CRUD" do
include AppCrudHelpers
with_user_with_org
with_new_space
with_time_limit
let(:app_content) { "#{SecureRandom.uuid}_#{Time.now.to_i}" }
let... | 27.195652 | 109 | 0.653877 |
3807595e09af00a51209e529169f9f21ff3b2abb | 468 | module Fiken
class Payment
include Virtus.model
include ActiveModel::Validations
attribute :uuid, String
attribute :date, DateTime
attribute :account, String
attribute :amount, Integer
def to_hash
result = {
account: account,
amount... | 22.285714 | 51 | 0.547009 |
21cdb72bf03d5eba68ec05e2cd98829eed900c14 | 988 | class BatsCore < Formula
desc "Bash Automated Testing System"
homepage "https://github.com/bats-core/bats-core"
url "https://github.com/bats-core/bats-core/archive/v1.4.1.tar.gz"
sha256 "bff517da043ae24440ec8272039f396c2a7907076ac67693c0f18d4a17c08f7d"
license "MIT"
bottle do
sha256 cellar: :any_skip_r... | 29.058824 | 138 | 0.703441 |
26e39ffaffdbebea6f8e29fca507433e3839509e | 33,010 | require 'spec_helper'
require 'securerandom'
require 'ddtrace'
require 'ddtrace/configuration/settings'
RSpec.describe Datadog::Configuration::Settings do
subject(:settings) { described_class.new }
describe '#analytics' do
describe '#enabled' do
subject(:enabled) { settings.analytics.enabled }
c... | 28.045879 | 118 | 0.57628 |
6aaca6eb60aaf7e651b11a4b2307d2459aee85ca | 2,299 | require 'rails_helper'
require 'spec_helper'
# rubocop:disable Metrics/BlockLength
RSpec.describe PostsController, type: :feature do
context 'timeline displays friends posts' do
let(:user) { User.create(id: '1', name: 'JonDoe', email: 'JonDoe@mail.com', password: 'password') }
scenario 'current_user posts... | 35.369231 | 103 | 0.681601 |
261d90385cd4991a0b1c913287e03f4752ce54eb | 1,798 | # frozen_string_literal: true
require 'spec_helper'
feature 'User deleting posts' do
scenario 'can delete their own post' do
user.log_in
topic = users_topic
topic.visit_topic
last_post = topic.last_post
expect(last_post).to be_listed
expect(last_post).to be_deletable
last_post.delete
... | 22.197531 | 63 | 0.697998 |
18ec94d67dfa3449c21688b0acce27d97d87b240 | 1,399 | RSpec.describe 'Escape helper' do
before do
@user = LinkTo.new
@actual = LinkTo::Index.render(format: :html)
end
it 'renders the title' do
expect(@actual).to match(%(<a href="/">Home</a>))
end
it 'renders relative link' do
expect(@actual).to match(%(<a href="relative">Relative</a>))
end
... | 32.534884 | 126 | 0.638313 |
4a1b3956fb33efd3bd67f2e13e4b0400fbe49e30 | 212 | class ManageChallenge < ActiveRecord::Base
belongs_to :user
belongs_to :set_challenge
validates_presence_of :user_id, :set_challenge_id
validates_uniqueness_of :user_id, :scope => [:set_challenge_id]
end
| 30.285714 | 65 | 0.806604 |
61a495dec62f43e3a3740b4aad2629d6328f6135 | 447 | # frozen_string_literal: true
module Usurper
module Pages
# / page for library workshops
class WorkshopPage < BasePage
include Capybara::DSL
include CapybaraErrorIntel::DSL
def on_page?
super &&
correct_content?
end
def correct_content?
page.has_selec... | 20.318182 | 64 | 0.635347 |
338776f1d88a949adcab17801dd16ba6454a4cc7 | 49 | require "heroku"
module Heroku::Deprecated
end
| 8.166667 | 25 | 0.77551 |
bf8b2bc6b093b43a52a4b0c107920afdc2a88c6a | 1,614 | # Copyright (c) 2013 Opscode, Inc.
# All Rights Reserved
# Perform safe cleanup after old packages and services following a
# successful Private Chef upgrade. Executables will have been removed
# from the package upgrade process, but old data, configuration, logs,
# directories, etc. can be left behind.
def whyrun_s... | 19.682927 | 73 | 0.73544 |
39544a3d5833ce46c161138fe4952e6c8ecf3116 | 884 | automaticVersion = '1.0.0'
Pod::Spec.new do |s|
s.name = 'PhyKitCocoapod'
s.version = automaticVersion
s.summary = 'Swift/Objc wrapper for Bullet Physics Engine with SceneKit support.'
s.description = <<-DESC
PhyKit wraps the popular Bullet physics library for Swift/Objc, pro... | 38.434783 | 108 | 0.635747 |
38c153f5e73a70e29ca8a03124b463b3ce4655e3 | 1,725 | class Pth < Formula
desc "GNU Portable THreads"
homepage "https://www.gnu.org/software/pth/"
url "https://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz"
mirror "https://ftpmirror.gnu.org/pth/pth-2.0.7.tar.gz"
sha256 "72353660c5a2caafd601b20e12e75d865fd88f6cf1a088b306a3963f0bc77232"
bottle do
rebuild 2
sha25... | 47.916667 | 106 | 0.764638 |
38acef81f4beae3bfa39c46f38383ed3c20f965f | 3,771 | # frozen_string_literal: true
gem "google-cloud-storage", "~> 1.11"
require "google/cloud/storage"
require "net/http"
require "active_support/core_ext/object/to_query"
require "active_storage/filename"
module ActiveStorage
# Wraps the Google Cloud Storage as an Active Storage service. See ActiveStorage::Service f... | 28.353383 | 113 | 0.63511 |
38e2c6514fc82ba84c5827707ed2e8fe38fc9911 | 204 | class EmailValidator < ActiveModel::Validator
def validate(record)
return if record.email.blank? || record.email.match?(URI::MailTo::EMAIL_REGEXP)
record.errors.add(:email, :invalid)
end
end
| 25.5 | 83 | 0.735294 |
e958b3ea85cf67a4a9e8147753cfe447ab18f4f2 | 18,864 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 36.487427 | 217 | 0.640479 |
7af004b84e0b80d41cda752fe4424f2b4a2470da | 127 | require 'test_helper'
class TaskKeyResultTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.875 | 49 | 0.716535 |
f78f24e617b7c54640d7cc188651d05bbbe8f6c2 | 1,104 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'elasticsearch/bulk_indexer/version'
Gem::Specification.new do |spec|
spec.name = 'elasticsearch-bulk_indexer'
spec.version = Elasticsearch::BulkIndexer::VERSION
spec.authors = ['Alex T... | 39.428571 | 74 | 0.682065 |
ab30cd104b0bf588cd5fad08442d6f1faff95d04 | 978 | # frozen_string_literal: true
module AliexpressAPI
class DsProduct < Base
class << self
def find(id, options = {})
params = options.symbolize_keys
params[:product_id] = id
params[:method] = 'aliexpress.postproduct.redefining.findaeproductbyidfordropshipper'
response = post(... | 29.636364 | 113 | 0.671779 |
4abca622dfc01f652f8d5072c5d600831a83ce2c | 927 | class Ndenv < Formula
desc "Node version manager"
homepage "https://github.com/riywo/ndenv"
url "https://github.com/riywo/ndenv/archive/v0.4.0.tar.gz"
sha256 "1a85e4c0c0eee24d709cbc7b5c9d50709bf51cf7fe996a1548797a4079e0b6e4"
license "MIT"
head "https://github.com/riywo/ndenv.git"
bottle :unneeded
depe... | 26.485714 | 75 | 0.632147 |
bb9f2783d397fca57d80e90f7446d839354cac23 | 750 | Pod::Spec.new do |s|
s.name = "WebRTC"
s.version = "86.4240.10.0"
s.summary = "WebRTC library for WebRTC SFU Sora"
s.description = <<-DESC
WebRTC library for WebRTC SFU Sora
DESC
s.homepage = "https://github.com/shiguredo/shiguredo-webrtc-ios"
s.l... | 44.117647 | 143 | 0.578667 |
21e4c91b507fc93eda8919246d4950b5106a5af0 | 709 | # frozen_string_literal: true
module Spree
class Promotion
module Rules
class Store < PromotionRule
has_many :promotion_rule_stores, class_name: "Spree::PromotionRuleStore",
foreign_key: :promotion_rule_id,
dependent:... | 26.259259 | 85 | 0.568406 |
6145627e8fba2ff500febeba5ba6814300811ed8 | 180 | module FMOD
module Core
module WindowType
RECT = 0
TRIANGLE = 1
HAMMING = 2
HANNING = 3
BLACKMAN = 4
BLACKMAN_HARRIS = 5
end
end
end | 15 | 25 | 0.555556 |
387131ac5bfc774dcc2c7528926861cf4689d592 | 2,699 | Dashboard::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... | 35.986667 | 87 | 0.758059 |
394dc0d87e5d7e4c9b1d87f3c0271f535231e666 | 3,958 | class ErlangAT20 < Formula
desc "Programming language for highly scalable real-time systems"
homepage "https://www.erlang.org/"
# Download tarball from GitHub; it is served faster than the official tarball.
url "https://github.com/erlang/otp/archive/OTP-20.3.8.7.tar.gz"
sha256 "2f74dcf66194be28b0faab29d2fbc7a... | 35.026549 | 104 | 0.696059 |
1df6000d2dd1fa3624cb15316004c07f0a41d572 | 6,063 | require "so_stub_very_test"
require "excon"
require "minitest"
require "minitest/autorun"
require "minitest/pride"
require "minitest/unit"
class TestSoStubVeryTest < Minitest::Test
include SoStubVeryTest
def teardown
SoStubVeryTest.default_host = nil
SoStubVeryTest.clear_custom_stubs
Excon.stubs.clear... | 27.066964 | 115 | 0.662708 |
615ae2e768d9f323f0da753b3d78932535076ba9 | 303 | require_relative "./model_logic/user_logic"
require_relative "./role_object"
require 'ostruct'
class UserObject < OpenStruct
include UserLogic
def initialize(hash)
super(hash)
self.roles = []
hash['roles'].each do |role|
self.roles << RoleObject.new(role)
end
end
end | 18.9375 | 43 | 0.686469 |
5d1af0b617c901347ecdf2745f78289b177df237 | 1,518 | # 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... | 33.733333 | 111 | 0.688406 |
79054c2bfa23ba8a28103bcc16d82fe42857c119 | 1,042 | # frozen_string_literal: true
module Dip
class RunVars
attr_reader :argv, :env
class << self
attr_accessor :env
def call(*args)
new(*args).call
end
end
self.env = {}
def initialize(argv, env = ENV)
@argv = argv
@env = env
end
def call
popul... | 16.806452 | 59 | 0.541267 |
6ab763de6ab9f54d741d16039fe2bf1b62278d38 | 3,026 | #!/opt/puppetlabs/puppet/bin/ruby
require_relative '../lib/puppet/util/task_helper'
require 'json'
require 'puppet'
require 'openssl'
# require 'pry-remote'; binding.remote_pry
# class PowerstoreImportVnxArrayInstanceQueryTask
class PowerstoreImportVnxArrayInstanceQueryTask < TaskHelper
def task(arg_hash)
heade... | 34.781609 | 134 | 0.64805 |
b982196778977a115c0b75a0a834149aa7a1e5d6 | 341 | cask :v1 => 'popkey' do
version :latest
sha256 :no_check
# amazonaws.com is the official download host per the vendor homepage
url 'https://popkey-downloads.s3.amazonaws.com/releases/darwin/PopKeySetup.dmg'
name 'PopKey'
homepage 'http://popkey.co/send-gifs?ref=header_app_nav_section'
license :gratis
... | 26.230769 | 81 | 0.744868 |
bf4ae5c559d7da93f3b5c910c021142c9a76ecda | 1,864 | # frozen_string_literal: true
require 'airborne'
module QA
RSpec.describe 'Enablement:Search' do
describe 'When using elasticsearch API to search for a public note', :orchestrated, :elasticsearch, :requires_admin do
let(:api_client) { Runtime::API::Client.new(:gitlab) }
let(:issue) do
Resou... | 34.518519 | 157 | 0.677039 |
38469ee25d08d00102d19f352569e2c4e84d00ac | 1,490 | # frozen_string_literal: true
require 'byebug'
require_relative 'lib/clients/bitbucket'
require_relative 'lib/commands/fetch'
require_relative 'lib/commands/update'
require_relative 'lib/options'
require_relative 'lib/vcs/repository'
$VERBOSE = nil
unless RUBY_VERSION.to_f >= 2.5
puts 'Octopus requires Ruby 2.5.0 a... | 31.041667 | 118 | 0.651007 |
289ff3fd26927759807aa26d9a6fcfb4ea8bf18e | 190 | class AddEmailToDeveloper < ActiveRecord::Migration
def self.up
add_column :developers, :email, :string
end
def self.down
remove_column :developers, :email, :string
end
end
| 19 | 51 | 0.731579 |
3825558e44195301598fc7e1fdad5028d5822380 | 401 | =begin
* Created by PSU Beeminder Capstone Team on 3/12/2017.
* Copyright (c) 2017 PSU Beeminder Capstone Team
* This code is available under the "MIT License".
* Please see the file LICENSE in this distribution for license terms.
=end
require "whenever"
set :output, "#{path}/log/cron_log.log"
set :environment, @... | 23.588235 | 70 | 0.733167 |
18d1642df34082ed26ad9c5a9d7b2e6a938894cc | 38 | module Edison
VERSION = '2.0.0'
end
| 9.5 | 19 | 0.657895 |
edb778c27c8f8d545f43c2c1c0fa6b49130e86f9 | 1,898 | #!/usr/bin/ruby -w
##############################################################################
#
# File x11/RPMGenericBuildAll.rb
#
# Author Andy Southgate 2007
#
# This file contains original work by Andy Southgate. The author and his
# employer (Mushware Limited) irrevocably waive all of their copyright rights
# ... | 35.148148 | 96 | 0.635933 |
ab9f5093e6044a33e8b40106ac9f1f74f0fcba88 | 807 | require 'spec_helper'
describe 'supermarket_instance_test::working_ssl' do
let(:chef_run) do
ChefSpec::SoloRunner.new(
step_into: 'supermarket_instance',
platform: 'ubuntu',
version: '14.04',
log_level: :error
) do |_node|
end.converge(described_recipe)
end
context 'inside of... | 26.9 | 71 | 0.656753 |
1122129154c98e6d61f491595fe6cbeaeb289073 | 720 | # Copyright 2016, SUSE LINUX GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 31.304348 | 74 | 0.768056 |
bb6e89ebe21c5ea43583f926fd0e2316ad1ae604 | 2,876 | require __DIR__.parent + 'associations'
require __DIR__ + 'relationship'
module DataMapper
module Associations
module ManyToOne
def many_to_one(name, options = {})
raise ArgumentError, "+name+ should be a Symbol, but was #{name.class}", caller unless Symbol === name
raise ArgumentError,... | 32.681818 | 176 | 0.620654 |
79d9d0fef1b775206d89e778e9c231f6995f8f86 | 379 | class Sms77HookListener < Redmine::Hook::ViewListener
def view_account_left_bottom(context = {})
mobile = Sms77Controller.user_mobile(context[:user])
if mobile.present?
link_to(l('sms77.menu.sms'), use_route: 'sms77_sms', to: mobile) +
tag('br', nil, true) +
link_to(l('sms77.menu.voice'... | 31.583333 | 76 | 0.670185 |
1af391a175e18de9322609fd62cdb54e0c8945b0 | 139 | class AddStatusToUsers < ActiveRecord::Migration[6.0]
def change
change_table :users do |u|
u.string :status
end
end
end
| 17.375 | 53 | 0.683453 |
e2faff631fcd1871338b14a12e067736d6703cd8 | 1,733 | def test_case
{"RawParseTree"=>
[:block,
[:lasgn, :var1, [:lit, 1]],
[:lasgn, :var2, [:lit, 2]],
[:lasgn, :result, [:nil]],
[:case,
[:lvar, :var1],
[:when,
[:array, [:lit, 1]],
[:case,
[:lvar, :var2],
[:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 1]]],
[:when, [... | 35.367347 | 313 | 0.465089 |
8731927691431d3c5e9e0d39d26c0c1822c6cf35 | 132 | class AddSortNoToSurveyForms < ActiveRecord::Migration[4.2]
def change
add_column :survey_forms, :sort_no, :integer
end
end
| 22 | 59 | 0.765152 |
61ebec38900baac519cbc7e6ee935baa214195c6 | 736 | # frozen_string_literal: true
module Compute
# Represents the Service
class Service < Core::ServiceLayer::Model
validates :reason, presence: { message: 'Please give a reason' }, on: :disable
def disableable?
valid? :disable
end
def name
read('binary')
end
def enabled?
s... | 19.368421 | 82 | 0.620924 |
ffc8e641b186f338c082478cadbea0c0a1bc64e8 | 896 |
Pod::Spec.new do |s|
s.name = "GCTUIModalPresentationViewController"
s.version = "0.0.1"
s.summary = "自定义 modal presentation vc"
s.description = <<-DESC
自定义 modal presentation vc 控件:
支持 xib 自定义控件布局约束;
支持 present 动画、dismiss 动画;
支持 TextField、TextView 跟随键盘一起 present 显示
... | 37.333333 | 117 | 0.651786 |
f78925a61dd093784957c53a12dad0eb64a51a61 | 1,877 | # This file is intended to be 'require'd by plugin authors who are developing a
# plugin outside of the Train source tree.
# Load Train. We certainly need the plugin system, and also several other parts
# that are tightly coupled. Train itself is fairly light, and non-invasive.
require_relative "../train"
# You can... | 36.096154 | 86 | 0.764518 |
1a0ea64942a01666bd9c945b1c73f8018d027ce6 | 321 | cask :v1 => 'baygenie' do
version :latest
sha256 :no_check
url 'https://www.baygenie.com/Download/BayGenie4Mac.dmg'
name 'BayGenie'
homepage 'http://www.baygenie.com/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
app 'BayGenie.app'
end... | 26.75 | 115 | 0.719626 |
6a17b73531c98038d9f690017344e618bc27765a | 3,764 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 44.282353 | 131 | 0.656217 |
0801c0cf47c10b55790d4bc325b648892cd086e8 | 6,879 | require 'corelib/enumerable'
class Struct
include Enumerable
def self.new(const_name, *args, keyword_init: false, &block)
if const_name
begin
const_name = Opal.const_name!(const_name)
rescue TypeError, NameError
args.unshift(const_name)
const_name = nil
end
end
... | 22.93 | 129 | 0.556476 |
bb78156845760e39adedb9c961f40fb456714cb1 | 1,222 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/sidekiq/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Mike Perham"]
gem.email = ["mperham@gmail.com"]
gem.description = gem.summary = "Simple, efficient background processing for Ruby"
gem.homepage = "http://s... | 43.642857 | 86 | 0.596563 |
1a4dc38cab70dae16a8f4a40c643cbd758a28cd1 | 16,929 | # frozen_string_literal: true
require "ipaddr"
require "active_support/core_ext/kernel/reporting"
require "active_support/file_update_checker"
require "active_support/configuration_file"
require "rails/engine/configuration"
require "rails/source_annotation_extractor"
module Rails
class Application
class Configu... | 36.250535 | 167 | 0.583319 |
d505af3f9082a74c0cf9c378443d34f0292ca10b | 7,881 | module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
UNREAD_REGEX = /(?<=\s|^)is:\s*unread(?=\s|$)/
READ_REGEX = /(?<=\s|^)is:\s*read(?=\s|$)/
STARRED_REGEX = /(?<=\s|^)is:\s*starred(?=\s|$)/
UNSTARRED_REGEX = /(?<=\s|^)is:\s*unstarred(?=\s|$)/
SORT_REGE... | 32.432099 | 111 | 0.560208 |
e2a942b343a793530a756e05eaf669c4a98ac353 | 2,964 | # Copyright (C) 2009-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 28.5 | 79 | 0.628205 |
39e064ab8f8e7a0bdc8fc54536f4831804271046 | 1,542 | require 'rubygems'
require 'ev3'
require 'ev3/connections/bluetooth'
class Ev3Bot
attr_accessor :brick, :left_leg, :right_leg, :gun
attr_accessor :left_forward, :right_forward
def initialize
puts "Connecting to EV3"
@brick = EV3::Brick.new(EV3::Connections::Bluetooth.new)
@brick.connect
@left_leg = brick.... | 15.267327 | 58 | 0.742542 |
621e280f3cba53070f17ecc5fb84315aa78cc2cb | 2,519 | =begin
= PEDAC Template
== (Understand the) Problem
First, identify the inputs and the outputs of the problem
* Inputs:
1. A year (integer)
* Output:
1. The century of the given year (string)
---
*Problem Domain:*
Calendar problem. A bit of English.
---
*Implicit Requirements:*
Can be more than the current ... | 15.645963 | 79 | 0.603811 |
7a6e6b708ccbce5d605b1ac75b238d681f8a2843 | 99 | class Project < ApplicationRecord
belongs_to :employer
has_many :tasks
has_many :workers
end
| 16.5 | 33 | 0.787879 |
610edaad3cdd2c5c1ed2368c9e34e6db773f91a7 | 8,282 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Enum do
let(:enum) { Jazz::Family }
describe ".path" do
it "is the name" do
assert_equal "Family", enum.path
end
end
describe "type info" do
it "tells about the definition" do
assert_equal "Family", enum.gra... | 33.530364 | 213 | 0.650809 |
61d0b97c3b85104a8871967ae97544b9baf792c1 | 310 | require "test_helper"
class ArgsControllerTest < Minitest::Capybara::Spec
it "run Song::Create,current_user: Module" do
visit "/args/with_args"
_(page.body).must_match ">{:fake=>"bla"} Module<"
_(page.body).must_match ">my_model<"
_(page.body).must_match ">my_form<"
end
end
| 25.833333 | 66 | 0.693548 |
03fd3143d3f670538edebef3b8878ddd0c650240 | 5,370 | # -*- encoding: utf-8 -*-
# stub: mime-types 3.1 ruby lib
Gem::Specification.new do |s|
s.name = "mime-types".freeze
s.version = "3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler"... | 63.176471 | 802 | 0.66648 |
f7984a9ae568a01948be1e6228a5e255a87b92e3 | 938 | # frozen_string_literal: true
class MyConfigPreferences
def self.set_preferences
Spree::Avatax::Config.reset
Spree::Avatax::Config.configure do |config|
config.company_code = 'DEFAULT'
config.license_key = '12345'
config.account = '12345'
config.refuse_checkout_address_validation_er... | 28.424242 | 157 | 0.684435 |
7a5bf6b8534c3e34456e167288edb9fb573fbf42 | 4,219 | require "rails_helper"
RSpec.describe "Accounts" do
it "List and filter accounts", :js do
carrier = create(:carrier)
user = create(:user, :carrier, carrier: carrier)
create(
:account,
name: "Rocket Rides",
carrier: carrier,
created_at: Time.utc(2021, 12, 1),
metadata: {
... | 29.711268 | 111 | 0.671486 |
ab904d51d98326b58ba54f87f5000eafdced623b | 207 | $: << '.'
require File.dirname(__FILE__) + '/../test_helper'
class CountriesControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end
| 14.785714 | 58 | 0.705314 |
acc2e570c2ee98d0db4f2de54f01db147d95ad1b | 8,978 | require "spec_helper"
describe "Rails::Mongoid" do
before(:all) do
require "rails/mongoid"
end
describe ".create_indexes" do
let(:pattern) do
"spec/app/models/**/*.rb"
end
let(:logger) do
stub
end
let(:klass) do
User
end
let(:model_paths) do
[ "spec/a... | 19.906874 | 82 | 0.565828 |
bf56c50382aefab8b1283ea73a9c8516df21ce05 | 126 | module Spud
module Photos
require 'spud_photos/configuration'
require 'spud_photos/engine' if defined?(Rails)
end
end | 21 | 49 | 0.769841 |
87d02a1f6f059d42e430bb02c8a3cf1425bec546 | 225 | class PostsController < ApplicationController
respond_to :json
def show
@blog = Blog.find params[:blog_id]
@post = @blog.posts.find params[:id]
respond_with(@post, responder: Hypermodel::Responder)
end
end
| 22.5 | 57 | 0.72 |
18c818c6de74090aa29ba2a9012906130246d799 | 4,792 | require 'webrick/httputils'
module DAV4Rack
class FileResource < Resource
include WEBrick::HTTPUtils
# If this is a collection, return the child resources.
def children
Dir[file_path + '/*'].map do |path|
child File.basename(path)
end
end
# Is this resource a colle... | 22.288372 | 73 | 0.56323 |
bfc8aede540b1dacc1888c176f1a27425441f5d0 | 340 | # See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class RemoveUserEmailProviderColumn < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
remove_column :users, :email_provider... | 26.153846 | 69 | 0.782353 |
87418d174db4fa0ad376a7f1674605908d3c9037 | 575 | cask 'beatunes' do
version '5.0.4'
sha256 '786962231564b260adae3ccac4726260cb63d3cb41581a82215add009d3d7358'
url "http://coxy.beatunes.com/download/beaTunes-#{version.dots_to_hyphens}.dmg"
name 'beaTunes'
homepage 'https://www.beatunes.com/'
depends_on macos: '>= :lion'
app "beaTunes#{version.major}.ap... | 28.75 | 81 | 0.64 |
38920d19e9acefa8d36c88e69de7a7b0ebead038 | 4,623 | require File.dirname(__FILE__) + '/../../spec_helper'
module Cucumber
module Formatters
describe PrettyFormatter do
def mock_step(stubs={})
stub('step', {
:keyword => 'Given',
:format => 'formatted yes',
:name => 'example',
:error => nil,
:r... | 41.276786 | 171 | 0.572788 |
1d5fa6883b262e38264185d50bc78795707fb88e | 916 | class ComedyShows::Shows
BASE_PATH = "https://www.dcimprov.com/"
attr_accessor :name, :description, :date, :month, :url, :price, :showtime, :spotlight, :address
@@all = [] #incorporate all scraped data here
def initialize(show_hash)
show_hash.each{|k,v| self.send("#{k}=", v)}
@@all << self
end
... | 26.941176 | 112 | 0.670306 |
3947affbcf7e42e3b4e29421218f1fe979cae8f8 | 1,136 | require 'inifile'
# Stores configuration file.
class BotConfig
def initialize(ini_filename)
@ini_filename = ini_filename
reload
end
def reload
@ini_file = IniFile.load(@ini_filename)
if @ini_file == nil
raise "#{@ini_filename} not found."
end
end
def get_common_section
get_se... | 19.254237 | 87 | 0.691021 |
d5d17e4c57cb785402dfdf3c233ec8c9b7557622 | 1,035 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "ar_enum_i18n/version"
Gem::Specification.new do |spec|
spec.name = "ar_enum_i18n"
spec.version = ArEnumI18n::VERSION
spec.authors = ["Andrea Dal Ponte"]
spec.email ... | 34.5 | 74 | 0.651208 |
33f1f3739e6bd378be3fa1b90bff5275db754ec9 | 426 | class AddDescriptionToTraffic < ActiveRecord::Migration
def change
a = Game.find_by_slug('traffic')
a.description = "Traffic -- look both way or you are going to be as flat as a board! This game require a little bit of luck and a whole lot of good timing. Navigate across lanes of busy traffic to reach t... | 53.25 | 297 | 0.734742 |
03b65074f4444073f64da1f724fbcf6f37e465b3 | 28,817 | module ActionController #:nodoc:
module Filters #:nodoc:
def self.included(base)
base.extend(ClassMethods)
base.send(:include, ActionController::Filters::InstanceMethods)
end
# Filters enable controllers to run shared pre and post processing code for its actions. These filters can be used to ... | 38.067371 | 154 | 0.636916 |
1ac09ce11d021308db83580b40af22f6495b09a8 | 757 | # frozen_string_literal: true
module Onebox
module Engine
class AudioOnebox
include Engine
matches_regexp(/^(https?:)?\/\/.*\.(mp3|ogg|opus|wav|m4a)(\?.*)?$/i)
def always_https?
AllowlistedGenericOnebox.host_matches(uri, AllowlistedGenericOnebox.https_hosts)
end
def to_ht... | 24.419355 | 107 | 0.610304 |
e96787af8af6a5165d54b465b749c4043093a90f | 846 | # encoding: UTF-8
module MongoMapper
module Extensions
module Boolean
Mapping = {
true => true,
'true' => true,
'TRUE' => true,
'True' => true,
't' => true,
'T' => true,
'1' => true,
1 => true,
1.0 => true,
... | 20.142857 | 47 | 0.426714 |
ffc702bc552b6b5bdb485d490a0bf1b4129b4b16 | 2,708 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Web::Mgmt::V2016_03_01
module Models
#
# Triggers for auto-heal.
#
class AutoHealTriggers
include MsRestAzure
# @return [Request... | 29.758242 | 78 | 0.498523 |
ac46f529a56f7f67797cef497104610a1adbad52 | 3,158 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Creating a new HTTP Integration' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:payload_example) do
{
'alert' => { 'name' => 'Test alert' },
'started_at' =>... | 27.946903 | 99 | 0.677011 |
1adc2b29d9a6afa71c8b6f3518315af34078104e | 782 | Rails.application.routes.draw do
get 'password_resets/new'
get 'password_resets/edit'
get 'sessions/new'
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
get '/... | 28.962963 | 71 | 0.649616 |
39a54c46f07f363e5691c05c9836f923a8f78c9b | 77 | Date::DATE_FORMATS[:year_month] = '%Y-%m'
Time::DATE_FORMATS[:hm] = '%H:%M'
| 19.25 | 41 | 0.623377 |
01bab854082aa5f4b9374af103c310c2ae2dbc19 | 1,242 | # frozen_string_literal: true
module Gitlab
module GitalyClient
class BlobsStitcher
include Enumerable
def initialize(rpc_response)
@rpc_response = rpc_response
end
def each
current_blob_data = nil
@rpc_response.each do |msg|
begin
if msg.o... | 24.84 | 86 | 0.565217 |
ac9c8283b4bc9fd5a72ccbdf53022ec71ca442ca | 1,956 | module Github
module Representation
class PullRequest < Representation::Issuable
attr_reader :project
delegate :user, :repo, :ref, :sha, to: :source_branch, prefix: true
delegate :user, :exists?, :repo, :ref, :sha, :short_sha, to: :target_branch, prefix: true
def source_project
p... | 24.759494 | 103 | 0.624744 |
18cdc3a38a6b71bb2dad11694f568ff76817bfe2 | 230 | module MixRailsCore
class Engine < ::Rails::Engine
config.generators do |g|
g.test_framework :rspec
g.integration_tool :rspec
end
end
end
| 23 | 91 | 0.478261 |
bbadbcf2c5a69c9b539415c8273071f7d90aeb6f | 632 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXDevice'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.auth... | 30.095238 | 73 | 0.579114 |
33edea48d984892b24473ebc6a27267ddf6a7305 | 3,724 | class ApmServerFull < Formula
desc "Server for shipping APM metrics to Elasticsearch"
homepage "https://www.elastic.co/"
url "https://artifacts.elastic.co/downloads/apm-server/apm-server-7.12.0-darwin-x86_64.tar.gz?tap=elastic/homebrew-tap"
version "7.12.0"
sha256 "80bb60dce66a8e2d89d4982a0662d062829a9b119ea8... | 40.478261 | 383 | 0.611976 |
acae72bb893188778accedbb9bf0cd3c1dc41897 | 484 | class UserPolicy
class Scope < Struct.new(:user, :scope)
def resolve
raise NotImplementedError
end
end
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
raise NotImplementedError
end
def show?
raise NotImplementedError
... | 13.828571 | 41 | 0.683884 |
03a887d2e9a1bb98eb77d3e6bed29e5f5c259fe6 | 7,790 | # frozen_string_literal: true
describe RuboCop::Cop::Performance::Detect do
subject(:cop) { described_class.new(config) }
let(:collection_method) { nil }
let(:config) do
RuboCop::Config.new(
'Style/CollectionMethods' => {
'PreferredMethods' => {
'detect' => collection_method
... | 30.912698 | 80 | 0.543389 |
f81a11ac0253b87dce8928fabb302f4f0b273e30 | 262 | module Blog
module FeedHelper
def rss_feed_url
Settings.app.feeds.rss
rescue
blog.feed_path(:format => :rss)
end
def atom_feed_url
Settings.app.feeds.atom
rescue
blog.feed_path(:format => :atom)
end
end
end
| 14.555556 | 38 | 0.629771 |
01f3bed3ffc5027bf7d88c87bf10e58aa3525e51 | 471 | # frozen_string_literal: true
require "helper"
class TestSiteDrop < JekyllUnitTest
context "a site drop" do
setup do
@site = fixture_site(
"collections" => ["thanksgiving"]
)
@site.process
@drop = @site.to_liquid.site
end
should "respond to `key?`" do
assert @drop.... | 19.625 | 64 | 0.622081 |
e87aaa19546f9afaf3ab92941cb76dd3f8848224 | 4,695 | # frozen_string_literal: true
require 'spec_helper'
describe RuboCop::Cop::Style::ClassAndModuleChildren, :config do
subject(:cop) { described_class.new(config) }
context 'nested style' do
let(:cop_config) { { 'EnforcedStyle' => 'nested' } }
it 'registers an offense for not nested classes' do
insp... | 31.938776 | 80 | 0.488179 |
08dc7d1064070c7e68ed328f1f60326c4c2fefa0 | 868 | #
# Cookbook Name:: rssh
# Resource:: user
#
# Copyright 2014, Dan Fruehauf
#
# 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... | 33.384615 | 83 | 0.737327 |
4a4f42b261a604462fdeb5ae9d89ad4d8e17c1a6 | 2,608 | # GnuTLS has previous, current, and next stable branches, we use current.
# From 3.4.0 GnuTLS will be permanently disabling SSLv3. Every brew uses will need a revision with that.
# http://nmav.gnutls.org/2014/10/what-about-poodle.html
class Gnutls < Formula
desc "GNU Transport Layer Security (TLS) Library"
homepage... | 30.682353 | 104 | 0.685966 |
6aeb48ecc69365f11debfe5a3d5149352a790b59 | 544 | Pod::Spec.new do |s|
s.name = 'ANBaseNetwork'
s.version = '2.1.0'
s.license = 'MIT'
s.summary = 'ANBaseNetwork'
s.homepage = 'https://github.com/anotheren/ANBaseNetwork'
s.authors = {
'anotheren' => 'liudong.edward@gmail.com',
}
s.source = { :git => 'https://github.com/anotheren/... | 32 | 94 | 0.604779 |
612a9ba93a8218ec3e708d9216f366ba6e274bed | 1,116 | namespace :gitlab do
namespace :import do
desc "GITLAB | Add all users to all projects (admin users are added as masters)"
task all_users_to_all_projects: :environment do |t, args|
user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id)
projects_ids = P... | 44.64 | 101 | 0.716846 |
5d13007bb4b7e21586833aa2c89e741cc4ddd08b | 766 | # Registers a new theme to use for this project. See
# http://zen-cms.com/documentation/Zen/Theme.html for more information on all
# the available options and working with themes in general.
Zen::Theme.add do |theme|
# The unique name of the theme specified as a symbol (required).
theme.name = :default
# The nam... | 33.304348 | 77 | 0.724543 |
7a6f5db3ccc3981013dfcf648c3fb8d19d341b93 | 834 | class Sfcgal < Formula
desc "C++ wrapper library around CGAL"
homepage "http://sfcgal.org/"
url "https://github.com/Oslandia/SFCGAL/archive/v1.3.7.tar.gz"
sha256 "30ea1af26cb2f572c628aae08dd1953d80a69d15e1cac225390904d91fce031b"
bottle do
sha256 "91ad496500abf1cac33f959e8008abe7724f642f8dabc28b455efec994... | 29.785714 | 93 | 0.757794 |
ab57d9583f23417e00085d71fcd21db4f69ee93f | 796 | require 'csv'
class PayslipProcessor
def process_csv
employee_array = []
Dir.glob("csv/*.csv") do |file|
basename = File.basename(file, '.csv')
CSV.foreach(file, converters: :numeric, headers:true) do |row|
employee_info = {
first_name: row['first_name'],
last_name:... | 20.947368 | 68 | 0.609296 |
1d73541450b865e87604aa24bcb6c853f9c8d3c8 | 2,015 | class Darkice < Formula
desc "Live audio streamer"
homepage "http://www.darkice.org/"
url "https://downloads.sourceforge.net/project/darkice/darkice/1.3/darkice-1.3.tar.gz"
sha256 "2c0d0faaa627c0273b2ce8b38775a73ef97e34ef866862a398f660ad8f6e9de6"
revision 1
bottle do
cellar :any
sha256 "a35885863f9... | 41.979167 | 103 | 0.660546 |
e8fca8954481dbcbe137e3304a3133374a60dd2b | 872 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tarot/version'
Gem::Specification.new do |spec|
spec.name = "tarot"
spec.version = Tarot::VERSION
spec.authors = ["Dax"]
spec.email = ["d.dax@email.com"]
sp... | 31.142857 | 74 | 0.651376 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.