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 |
|---|---|---|---|---|---|
286d77eae0323475c09e2ebf1c628d35bf282ad6 | 250 | module Keap
module REST
class Client
module UserInfo
def user_info
Keap::REST::UserInfo.new get("oauth/connect/userinfo").body
end
alias_method :retrieve_user_info, :user_info
end
end
end
end
| 19.230769 | 69 | 0.628 |
1a0147a86d4292e59b2951f9aeec4e21730f018a | 677 | # frozen_string_literal: true
class Lite::Report::Exporter
class NotImplementedError < StandardError; end
attr_reader :records
def initialize(records)
@records = records
end
class << self
def call(records)
instance = new(records)
instance.call
end
end
def call
results =... | 15.744186 | 65 | 0.661743 |
332ba42094e0ce6be9ee894e6fdc9741dafbf829 | 1,147 | # frozen_string_literal: true
class Measure
include Comparable
attr_reader :amount, :unit
def initialize(amount:, unit:)
@amount = amount
@unit = unit
end
def <=>(other)
if @unit == other.unit
if @amount < other.amount
-1
elsif @amount > other.amount
1
else
... | 16.623188 | 79 | 0.619006 |
33f0a8a66407cdae78b944fadbe0da408fb16e0f | 4,341 | class Project < ApplicationRecord
LANGUAGES = ['ABAP', 'ActionScript', 'Ada', 'Apex', 'AppleScript', 'Arc',
'Arduino', 'ASP', 'Assembly', 'Augeas', 'AutoHotkey', 'Awk', 'Bluespec',
'Boo', 'Bro', 'C', 'C#', 'C++', 'Ceylon', 'Chisel', 'CLIPS', 'Clojure',
'COBOL', 'CoffeeScri... | 44.295918 | 132 | 0.619673 |
330d3be450eb232a9de8ff1723311c6363770edf | 6,358 | =begin
#Selling Partner API for Direct Fulfillment Transaction Status
#The Selling Partner API for Direct Fulfillment Transaction Status provides programmatic access to a direct fulfillment vendor's transaction status.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger ... | 31.320197 | 236 | 0.639509 |
4aeca79c95808a3e147a85ea06bf4c68b6165541 | 29 | module IntitutionsHelper
end
| 9.666667 | 24 | 0.896552 |
790f7097e6632f4b963622592da86008f55e96b9 | 1,141 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-datasync'
spec.version = File.read(Fil... | 38.033333 | 117 | 0.659947 |
bf1f6fcf2b41ec9eda645d1d41e8414a6f760f89 | 823 | #
# Copyright 2012 Red Hat, 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... | 28.37931 | 76 | 0.708384 |
4a40ba99348e27e44e53842e796584c1114ea115 | 609 | cask 'unity-ios-support-for-editor' do
version '2019.1.0f2,292b93d75a2c'
sha256 '03ff3d39f5d02f2719b8f10979c3827d002a20f159091866a0e3683a2955f6b1'
url "https://netstorage.unity3d.com/unity/#{version.after_comma}/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-#{version.before_comma}.pkg"
appcast 'ht... | 38.0625 | 154 | 0.784893 |
ac7c1c39a2ea0d1f6c3217b7d9b8a0759cbbaadc | 1,575 | class PasswordResetsController < ApplicationController
before_action :get_user, only: [:edit, :update]
before_action :valid_user, only: [:edit, :update]
before_action :check_expiration, only: [:edit, :update]
def new
end
def create
@user = User.find_by(email: params[:password_reset][:email].downcase... | 24.609375 | 73 | 0.653333 |
6aa29f19101233965592b645ed0bed986dd6a37e | 2,621 | require_relative '../spec_helper'
require_relative '../../lib/warnings/helper/severity_util'
module Warnings
describe SeverityUtil do
context 'rcwef_short' do
it 'maps unknown to low' do
expect(SeverityUtil.rcwef_short('U000')).to eq(SeverityUtil::LOW)
expect(SeverityUtil.rcwef_short('u000'... | 36.915493 | 79 | 0.671499 |
e9e2b8d196fe409a155852782940496b4424edf6 | 1,427 | # 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... | 34.804878 | 79 | 0.714786 |
6195987cb897436d5d7dd9855590ed152a06343f | 233 | class CreateImports < ActiveRecord::Migration
def change
create_table :imports do |t|
t.string :export_site
t.references :user
t.references :import_item, polymorphic: true
t.timestamps
end
end
end
| 21.181818 | 50 | 0.686695 |
bfaf73c9da407ea0a5f93d1f219b3f20054a7002 | 1,569 | # frozen_string_literal: true
require 'geocoder/results/base'
module Geocoder
module Result
class Baidu < Base
def coordinates
%w[lat lng].map { |i| @data['location'][i] }
end
def province
@data['addressComponent'] and @data['addressComponent']['province'] or ''
end
... | 19.860759 | 81 | 0.574251 |
f7164ac36801af3beb926964a01858d8e6c04a62 | 13,602 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 48.752688 | 154 | 0.750919 |
bf8e507b675787cad147bebe8a3544b57bfa70c9 | 616 | require 'spec_helper'
describe Queri::Stats::AnsweredCalls::AnsweredCallsByStints do
let(:report_class) { Queri::Stats::AnsweredCalls::AnsweredCallsByStints }
let(:xml_code) { report_class.xml_code }
before do
Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml'))
end
it_beha... | 26.782609 | 85 | 0.753247 |
f74e64d37c8aeac90954740faed99b2f46f001ca | 1,432 | Shindo.tests("Fog::Compute[:iam] | managed_policies", ['aws','iam']) do
iam = Fog::AWS[:iam]
tests('#all').succeeds do
iam.managed_policies.size == 100
end
tests('#each').succeeds do
policies = []
iam.managed_policies.each { |policy| policies << policy }
policies.size > 100
end
policy ... | 21.058824 | 84 | 0.590084 |
3352537909d6570c1ef0c87a88c9a7728073b530 | 757 | # encoding: UTF-8
require 'spec_helper'
module CASServer
end
require 'casserver/utils'
describe CASServer::Utils, '#log_controller_action(controller, params)' do
let(:params) { {} }
let(:params_with_password) { { 'password' => 'test' } }
let(:params_with_password_filtered) { { 'password' => '******' } }
it '... | 30.28 | 117 | 0.735799 |
7ad2479809babe28aff3c2fe1393d5610cf561ce | 90 | SimpleTypex::Engine.routes.draw do
resources :types
root :to => 'types#index'
end
| 12.857143 | 34 | 0.688889 |
b9247c1cb389ce5f622539c8f437f584fdb56cd2 | 9,601 | RSpec.describe MiqWorker::ContainerCommon do
before { EvmSpecHelper.local_miq_server }
let(:compressed_server_id) { MiqServer.my_server.compressed_id }
def deployment_name_for(name)
"#{compressed_server_id}-#{name}"
end
describe "#configure_worker_deplyoment" do
let(:test_deployment) do
{
... | 40.855319 | 182 | 0.662223 |
9189a5861a2861549992c129134d14d461c7ab70 | 255 | module AArch64
module Instructions
# AXFLAG -- A64
# Convert floating-point condition flags from Arm to external format
# AXFLAG
class AXFLAG
def encode
0b1101010100_0_00_000_0100_0000_010_11111
end
end
end
end
| 19.615385 | 72 | 0.690196 |
bb4102d22d718266f6e3af170c66fb4474b058ff | 1,432 | require 'neo4j'
require_relative '../workflow/core/team'
require_relative '../policies/core/team_save'
module Models
module Core
# Team
class Team
include Neo4j::ActiveNode
include Neo4j::Timestamps
prepend Models::Workflow::Core::TeamInterceptor
property :name, index: :exact, constra... | 19.616438 | 72 | 0.589385 |
21d523fcf8e00d4d4a072c54eeab2c8abc6f306e | 4,709 | class CreateExampleProviderUsersWithPermissions
def self.call
create_provider_user({
dfe_sign_in_uid: 'dev-provider',
email_address: 'provider@example.com',
first_name: 'Peter',
last_name: 'Rovider',
}, %w[1JA 1N1])
create_provider_user({
dfe_sign_in_uid: 'dev-support',
... | 31.393333 | 88 | 0.698662 |
eddad40f93cdd44b404ff49c75a0c35e7629a87c | 7,713 | require "unicode/emoji"
module PragmaticTokenizer
class Regex
# Things that can or should be done:
# - check where the use of unicode categories helps (\p{Abbreviation})
# - use URI.parse and other libraries instead of regexp to identify urls, domains, emails
# - check multiple domain regex, we have... | 50.743421 | 201 | 0.492675 |
3818ee2999a52b153794d630267520527a6c3ac9 | 169 | require 'rails_helper'
describe NodesController, type: :controller do
it 'should have an index action' do
get :index
expect(response).to be_success
end
end
| 18.777778 | 46 | 0.739645 |
ab200f32c7199ce0946f03052add59fc2f8e7b75 | 39 | module Patron
VERSION = "0.4.19"
end
| 9.75 | 20 | 0.666667 |
e8c2e4fe7463f1acff481f6fe10fe62cd8715ad3 | 1,643 | class AndroidNdk < Formula
desc "Android native-code language toolset"
homepage "https://developer.android.com/sdk/ndk/index.html"
url "https://dl.google.com/android/ndk/android-ndk-r10e-darwin-x86_64.bin"
version "r10e"
sha256 "728c309e606f63101f1258c9d3d579b80ac74fe74c511ebb71f460ce5c5d084e"
bottle :unne... | 31 | 86 | 0.69507 |
0303b780461e23a4588f918c747ee57e3241d37c | 456 | require_relative 'any'
module BELParser
module Language
module Version2_0
module ReturnTypes
# Abundance return type.
class Abundance < Any
# Return the {Symbol} value.
#
# @note This method should be overridden in subclasses.
def self.to_sym
... | 21.714286 | 66 | 0.585526 |
abfc65e1ad484c280982fbfb0f845401ca07ffeb | 139 | class AddReferenceToCustomers < ActiveRecord::Migration[5.0]
def change
add_reference :customers, :user, foreign_key: true
end
end
| 23.166667 | 60 | 0.769784 |
386de912862adccc9eac90fbe69868f0abba8958 | 821 | require "rails_helper"
RSpec.describe Atoms::Matcher::Each, type: :model do
let(:options) do
{}
end
it_behaves_like "an atom rule" do
let(:rule) { described_class.new(true, options) }
end
describe "when executing" do
let(:rule) { described_class.new(true, options) }
let(:list) { Capybara.s... | 29.321429 | 110 | 0.676005 |
1897bc89e06c4d4f109f94a4e6ea842dd26fc175 | 1,987 | # frozen_string_literal: false
#
# use-loader.rb -
# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#
#
require_relative "../cmd/load"
require_relative "loader"
class Object
alias __original__load__IRB_use_loader__ load
alias __original__require__IRB_use_loader... | 26.144737 | 94 | 0.656266 |
1876d40cb2cbb78ff1d98c0dac52cbc0b45baeb1 | 169 | class CreateDetails < ActiveRecord::Migration[5.0]
def change
create_table :details do |t|
t.references :my_other_model
t.timestamps
end
end
end
| 18.777778 | 50 | 0.692308 |
1cf3274df35be38d2e3dcdb41268ff3b3b248285 | 49 | module SpreeEssentialCms
VERSION = "0.4.0"
end
| 12.25 | 24 | 0.734694 |
287716a8577c73e3513bc3130e358c814a3f0fdb | 4,837 | module VideoSprites
class Processor
def initialize(input_file, output_directory, options=nil)
@input_file = input_file
@output_directory = output_directory
FileUtils.mkdir_p @output_directory unless File.exist? @output_directory
@options = options || default_options
end
def proces... | 26.431694 | 119 | 0.63345 |
f889b60a0aeaf1ef51145677167399c6171d47b7 | 474 |
crumb :inspection_do_inspection do
link t('views.inspection.do_inspecrion'), nil
parent :daily_work
end
crumb :inspection_edit do
link t('views.inspection.edit'), nil
parent :daily_work
end
crumb :inspection_index do
link t('views.inspection.index'), nil
parent :daily_work
end
crumb :inspection_new do
... | 17.555556 | 47 | 0.755274 |
f8c165876e692a966e86d992af7360fd987fddc2 | 955 | require 'rails_helper'
RSpec.describe SpecsController, type: :controller do
delegate :dynamic_scaffold, to: :controller
describe 'Delete' do
it 'should be able to delete.' do
controller.class.send(:dynamic_scaffold, Country) {}
country = FactoryBot.create(:country)
delete :destroy, params: { l... | 35.37037 | 106 | 0.693194 |
6a5a11d2e65a570ee70c92bd7b9fbfb8be61da4c | 48 | module ActiveAdminTheme
VERSION = "1.1.4"
end
| 12 | 23 | 0.729167 |
1aac54f4a2dc4c58f7e7c2d0a5395fb6a5f8a9b9 | 20,189 | class MiqCompare
include Vmdb::Logging
EMPTY = '(empty)'
TAG_PREFIX = '_tag_'
attr_reader :report
attr_reader :mode
attr_reader :ids
attr_reader :records
attr_reader :master_list
attr_reader :results
attr_accessor :include
def initialize(options, report)
options = {:mode => :compare}.merge... | 33.536545 | 160 | 0.645203 |
1de6c6a2a91607f095cca3e504cb2a0927f43c40 | 1,063 | # frozen_string_literal: true
class Users::ConfirmationsController < Devise::ConfirmationsController
# GET /users/confirmation/new
def new
super
end
# POST /users/confirmation
def create()
registered = UserDatabaseAuthentication.where(email: params[:user_registration][:email]).exists?
if regist... | 23.622222 | 117 | 0.748824 |
e28ff2ada7c2c4b58148f5fb73bdf05d67a784e9 | 938 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.nic.ht/property_status_not_registered.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_helper'
... | 23.45 | 88 | 0.696162 |
bf3f217c77dbec68e0d1e333358082902c8220fa | 1,637 | # frozen_string_literal: true
require_relative "../test_helper"
module GeosCapi
class AnalysisTest < CartesianAnalysisTest
def setup
skip "Needs GEOS." unless RGeo::Geos.capi_supported?
@fixtures = Fixtures.new(RGeo::Geos.factory)
end
def test_ccw_p_raises_if_not_a_geos_object
skip "N... | 35.586957 | 80 | 0.681735 |
260fce82f2e29a607f40517736f8d37130d39868 | 1,135 | # frozen_string_literal: true
require 'urbit'
require_relative 'graph_rover'
require_relative 'group_room'
require_relative 'viewport'
module MarsBase10
class Error < StandardError; end
class CommCentral
def initialize(config_filename:)
@viewport = Viewport.new
@ship = Urbit.connect(config_fil... | 23.163265 | 112 | 0.688987 |
e90a292ac34f12647b66b3a86214cd3c16be4a8a | 22 | json.extract! @follow
| 11 | 21 | 0.772727 |
1d22e933b20a2fc10012d3140a141f07b3e0b237 | 1,156 | #--
# Copyright (c) 2010-2013 Michael Berkovich
#
# 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
# without limitation the rights to use, copy, modify, merge, p... | 42.814815 | 72 | 0.769896 |
21ddd6d30fcc5c9b4c17520ade6e50d3033d224d | 150 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "wp2jekyll"
require "minitest/autorun"
require 'pretty_diffs'
require 'diff/lcs'
| 18.75 | 58 | 0.753333 |
4a446b2bd25cf73ed7ececb1faf1f89ad40a0b7a | 279 | class CreateSolutions < ActiveRecord::Migration[5.2]
def change
create_table :solutions do |t|
t.string :content
t.string :status
t.references :user, foreign_key: true
t.references :sublesson, foreign_key: true
t.timestamps
end
end
end
| 21.461538 | 52 | 0.673835 |
e8e444a7d9f9576bfdef6cb951308131af1510c3 | 700 | module Rack; module Throttle
###
# This is the base class for matcher implementations.
# Implementations are provided for User Agent, URL, and request
# method. Subclass Matcher if you want to provide a custom
# implementation.
class Matcher
attr_reader :rule
def initialize(rule)
@rule = rule... | 21.212121 | 65 | 0.641429 |
bf770027e25acf02a2302ca31625d03d164a6c70 | 15,968 | class AutomationManagerController < ApplicationController
before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data
include Mixins::GenericSessionMixin
include Mixins::ManagerControllerMixin
include Mixins::AutomationManagerControllerMixi... | 34.046908 | 179 | 0.690944 |
7a5a27fbbbb0a861522501c590a6804c3358f9d9 | 375 | class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def videos
@user = current_user
@videos = @user.videos
end
def feed
@user = User.find(params[:id])
@videos = @user.recent_videos_without_actors
respond_to do |format|
format.html
for... | 17.857143 | 48 | 0.648 |
b91b5a6d6e8d1bc384deccff647f7e12c72ac7e7 | 5,482 | # Copyright (c) 2016-2021, The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include ::Asciidoctor
class OpenXRInlineMacroBase < Extensions::InlineMacroProcessor
use_dsl
using_format :short
end
class NormativeInlineMacroBase < OpenXR... | 21.928 | 174 | 0.676031 |
39c62d59bdc3c83df26de64efb9bb0ea3d9dfb6b | 1,442 | class Lono::Builder::Dsl::Finalizer
class ParameterGroups < Base
extend Memoist
include Lono::Builder::Util::Stringify
def initialize(options={})
super
@parameters = options[:parameters]
end
def run
return @cfn if parameter_groups.empty?
@cfn["Metadata"] ||= {}
@cfn... | 24.862069 | 80 | 0.604716 |
79f8f6b020a265d7833b5a55423d4c8812109881 | 853 | class TopCocktail::Scraper
def scrape_page
doc = Nokogiri::HTML(open("http://www.themost10.com/10-most-popular-cocktail-drinks/"))
end
def scrape_cocktails
self.scrape_page.css(".cb-entry-content")
end
def set_info
scrape_co... | 32.807692 | 96 | 0.536928 |
0388c88a720a174f22d45d2edab4d794ca97d5a0 | 101 | require "capistrano/mysql_admin/version"
load File.expand_path('../tasks/mysql_admin.cap', __FILE__)
| 33.666667 | 59 | 0.80198 |
62e35419ddddc84355f5e0504ea78e3e51faba4b | 401 | require 'arc-furnace/observer'
module ArcFurnace
class BlockObserver < Observer
private_attr_reader :block
def initialize(source:, block:)
raise 'Must specify a block' if block.nil?
@block = block
super(source: source)
end
def observe(row)
if block.arity == 2
block.c... | 17.434783 | 48 | 0.620948 |
26fc1be0a5c39add30f15ae99155ceebcbf3e743 | 701 | # frozen_string_literal: true
module ActiveRecord
module ConnectionAdapters
module Clickhouse
module OID # :nodoc:
class DateTime < Type::DateTime # :nodoc:
def serialize(value)
value = super
return value unless value.acts_like?(:time)
value.to_time.s... | 22.612903 | 83 | 0.570613 |
010cb9c94c7a112c81e9bc4aa1e58656ea8dd34c | 496 | module Spree
module Api
class SuppliersController < Spree::Api::BaseController
def index
if params[:ids]
@suppliers = Spree::Supplier.accessible_by(current_ability, :read).where(id: params[:ids].split(',')).order(:name)
else
@suppliers = Spree::Supplier.accessible_by(curr... | 29.176471 | 124 | 0.641129 |
1145c5e585ec1722895c35907cf2a14df3ad434b | 1,520 | # frozen_string_literal: true
$:.push File.expand_path('lib', __dir__)
require 'solidus_related_products/version'
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'solidus_related_products'
s.version = SolidusRelatedProducts.version
s.summary = 'Allows multiple types o... | 35.348837 | 89 | 0.692763 |
7afc163121a2d0fcaaf24b1309912d1bc8d536bc | 321 | require 'webmock/rspec'
require 'avro_turf/confluent_schema_registry'
require 'avro_turf/test/fake_confluent_schema_registry_server'
describe AvroTurf::ConfluentSchemaRegistry do
it_behaves_like "a confluent schema registry client" do
let(:registry) { described_class.new(registry_url, logger: logger) }
end
end... | 32.1 | 72 | 0.82243 |
1de648a132ce54497e6fbb3cd35b9591e05c5fe3 | 358 | # frozen_string_literal: true
require "economic/proxies/entity_proxy"
require "economic/proxies/actions/find_by_ci_number"
require "economic/proxies/actions/find_by_handle_with_number"
require "economic/proxies/actions/find_by_number"
module Economic
class ProductProxy < EntityProxy
include FindByHandleWithNumb... | 25.571429 | 61 | 0.835196 |
26d72ba6f376e701ee7adcfff9128ad547f9e5cb | 2,634 | require 'rails_helper'
require 'model_examples'
module CycleThree
describe CycleThreeAttribute do
let(:letters_only_form) {
Class.new(CycleThreeAttribute) do
define_method(:pattern) do
Regexp.new('^[a-z]*$')
end
end
}
%i[
name
field_name
help_to_fi... | 29.931818 | 120 | 0.689446 |
03ae865ccdfa2f00387e11250611acd68bc7295c | 329 | module SessionHelper
def log_in user
session[:user_id] = user.id
end
def log_out
session.delete :user_id
end
# GET current_user
def current_user
@current_user ||= User.find_by id: session[:user_id]
end
# Check user has logged in before ?
def logged_in?
current_user.present?
en... | 14.954545 | 56 | 0.677812 |
61c7196f51301a5c17c0d67b7cb325ce57849f7d | 381 | cask 'font-noto-sans-symbols' do
version :latest
sha256 :no_check
# noto-website.storage.googleapis.com was verified as official when first introduced to the cask
url 'https://noto-website.storage.googleapis.com/pkgs/NotoSansSymbols-unhinted.zip'
name 'Noto Sans Symbols'
homepage 'https://www.google.com/ge... | 31.75 | 98 | 0.766404 |
39b9913190b3ddfea88de2f988f79c206fd7b6b8 | 18,521 | require 'puppet/face'
require 'puppet/pops'
require 'puppet/parser/files'
require 'puppet/file_system'
Puppet::Face.define(:epp, '0.0.1') do
copyright "Puppet Labs", 2014
license "Apache 2 license; see COPYING"
summary "Interact directly with the EPP template parser/renderer."
action(:validate) do
summ... | 38.585417 | 132 | 0.671076 |
1a335a194e49ce678a1c0ecd7a72b81eafacbcc5 | 325 | require "spec_helper"
RSpec.describe GovukIndex::DocumentTypeMapper do
it "infer payload document_type" do
payload = {
"base_path" => "/cheese",
"document_type" => "help_page",
}
document_type_mapper = described_class.new(payload)
expect(document_type_mapper.type).to eq("edition")
end... | 21.666667 | 55 | 0.695385 |
7ac2ef3763f9ccb74ecd01e1a9c293785c2365b3 | 1,472 | class Libprotoident < Formula
desc "Performs application layer protocol identification for flows"
homepage "https://research.wand.net.nz/software/libprotoident.php"
url "https://research.wand.net.nz/software/libprotoident/libprotoident-2.0.13.tar.gz"
sha256 "8ca7ccd95b3f23457c3f9eff480364565b553bbcab9b39969f964... | 32.711111 | 95 | 0.700408 |
7a22f8f6cd6600ef81f6789f5295ecd770a7366f | 212 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Agenda, type: :model do
it { is_expected.to validate_presence_of(:subject) }
it { is_expected.to validate_presence_of(:description) }
end
| 23.555556 | 58 | 0.778302 |
bf3d64c34cf37dbb250fd55dc10e02a5f37ad64c | 554 | require 'active_support/concern'
require 'redis_counters/dumpers/engine'
module RedisCounters
module Dumpers
module Dsl
module List
extend ActiveSupport::Concern
module ClassMethods
def build(&block)
instance = new
instance.instance_eval(&block)
... | 20.518519 | 65 | 0.579422 |
6a0f7df0b84ee2219107c6075e430d4cf7e438b9 | 795 | # frozen_string_literal: true
require_relative 'lib/usedby/version'
Gem::Specification.new do |s|
s.author = 'AppFolio, Inc.'
s.description = <<~DESCRIPTION
usedby is a command line tool to discover all dependents of ruby gems across a github organization.
DESCRIPTION
s.email = 'opensource@appfolio.com'
... | 33.125 | 103 | 0.709434 |
21090e4b637108ff24941c1a5ccaee8d3e6df44d | 1,031 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# IBM WebSphere Application Server Liberty Buildpack
# Copyright (c) 2015 the original author or authors.
#
# 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... | 32.21875 | 74 | 0.735209 |
e88c66fcf012b8e848e3095eedfb1ea5ed0f0f94 | 965 | # frozen_string_literal: true
class ArticlesController < ApplicationController
include ArticlesHelper
def index
@articles = Article.all
end
def show
@article = Article.find(params[:id])
@comment = Comment.new
# @comment = @article.comments.new
@comment.article_id = @article.id
end
de... | 20.978261 | 58 | 0.676684 |
269316069fcf740c438e13f7a42c6745f143c1e5 | 6,750 | =begin
#Selling Partner API for Orders
#The Selling Partner API for Orders helps you programmatically retrieve order information. These APIs let you develop fast, flexible, custom applications in areas like order synchronization, order research, and demand-based decision support tools.
OpenAPI spec version: v0
Gener... | 32.608696 | 247 | 0.655407 |
5d0cd84640a29728a6b0c93c6a01eab3148b8026 | 339 | # 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::V2018_04_01
module Models
#
# Defines values for PassNames
#
module PassNames
OobeSystem = "OobeSystem"... | 21.1875 | 70 | 0.705015 |
18795ffbfa92ed5d978a1d86c171173facd2632e | 507 | class RelationshipsController < ApplicationController
before_action :logged_in_user
def create
@user = User.find(params[:followed_id])
current_user.follow(@user)
respond_to do |format|
format.html { redirect_to @user }
format.js
end
end
def destroy
@user =... | 23.045455 | 53 | 0.637081 |
7ad4b579e677c40d80823f4f495b09395998cc58 | 400 | # 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::ResourceHealth::Mgmt::V2015_01_01
module Models
#
# Defines values for ReasonChronicityTypes
#
module ReasonChronicityTypes
... | 23.529412 | 70 | 0.72 |
f7bb40cb63378c323d532bf59bbb86e9a52b4801 | 7,748 | # frozen_string_literal: true
class DependentsApplication < Common::RedisStore
include RedisForm
validates(:user, presence: true, unless: :persisted?)
validate(:user_can_access_evss, unless: :persisted?)
FORM_ID = '21-686C'
SEPARATION_TYPES = {
'Death' => 'DEATH',
'Divorce' => 'DIVORCED',
'Othe... | 30.503937 | 114 | 0.684435 |
5dd821bf11b804cd5a9fda82444b7cd3c3270f00 | 7,182 | #
# Be sure to run `pod spec lint YRSerialization.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://gi... | 42.75 | 268 | 0.636313 |
e2f190dad069ac884a3408e827adf179baf53d12 | 371 | module TD::Types
# TDLib client is in its final state.
# All databases are closed and all resources are released.
# No other updates will be received after this.
# All queries will be responded to with error code 500.
# To continue working, one should create a new instance of the TDLib client.
class Authori... | 37.1 | 78 | 0.757412 |
01bf3aff3257b8b581f977b5936e9294d0137c51 | 736 | # frozen_string_literal: true
module BCDice
module GameSystem
class Gorilla < Base
# ゲームシステムの識別子
ID = 'Gorilla'
# ゲームシステム名
NAME = 'ゴリラTRPG'
# ゲームシステム名の読みがな
SORT_KEY = 'こりらTRPG'
# ダイスボットの使い方
HELP_MESSAGE = <<~MESSAGETEXT
2D6ロール時のゴリティカル自動判定を行います。
... | 18.871795 | 72 | 0.578804 |
7943a5b5e4a2c8c4359930f51149b7f31357716e | 7,783 | require 'fileutils'
require 'cfpropertylist'
require 'puppet/managedmac/common'
Puppet::Type.type(:remotemanagement).provide(:default) do
desc "Abstracts the Mac OS X kickstart command, allowing management of the Apple Remote Desktop features."
commands :kickstart => '/System/Library/CoreServices/RemoteManagem... | 30.762846 | 117 | 0.632147 |
915c25d01e1088c5441944d8cce08d2e7f270848 | 266 | class CreateOutlaysGroups < ActiveRecord::Migration[6.1]
def change
create_table :outlays_groups do |t|
t.references :outlay, null: false, foreign_key: true
t.references :groups, null: false, foreign_key: true
t.timestamps
end
end
end
| 24.181818 | 58 | 0.703008 |
bf99ab78ae970f8b7e115b78e631c5799eb4d1e1 | 238 | def test_destroy
<%= singular_name %> = <%= class_name %>.first
delete :destroy, :id => <%= singular_name %>
assert_redirected_to <%= items_path('url') %>
assert !<%= class_name %>.exists?(<%= singular_name %>.id)
end
| 34 | 62 | 0.605042 |
7919a37a981736172e13ee0587c6b3e2bbbc0acf | 827 | require 'edifact_converter/xml112edi'
module EdifactConverter::XML112EDI
class SegmentChecks
def is_segment(nodeset)
(nodeset.first.name =~ /\p{Upper}{3}/) == 0
end
def is_segmentgroup(nodeset)
(nodeset.first.name =~ /S[0-9]{2}/) == 0
end
def valid_elms(nodeset)
nodeset.each ... | 19.232558 | 63 | 0.602177 |
9112625068ac72830d5fc94de0b7f4b39f4ac4af | 406 | # frozen_string_literal: true
module Computer
module OperatingSystems
module Linux
module OpenSource
class Letsencrypt
def define
<<~DEFINE.strip
To enable HTTPS on your website.
Let’s Encrypt is a CA (Certificate Authority)
https://le... | 20.3 | 59 | 0.564039 |
ed5fb78df34163637d8bcae76ab532b470f6124e | 621 | require 'chefspec'
describe 'user::modify' do
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
it 'modifys a user with an explicit action' do
expect(chef_run).to modify_user('explicit_action')
expect(chef_run).to_not modify_user('not_explicit_action')
end
it 'modifys a user with att... | 31.05 | 76 | 0.743961 |
e8f770bdf9da784c508cb2df30d23b0605f046f3 | 1,284 | #
# Copyright 2019 ThoughtWorks, 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 ... | 41.419355 | 158 | 0.767913 |
7a781341254c8c21984775956cbeb668745d51ce | 2,760 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop checks whether trailing commas in block arguments are
# required. Blocks with only one argument and a trailing comma require
# that comma to be present. Blocks with more than one argument never
# require a tra... | 26.037736 | 91 | 0.514493 |
79904e2bf72d144c073a212e7f7061ba2950b7e7 | 15,645 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_redis_cache do
using RSpec::Parameterized::TableSyntax
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, :private) }
let(:repository) { cr... | 30.437743 | 196 | 0.623011 |
abd20558226258b515200365576bc0339c90a853 | 465 | require 'rack/utils'
module Mangar
class SystemStaticMiddleware
FILE_METHODS = %w(GET HEAD).freeze
def initialize(app)
@app = app
@file_server = ::Rack::File.new((Mangar.mangar_dir + "public").to_s)
end
def call(env)
path = env['PATH_INFO'].chomp('/')
method = env['REQUEST... | 22.142857 | 94 | 0.621505 |
b987bb82514876132a1796613b415a067c6fc8f7 | 1,372 | # Buhos
# https://github.com/clbustos/buhos
# Copyright (c) 2016-2018, Claudio Bustos Navarrete
# All rights reserved.
# Licensed BSD 3-Clause License
# See LICENSE file for more information
# @!group Inclusion and exclusion criteria
post '/review/criteria/cd' do
cd = CanonicalDocument[params['cd_id']]
sr = ... | 31.906977 | 139 | 0.751458 |
1c2da362045290642e69a8a413a9d3295bfba4e3 | 3,071 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
module ESP
class CustomSignatureTest < ActiveSupport::TestCase
context ESP::CustomSignature do
context '#organization' do
should 'call the api' do
custom_signature = build(:custom_signature, organization_id: 4)
... | 38.873418 | 149 | 0.645392 |
f816afc9f8e1eec3ff4fa4f92c71eceb5a3036a7 | 318 | require 'requirement'
class MinimumMacOSRequirement < Requirement
fatal true
def initialize(tags)
@version = MacOS::Version.from_symbol(tags.first)
super
end
satisfy(:build_env => false) { MacOS.version >= @version }
def message
"OS X #{@version.pretty_name} or newer is required."
end
end
| 18.705882 | 60 | 0.704403 |
1c33758f13bf4ed64806adb4a8e658e4968d9988 | 2,547 | # 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' }])
# ... | 79.59375 | 305 | 0.743227 |
21ac08ccb9498b66bea4bd2199d4f88fd78bd204 | 2,353 | require "spec_helper"
require "digest"
# NOTE: This test uses `eval` on lines pulled from the README.md file, which is dangerous if the
# README ends up containing bad code
#
# To mitigate this problem, we have a hard-coded checksum here that must be updated by hand when
# making code changes. This will force develop... | 35.119403 | 201 | 0.596685 |
21a8ae6c6ff55aded8c5cc1286eb58b70b464f13 | 1,372 | # frozen_string_literal: true
module Onebox
module Engine
class InstagramOnebox
include Engine
include StandardEmbed
include LayoutSupport
matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/(?:p|tv)\/[a-zA-Z\d_-]+/)
always_https
def clean_url
... | 29.191489 | 120 | 0.605685 |
33ed38e614588f2ed9830d87c32f2b3d7358bbf2 | 692 | class NoticesController < ApplicationController
respond_to :xml
skip_before_filter :authenticate_user!, :only => :create
def create
# params[:data] if the notice came from a GET request, raw_post if it came via POST
notice = App.report_error!(params[:data] || request.raw_post)
api_xml = notice.to_xm... | 31.454545 | 95 | 0.706647 |
1160e1efc923c6291c192e6e5dfcb327a7a49234 | 68 | module Rack
class PushstateStatic
VERSION = '0.1.0'
end
end
| 11.333333 | 23 | 0.676471 |
e98aa5196d390549d91562c61af7c9745b60dbb5 | 981 | begin
require 'capybara/rspec'
rescue LoadError
end
begin
require 'capybara/rails'
rescue LoadError
end
if defined?(Capybara)
require 'rspec/support/comparable_version'
unless RSpec::Support::ComparableVersion.new(Capybara::VERSION) >= '2.2.0'
raise "You are using capybara #{Capybara::VERSION}. RSpec requ... | 27.25 | 81 | 0.686035 |
abeec22cfe4d8828923b6aee6319163ee081c0c5 | 9,353 | # frozen_string_literal: true
require "hanami/utils/string"
RSpec.describe "hanami generate", type: :integration do
describe "model" do
context "with model name" do
it_behaves_like "a new model" do
let(:input) { "user" }
end
end
context "with underscored name" do
it_behaves_li... | 32.140893 | 132 | 0.580455 |
08da79dfd46066e97ebf57f1229c7764f00eacf3 | 478 | class Micropost < ApplicationRecord
belongs_to :user
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
validates :user_id, presence: true
validates :content, presence: true, length: { maximum: 140 }
validate :picture_size
private
# Validates the size of a... | 23.9 | 62 | 0.688285 |
1d40ce7702c653d10c331ee74e5c83ee3267dc22 | 448 | require "test_helper"
class SessionsHelperTest < ActionView::TestCase
def setup
@user = users :michael
remember(@user)
end
test "current_user returns right user when session is nil" do
assert_equal @user, current_user
assert is_logged_in?
end
test "current_user returns nil when remember dig... | 23.578947 | 72 | 0.75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.