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 |
|---|---|---|---|---|---|
4a38350569bab7877b9aba589e7eef0889982143 | 7,708 | require 'rails_helper'
require 'support/gravity_helper'
describe Api::GraphqlController, type: :request do
describe 'buyer_counter_offer mutation' do
include_context 'GraphQL Client'
let(:order_seller_id) { jwt_partner_ids.first }
let(:buyer_id) { jwt_user_id }
let(:artwork_location) { { country: 'US... | 38.348259 | 174 | 0.638168 |
18aa96db4fe089cfd40d8155842310694fd251b4 | 673 | class DropAccessControlEntry < ActiveRecord::Migration[5.2]
def change
drop_table :access_control_entries do |t|
t.string "group_uuid"
t.bigint "tenant_id"
t.string "permission"
t.string "aceable_type"
t.bigint "aceable_id"
t.datetime "created_at", null: false
t.datetime ... | 39.588235 | 115 | 0.720654 |
1a2bde309a0986957713c74cfafe3328c0682090 | 62 | # return: Integer
# params: Integer
def main(a)
a << 2
end
| 8.857143 | 17 | 0.629032 |
bbe21a678768223d149df8a1293109e76d94b389 | 4,762 | =begin
#OpenAPI Extension with dynamic servers
#This specification shows how to use dynamic servers.
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-beta3
=end
# load the gem
require 'dynamic_servers'
# The following was generated by the `r... | 42.517857 | 92 | 0.743385 |
bf2ecf95fd66ff329395f066b4b579ac881444a8 | 1,387 | module Pageflow
module AudioFilesHelper
def audio_file_audio_tag(audio_file_id, options = {})
options.merge!(class: ['audio-js', options.delete(:class)].compact * ' ',
controls: true,
preload: 'none')
url_options = {unique_id: options.delete(:unique_id)}
... | 33.829268 | 83 | 0.631579 |
5da5af6b5ef8e2c44891173d62a6f08490180c14 | 6,209 | module Polkadot
class Client < Common::IndexerClient
DEFAULT_TIMEOUT = 10
DEFAULT_DAYS_LIMIT = 89
DEFAULT_HOURS_LIMIT = 24
DEFAULT_SESSIONS_LIMIT = 1
DEFAULT_ERAS_LIMIT = 1
def status
@status ||= Polkadot::Status.new(get('/status'))
rescue Common::IndexerClient::Error
Polkadot... | 41.393333 | 154 | 0.705589 |
1841aea252c691b80b5bce028a836c591359aff1 | 1,182 | require "language/node"
class ApolloCli < Formula
desc "Command-line tool for Apollo GraphQL"
homepage "https://apollographql.com"
url "https://registry.npmjs.org/apollo/-/apollo-2.30.3.tgz"
sha256 "b47fc4f45e15ada032fc9e87fb51ea2e03213707eaad7780b337bd6105200e3b"
license "MIT"
livecheck do
url :stabl... | 31.945946 | 97 | 0.753807 |
38723ad6fd771470c74aa29ce5cef43346624106 | 2,341 | require "cognito_jwt_keys"
require "cognito_pool_tokens"
require "cognito_urls"
class CognitoClient
def initialize(params = {})
@pool_id = params[:pool_id] || ENV['AWS_COGNITO_POOL_ID']
@client_id = params[:client_id] || ENV['AWS_COGNITO_APP_CLIENT_ID']
@client_secret = params[:client_secret] || ENV['AW... | 27.22093 | 93 | 0.63947 |
2864734a0e5aa39132d70ffd023872c4c492c7a4 | 23,634 | require 'test_helper'
class RemoteStripeTest < Test::Unit::TestCase
CHARGE_ID_REGEX = /ch_[a-zA-Z\d]+/
def setup
@gateway = StripeGateway.new(fixtures(:stripe))
@currency = fixtures(:stripe)["currency"]
@amount = 100
@credit_card = credit_card('4242424242424242')
@declined_card = credit_card(... | 46.341176 | 672 | 0.7694 |
7a2ae2dc456a492444951fd6df16d16a38009eb0 | 612 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module SampleApp
class Application < Rails::Application
# Include the authenticity token in remote forms.
config.acti... | 32.210526 | 82 | 0.771242 |
1d1cd6879c2edfebc98e5df70eafacdc7d57d687 | 387 | # frozen_string_literal: true
module Appsignal
module Utils
module RailsHelper
def self.detected_rails_app_name
rails_class = Rails.application.class
if rails_class.respond_to? :module_parent_name # Rails 6
rails_class.module_parent_name
else # Older Rails versions
... | 22.764706 | 64 | 0.684755 |
5df7ddd7a0426b6b108ca559dfc1ef7349009514 | 203 | require 'fog/core/model'
module Fog
module DNS
class StormOnDemand
class Reverse < Fog::Model
def initialize(attributes={})
super
end
end
end
end
end
| 12.6875 | 37 | 0.581281 |
2662d756d48d51ce9dd20195a220eba64a1f4f6a | 706 | module Rails
module Generators
class ActionsGenerator < NamedBase
source_root File.expand_path('../templates', __FILE__)
def create_actions_folder
template 'collect.rb.erb', File.join('app/actions', plural_name, 'collect.rb')
template 'create.rb.erb', File.join('app/actions', plural_n... | 32.090909 | 86 | 0.66289 |
183bf00a70314237aa8e09a2a29233dc886e209d | 445 | cask 'font-arapey' do
version :latest
sha256 :no_check
# github.com/google/fonts/ was verified as official when first introduced to the cask
url 'https://github.com/google/fonts/trunk/ofl/arapey',
using: :svn,
revision: '50',
trust_cert: true
name 'Arapey'
homepage 'https://www.goo... | 24.722222 | 87 | 0.680899 |
e8fc3b63fba5d1b55bee5b8ee9fa5364fc66bf57 | 1,287 | # 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... | 34.783784 | 86 | 0.748252 |
33621bb94376d111bb39e990bbde1f8b2c76c16b | 15,155 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
# rubocop:disable Metrics/BlockLength
class Dataminer < Roda
route 'functional_areas', 'security' do |r|
# FUNCTIONAL AREAS
# --------------------------------------------------------------------------
r.on 'functional_areas', Integer do... | 38.958869 | 141 | 0.566414 |
bb5360f465d694eac54f3d0dac4032ae3421e7d1 | 5,209 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
use_doorkeeper
namespace :oauth, { defaults: {format: :json} } do
get 'device_flow_init', to: 'device_flow#init'
get 'device_flow_authorize', to: 'device_flow#authorize'
... | 26.045 | 101 | 0.571127 |
116baddf026f0e592c770f25b22829de4aafdffd | 7,238 | # 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::ApiManagement::Mgmt::V2018_06_01_preview
module Models
#
# Api Entity Properties
#
class ApiContractProperties < ApiEntityBa... | 31.333333 | 78 | 0.435479 |
615ec7755d41dec6060bd9eea328ef3dda1773f9 | 5,359 | # encoding: utf-8
require 'mongoid/paranoia/monkey_patches'
require 'mongoid/paranoia/configuration'
require 'active_support'
require 'active_support/deprecation'
module Mongoid
# Include this module to get soft deletion of root level documents.
# This will add a deleted_at field to the +Document+, managed automa... | 26.269608 | 84 | 0.635007 |
01220dcd33609598ca3038351368cffcd0ba03dd | 2,250 | require 'securerandom'
RSpec.shared_context :integration_test_context do
subject(:client) do
ThreeScale::API.new(endpoint: @endpoint, provider_key: @provider_key, verify_ssl: @verify_ssl)
end
before :context do
@endpoint = ENV.fetch('ENDPOINT')
@provider_key = ENV.fetch('PROVIDER_KEY')
@verify_s... | 52.325581 | 135 | 0.571111 |
18d2d942abe9dbf115533edca007dce11388f0ad | 1,933 | ##
# 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'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Re... | 26.479452 | 106 | 0.634765 |
ab8746add10217c0ab8b27c9e5dad43a7f58f16a | 1,298 | require 'abstract_unit'
require 'active_support/log_subscriber/test_helper'
require 'action_controller/log_subscriber'
module Another
class LogSubscribersController < ActionController::Base
abstract!
self.perform_caching = true
def with_page_cache
cache_page('Super soaker', '/index.html')
r... | 23.6 | 80 | 0.736518 |
3930bd438ca2973b6f8649b4a9c32c05634d9226 | 16,021 | #!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'time'
module FeedParser
class FeedTimeParser
@@date_handlers = [:parse_date_rfc822,
:parse_date_hungarian, :parse_date_greek,:parse_date_mssql,
:parse_date_nate,:parse_date_onblog,:parse_date_w3dtf,:parse_date_iso8601
]
class << self
... | 39.171149 | 138 | 0.498159 |
f739aa3634f3f4c9471813926fceb6918af0c9f3 | 3,438 | # frozen_string_literal: false
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic ... | 36.574468 | 217 | 0.655032 |
e23f88f5b92b51f6899338257feec73847aa00b4 | 537 | require 'bundler'
require 'shellwords'
module Solargraph
class ApiMap
module BundlerMethods
module_function
def require_from_bundle directory
@require_from_bundle ||= begin
Solargraph.logger.info "Loading gems for bundler/require"
Documentor.specs_from_bundle(directory)
... | 21.48 | 67 | 0.659218 |
d552cd6ef94e001f41fa720fa5828eb792caf091 | 2,909 | #
# Unit tests for aodh::keystone::auth
#
require 'spec_helper'
describe 'aodh::keystone::auth' do
shared_examples_for 'aodh::keystone::auth' do
context 'with default class parameters' do
let :params do
{ :password => 'aodh_password' }
end
it { is_expected.to contain_keystone__resourc... | 35.91358 | 84 | 0.515641 |
331eaa7bdffafcf1d0af04d3f071e125b89a1205 | 343 | unless Rails.env.production?
require "cucumber/rake/task"
namespace :cucumber do
Cucumber::Rake::Task.new(:ok, "Run features that should pass") do |t|
t.fork = true # You may get faster startup if you set this to false
t.profile = "default"
end
end
desc "Alias for cucumber:ok"
task cucum... | 24.5 | 73 | 0.6793 |
5d28843ae31ec618fb023c46411a5a1cb0fd8b5a | 176 | class ChangeTagIsTaxanomicToIsTaxonomic < ActiveRecord::Migration[6.0]
def change
change_table :tags do |t|
t.rename :is_taxanomic, :is_taxonomic
end
end
end
| 22 | 70 | 0.732955 |
b92c4fe1131a2e58839da118b6be73c77fd2d410 | 2,833 | # frozen_string_literal: true
RSpec.describe "Defining custom macros" do
subject(:contract) do
contract_class.new
end
subject(:contract_class) do
Class.new(Test::BaseContract) do
schema do
required(:numbers).array(:integer)
end
end
end
before do
class Test::BaseContract ... | 26.231481 | 103 | 0.644899 |
f84c27b55b33bcbc2fb1ae19b66f528e156aedf4 | 368 | #
# Output rest api
#
require 'kumogata/template/helper'
_output "#{args[:name]} rest api",
ref_value: "#{args[:name]} rest api",
export: _export_string(args, "rest api")
_output "#{args[:name]} rest api root resource",
ref_value: [ "#{args[:name]} rest api", "RootResourceId" ],
export:... | 30.666667 | 67 | 0.63587 |
ff1c45e373b8fd47aa6e2a3f671fc75df52def10 | 1,609 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "shuffles/version"
Gem::Specification.new do |spec|
spec.name = "shuffles"
spec.version = Shuffles::VERSION
spec.authors = ["Tim Gourley"]
spec.email = ["tgourley@gmail.com"]... | 37.418605 | 96 | 0.663766 |
e9fcedd562d6640fb4c5b8581409070865f0fbcf | 614 | module PostmanMta
class ApiClient
attr_reader :response_body, :response_status
[:get, :post, :put, :patch, :delete].each do |type|
define_method type do |url, options = {}|
perform_request(type.to_s.upcase, url, options)
end
end
private
def perform_request(request_type, path... | 25.583333 | 77 | 0.675896 |
b96edca383e39db045c7a19c5c1e7f4807d5b70e | 544 | # Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
Rails.application.config.middleware.insert_before 0, Rac... | 30.222222 | 92 | 0.672794 |
114c1cb512f5b6ee228774c178194c3ba8c82cb7 | 1,171 | # Only use Lograge for Rails
unless Sidekiq.server?
filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log")
Rails.application.configure do
config.lograge.enabled = true
# Store the lograge JSON files in a separate file
config.lograge.keep_original_rails_log = true
# Don't use the Logstash ... | 33.457143 | 77 | 0.673783 |
7ab3f5d221da44c1e090106db24d8449a4098756 | 803 | module AuthorizedSystem
module ClassMethods
end
module InstanceMethods
protected
def set_current_user_for_model_security
Authorization.current_user = self.current_user
end
def permission_denied
respond_to do |format|
flash[:error] = t('users.flashs.errors.not_allowed')
... | 25.903226 | 86 | 0.708593 |
7a9b753254d9b3b650901d49a50dc367ff0a4b4b | 207 | class AddAvatarsToUsers < ActiveRecord::Migration[5.1]
def self.up
change_table :users do |t|
t.attachment :avatar
end
end
def self.down
drop_attached_file :users, :avatar
end
end
| 17.25 | 54 | 0.690821 |
111fadc1ec95f7da150c4544ff1e6c57cf176dae | 185 | class CreateUrzaCardsSubtypes < ActiveRecord::Migration
def change
create_table :urza_cards_subtypes do |t|
t.integer :card_id
t.integer :subtype_id
end
end
end
| 20.555556 | 55 | 0.724324 |
871e7389435011c2896c53e9e708fdac6b3eeef8 | 61 | module TemplateForm
class DateInput < TextInput
end
end
| 10.166667 | 29 | 0.770492 |
e29866699989948bfdff818c2e96956bd588168d | 1,606 | class Chezscheme < Formula
desc "Implementation of the Chez Scheme language"
homepage "https://cisco.github.io/ChezScheme/"
url "https://github.com/cisco/ChezScheme/archive/v9.5.6.tar.gz"
sha256 "e23c556493f9a661852ea046f3317500feac5f223ea6ef3aa3b9234567e14c0e"
license "Apache-2.0"
bottle do
sha256 ... | 36.5 | 121 | 0.668742 |
f7026e11c3914daac861a1987fdeb418c92e17e0 | 7,939 | # frozen_string_literal: true
require 'rails_helper'
require "#{BenefitSponsors::Engine.root}/spec/shared_contexts/benefit_market.rb"
require "#{BenefitSponsors::Engine.root}/spec/shared_contexts/benefit_application.rb"
RSpec.describe BenefitSponsors::Operations::BenefitApplications::Clone, dbclean: :after_each do
... | 39.108374 | 181 | 0.740144 |
bbf13479f7883a8788746773fb30ca8158449988 | 744 | require "English"
require "stringio"
class CSV
module InputRecordSeparator
class << self
is_input_record_separator_deprecated = false
verbose, $VERBOSE = $VERBOSE, true
stderr, $stderr = $stderr, StringIO.new
input_record_separator = $INPUT_RECORD_SEPARATOR
begin
$INPUT_RECO... | 23.25 | 74 | 0.637097 |
d56704b5e789a47112cc424506ec8bdfb27e7d28 | 1,638 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... | 34.125 | 115 | 0.640415 |
1cab3014c7c19c1eebbb2d6da014a24c3c3a9325 | 12,582 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class VmToolsInfo
# Link to this resource
attr_accessor :_self
# The server will ... | 31.533835 | 203 | 0.627563 |
2834876f75ab3c1de80055c057f32e8ddaf60991 | 334 | require 'bcrypt'
module Restmachine
module User
def self.included receiver
receiver.send :include BCrypt
end
def password
@password ||= Password.new(password_hash)
end
def password=(new_password)
@password = Password.create(new_password)
self.password_hash = @password
... | 19.647059 | 47 | 0.682635 |
d5c93812d510591207741e1a584e65cadc916499 | 887 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hosts_file/version'
Gem::Specification.new do |spec|
spec.name = "hosts_file"
spec.version = HostsFile::VERSION
spec.authors = ["Joshua Bussdieker"]
spec.email ... | 36.958333 | 74 | 0.666291 |
289cba2b663a163fd2104d9ebd22a2126cea6a71 | 2,962 | # 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::Compute::Mgmt::V2020_12_01
module Models
#
# The List Virtual Machine operation response.
#
class VirtualMachineScaleSetList... | 29.326733 | 80 | 0.544902 |
914fa57db8457ea73d6745e4c7fdd6008be43b21 | 19,448 | class Plan
include Mongoid::Document
include Mongoid::Timestamps
# include Mongoid::Versioning
COVERAGE_KINDS = %w[health dental]
METAL_LEVEL_KINDS = %w[bronze silver gold platinum catastrophic dental]
REFERENCE_PLAN_METAL_LEVELS = %w[bronze silver gold platinum dental]
MARKET_KINDS = %w(shop individual)
... | 36.556391 | 229 | 0.675442 |
0896d351ce95c487d284b0af2199d86d12dc6af4 | 10,250 | #
# Copyright (C) 2008-2010 Wayne Meissner
# Copyright (C) 2008, 2009 Andrea Fazzi
# Copyright (C) 2008, 2009 Luc Heinrich
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | 27.406417 | 123 | 0.608 |
879e89a3c2b734f83774ce2c2d1b4734b7d6bd9d | 1,645 | # (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# 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... | 40.121951 | 95 | 0.635258 |
ff0c912fb64ff991aa6a5a7be489ee0e3739ae54 | 217 | class Kaui::Base
def self.to_money(amount, currency)
begin
return Money.from_amount(amount.to_f, currency)
rescue => _
end if currency.present?
Money.from_amount(amount.to_f, 'USD')
end
end
| 19.727273 | 53 | 0.686636 |
5dbce0535b047ea8d40844b95468df57f115f150 | 173 | require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes'
| 57.666667 | 86 | 0.751445 |
6a68f624abf67049b2aed710b6e7046acba76662 | 4,562 | require 'spec_helper'
describe RailsAdmin::Config::Fields::Types::MultipleFileUpload do
it_behaves_like 'a generic field type', :string_field, :multiple_file_upload
describe '#allowed_methods' do
it 'includes delete_method and cache_method' do
RailsAdmin.config do |config|
config.model FieldTest... | 30.824324 | 192 | 0.642262 |
e9483409898d28bde473e9f1f05da01a35b966c1 | 45 | When /^I retrieve the logs$/ do
pending
end | 15 | 31 | 0.711111 |
4af054e287cbd78a1b744d020983ec74894dfcb0 | 2,105 | # Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
#
class TagFollowingsController < ApplicationController
before_filter :authenticate_user!
respond_to :html, :json
# POST /tag_followings
# POST /tag_f... | 30.507246 | 90 | 0.67601 |
336a8f18945313947bc671ac407142a6a87b4dd8 | 52,716 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 55.142259 | 317 | 0.730366 |
e25b57b19db6ac3322567a8edb8df133c13cbd68 | 342 | require 'spec_helper'
describe DBus::Systemd::Networkd::Manager do
it 'sets the right dbus node path' do
expect(DBus::Systemd::Networkd::Manager::NODE).to eq '/org/freedesktop/network1'
end
it 'sets the right interface' do
expect(DBus::Systemd::Networkd::Manager::INTERFACE).to eq 'org.freedesktop.networ... | 28.5 | 96 | 0.736842 |
7aac58c0e42be3067097831915224764e037d997 | 2,573 | require "test_helper"
class ApplicationControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
def setup
ApplicationController.class_eval do
def any_action
render plain: I18n.locale
end
end
# If disable_clear_and_finalize is set to true, Rails will not ... | 25.73 | 99 | 0.708123 |
b942a04ddea87af40b9494253725299d4fea9fa9 | 2,971 |
require 'rly'
require 'palo_alto/models/nat_policy'
module PaloAlto
module V6
class ConfigParser < Rly::Yacc
rule 'policies : policies policy' do |policies_out, policies_in, policy|
policies_out.value = policies_in.value.push( policy.value )
end
rule 'policies : ' do |pol... | 31.606383 | 114 | 0.571861 |
e8e69a1c09df0d2f37b2103b5a85e6d276d986da | 62 | class Setting <ActiveRecord::Base
belongs_to :project
end | 20.666667 | 34 | 0.774194 |
e912d7818220d57bcdfe7f6dde83445312061d8b | 1,417 |
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'insta/version'
Gem::Specification.new do |spec|
spec.name = 'insta'
spec.version = Insta::VERSION
spec.authors = ['Renan Garcia']
spec.email = ['email@renangarcia.me']
sp... | 38.297297 | 172 | 0.676782 |
ff7eb5f1f1a6845dc7051a1affc3de9a57f462eb | 274 | module UsersHelper
def gravatar_for(user, size: 80 )
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
end
| 30.444444 | 80 | 0.711679 |
6aff85a197c18c831bcc6097aa6a62c2918e4920 | 2,899 | class SystemTestWorkspace
# Creates the system test workspace, but only on environments which are
# configured to include the system test workspace.
def self.prepare
return unless Feature.enabled?(:system_test)
Factory.new(Client).find_or_create_workspace!
end
class Factory
attr_accessor :client... | 32.211111 | 90 | 0.639186 |
e81232c78cf88d614c09cbc15d81d1851f2aa019 | 744 | module Types
class ReviewedSubmissionType < Types::BaseObject
field :id, ID, null: false
field :title, String, null: false
field :created_at, String, null: false
field :level_id, ID, null: false
field :target_id, ID, null: false
field :user_names, String, null: false
field :feedback_sent, ... | 21.257143 | 50 | 0.655914 |
21fb03a901ffb6a67ba04f927bd5c8e09ebef44a | 210 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :heteronym do
word nil
bopomofo "MyString"
bopomofo2 "MyString"
pinyin "MyString"
end
end
| 19.090909 | 68 | 0.728571 |
f88d31bda888cdd7050207cd2077f0a9c0105828 | 6,807 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Issue Boards new issue', :js do
let_it_be(:project) { create(:project, :public) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:backlog_list) { create(:backlog_list, board: board) }
let_it_be(:label) { c... | 29.214592 | 93 | 0.63229 |
b9513981b26bf89323c6a79e35e7280d1c04411d | 628 | Pod::Spec.new do |s|
s.name = 'PopupDialog'
s.version = '1.1.1'
s.summary = 'A simple custom popup dialog view controller'
s.homepage = 'https://github.com/orderella/PopupDialog'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Martin ... | 41.866667 | 105 | 0.585987 |
038a45e7a71eb9455cc5b80b8109ac5d4107404d | 3,719 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.786517 | 102 | 0.757462 |
f7b4fa4ca36c1e0e4e09e09b1c233c5ecd09c8e8 | 1,363 | # 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... | 35.868421 | 86 | 0.73661 |
b979617c1b8b67f800b92281ea7245613672b773 | 460 | RSpec::Matchers.define :raise_unless_reference do |variable|
match do
begin
actual.call
rescue ArgumentError => e
return e.message.match?(/#{variable} is not a valid reference/)
end
false
end
def supports_block_expectations?
true
end
description do
"raise an error if the ... | 20 | 72 | 0.695652 |
792763f7d50ecbd4c5bd9fdbce374adfde64b79d | 456 | FactoryBot.define do
factory :general_setting do
url { Faker::Internet.url }
description { Faker::Lorem.paragraph(10) }
# association :phone, factory: :user, strategy: :build
phones { Array.new(3) { FactoryBot.build(:phone) } }
opening_hours { Array.new(5) { FactoryBot.build(:opening_hour) } }
... | 30.4 | 70 | 0.635965 |
1d64e8205d4b22a4406868da1c717150bb26bb1c | 1,206 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "memory-view-test-helper/version"
clean_white_space = lambda do |entry|
entry.gsub(/(\A\n+|\n+\z)/, "") + "\n"
end
Gem::Specification.new do |spec|
spec.name = "memory-view-test-helper"
spec.version = Memo... | 31.736842 | 81 | 0.669154 |
5dd481ae8e1cb9e3b1bee634eea0e3585c24f6a2 | 2,541 | cask 'wine-devel' do
version '5.2'
sha256 'f99693b73eca6af4ee900e5cf05e529b3edfc3ea1a5b7b19b9e52438fae4fa43'
url "https://dl.winehq.org/wine-builds/macosx/pool/winehq-devel-#{version}.pkg"
appcast 'https://dl.winehq.org/wine-builds/macosx/download.html'
name 'WineHQ-devel'
homepage 'https://wiki.winehq.org... | 45.375 | 104 | 0.639512 |
014629609f1b2e8bafcf2524517133d13416b0e9 | 32 | require 'planter'
Planter.seed
| 8 | 17 | 0.78125 |
4a3468617aeebabc3c94c1dcfd95d6bc68f8c02b | 1,490 | #
# Be sure to run `pod lib lint HubFintechUtils.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'Hub... | 39.210526 | 152 | 0.669128 |
39f1c7ab5035c9ae840e0c0bf48bb6f8316fe925 | 123 | require 'test_helper'
class AdminpageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
5d7c09df822b72c02b8137284028e30b815eeee0 | 5,670 | # Sonic Dreams
#
# rand-seed-ver 31
#
# Coded by Meta-eX
#
# Video: https://vimeo.com/110416910
use_debug false
load_samples [:bd_haus, :elec_blip, :ambi_lunar_land]
define :ocean do |num, amp_mul=1|
num.times do
s = synth [:bnoise, :cnoise, :gnoise].choose, amp: rrand(0.5, 1.5) * amp_mul, attack: rrand(0, 4), su... | 24.977974 | 255 | 0.567196 |
03e52331eda8f43b460fb4b2fdf663c670ad5470 | 424 | # frozen_string_literal: true
require 'test_helper'
class CustomCollectionTest < Test::Unit::TestCase
test "#create should create a custom collection" do
fake("custom_collections", method: :post, status: 201, body: load_fixture('custom_collection'))
link = ShopifyAPI::CustomCollection.create(title: "Macbooks... | 38.545455 | 118 | 0.747642 |
7a1e70d5d55ee6fdd9926fa0c7359b4f10b0879c | 16,766 | require_relative 'pardot_helpers'
class PardotV2
extend PardotHelpers
API_V4_BASE = "https://pi.pardot.com/api/prospect/version/4".freeze
PROSPECT_QUERY_URL = "#{API_V4_BASE}/do/query".freeze
PROSPECT_READ_URL = "#{API_V4_BASE}/do/read/email".freeze
PROSPECT_DELETION_URL = "#{API_V4_BASE}/do/delete/id".free... | 41.093137 | 140 | 0.708279 |
03be87f4cc1dd2e847298924b08b526d374b3194 | 2,964 | # frozen_string_literal: true
class CohortsService
MONTHS_INCLUDED = 12
def execute
{
months_included: MONTHS_INCLUDED,
cohorts: cohorts
}
end
# Get an array of hashes that looks like:
#
# [
# {
# registration_month: Date.new(2017, 3),
# activity_months... | 29.346535 | 87 | 0.657557 |
039a3a609fb64df4fee76644d1d0fa2f99ae3425 | 1,656 | require 'orph'
require 'pygments'
class Post < Mustache
include Comparable
def self.meta(field, opts = {})
define_method(field) { @meta[field.to_s] || opts[:default] }
end
def self.date_format(name, format)
define_method(name) { date_time.strftime format }
end
def self.all
Dir.glob("posts/*"... | 20.7 | 65 | 0.603865 |
bf023b3ae7f66d1b6127e50fed4d6ad2ff62561d | 31 | require 'blast_furnace/blaster' | 31 | 31 | 0.870968 |
6a51a708de52ec4b10367e16baeceb4a543bc5de | 450 | require 'printer'
module Package
class Printer < ::Printer
def call(packages)
name_justification = packages.name_justification
version_justification = packages.version_justification
packages.each do |package|
puts "%s %s = %s" % [
package.name.to_s.ljust(name_justificatio... | 20.454545 | 60 | 0.644444 |
28af0357b8aab93ce7f29d0c1f2c146aba96889d | 887 | # encoding: utf-8
require 'spec_helper'
describe Rubocop::Cop::Style::SpaceAfterComma do
subject(:cop) { described_class.new }
it 'registers an offense for block argument commas without space' do
inspect_source(cop, ['each { |s,t| }'])
expect(cop.messages).to eq(
['Space missing after comma.'])
e... | 28.612903 | 75 | 0.664036 |
e277bef35b725412918085ec6cd97388d8c70f87 | 821 | require_relative '../../helpers/inspec/docker_helper.rb/'
docker_env = 'DOCKER_HOST="tcp://0.0.0.0:2376" DOCKER_CERT_PATH="/etc/docker/ssl" DOCKER_TLS_VERIFY="1"'
inspec_docker?(docker_env)
describe port(2376) do
it { should be_listening }
end
describe crontab do
its('commands') { should include '/usr/bin/docke... | 37.318182 | 122 | 0.691839 |
1a24fde34968666d771c464bab9a44e238d9e527 | 157 | # frozen_string_literal: true
# Base abstract object for ActiveRecord classes
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| 22.428571 | 47 | 0.815287 |
1a81aaa74cb5b7d8ea8c9d331a8268bdb72c07c7 | 306 | require 'awestruct/handlers/file_handler'
module Awestruct
module Handlers
class VerbatimFileHandler < FileHandler
# Read file in binary mode so that it can be copied to the generated site as is
def read_content
File.open(@path, 'rb') {|is| is.read }
end
end
end
end
| 23.538462 | 85 | 0.686275 |
18a4b76bb19b80b97daf671a32f68ab2e0bf0521 | 1,312 | require 'rbconfig'
require 'yaml'
module Metasploit
module Framework
module Version
# Determines the git hash for this source tree
#
# @return [String] the git hash for this source tree
def self.get_hash
@@git_hash ||= begin
root = File.expand_path(File.join(File.dirname... | 30.511628 | 86 | 0.551829 |
d5062589f0b0ea26a45e6a80be4b5bc20b5471cd | 1,803 | class BooksController < ApplicationController
before_action :set_book, only: [:show, :edit, :update, :destroy]
# GET /books
# GET /books.json
def index
@books = Book.all
end
# GET /books/1
# GET /books/1.json
def show
end
# GET /books/new
def new
@book = Book.new
end
# GET /books/1... | 24.364865 | 88 | 0.635053 |
08db62f78fff5d95c32bd4f72d224cfab9eedee2 | 4,516 | require "formula"
require "language/go"
class Aptly < Formula
homepage "http://www.aptly.info/"
url "https://github.com/smira/aptly/archive/v0.8.tar.gz"
sha1 "cf6ec39d2a450d5a7bc4a7ee13cacfba782a324f"
head "https://github.com/smira/aptly.git"
bottle do
cellar :any
sha1 "0c8c7a948f123d1a40bc2259d844... | 35.28125 | 114 | 0.721435 |
9107f6f314d54f7f1975f96e1bade9d8d3df8f87 | 630 | module Gsa18f
class ProcurementFields
def initialize(procurement = nil)
@procurement = procurement
end
def relevant(recurring)
fields = default
if recurring
fields += [:recurring, :recurring_interval, :recurring_length]
end
fields
end
private
attr_rea... | 17.027027 | 70 | 0.588889 |
1a0f73ef9405b36846de35bb225261c2a5587693 | 50 | module ActiveadminAddons
VERSION = "0.12.0"
end
| 12.5 | 24 | 0.74 |
1cf1bc31c92f8682c7a986486830a80d2e759f1f | 1,462 | require 'rails_helper'
describe UpdateClosureService do
describe '#call' do
let(:date_received) { 7.business_days.ago.to_date }
let(:new_date_responded) { 4.business_days.ago.to_date }
let(:team) { find_or_create :team_dacu }
let(:user) { team.users.first... | 32.488889 | 99 | 0.619699 |
ed7b4fef695d8577e621ab2c26b5372cff4bd345 | 5,683 | require 'nu_plugin/packing'
describe NuPlugin::Packing do
let(:nu_tag) {
{
'tag' => {
'anchor' => '00000000-0000-0000-0000-000000000000',
'span' => {
'start' => 0,
'end' => 3
}
}
}
}
def nu_value(value)
{ 'value' => value }
end
def nu_tagg... | 25.484305 | 138 | 0.600915 |
e2460005a1052a3bf60305de0e711059c1734980 | 1,148 | =begin
#CloudReactor API
#CloudReactor API Documentation
The version of the OpenAPI document: 0.3.0
Contact: jeff@cloudreactor.io
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.4.0
=end
require 'date'
require 'time'
module CloudReactorAPIClient
class RuleTypeEnum
ALWAYS = "always".... | 26.090909 | 96 | 0.702962 |
f884b1fcf98aefc2215104c74247c739ac0f4cd9 | 1,800 | class Gdu < Formula
desc "Disk usage analyzer with console interface written in Go"
homepage "https://github.com/dundee/gdu"
url "https://github.com/dundee/gdu/archive/v5.1.1.tar.gz"
sha256 "fb1a76562947e34fec16fd650f03793ccc5afe04fa6ba817639d92f55a1f927b"
license "MIT"
bottle do
sha256 cellar: :any_sk... | 40 | 122 | 0.712222 |
28a72dc18af2f141f5a9ad2c0118035fa00f34ad | 843 | require 'spec_helper'
describe 'krb5::kadmin_init' do
context 'on Centos 6.7 x86_64' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'centos', version: 6.7) do |node|
node.automatic['domain'] = 'example.com'
stub_command('test -e /var/kerberos/krb5kdc/principal').and_return(false)
... | 32.423077 | 98 | 0.682088 |
3994867e10fcd9427a202e51562b3e7050a1c83e | 878 | class Tcpsplit < Formula
desc "Break a packet trace into some number of sub-traces"
homepage "https://www.icir.org/mallman/software/tcpsplit/"
url "https://www.icir.org/mallman/software/tcpsplit/tcpsplit-0.2.tar.gz"
sha256 "885a6609d04eb35f31f1c6f06a0b9afd88776d85dec0caa33a86cef3f3c09d1d"
bottle do
cella... | 41.809524 | 93 | 0.810934 |
5d5b543fd7c192cf3a220789ed1044bbb3a4cc73 | 5,340 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.132231 | 114 | 0.765543 |
6a855701521708c0fa9464053ed0000ca169c9d2 | 1,164 | # -*- ruby -*-
require 'mkmf'
$:.unshift File.dirname(__FILE__)
require 'type'
require 'dlconfig'
def output_arg(x,i)
"args[#{i}].#{DLTYPE[x][:stmem]}"
end
def output_args(types)
t = []
types[1..-1].each_with_index{|x,i| t.push(output_arg(x,i))}
t.join(",")
end
def output_callfunc(types)
t = types[0]
st... | 18.47619 | 61 | 0.582474 |
5d8b2b2cf4dbf3f246cb03481dbfb8ac551cbabb | 179 | module Cerberus
HOME = File.expand_path(ENV['CERBERUS_HOME'] || '~/.cerberus')
CONFIG_FILE = "#{HOME}/config.yml"
LOCK_WAIT = 30 * 60 # 30 minutes
VERSION = '0.8.0'
end
| 19.888889 | 64 | 0.648045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.