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 |
|---|---|---|---|---|---|
e9f80a7b370e63dc88104cef15e38bd647343669 | 2,568 | # This module supports calculation of actual time spent processing requests over the course of
# one harvest period. It's similar to what you would get if you just added up all the
# execution times of controller calls, however that will be inaccurate when requests
# span the minute boundaries. This module manages ac... | 27.913043 | 126 | 0.678738 |
6a24fd141533a389e2cd9ec269a210e426d34380 | 1,550 | require 'kashmir/extensions'
module Kashmir
module Caching
class Memory
def from_cache(definitions, instance)
key = presenter_key(definitions, instance)
if cached_data = get(key)
return cached_data
end
end
def bulk_from_cache(definitions, instances)
k... | 23.134328 | 77 | 0.590323 |
bb6ff80bebf5a3254b74b89b05d80cdb61cd44a2 | 243 | class RemoveUserByFromIncidentEvent < ActiveRecord::Migration
def change
remove_foreign_key :incident_events, column: "user_by_id"
remove_index :incident_events, :user_by_id
remove_column :incident_events, :user_by_id
end
end
| 30.375 | 61 | 0.798354 |
08ea636aff02b47016353dc5541db1ee86853624 | 5,413 | #!/usr/bin/env ruby
require 'spec_helper'
describe Puppet::Type.type(:dsc_xsqlhaendpoint) do
let :dsc_xsqlhaendpoint do
Puppet::Type.type(:dsc_xsqlhaendpoint).new(
:name => 'foo',
:dsc_instancename => 'foo',
:dsc_name => 'foo',
)
end
it 'should allow all properties to be specified... | 33.83125 | 112 | 0.715869 |
87816a47cf4a5acb9f8b69a3a7c14a40ce13a309 | 433 | class API::BaseController < ApplicationController
skip_before_action :verify_authenticity_token
#before_action
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }
include ::Openbuild::OpenbuildUser
before_action :is_openbuild_user?
#respond_to :json
re... | 27.0625 | 103 | 0.771363 |
21c6357f20cdcf8834575acfa759a88163692d3f | 816 | require 'openssl'
require 'base64'
require 'api_auth/errors'
require 'api_auth/helpers'
require 'api_auth/request_drivers/net_http'
require 'api_auth/request_drivers/curb'
require 'api_auth/request_drivers/rest_client'
require 'api_auth/request_drivers/action_controller'
require 'api_auth/request_drivers/action_dispa... | 37.090909 | 145 | 0.816176 |
bb48b839b0e20eb9b50ff7ba55a8d28eb123ca92 | 5,499 | require "spec_helper"
describe "nginx::configuration" do
let(:chef_run) do
ChefSpec::SoloRunner.new.converge(described_recipe, "nginx::service")
end
it "creates the configuration directory" do
expect(chef_run).to create_directory("/etc/nginx").with(
owner: "root",
group: "root",
recurs... | 28.056122 | 87 | 0.609747 |
1ca8f64fbf1db1f2099796f23b37e527719e3b6e | 3,467 | #
# Copyright:: Peter Donald
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 39.850575 | 118 | 0.687626 |
912ee4fbbd0c266935e9522bc27723bc1d0298ca | 1,031 | # frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# name :string ... | 32.21875 | 78 | 0.592629 |
b9d92f778ce75db8cb7bd9f12e7986e922bbc654 | 4,600 | require 'minitest/autorun'
require 'minitest/mock'
require 'shoulda/matchers'
require 'shoulda/context'
require_relative '../../../lib/readers/work_item/jira_work_item_reader'
class TestJiraWorkItemReader < Minitest::Test
context 'JiraWorkItemReader' do
should 'return an item for query using mocks' do
@... | 54.761905 | 198 | 0.611739 |
e2fdc5ba93485d92a0134bfe80081edea865257e | 204 | class Gemini < Cask
url 'http://dl.devmate.com/download/com.macpaw.site.Gemini/macpaw%20gemini.dmg'
homepage 'http://macpaw.com/gemini'
version 'latest'
no_checksum
link 'MacPaw Gemini.app'
end
| 25.5 | 81 | 0.740196 |
11395786b0eb41939ae63fee9af3bcc45f4368d4 | 386 | #!/usr/bin/env ruby
require 'test/unit'
require 'pp'
require 'ex9_tiger_tree'
class TigerTreeTest < Test::Unit::TestCase
def test_tree
t = Tree.new('oak')
assert_equal 'oak', t.instance_variable_get(:@name)
t.grow
end
def test_tiger
t = Tiger.new('tony')
assert_equal 'tony', t.instance_va... | 15.44 | 56 | 0.658031 |
61ad463eb0c13719248cca73bc0787d18d766c26 | 720 | #
# Author:: Ezra Pagel (<ezra@cpan.org>)
# License:: Apache License, Version 2.0
#
require 'chef/knife'
require 'chef/knife/base_vsphere_command'
# Lists all vm folders
class Chef::Knife::VsphereFolderList < Chef::Knife::BaseVsphereCommand
banner "knife vsphere folder list"
get_common_options
def traverse_fo... | 23.225806 | 78 | 0.708333 |
d50c5ecdf4d4380322e718f04a502017f4f27c8c | 2,352 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 45.230769 | 839 | 0.702806 |
0395b6ca85453cfc4db385dbb32857a6b0254ee3 | 188 | require 'blacklight'
require 'rails'
module Blacklight
module Hierarchy
class Engine < Rails::Engine
config.closed_icon = '⊞'
config.opened_icon = '⊟'
end
end
end
| 15.666667 | 32 | 0.664894 |
08978afe28ca022b695c071e1402d04a4ed074c3 | 403 | # ytel_apiv3
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module YtelApiv3
# Interrupted Call Status
class InterruptedCallStatusEnum
INTERRUPTED_CALL_STATUS_ENUM = [
# Interrupt Call will be cancel
CANCELED = 'canceled'.freeze,
# Interrupt... | 22.388889 | 57 | 0.672457 |
622622e705de3919c6abbc547938891bb4775b6a | 1,092 |
module MensagensHelper
def flash_messages_error(errors)
if errors.present?
render "/crud/mensagens/erros_formulario", mensagens: errors.full_messages
end
end
def flash_messages
message, tipo = extrair_mensagem
if message.present? && tipo.present?
render "/crud/mensagens/avisos", tipo... | 24.266667 | 80 | 0.627289 |
7ad31cc24b6eed02d7426b574723de03488d2f8f | 68 | require 'spec/extensions/class'
require 'spec/extensions/metaclass'
| 22.666667 | 35 | 0.823529 |
ff676957ba6c4eb9a6f827703ba5f4332eb1aae8 | 4,231 | class EyeD3 < Formula
desc "Work with ID3 metadata in .mp3 files"
homepage "https://eyed3.nicfit.net/"
url "https://eyed3.nicfit.net/releases/eyeD3-0.8.10.tar.gz"
sha256 "ecd1a3df14c511a2ebaf09b4f04c29e468d65016814767d95daf7f26831562c9"
bottle do
cellar :any_skip_relocation
sha256 "1ea5a6b8f082fdd6e9... | 44.072917 | 143 | 0.792957 |
e874dd4aad95b23ac9365b53a09e8713ccd078e4 | 2,345 | class Bulb < ApplicationRecord
validates :hue, numericality: { only_integer: true,
greater_than_or_equal_to: 0,
less_than: 65536 }
validates :saturation, numericality: { only_integer: true,
greater_than_o... | 30.855263 | 106 | 0.551812 |
2190219bc984cbd348a3023986e0f07c07ae2a21 | 238 | module EShipper
class Response
attr_reader :type, :xml, :time
attr_accessor :errors
def initialize(type, xml, time = Time.now)
@type = type.to_s
@xml = xml
@time = time
@errors = []
end
end
end | 18.307692 | 46 | 0.588235 |
39d0bf0170f36d88757a0ddc2e6dc2e1309ebb5d | 194 | class EquipmentSerializer < ActiveModel::Serializer
attributes :id, :name, :code, :location, :calibration_unit, :calibration_start, :calibration_end, :uncertainty
has_many :maintenances
end
| 38.8 | 112 | 0.798969 |
6a35bf26f9dbbe7f18f477663d9a5fa2e4d5334e | 447 | require 'amazing_print'
require 'as-duration'
require 'colorize'
require 'json'
require 'jwt'
require 'hamlit'
require 'hamlit/block'
require 'rack'
require 'sequel'
require 'pry'
require 'hash_wia'
# require 'clean-annotations'
require 'class-cattr'
require 'class-callbacks'
require_relative './overload/object'
requ... | 19.434783 | 62 | 0.774049 |
e8c7cc4509443037215ec13fde3b282c0d37f651 | 420 | module SeoFriendly
class MetaRenderer
def self.render(container, context)
tags = ''
tags << context.content_tag(:meta, nil, content: container.title, name: 'title')
tags << context.content_tag(:meta, nil, content: container.description, name: 'description')
tags << context.content_tag(:m... | 28 | 98 | 0.678571 |
1d6680c7d6404f0f0afc4dae4711113b93709e77 | 2,778 | # frozen_string_literal: true
require 'common/exceptions'
require 'common/client/errors'
module VAOS
module V2
class MobileFacilityService < VAOS::SessionService
def get_facilities(ids:, children: nil, type: nil, pagination_params: {})
params = {
ids: ids,
children: children,
... | 29.242105 | 111 | 0.62383 |
ff7ddd6d6bc6e9f62056ffe8e43e942b3e607a8a | 1,386 | class CLI
def run
puts "Welcome to the News Stories"
puts "Here are the latest news stories!"
puts " "
puts "------------------"
puts " "
Scraper.get_articles
print_stories
puts " "
puts "Select an article you would like to see more informatio... | 28.285714 | 132 | 0.524531 |
280f9f6a6196fc11e550a08dcd032ddaaeac5fec | 2,960 | require "spec_helper"
describe Refinery::Admin::UsersController do
refinery_login_with :refinery_superuser
shared_examples_for "new, create, update, edit and update actions" do
it "loads roles" do
Refinery::Role.should_receive(:all).once{ [] }
get :new
end
it "loads plugins" do
user... | 33.636364 | 109 | 0.684459 |
8770021ceaaf41119d8c5035ef2aab4f32654784 | 23,229 | # Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2013, 2014 iWeb Technologies Inc.
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | 31.179866 | 128 | 0.575014 |
6277c0097d799fb5cee446ab67e810f4cf1d3475 | 404 | module Her
module Middleware
class BearerTokenAuthentication < Faraday::Middleware
def initialize(app, token = nil)
super(app)
@token = token && token.to_s
end
def call(env)
env[:request_headers][:authorization] = authorization_header
@app.call(env)
end
... | 19.238095 | 68 | 0.608911 |
08f042f700c8b53e27800071bbbd3dc76e499a02 | 83 | # desc "Explaining what the task does"
# task :raven do
# # Task goes here
# end
| 16.6 | 38 | 0.662651 |
4a229fd365a3be750d2af6f197c707066d2acfe6 | 295 | module Abstractor
module AbstractorAbstractionGroupMemberCustomMethods
end
class AbstractorAbstractionGroupMember < ActiveRecord::Base
include Abstractor::Methods::Models::AbstractorAbstractionGroupMember
include Abstractor::AbstractorAbstractionGroupMemberCustomMethods
end
end | 32.777778 | 73 | 0.857627 |
ff62d24b9fbeef0aabb76a4a3f6673e53e9b19c3 | 850 | require 'helper'
class ElasticRecord::SearchingTest < MiniTest::Test
def test_elastic_relation
relation = Widget.elastic_relation
assert_equal Widget, relation.klass
assert_equal Widget.arelastic, relation.arelastic
end
def test_elastic_search
widget = Widget.create(color: 'red')
assert_equ... | 26.5625 | 81 | 0.736471 |
21de5e24bd1a076091fc16aef280091f446751a7 | 747 | # frozen_string_literal: true
require 'json'
require 'bolt/error'
require 'bolt/util'
module Bolt
class PlanResult
attr_accessor :value, :status
# This must be called from inside a compiler
def self.from_pcore(result, status)
result = Bolt::Util.walk_vals(result) do |v|
if v.is_a?(Puppet:... | 18.219512 | 52 | 0.597055 |
388e8f5a8591d30de0e40561f73b7937e0ad5ac7 | 19 | brew_install "zsh"
| 9.5 | 18 | 0.789474 |
d5ef7407271d359660eb0e546f85f83faba19c02 | 841 | module Cyby
class UserApi
AUTH = 'X-Cybozu-Authorization'
include HTTParty
def initialize
config = YAML.load_file("#{ENV['HOME']}/.cyby.yml")
self.class.base_uri "https://#{config['subdomain']}.cybozu.com/v1/csv"
@auth = Base64.encode64("#{config['login']}:#{config['password']}").chomp... | 17.893617 | 79 | 0.58264 |
21d41cf0fe55df8c5928e6203ef434b44b633902 | 1,131 | Pod::Spec.new do |s|
s.name = "BackspaceJSON"
s.version = "1.0.0"
s.summary = "Stupid simple access for unCodable JSON objects."
s.description = <<-DESC
Codable has made consuming JSON much easier, but there are still cases where
... | 53.857143 | 106 | 0.565871 |
9164c285f364b1e03c8b4b5ed28c8ccf60a2c8fd | 1,161 | # 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/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-signer'
spec.... | 36.28125 | 113 | 0.660637 |
1c93404135578bfe12f1841c5d7fd05b9747b98c | 1,060 | # Prep string
# split string
# column_count
#Find length of array
# return square root of length rounded up
# row_count
# length of array
# return squar roote rounded down
# arrange grid
# Use each_slice with the number given in column count
# return array of row arrays
# Buffer grid
#if the last r... | 17.966102 | 95 | 0.724528 |
e249892502a9d1f85a73e661d5eb4fe480d7f75b | 13,994 | # Simperium Ruby bindings
# API spec at https://simperium.com/docs/reference
require 'rest_client'
require 'json'
require 'uuid'
require 'simperium/error_handling'
#state file is not shared between processes on Heroku
UUID.state_file = false
module Simperium
class Auth
def initialize(appname, api_key, hos... | 30.688596 | 100 | 0.485422 |
28b29c595aab3cc10e5b2725fefa74fbe35a2c88 | 872 | module Conrateblogs
class BlogPolicy < Notifications::ApplicationPolicy
def permitted_attributes
[:title, :description]
end
Scope = Struct.new(:user, :scope) do
# def resolve
# if !user.nil? && (user.has_role?('security-admin') || user.has_role?('conratepages-pagesrole'))
# ... | 16.148148 | 105 | 0.544725 |
875800faa5f5f6ef41ed909c1caa887ad3c7c098 | 936 | module Clang
##
# Object encapsulating information about overlaying virtual file/directories over the real file system.
class VirtualFileOverlay
##
# Creates a new instance of the {VirtualFileOverlay} class.
#
# @param case_sensitive [Boolean] Flag indicating if paths are case sensitive.
de... | 28.363636 | 127 | 0.67735 |
b9b6a1b2bbb1c670b9850497f51cc0048cf74983 | 1,193 | require 'spec_helper'
describe 'Sub-flows' do
include ATP::FlowAPI
before :each do
self.atp = ATP::Program.new.flow(:sort1)
end
it "can be added to flows" do
test :test1
test :test2
sf = atp.raw
self.atp = ATP::Program.new.flow(:sort2)
test :test3
test :test4
atp.raw.shoul... | 18.075758 | 45 | 0.485331 |
088105bc913c6d32def93095f4cf17532edc062c | 2,460 | # frozen_string_literal: true
module AppealsApi
module PdfConstruction
module HigherLevelReview
module Pages
module V2
class AdditionalIssues
def initialize(pdf, form_data)
@pdf = pdf # Prawn::Document
@form_data = form_data
end
... | 28.275862 | 117 | 0.549187 |
0126f69516180ee046bdddd6a701d38677e51f9c | 143 | class AddPartnerAssociationToUsers < ActiveRecord::Migration[5.2]
def change
add_reference :users, :partner, foreign_key: true
end
end
| 23.833333 | 65 | 0.776224 |
e9435ef675c093b91c251dc9f32d838e2d72c12e | 120 | json.extract! district, :id, :name, :country_id, :created_at, :updated_at
json.url district_url(district, format: :json) | 60 | 73 | 0.766667 |
218f14d2b48110ae4a8836cda178e4ffa1f854e2 | 246 | require 'pry'
class Artist < ActiveRecord::Base
has_many :songs
has_many :genres, through: :songs
def slug
self.name.downcase.gsub(' ','-')
end
def self.find_by_slug(slug)
self.all.find{|artist| artist.slug == slug}
end
end
| 17.571429 | 47 | 0.674797 |
088cbcd38ffec9bc2973124fa666b7297f7e5685 | 470 | # A method returns the value of the last line
# Methods that act as queries are often named with a trailing ?
# Methods that are "dangerous," or modify the receiver, might be named
# with a trailing ! (Bang methods)
# A simple method
def hello
'Hello'
end
#use the method
puts hello
# Method with an argument - 1
def ... | 20.434783 | 70 | 0.717021 |
62ee813c33506a5e3f8dd747d564cddd5c93f305 | 438 | cask 'tandem' do
version '1.5.5'
sha256 'd0f8d91b755a241c8e196605c760e5f35e63bf0f4518c91c720fdef9dcb26ee2'
# wisp-app.s3-accelerate.amazonaws.com/ was verified as official when first introduced to the cask
url "https://wisp-app.s3-accelerate.amazonaws.com/Tandem-#{version}-mac.zip"
appcast 'https://wisp-app.... | 33.692308 | 100 | 0.760274 |
e8bfc856e401141b36fe846d8f9f19af32d7a4e7 | 4,446 | # coding: UTF-8
require 'tilt'
require 'test_helper'
begin
require 'nokogiri'
module MarkdownTests
def self.included(mod)
class << mod
def template(t = nil)
t.nil? ? @template : @template = t
end
end
end
def render(text, options = {})
self.class.template.new(options) { text }.re... | 25.405714 | 86 | 0.668466 |
1824f53e6d1cf78c07bd9cc01cb01f57f0dbfa66 | 1,003 | class OrganisationsController < ApplicationController
def index
@organisations = Organisation.all
search_view = create_search_view(@organisations)
render json: {organisations: search_view}
end
def show
organisation = Organisation.find(params[:id])
render json: {organisation: organisation.rend... | 31.34375 | 88 | 0.779661 |
086ee32c471ff8296fe6cb9022f5bbba0fe0099e | 1,324 | module Concurrent
# @!visibility private
# @!macro internal_implementation_note
class MutexAtomicReference < Synchronization::LockableObject
include AtomicDirectUpdate
include AtomicNumericCompareAndSetWrapper
alias_method :compare_and_swap, :compare_and_set
# @!macro atomic_reference_m... | 23.22807 | 63 | 0.636707 |
b93070b54af55cb25d1a582f2d24d746cda4c633 | 715 | Pod::Spec.new do |s|
s.name = 'AWSTranslate'
s.version = '2.11.1'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'htt... | 39.722222 | 157 | 0.613986 |
1aa63c3071401a75ed4f5a61d439aca355693483 | 417 | #!/usr/bin/env ruby
require 'eventmachine'
require 'daemons'
require 'pp'
class MockOpenVPN < EventMachine::Connection
def receive_data(data)
case data
when /quit/i
close_connection
when /pid/i
send_data "#{Process.pid}\n"
else
send_data "status\n"
end
end
end
Daemons.daemon... | 17.375 | 49 | 0.676259 |
3953d0f0ad3b9d62e1f07a9914fd5b2e17929b57 | 366 | module Fog
module Compute
class XenServer
class Real
def assert_operation_valid_server(ref, op)
@connection.request({ :parser => Fog::Parsers::XenServer::Base.new, :method => "VM.assert_operation_valid" }, ref, op)
end
alias_method :assert_operation_valid_vm, :assert_opera... | 26.142857 | 128 | 0.674863 |
38697064439e58b81a83d70ab3ecab01087dd184 | 1,895 | class CrosstoolNg < Formula
desc "Tool for building toolchains"
homepage "http://crosstool-ng.org"
url "http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.21.0.tar.bz2"
sha256 "67122ba42657da258f23de4a639bc49c6ca7fe2173b5efba60ce729c6cce7a41"
bottle do
cellar :any_skip_relocation
revision 1... | 29.153846 | 94 | 0.665963 |
1ce600aff23e3ca56f62149b89280e30e5c07a9c | 1,262 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe SolidusImporter::Processors::VariantImages do
describe '#call' do
subject(:described_method) { described_class.call(context) }
let(:context) { {} }
context 'without "Variant Image" attribute in row data' do
let(:context) do
... | 28.044444 | 99 | 0.631537 |
f7fc05665506a6708a52b8059426eaa5567c8a11 | 1,787 | require 'test_helper'
class RolesControllerTest < ActionController::TestCase
def setup
#authenticate
create_and_authenticate_preallowed_subject
@controller = RolesController.new
end
# TODO: This is deprecated, go and write some test
#--------------------------------------------------------------... | 28.822581 | 171 | 0.629547 |
26f02429012a2ae8cc05453d87179db7867ccd7b | 2,444 | require "rails_helper"
RSpec.describe "Superseding editions" do
let(:put_content_command) { Commands::V2::PutContent }
let(:publish_command) { Commands::V2::Publish }
let(:content_id) { SecureRandom.uuid }
let(:put_content_payload) do
{
content_id: content_id,
base_path: "/vat-rates",
t... | 28.091954 | 67 | 0.662029 |
01629739fdd7961579823e1ca087b3794ccbda7a | 813 | require 'rspec'
require '../lib/vampire'
RSpec.describe Vampire do
it 'has a name' do
vampire = Vampire.new('Dracula')
expect(vampire.name).to eq('Dracula')
end
it 'it can be named something else' do
vampire = Vampire.new('Vladimir')
expect(vampire.name).to eq('Vladimir')
end
it 'keeps a pe... | 21.394737 | 46 | 0.661747 |
87a3f4ccf7ff72d917375549479f285c660687b5 | 39 | class Request < ActiveRecord::Base
end
| 13 | 34 | 0.794872 |
1a7cd337bd8155e7db64fc946f8910ff179c4508 | 777 | Pod::Spec.new do |s|
s.name = "XLPagerTabStrip"
s.version = "8.0.0"
s.summary = "Android PagerTabStrip for iOS and much more."
s.homepage = "https://github.com/xmartlabs/XLPagerTabStrip"
s.license = { type: 'MIT', file: 'LICENSE' }
s.author = { "Marti... | 48.5625 | 103 | 0.617761 |
e2aba5a717224decff10ebbb086af0f80c562ac2 | 659 | require "spec_helper"
describe "bundle licenses" do
before :each do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rails"
gem "with_license"
G
end
it "prints license information for all gems in the bundle" do
bundle "licenses"
expect(out).to include("actionpack: Unknow... | 20.59375 | 63 | 0.638847 |
bb4f84773e82b70d2ab8878b592fb4ab29487d92 | 3,918 | class Activity < ApplicationRecord
belongs_to :friend
belongs_to :region
belongs_to :judge, optional: true
belongs_to :location
belongs_to :activity_type
has_many :accompaniments, -> { order(created_at: :asc) }, dependent: :destroy
has_many :users, through: :accompaniments
has_many :accompaniment_report... | 28.18705 | 101 | 0.666667 |
ffc5e9f72a40c5af6f7f4bbbf967ce9cfffb30b1 | 2,955 | # Copyright (c) 2011 VMware, Inc. All Rights Reserved.
#
# 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,... | 28.970588 | 79 | 0.65753 |
08d4406a547c70fa8f6745de331c9574960dd9b9 | 1,110 | require_relative 'stdout_storage'
module Buildmetrics
class RSpecCollector
attr_reader :tests
attr_accessor :storage
def initialize(build, repo, branch, commit, storage: StdoutStorage.new)
@build = build
@repo = repo
@branch = branch
@commit = commit
@tests = []
... | 23.125 | 87 | 0.614414 |
1a5b5e27c10395fa5082786236358c75997cb780 | 5,109 | 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... | 44.043103 | 114 | 0.762772 |
f7afecc4e61e4dd6e8ca1c846d9e95033336bc5d | 3,622 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/pops'
require 'puppet/pops/evaluator/evaluator_impl'
# This file contains basic testing of variable references and assignments
# using a top scope and a local scope.
# It does not test variables and named scopes.
#
# relative to this spec file (./) does not ... | 40.244444 | 139 | 0.586416 |
1ae1685b1837f8fae40504ed6a3b90eb2221575f | 957 | Pod::Spec.new do |spec|
spec.name = "SwiftAccessPolicy"
spec.version = "1.0.0"
spec.summary = "Simple Password & Biometry authorisation with sessions"
spec.description = <<-DESC
This library implements usage of biometry, password-based acces, and different access policies useful f... | 47.85 | 126 | 0.62069 |
f732450f8043933b382e45a1258df4a10a5cc61c | 387 | require 'spec_helper'
describe CircleCiProjectDecorator do
let(:circle_ci_project) { build(:circle_ci_project) }
subject { circle_ci_project.decorate }
describe '#current_build_url' do
subject { super().current_build_url }
it { is_expected.to eq('https://circleci.com/api/v1/project/username/a-project?c... | 29.769231 | 140 | 0.775194 |
b9d5009683ebb2e3709c82954e6b391efaaecf6e | 8,370 | require 'set'
require 'singleton'
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/string/starts_ends_with'
module Mime
class Mimes < Array
def symbols
@symbols ||= map { |m| m.to_sym }
end
%w(<< concat shift unshift push pop []= clear compact! collect!... | 26.487342 | 117 | 0.583513 |
03e4e96f122b319c1d63167c9f37250276f4e35e | 560 | module Workers
class Wait
include SideJob::Worker
register(
description: 'Waits for a trigger before sending data from in to out',
icon: 'step-forward',
inports: {
trigger: { type: 'all', description: 'Trigger' },
in: { type: 'all', description: 'Input data' },
... | 24.347826 | 78 | 0.5375 |
21697ebd536a9b3312e402de600ca07167ee63d0 | 1,313 | class User < ActiveRecord::Base
attr_accessor :remember_token
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: {... | 33.666667 | 76 | 0.674791 |
6af56334f5e67b4915b20037de7bec270f41d28d | 15,366 | require_relative 'globals'
require_relative 'tunes/tunes_client'
module Spaceship
class Client
def handle_two_step_or_factor(response)
# extract `x-apple-id-session-id` and `scnt` from response, to be used by `update_request_headers`
@x_apple_id_session_id = response["x-apple-id-session-id"]
@s... | 40.543536 | 177 | 0.645972 |
39e526f4bee943c1a68a1d1427fe9f8af20cff8b | 198 | require 'spec_helper'
describe name_from_filename do
include_examples 'check'
def self.elements
[ Element::Body ]
end
def issue_count
1
end
easy_test
end
| 12.375 | 30 | 0.636364 |
e88bb634898b1a824b75b7f8e10abf08c069910a | 1,804 | # frozen_string_literal: true
FactoryBot.define do
# This factory is called :namespace but actually maps (and always has) to User type
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74152#note_730034103 for context
factory :namespace, class: 'Namespaces::UserNamespace' do
sequence(:name) { |n| "... | 36.816327 | 139 | 0.720067 |
7af8982b5fb85fef949a74944ccb8031d51b76eb | 10,540 | =begin
#DocuSign Click API
#DocuSign Click lets you capture consent to standard agreement terms with a single click: terms and conditions, terms of service, terms of use, privacy policies, and more. The Click API lets you include this customizable clickwrap solution in your DocuSign integrations.
OpenAPI spec version... | 30.37464 | 289 | 0.62723 |
08aeebdbf47eee66264098868c25cb409e95f1f4 | 664 | class InstallSearchjoy < ActiveRecord::Migration[5.1]
def change
create_table :searchjoy_searches do |t|
t.references :user
t.string :search_type
t.string :query
t.string :normalized_query
t.integer :results_count
t.timestamp :created_at
t.references :convertable, polymor... | 34.947368 | 169 | 0.733434 |
18d33435ceefd9c2d342864031d7f276cd604de0 | 11,758 | #
# Copyright 2021 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 ... | 55.201878 | 180 | 0.680388 |
629b75aee6ba57cb100f531c1f2620b2be7a6362 | 1,197 | require 'railroader/checks/base_check'
# Check for vulnerability in nested attributes in Rails 2.3.9 and 3.0.0
# http://groups.google.com/group/rubyonrails-security/browse_thread/thread/f9f913d328dafe0c
class Railroader::CheckNestedAttributes < Railroader::BaseCheck
Railroader::Checks.add self
@description = "Che... | 30.692308 | 101 | 0.687552 |
6a3363d3c5c6e9c87c0cc99f6970c1898a1224cf | 338 | class TokyoMetro::App::Renderer::RailwayLine::Links::Header < TokyoMetro::App::Renderer::Concerns::Header::Content
def initialize( request , railway_line_infos )
super(
request ,
:title ,
:railway_line ,
"この路線に関するご案内" ,
"Other pages related to this railway line" ,
icon_size: 3... | 22.533333 | 114 | 0.64497 |
eda132d394c29979882f96ffd3cb75be40ee6689 | 4,002 | require "rails_helper"
RSpec.describe Reports::QuarterlyFacilityState, {type: :model, reporting_spec: true} do
describe "Associations" do
it { should belong_to(:facility) }
end
around do |example|
freeze_time_for_reporting_specs(example)
end
it "has a row for every facility, every quarter" do
f... | 46 | 138 | 0.73938 |
017f7888344c63ec68234c0651b65472d606037c | 260 | require "bundler/setup"
require "uri/s3"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
| 21.666667 | 63 | 0.738462 |
79911f526e374e1897983491b982c66d83e091dc | 10,571 | # frozen_string_literal: true
module UiRules
class ProductSetupTemplateRule < Base
def generate_rules
@repo = ProductionApp::ProductSetupRepo.new
make_form_object
apply_form_values
@rules[:hide_clone_fields] = @mode != :clone
common_values_for_fields common_fields
set_clone_... | 56.833333 | 167 | 0.596727 |
1c7b09b2ec05ccd2693881bcc37c24d17e5919cb | 1,455 | require 'spec_helper'
module BinanceClient
RSpec.describe Deposit do
let(:raw_hash) do
{
# The example Binance gives in
# https://binance-docs.github.io/Brokerage-API/Brokerage_Operation_Endpoints/#get-sub-account-deposit-history
# differs from what they actually returned. They ret... | 34.642857 | 117 | 0.631615 |
1a0b380664172f193c38c3778440dda88003f51a | 1,144 | require 'securerandom'
require 'digest'
class User
include Monatomic::Model
set display_name: "用户"
set represent_field: -> { name + " (" + uid + ")" }
set display_fields: %w[ uid name roles created_by_id created_at ]
set search_fields: %w[ uid name ]
set writable: -> (user) { user.is(:admin) or id == use... | 30.918919 | 101 | 0.686189 |
e27a7ea3c20384af28cfbb0567235133ab0c3b55 | 1,459 | describe TfpMetaprogramming::ObjectModel::String do
let(:myString) { TfpMetaprogramming::ObjectModel::String.new("My Prepended String") }
describe '.included_modules' do
it 'includes TfpMetaprogramming::ObjectModel::IPrimate ' do
expect(myString.class.included_modules).to include(TfpMetaprogramming::Obje... | 36.475 | 116 | 0.73475 |
383cc2bf5091347bdad74c87ba6232d2c5c3eb15 | 125 | module Refract
module Logger
class PutsLogger
def log(message)
puts(message)
end
end
end
end
| 12.5 | 22 | 0.608 |
4aee6d005a8cb093716de68ca53e17f9e7700aa5 | 6,956 | require 'rake_helper'
describe 'gitlab:cleanup rake tasks' do
before do
Rake.application.rake_require 'tasks/gitlab/cleanup'
end
describe 'cleanup namespaces and repos' do
let(:gitlab_shell) { Gitlab::Shell.new }
let(:storage) { storages.keys.first }
let(:storages) do
{
'default' =... | 31.762557 | 130 | 0.642754 |
acd28bb4c14c8ef2d51f9de0d948a4f2b32bc89a | 293 | class UserMailer < ActionMailer::Base
default from: "noreply@fococoder.com"
def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end
def password_reset(user)
@user = user
mail to: user.email, subject: "Password reset"
end
end | 22.538462 | 54 | 0.703072 |
ac28079d9365cdde9a1cbef26a8395fb98953c9a | 2,285 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @use... | 27.865854 | 78 | 0.659956 |
bb3da03e25cf344fda6a9594b2d5d09cd76e1f8e | 203 | class ChangeFilterOnReportReportsToText < ActiveRecord::Migration
def up
change_column :report_reports, :filter, :text
end
def down
change_column :report_reports, :filter, :string
end
end
| 20.3 | 65 | 0.768473 |
03248de11d250c471f5aac155273c3187e3c65ac | 1,164 | class Swiftformat < Formula
desc "Formatting tool for reformatting Swift code"
homepage "https://github.com/nicklockwood/SwiftFormat"
url "https://github.com/nicklockwood/SwiftFormat/archive/0.39.2.tar.gz"
sha256 "1ba3b4e4a35df42edf10b44ff5bae67299e98da17f6e54c5b0b1c04db87ae5db"
head "https://github.com/nickl... | 33.257143 | 93 | 0.725945 |
1a03ccfe742fd20cc233bd576d817147c6a71477 | 34,039 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 57.304714 | 444 | 0.578542 |
7ab51bb2c8aa94c4cd7f56548f019386eb50923d | 179 | class AddPriceQuantityPlaceholderToCommunityCategories < ActiveRecord::Migration
def change
add_column :community_categories, :price_quantity_placeholder, :string
end
end
| 29.833333 | 80 | 0.843575 |
acca9befd9ce9d1fa4fa992e7decffd15a60d70e | 6,851 | # 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... | 37.437158 | 126 | 0.713618 |
62836e71138c8646be0c155c50cc7f4aacb1b2cb | 484 | cask 'quicklook-csv' do
version '1.3'
sha256 'e052e89f8003aed08bb2058e3fb3335ac0a5cdaa0171bfb23b762976e095ef5b'
url "https://github.com/p2/quicklook-csv/releases/download/#{version}/QuickLookCSV-#{version}.dmg"
appcast 'https://github.com/p2/quicklook-csv/releases.atom',
checkpoint: 'f86d74a21377ce2e... | 37.230769 | 100 | 0.785124 |
1cd7d6bc3413bc1547e4609a4c86c4c964b5e790 | 1,157 | # frozen_string_literal: true
def link_css(href, method)
"a[href='#{href}'][data-method=#{method}]"
end
def modal_css(id)
"div.modal.fade##{id} div.modal-dialog div.modal-content div.modal-body"
end
def remote_link_css(path)
"a[data-remote=true][href='#{path}']"
end
def create_one_of_each_status(klass, option... | 22.686275 | 83 | 0.737252 |
4a6f3e93717df6846beb3fb041b94005c12cb69a | 1,064 | module MagLev
module ActiveJob
module Stats
extend ActiveSupport::Concern
included do
after_exception do
MagLev::Statsd.increment("active_job.exception", tags: { class: self.class.name, exception: @exception.class.name })
end
after_retry do
MagLev::Statsd.... | 28 | 126 | 0.617481 |
6aa36bcbdda933f46fedca34f699bf7849dbf7c1 | 8,791 | # frozen_string_literal: true
require 'test_helper'
module Vedeu
module Borders
describe DSL do
let(:described) { Vedeu::Borders::DSL }
let(:instance) { described.new(model, client) }
let(:model) { Vedeu::Borders::Border.new(attributes) }
let(:client) {}
let(:attribu... | 24.28453 | 84 | 0.576044 |
01fc4656dafb267e3a9ae0a5aa270370e1eb1465 | 1,539 | control 'V-73527' do
title 'Downloading print driver packages over HTTP must be prevented.'
desc "Some features may communicate with the vendor, sending system
information or downloading data or components for the feature. Turning off this
capability will prevent potentially sensitive information from being se... | 39.461538 | 101 | 0.746589 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.