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 |
|---|---|---|---|---|---|
114cacfc7cd4e630ffa4f46050981789670aa03a | 1,808 |
# This file is automatically generated by puppet-swagger-generator and
# any manual changes are likely to be clobbered when the files
# are regenerated.
require_relative '../../../puppet_x/puppetlabs/kubernetes/provider'
Puppet::Type.type(:kubernetes_daemon_set).provide(:swagger, :parent => PuppetX::Puppetlabs::Kube... | 19.868132 | 116 | 0.614491 |
ac0cf3828593866d6425dfc5ae223d4c4ffc5fd3 | 255 | class AddIntegrationTimeStampsToSyncMatches < ActiveRecord::Migration
def change
add_column :spree_integration_sync_matches, :sync_object_created_at, :string
add_column :spree_integration_sync_matches, :sync_object_updated_at, :string
end
end
| 36.428571 | 80 | 0.839216 |
87298dbde4da5f170994342114d4d169a2be8a86 | 1,397 | # -*- coding: utf-8 -*-
module Beecart
module Gateway
class WebpayGateway < Beecart::Gateway::BaseGateway
# @param [Hash] payment_info 支払い方法に関してのハッシュ
def initialize *args
super
# raise Error, "You need to set Webpay API Key" if Webpay.api_key.nil?
end
def charge price, p... | 22.901639 | 78 | 0.521832 |
e808738aa903c2482209e6a554d0c281166dd351 | 2,935 | require 'open-uri'
module AntiSamy
# Css Scanner class
class CssScanner
attr_accessor :policy, :errors
# Create a scanner with a given policy
def initialize(policy)
@policy = policy
@errors = []
end
# Scan the input using the provided input and output encoding
# will raise an err... | 34.529412 | 107 | 0.596934 |
d5fe3e8e8ac503ab42295791e416ecf3441ba8df | 201 | # solution #2 - Non-hackery substs, like Olaf
p File.read(ARGV[0]).split("\n").reject{|w| w !~
%r"^[a-#{(?a-11+ARGV[1].to_i).chr}|lO]+$"}.sort_by{|w| [w.length,w]} if
(?a...?k)===?a-11+ARGV[1].to_i
| 33.5 | 72 | 0.557214 |
1c25a4b5c2cf321e349d8bca46c3639e6fbf4616 | 1,373 | # -*- encoding: utf-8 -*-
# stub: globalid 0.4.2 ruby lib
Gem::Specification.new do |s|
s.name = "globalid".freeze
s.version = "0.4.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["David Heinemeie... | 37.108108 | 112 | 0.669337 |
f70e7167d9fe009060763b594ee885b61b2e3c5b | 174 | class CreateSuppliers < ActiveRecord::Migration[5.1]
def change
create_table :suppliers do |t|
t.string :name, unique: true
t.timestamps
end
end
end
| 17.4 | 52 | 0.672414 |
1d23e708ffa9c4ea1c449a593ddeabd573028a7f | 8,068 | require 'backburner/job'
module Backburner
#
# @abstract Subclass and override {#process_tube_names}, {#prepare} and {#start} to implement
# a custom Worker class.
#
class Worker
include Backburner::Helpers
include Backburner::Logger
# Backburner::Worker.known_queue_classes
# List of known... | 33.065574 | 121 | 0.661006 |
79b6fc66f637441960ebc0307bf08a8b40e5b4ff | 1,317 | class Goawk < Formula
desc "POSIX-compliant AWK interpreter written in Go"
homepage "https://benhoyt.com/writings/goawk/"
url "https://github.com/benhoyt/goawk/archive/refs/tags/v1.9.2.tar.gz"
sha256 "c66a6aecee7d35d6768f2bd826916e0a2c1f77d7c426d5c291a2ad0bc4039136"
license "MIT"
bottle do
sha256 cella... | 47.035714 | 123 | 0.78208 |
ff21fce6a39be5ef2cdd10540e89048132972ff9 | 1,952 | module Intrigue
module Task
class RailsFileExposureCve20195418 < BaseTask
def self.metadata
{
:name => "vuln/rails_file_exposure",
:pretty_name => "Vuln Check - Rails File Exposure (CVE-2019-5418)",
:authors => ["jcran", "jhawthorn"],
:identifiers => [{ "cve" => "CVE-2019-5418" }],
... | 29.575758 | 101 | 0.57582 |
e2982fa592bf9890b90b52fc26189cc8d5e32160 | 3,199 | require 'rqrcode_png'
class Product < ApplicationRecord
acts_as_tenant :account
belongs_to :category
has_many :purchase_products
has_many :sale_products
has_many :group_products
has_one_attached :image
has_many :simplo_items
def count_purchase_product
rs = purchase_products.from_store('PurchaseSto... | 32.313131 | 100 | 0.660206 |
e94e8b578c09c8db5d6a6af03196ba11d3024114 | 72 | # frozen_string_literal: true
module Capybara
VERSION = '3.25.0'
end
| 12 | 29 | 0.736111 |
62a0ffa6c5841d4a9060a8ef63fdafc23f7cb544 | 503 | desc "This task is called by the Heroku scheduler add-on"
task :reset_application => :environment do
Task.destroy_all
List.destroy_all
List.create(:name => 'My Installation Todo List')
id = List.all.last.id
Task.create(:name => "", :list_id => id)
Task.create(:name => "Build a great web application", :list... | 38.692308 | 96 | 0.697813 |
7945436c0efb9321abecf05c3aa114b8997c16c2 | 5,126 | #
# Copyright 2017, Schuberg Philis B.V.
#
# 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 ... | 44.189655 | 558 | 0.726883 |
7a83d5fa225d8364372f37e29e2c4f600fc74730 | 250 | module ShoppingCart
class AddMyStep < ShoppingCart::BaseCommand
def name
:add_my_step
end
private
def add_my_step
attr = attr_except(:order)
order.my_step = MyStep.create(attr)
order.save
end
end
end
| 15.625 | 45 | 0.652 |
bfef38029266c60fb99e4ce5530549bf6738d527 | 1,811 | # -*- encoding: utf-8 -*-
# stub: mercenary 0.4.0 ruby lib
Gem::Specification.new do |s|
s.name = "mercenary".freeze
s.version = "0.4.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tom Preston-W... | 42.116279 | 112 | 0.66317 |
114d366111c7f84eebab06573a84b242e05f84cb | 1,900 | # Generated by juwelier
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: domain_prefix 0.4.20210906 ruby lib
Gem::Specification.new do |s|
s.name = "domain_prefix".freeze
s.version = "0.4.20210906"
s.required_rubygems_version ... | 32.20339 | 146 | 0.672632 |
f85c985b0e43695c4326eb2e08af67a32f3fd365 | 36,445 | # encoding: utf-8
require_relative '../../../spec_helper'
require_relative '../../../../app/controllers/carto/api/organizations_controller'
require 'helpers/unique_names_helper'
describe Carto::Api::OrganizationUsersController do
include_context 'organization with users helper'
include UniqueNamesHelper
include... | 37.379487 | 157 | 0.712992 |
26c7bd64428277a0c4a071afa7ebff41a9d89626 | 5,271 | class DataPlan < ActiveRecord::Base
has_one :plan_billing, dependent: :destroy
def save_transaction(customer)
@customer = customer
result = transaction(customer,self.plan_price, self.id, 0.00)
end
# def change_plan(customer)
# @total_days = Time.days_in_month(Date.today.day)
# @customer = cust... | 40.860465 | 579 | 0.675394 |
e2c36924f3ee51404d442d0f2029278ad94fac34 | 1,864 | class Wxmaxima < Formula
desc "Cross platform GUI for Maxima"
homepage "https://wxmaxima-developers.github.io/wxmaxima/"
url "https://github.com/wxMaxima-developers/wxmaxima/archive/Version-21.02.0.tar.gz"
sha256 "573ab40de4e4dd3ca56d1e73fc913e3f6495c2331c4b71b1e4c48626499c0a6c"
license "GPL-2.0-or-later"
h... | 36.54902 | 110 | 0.728004 |
79308b0f9fb5920f07b52516c10452e42e7986c6 | 1,476 | class Wimlib < Formula
desc "Library to create, extract, and modify Windows Imaging files"
homepage "https://wimlib.net/"
url "https://wimlib.net/downloads/wimlib-1.13.3.tar.gz"
sha256 "8a0741d07d9314735b040cea6168f6daf1ac1c72d350d703f286b118135dfa7e"
livecheck do
url "https://wimlib.net/downloads/"
... | 27.849057 | 93 | 0.680894 |
d58a807ad5b00913df0c17950188bb583e2423d8 | 1,251 | require 'quickeebooks/windows/service/service_base'
require 'quickeebooks/windows/model/sync_status_request'
module Quickeebooks
module Windows
module Service
class SyncStatus < Quickeebooks::Windows::Service::ServiceBase
def retrieve(sync_status_request, errored_objects_only = false)
un... | 35.742857 | 114 | 0.686651 |
ab08296bbae5bf58b01b4319dd7cb54b912fea2a | 590 | cask "zy-player" do
version "2.8.0"
sha256 "7c072abf6ade74b74e020ab74d039825f9534de488390fed0403e8a72a2d6669"
url "https://github.com/Hunlongyu/ZY-Player/releases/download/v#{version}/ZY-Player-#{version}.dmg"
name "ZY Player"
desc "Video resource player"
homepage "https://github.com/Hunlongyu/ZY-Player"
... | 25.652174 | 101 | 0.722034 |
bb0718cbbc25561b754f2bb7ca015a0f359f58cb | 1,982 | require 'ebay/types/pagination'
module Ebay # :nodoc:
module Requests # :nodoc:
# == Attributes
# value_array_node :order_ids, 'OrderIDArray', 'OrderID', :default_value => []
# time_node :create_time_from, 'CreateTimeFrom', :optional => true
# time_node :create_time_to, 'CreateTimeTo', :optional =... | 50.820513 | 104 | 0.689707 |
6a9107574a01de3abd687b891285cb92de1bc695 | 9,165 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ResourceGraph::Mgmt::V2019_04_01
#
# A service client - single point of access to the REST API.
#
class ResourceGraphClient < MsRestAz... | 40.374449 | 154 | 0.689471 |
79ff58a2100c959e74fdaf79a851d9cc478b69f6 | 3,096 | # frozen_string_literal: true
class PrisonersController < PrisonsApplicationController
def search
@q = search_term
offenders = SearchService.search_for_offenders(@q, @prison.offenders)
@offenders = get_slice_for_page(offenders)
MetricsService.instance.increment_search_count
end
def show
@pr... | 34.4 | 126 | 0.733527 |
b929e96b9a1ffe0836a5dd7c316fb7867ca3dcbb | 232 | class Record < ActiveRecord::Base
has_many :primary_records, :class_name => "relation", :foreign_key => "record_a_id"
has_many :secondary_records, :class_name => "relation", :foreign_key => "record_b_id"
has_many :results
end
| 38.666667 | 87 | 0.74569 |
ab4606735e22ef0320a00c9c49f2f35467330205 | 958 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jekyll-paginate/version'
Gem::Specification.new do |spec|
spec.name = "jekyll-paginate"
spec.version = Jekyll::Paginate::VERSION
spec.authors = ["Parker Moore"]
spec.... | 38.32 | 74 | 0.661795 |
e292e49265dc2814f2095b111a3e9d2d59c11789 | 308 | require File.join(File.dirname(__FILE__), 'ec2')
module Opscode
module Aws
module IAM
include Opscode::Aws::Ec2
def iam
require 'aws-sdk'
Chef::Log.debug('Initializing the IAM Client')
@iam ||= create_aws_interface(::Aws::IAM::Client)
end
end
end
end
| 18.117647 | 57 | 0.616883 |
f8d17073b9d95d8f445b603651396cc13342ae98 | 178 | # The version of logstash.
LOGSTASH_VERSION = "1.2.0.beta1"
# Note to authors: this should not include dashes because 'gem' barfs if
# you include a dash in the version string.
| 29.666667 | 72 | 0.747191 |
e262b7a7d19c623a3eb524d19d962355a57f9e7d | 1,222 | # frozen_string_literal: true
module ServiceLayer
module NetworkingServices
# Implements Openstack RBAC
module Rbac
def rbac_map
@rbac_map ||= class_map_proc(Networking::Rbac)
end
def rbacs(filter = {})
elektron_networking.get('rbac-policies', filter).map_to(
'bod... | 23.056604 | 64 | 0.601473 |
6a83646b74fb2770505a8811fad787f1d7fd9185 | 9,850 | # -*- encoding: us-ascii -*-
class IO
def self.for_fd(fd, mode = nil)
new fd, mode
end
##
# Opens the file, optionally seeks to the given offset,
# then returns length bytes (defaulting to the rest of
# the file). read ensures the file is closed before returning.
#
# IO.read("testfile") ... | 23.792271 | 111 | 0.61066 |
6125f2a9e729ab341492ca1f3407fa2249b45319 | 118 | class AddActiveToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :active, :boolean
end
end
| 19.666667 | 53 | 0.737288 |
7a71608c093760ab474cb7aa44858a1139984867 | 551 | #
# Cookbook Name:: windows_paging_file
# Recipe:: get page file information
# Licensed Materials - Property of IBM
# Copyright (c) 2016 IBM, All Rights Reserved.
# Copyright (c) 2016 The Authors, All Rights Reserved.
#########################################################
# Author: Ruifeng Ma
# Date: 2016-May-18
# ... | 32.411765 | 77 | 0.598911 |
4a3e04dd7cd2533e7838f3d66c734965b33b17b4 | 3,519 | module Awful
module Short
def sqs(*args)
Awful::SQS.new.invoke(*args)
end
end
class SQS < Cli
no_commands do
def sqs
@_sqs ||= Aws::SQS::Client.new
end
def is_url?(str)
str =~ /\A#{URI::regexp}\z/
end
def queue_url(name)
if is_url?(name)
... | 34.165049 | 163 | 0.642512 |
6190fe4d9a40d04f9917ed10c9286413ba84e55b | 4,000 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::CommentedKeyword do
subject(:cop) { described_class.new(config) }
let(:config) { RuboCop::Config.new }
it 'registers an offense when commenting on the same line as `end`' do
expect_offense(<<-RUBY.strip_indent)
if x
y
end... | 25.157233 | 88 | 0.609 |
3929ced8eee498410943fd5a3cca58e3fe14726f | 1,269 | #!/usr/bin/ruby -I../.. -rmagic_xml
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
#
#Permission is hereby granted, free of charge, to any person obtaining a
#copy of this software and associated documentation files (the "Software"),
#to deal in the Software without restriction, including ... | 48.807692 | 96 | 0.77699 |
79c5d22320668a00bd6c79fafebadfe19864278c | 143 | Bundler.require(:mongoid)
puts File.expand_path("../mongoid.yml", __FILE__)
Mongoid.load!(File.expand_path("../mongoid.yml", __FILE__), :test)
| 35.75 | 66 | 0.741259 |
6a57b43a4f54106a13bad4a70af8fabcc1fb8b8a | 644 | Rails.application.routes.draw do
root to: 'home#index'
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
# resources :surveys
resources :users, only: [:show] do
resources :polls, only: [ :index, :show ]
end
resources :polls, only: [:index, :create, :show, :updat... | 29.272727 | 90 | 0.681677 |
f74f6944ea334b34cc7cb1c8b2c3e478e506fd86 | 1,221 | def add_author_resource(options = {}, &block)
ActiveAdmin.register Author do
config.filters = true
decorate_with AuthorDecorator
config.scoped_collection_actions_if = -> { true }
scoped_collection_action :scoped_collection_update,
title: 'Update',
... | 27.75 | 98 | 0.490581 |
187b566941fc1cd054a04920083ff3f231ead498 | 367 | require "bundler/setup"
require "trivial_gem"
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.expect_with ... | 24.466667 | 66 | 0.754768 |
f7675a5c83e755e5f5c05d04e5d85512e48d463b | 2,417 | # encoding: utf-8
module Github
class Repos::Collaborators < API
# Add collaborator
#
# Examples:
# github = Github.new
# github.collaborators.add 'user', 'repo', 'collaborator'
#
# collaborators = Github::Repos::Collaborators.new
# collaborators.add 'user', 'repo', 'collaborator... | 30.987179 | 84 | 0.663633 |
e89fe3e5c2c52b39c548f4c4d6c3f922a9e1dc9e | 15 | rake "db:seed"
| 7.5 | 14 | 0.666667 |
fffe127dd90e963eb79db13c93e302a1b2aecc22 | 1,002 | # encoding: utf-8
module RuboCop
module Cop
module Style
# This cop checks whether comments have a leading space
# after the # denoting the start of the comment. The
# leading space is not required for some RDoc special syntax,
# like #++, #--, #:nodoc, etc.
class LeadingCommentSpac... | 29.470588 | 77 | 0.58483 |
d5c18e939d761894bec272434ff19d5dd6243ecd | 3,805 | require 'csv'
require 'faker'
require 'bcrypt'
helpers do
def create_user(username, email, password)
user = User.new({:username => username,
:email => email,
:password => make_hash(password)})
Follow.new({:user_id => user.id, :followed_user_id => user.id}).save
r... | 25.536913 | 120 | 0.636794 |
b9a7a2d494382cd01aa0e9413f1608fbcb2a6ace | 303 | if Rails.env.development? || Rails.env.test?
require "factory_girl"
namespace :dev do
desc "Seed data for development environment"
task prime: "db:setup" do
include FactoryGirl::Syntax::Methods
# create(:user, email: "user@example.com", password: "password")
end
end
end
| 23.307692 | 70 | 0.679868 |
4a04e5a482fdd8c8efcf15aaa60f794c53713212 | 1,329 | #! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe 'dns_lookup' do
it 'should return a list of addresses when doing a lookup for a single record' do
results = subject.execute('google.com')
expect(results).to be_a Array
results.each do |res|
# Horrible regex that matches both IPv4 and v6 ... | 55.375 | 738 | 0.523702 |
7938693469674b98a86d558881f6577bf70dfa4b | 12,512 | # encoding: utf-8
module CarrierWave
##
# If a Class is extended with this module, it gains the mount_uploader
# method, which is used for mapping attributes to uploaders and allowing
# easy assignment.
#
# You can use mount_uploader with pretty much any class, however it is
# intended to be used with s... | 30.368932 | 120 | 0.622283 |
1166302a015900df759d418033c60b25130b181d | 425 | require 'lex/matcher'
class RegexMatcher < Matcher
attr_reader :regex
def initialize(identifier, regex)
super(identifier)
@regex = regex
end
def match(code)
match = code[@regex, 1]
if match
return [@identifier, match]
else
return nil
end
end
def self.create(*matchers... | 15.178571 | 46 | 0.644706 |
21f2aef3901fc6ad43ff4c12cc6c380928153fa2 | 2,495 | class Form
#templateは、max4つ
def template(title = "未入力", text1 = "未入力", text2 = "", text3 = "", text4 = "")
if text4 != ""
{
"type": "template",
"altText": "this is a buttons template",
"template": {
"type": "buttons",
"text": title,
"actions": [
... | 24.70297 | 80 | 0.284168 |
ac20acb06bce46e47f027ee1d30c3fc5fb27eef4 | 1,492 | class Gettext < Formula
desc "GNU internationalization (i18n) and localization (l10n) library"
homepage "https://www.gnu.org/software/gettext/"
url "https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.xz"
mirror "https://ftpmirror.gnu.org/gettext/gettext-0.19.8.1.tar.xz"
sha256 "105556dbc5c3fbbc2aa0edb46d22d... | 39.263158 | 106 | 0.526139 |
ed07ece836ac95e262cab605877ac6b253c4550f | 267 | class AddAcceptProposalCommentsAfterDeadlineToggle < ActiveRecord::Migration
def self.up
add_column :events, :accept_proposal_comments_after_deadline, :boolean
end
def self.down
remove_column :events, :accept_proposal_comments_after_deadline
end
end
| 26.7 | 76 | 0.820225 |
6a37cceb3334216625e85f4e99f57a9c46409407 | 1,019 | # Users
User.create!(name: "Example User",
email: "example@railstutorial.org",
password: "foobar",
password_confirmation: "foobar",
admin: true,
activated: true,
activated_at: Time.zone.now)
99.times do |n|
name = Faker::Nam... | 29.114286 | 65 | 0.60157 |
1c285c7a9247c9aa9417d663ef0bdb5840c00909 | 24 | homebrew_cask 'pacifist' | 24 | 24 | 0.875 |
01b80c1d0d836f148c32dbf16a08d6cced6d8120 | 1,338 | module TimePeriods
class SpreadsheetsContainingItem
def self.call(budget_item)
spreadsheet_time_periods(budget_item).sort_by(&:start_date).uniq
end
private
def self.spreadsheet_time_periods(budget_item)
month_time_periods(budget_item) + year_time_periods(budget_item)
end
def sel... | 29.086957 | 76 | 0.758595 |
7ac4eee808ca990a829ddb2185fcf092cb57ccee | 574 | class Phone
attr_accessor :airplane_mode
def initialize
@airplane_mode = false
end
def text(message)
if @airplane_mode
puts "Saved text: #{message}"
else
puts "Sent text: #{message}"
end
end
def in_airplane_mode
@airplane_mode = true
yield
rescue Exception => e
p... | 17.393939 | 40 | 0.662021 |
1cffc1f19b27b228958592797ebbc4ff0d6f0a2b | 2,242 | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... | 40.035714 | 85 | 0.766726 |
edb2eeedabf90ae5baa71447f8899074c35fafd9 | 1,065 | Pod::Spec.new do |s|
s.name = "ColorFromAddress"
s.version = "1.0.1"
s.summary = "UIView category that generates a UIColor based on the memory address of the view."
s.description = <<-DESC
Helps determine when views are being re-used and also to get an easy and quick way of knowing how view... | 44.375 | 157 | 0.661033 |
211c01de42460624fb25bbfcadd744e662b07999 | 2,789 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
test 'associations' do
assert have_many(:identities).dependent(:destroy)
assert have_many(:announcements).dependent(:destroy)
assert have_many(:draft_items).dependent(:destroy)
end
test '#email' do
assert validate_presence_of(:email... | 29.670213 | 66 | 0.72033 |
015dd49807e895ae69ac9324d85a2ff958078455 | 506 | class Api::V2::AdminController < Api::V2Controller
respond_to :json
before_action :authorize_by_api_key
def freshen
url = "#{versioned_api_prefix}/freshen"
response = Net::HTTP.get(URI.parse(url))
respond_with response
end
private
def authorize_by_api_key
api_key = params[:api_key] || req... | 24.095238 | 73 | 0.709486 |
ac908d339c3f929f202a30631a5e7f5c93f126d4 | 256 | require './config/environment'
if ActiveRecord::Migrator.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
use Rack::MethodOverride
run ApplicationController
use CustomersController
use MealkitsController
| 23.272727 | 77 | 0.820313 |
5d30afc31fc2ac79832d5ee67b24b460e652a77b | 4,586 | #!/usr/bin/env rspec
require 'spec_helper'
describe 'network::bond', :type => 'define' do
context 'incorrect value: ensure' do
let(:title) { 'bond1' }
let :params do {
:ensure => 'blah',
}
end
it 'should fail' do
expect {should contain_file('ifcfg-bond1')}.to raise_error(Puppet::Err... | 28.484472 | 123 | 0.473397 |
1c1eda5d0d6dec6f75468861f84dd4bf1f6bf54a | 325 | module Rubyeet
module Adapters
class Base
include Env::Validatable
class << self
def inherited(child)
Rubyeet::AdapterBuilder.adapter_classes << child
end
end
attr_reader :bot
def initialize(bot)
@bot = bot
validate
end
end
end... | 15.47619 | 58 | 0.572308 |
ff85ba0c7cb8372091877d7009b74a5101b76e5c | 149 | # frozen_string_literal: true
require "rack"
class HelloWorld
def call(_env)
[200, {"Content-Type" => "text/html"}, "Hello Rack!"]
end
end
| 14.9 | 57 | 0.66443 |
e2f00252ed52c474e16a930b8ef870f4adddabb7 | 37,054 | require 'spec_helper'
describe ReportsKit::Reports::Data::Generate do
subject { described_class.new(properties, context_record: context_record).perform }
let(:repo) { create(:repo) }
let(:repo2) { create(:repo) }
let(:context_record) { nil }
let(:chart_data) do
chart_data = subject[:chart_data].except(:... | 27.007289 | 212 | 0.452394 |
e25a40d6cafdfeab66133a5773d8637bf80d8aee | 774 | class Blob
def initialize(params={})
@sha, @path, @repository = params[:sha], params[:path], params[:repository]
@raw_blob = Gitlab::Git::Blob.find(@repository, @sha, @path)
raise ArgumentError("Blob with sha: '#{@sha}' and path: '#{@path}' does not exist in the repository") unless @raw_blob
end
de... | 14.603774 | 122 | 0.627907 |
3801a0eea7d8b7333a9ee993c40e7dcabb678be5 | 302 | module VCAP::CloudController
class TaskAnnotationModel < Sequel::Model(:task_annotations)
many_to_one :task,
class: 'VCAP::CloudController::TaskModel',
primary_key: :guid,
key: :resource_guid,
without_guid_generation: true
def_column_alias(:key_name, :key)
end
end
| 25.166667 | 62 | 0.711921 |
4adabbcad2ba488afc1916909920d2233af42ae9 | 101 | # frozen_string_literal: true
Premailer::Rails.config.merge!(remove_ids: true) # rubocop:disable all
| 33.666667 | 70 | 0.80198 |
79c53643201109ee0ba9dd71c6be1ed484151328 | 7,391 | # encoding: utf-8
# This file is distributed under Ting Yun's license terms.
module TingYun; TEST = true; end unless defined? TingYun::TEST
ENV['RAILS_ENV'] = 'test'
TINGYUN_PLUGIN_DIR = File.expand_path(File.join(File.dirname(__FILE__),".."))
$LOAD_PATH << '.'
$LOAD_PATH << '../../..'
$LOAD_PATH << File.join(TINGYUN... | 27.374074 | 132 | 0.690299 |
186e343dc7c86e04fb64c5003c45f5a81df1288c | 128 | class AddImageUrlToMessages < ActiveRecord::Migration[5.0]
def change
add_column :messages, :image_url, :string
end
end
| 21.333333 | 58 | 0.757813 |
4a96da7ea48510888298ea390e5e979b2a15d5fb | 2,013 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/ads/googleads/v8/services/ad_schedule_view_service.proto for package 'Google.Ads.GoogleAds.V8.Services'
# Original file comments:
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... | 34.706897 | 159 | 0.648286 |
6acb0ef1af4c5e2dd957871c1ccd7defc3724178 | 85 | json.array! @match_players, partial: 'match_players/match_player', as: :match_player
| 42.5 | 84 | 0.8 |
26bfb4b4778068d601c9f0c1180e68cc66f0b1e8 | 159 | run 'hooks/raw'
run 'hooks/ping'
run 'hooks/kick'
run 'hooks/privmsg'
run 'hooks/ctcp'
run 'hooks/joinpart'
run 'hooks/nick'
run 'hooks/topic'
run 'hooks/sasl' | 17.666667 | 20 | 0.72327 |
d5e43f02e26daf05262680a969f3309da2b706fa | 945 | require 'rails_helper'
describe EmailFormatValidator do
class TestModel
include ActiveModel::Model
attr_accessor :email_address
validates :email_address, email_format: true
end
before { instance.valid? }
subject { instance.errors.to_h }
context 'invalid addresses' do
[
'test.com', 'te... | 25.540541 | 78 | 0.671958 |
3399b86fd72eb1bf67d8bd92f749d22cfc074387 | 1,151 | require 'spec_helper'
describe Question do
before do
@node = Node.where(:name => "default").first_or_create
@user = User.create username: 'name1', password: "secert12", email: "mlx@gmail.com", uid: "123456", provider: "github"
@question = Question.create title: "who are you ?", body: "who are you ?", nod... | 26.767442 | 154 | 0.659427 |
bb0072fc8ddfe86adb1d9c150b5b21a0b706b39b | 879 | # frozen_string_literal: true
require 'spec_helper'
describe 'AWS EKS Cluster', :js do
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
gitlab_sign_in(user)
allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 }
stu... | 24.416667 | 84 | 0.68942 |
2608b3e00cc55193f63f77e89f47c73a6a1f419c | 1,292 | #!/usr/bin/env ruby
#
# This sample demonstrates using the framework core directly to launch an
# exploit. It makes use of the simplified exploit wrapper method provided by
# the Msf::Simple::Exploit mixin.
#
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
require 'msf/base'
if (ARGV.length =... | 26.367347 | 77 | 0.697368 |
1126cbfde68e765ed8e305079bcaab4a2dca6814 | 136 | require 'test_helper'
class SuppliersControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 17 | 58 | 0.735294 |
1dea2eada84bcb3b59e192429504bb62de5c38f8 | 1,429 | # encoding: UTF-8
# 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 sou... | 36.641026 | 86 | 0.69979 |
1a515f263be1823bcecd3af084f99e8b9007d374 | 1,391 | # 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/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-apigate... | 25.759259 | 86 | 0.746226 |
870c3d63e8ec948af0452d14d9b43891f653f400 | 178 | module Sexp2Ruby
# Raised when `Processor` is initialized with an unknown
# option, or a known option with an invalid value.
class InvalidOption < StandardError
end
end
| 22.25 | 58 | 0.758427 |
1a5e6e84659ca8800fb66003545ff0b6d5bd7add | 1,009 | # frozen_string_literal: true
require 'test_helper'
module ShopifyCli
class ContextTest < MiniTest::Test
include TestHelpers::FakeFS
def setup
super
@ctx = Context.new
end
def test_write_writes_to_file_in_project
@ctx.root = Dir.mktmpdir
@ctx.write('.env', 'foobar')
as... | 24.609756 | 91 | 0.637265 |
e872290c87cab5262e6f2f866380760706f2c159 | 2,420 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10
module Models
#
# ASR error model
#
class ServiceError
include MsRest... | 26.593407 | 70 | 0.48595 |
6ae718b3bbbb425498fe7790e8c714d09a9b4b23 | 1,458 | class Sqldiff < Formula
desc "Displays the differences between SQLite databases"
homepage "https://www.sqlite.org/sqldiff.html"
url "https://www.sqlite.org/2020/sqlite-src-3340000.zip"
version "3.34.0"
sha256 "a5c2000ece56d2de13c474658b9cdba6b7f2608a4d711e245518ea02a2a2333e"
license "blessing"
livecheck ... | 35.560976 | 94 | 0.71262 |
87b1925cdf9bc3432e3439b0146287bc2b473d59 | 911 | cask 'onenote-importer-preview' do
version '1.0.4'
sha256 '9f791a368093ba5204f3be97771a061fc5a78399a7e4411dd45e2cbbb7e4cd89'
# download.microsoft.com/ was verified as official when first introduced to the cask
url "https://download.microsoft.com/download/3/9/C/39CE3624-6D17-495F-B421-D86FC96A23D9/OneNote%20Imp... | 41.409091 | 136 | 0.740944 |
e8848a2b33e486e6a4f7e1f17b76465c773beea3 | 466 | module Munge
module Vfs
class Memory
def initialize(fs = {})
@fs = fs
end
def write(relpath, contents)
@fs[relpath] = contents
end
def read(relpath)
@fs[relpath]
end
def rm(relpath)
@fs.delete(relpath)
end
def exist?(relpath... | 13.705882 | 34 | 0.487124 |
e2b85cb7a5ed12234f29c7a30db33629c4527c31 | 799 | require 'myob/api/version'
require 'myob/api/helpers'
require 'myob/api/models/base'
require 'myob/api/models/company_file'
require 'myob/api/models/company'
require 'myob/api/models/current_user'
require 'myob/api/models/contact'
require 'myob/api/models/customer'
require 'myob/api/models/employee'
require 'myob/a... | 24.212121 | 50 | 0.806008 |
d5b9835be2ad61637214f5f01a82ea357f3e03dc | 1,943 | # frozen_string_literal: true
# This is the controller for Gear.
class GearsController < ApplicationController
before_action :set_gear, only: %i[show edit update destroy]
# GET /gears
# GET /gears.json
def index
@hunter = Hunter.find(params[:hunter_id]) if params[:hunter_id]
@gears = Gear.all
end
... | 24.594937 | 93 | 0.653114 |
e2eda8fdfae77eea1426b3895e1bf32f731b3954 | 9,052 | # frozen_string_literal: true
require 'spec_helper'
require 'openssl'
describe Akero do
subject { Akero.new(1024) }
describe '#new' do
it 'returns instance with unique fingerprint' do
memo = {}
10.times do
id = Akero.new.id
memo.should_not include id
memo[id] = true
en... | 35.359375 | 121 | 0.612351 |
acd199000e35730b2db076dcbabc353d52957ec4 | 227 | libdir = File.dirname(__FILE__)
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Gems
require 'find'
require 'rack'
require 'rack/file'
require 'logger'
require 'cgi'
# Base
require 'core/base'
include Pakyow
| 16.214286 | 61 | 0.753304 |
9198d45839037b9031c1881df2f4c88c68ae3417 | 7,177 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Default role-based authorization UI' do
describe 'Posts index' do
let(:visit_posts_index) { visit_path_and_login_with(posts_path, user) }
let!(:post) { FactoryBot.create(:post, author: user) }
let!(:other_post) { FactoryBot.create(:po... | 27.710425 | 80 | 0.656402 |
218ad9aa555786d39c288be39d36c8aa1a25e304 | 18,235 | require 'digest/md5'
require 'cgi'
module Facebooker
#
# Raised when trying to perform an operation on a user
# other than the logged in user (if that's unallowed)
class NonSessionUser < StandardError; end
class Session
class SessionExpired < StandardError; end
class UnknownError < StandardError; en... | 34.601518 | 154 | 0.659611 |
8725c09442a602c7ff0e837144373ca0a67e3fa3 | 71 | # frozen_string_literal: true
module GraphQL
VERSION = "1.10.10"
end
| 14.2 | 29 | 0.746479 |
26c9eb1ee11b3cf9d1401e86c3a044c69e43dbd8 | 478 | class ImproveRiverPage < SitePrism::Page
section(:user_bar, AdminUserBarSection, AdminUserBarSection::SELECTOR)
element(:improve_yes, "#improve_river_step_improve_river_true", visible: false)
element(:improve_no, "#improve_river_step_improve_river_false", visible: false)
element(:submit_button, "input[name='... | 22.761905 | 81 | 0.736402 |
bf1aa778cdedb54ec9ae0275daa76a7b1b187548 | 326 | # frozen_string_literal: true
require 'aws-sdk-sns'
class SnsClientFactory
# Create a real SNS client if credentials are present; otherwise create a stubbed SNS client
def self.client
if ENV['AWS_ACCESS_KEY_ID']
Aws::SNS::Client.new
else
Aws::SNS::Client.new(stub_responses: true)
end
en... | 20.375 | 94 | 0.714724 |
6a858b1e4416661957545b0dc8488c43ac091106 | 2,508 | RSpec::Support.require_rspec_core "formatters/base_formatter"
RSpec::Support.require_rspec_core "formatters/console_codes"
module RSpec
module Core
module Formatters
# Base for all of RSpec's built-in formatters. See RSpec::Core::Formatters::BaseFormatter
# to learn more about all of the methods call... | 32.571429 | 95 | 0.624003 |
03f509ef86d5e00bb7b312d2d0804272183189bb | 259 | module CC
module CLI
class Version < Command
def run
say version
end
private
def version
path = File.expand_path("../../../../VERSION", __FILE__)
@version ||= File.read(path)
end
end
end
end
| 15.235294 | 64 | 0.528958 |
03fa51b502b7e967de55e174b67c83e2edbd794d | 8,689 | # empty settings (populate these for the elasticsearch::default recipe)
# see the resources or README.md to see what you can pass here.
default['elasticsearch']['user'] = {}
default['elasticsearch']['install'] = {}
default['elasticsearch']['configure'] = {}
default['elasticsearch']['service'] = {}
default['elasticsearc... | 86.89 | 126 | 0.800668 |
28f4b8316a2a216399692e32978e64e6d82d0349 | 5,324 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
DependencyDetection.defer do
named :mongo
depends_on do
defined?(::Mongo)
end
depends_on do
require 'new_relic/agent/datastores/m... | 32.463415 | 148 | 0.683509 |
d5d21dd5f800f98c48dcf091aad5ef1705cdbd24 | 4,253 | module SlackStatusTracker
class ReportManager
include Singleton
attr_accessor :output_path
attr_accessor :json_hash
def cmd
options = parse_options ARGV
set_output options
set_json_hash options
frequency = options.fetch :frequency
append_to_output "Time\t\t\t\tOnline Us... | 27.262821 | 76 | 0.55067 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.