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 |
|---|---|---|---|---|---|
5ddd0dcee13d445c1c8ced2b0a3fc1e14cdcddea | 648 | module Support
module Messages
module Outlook
module Reply
class FileAttachment
def self.from_uploaded_file(http_uploaded_file)
new(file: http_uploaded_file.tempfile, name: http_uploaded_file.original_filename)
end
attr_reader :file, :name
def in... | 21.6 | 94 | 0.560185 |
f800f415bd2d94a37e76218d925d67f182a8b313 | 1,736 | # == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
# type :string(255) default("ProjectHo... | 31.563636 | 89 | 0.604263 |
626d61f1ab94c035316a541dd843b90c2a0860ab | 1,727 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "carrot"
s.version = "1.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_... | 27.412698 | 105 | 0.639259 |
188b265f0f30a41014783aaf95f1f366d5eebfe1 | 532 | class Api::V4::SegmentSerializer < Api::V4::ApplicationSerializer
attributes :id, :name, :segment_number,
:realtime_start_ms, :realtime_end_ms, :realtime_duration_ms, :realtime_shortest_duration_ms,
:realtime_gold, :realtime_reduced, :realtime_skipped,
:gametime_start_ms, :g... | 53.2 | 106 | 0.740602 |
015871889a5b2fbe3f047e4d16581d6ca30f718b | 1,088 | # frozen_string_literal: true
require File.join(File.dirname(__FILE__), 'lib', 'jsonpath', 'version')
Gem::Specification.new do |s|
s.name = 'jsonpath'
s.version = JsonPath::VERSION
s.required_ruby_version = '>= 2.5'
s.authors = ['Joshua Hull', 'Gergely Brautigam']
s.summary = 'Ruby implementation of http:/... | 38.857143 | 82 | 0.701287 |
6a8a4ea61339757c2e4f42d0e9b3c9f9bb209ebe | 1,679 | Gem::Specification.new do |s|
s.name = 'squcumber-postgres'
s.version = '0.0.5'
s.default_executable = 'squcumber-postgres'
s.licenses = ['MIT']
s.required_ruby_version = '>= 2.0'
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version... | 34.979167 | 105 | 0.664086 |
bf8012b9ea79c1f51392e7e286c25afcfc6daedc | 1,019 | require('keen/arguments/ArgumentParser')
require('keen/arguments/ArgumentType')
module Keen
module TaskInvoker
def self.invoke(clazz, command, args)
obj = clazz.new()
if (!obj.respond_to?(command))
raise ArgumentError.new("Task class #{clazz} does not contain a command '#{command}'")
end
parsedA... | 20.795918 | 90 | 0.65947 |
18c41b4060bff5acc7e42ff8af5a79e1e662508b | 1,270 | require 'spec_helper'
require 'napa/middleware/request_stats'
describe Napa::Middleware::RequestStats do
before do
# Delete any prevous instantiations of the emitter and set valid statsd env vars
Napa::Stats.emitter = nil
ENV['STATSD_HOST'] = 'localhost'
ENV['STATSD_PORT'] = '8125'
end
it 'shoul... | 39.6875 | 117 | 0.608661 |
f8ae55610e122336a52e43cdf31311de6d7dcc6e | 1,775 | # encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
# include Sprockets::Helpers::RailsHelper
# include Spr... | 27.734375 | 81 | 0.696901 |
e224f9a0f016710ce8b4932422775d4b9d88a3eb | 1,047 | module Fog
module Parsers
module Redshift
module AWS
class DescribeEvents < Fog::Parsers::Base
# :marker - (String)
# :events - (Array)
# :source_identifier - (String)
# :source_type - (String)
# :message - (String)
# :date - (Time)... | 23.795455 | 60 | 0.424069 |
1af564a0258adf14b4008dea6d4bc5deb5e7a4ae | 1,121 | cask 'tableau' do
version '2020.2.1'
sha256 '8437d0fd125cdc76849adef9fffec0dbe162445d549811246d2f333cacc13db9'
url "https://downloads.tableau.com/tssoftware/TableauDesktop-#{version.dots_to_hyphens}.dmg"
appcast 'https://macupdater.net/cgi-bin/check_urls/check_url_redirect.cgi?url=https://www.tableau.com/downl... | 40.035714 | 127 | 0.601249 |
61aa5bef75ccf5ddc4f74b435a18c8b58280603b | 1,535 | module SessionsHelper
# Logs in the given user.
def log_in(user)
session[:user_id] = user.id
end
# Remembers a user in a persistent session.
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
# R... | 23.984375 | 67 | 0.686645 |
1801afd20059f509c64ba7706842c86af06e53b5 | 1,285 | require 'test_helper'
class ProductPartsControllerTest < ActionDispatch::IntegrationTest
setup do
@product_part = product_parts(:one)
end
test "should get index" do
get product_parts_url
assert_response :success
end
test "should get new" do
get new_product_part_url
assert_response :succ... | 26.22449 | 141 | 0.752529 |
1c946c7eb81abf37bbbe65731bae95522c072795 | 50 | # 版本
module Fibman
VERSION = "2.0.6".freeze
end
| 10 | 26 | 0.66 |
26a32edbcd65fe6889162a1ae4c7fdcd4c6286f7 | 172 | class CreateBoardcategories < ActiveRecord::Migration[5.0]
def change
create_table :boardcategories do |t|
t.string :name
t.timestamps
end
end
end
| 17.2 | 58 | 0.69186 |
26daefc11344db5413ca9fa97a972c3ca91828e2 | 2,340 | require 'spec_helper'
describe HackerNewsRanking do
it 'has a version number' do
expect(HackerNewsRanking::VERSION).not_to be nil
end
context 'class method' do
describe '#configure' do
let(:configuration) { HackerNewsRanking::Configuration.configuration }
it 'returns defaults' do
ex... | 24.375 | 76 | 0.536325 |
910702349f3ac42e755879ae5720cd8bc036add5 | 2,738 | class Znc < Formula
desc "Advanced IRC bouncer"
homepage "https://wiki.znc.in/ZNC"
url "https://znc.in/releases/archive/znc-1.8.2.tar.gz"
sha256 "ff238aae3f2ae0e44e683c4aee17dc8e4fdd261ca9379d83b48a7d422488de0d"
license "Apache-2.0"
revision 1
bottle do
sha256 arm64_big_sur: "a4fb4117aeb8ffc30b301d9f... | 32.211765 | 108 | 0.659606 |
39a1a6d55e3021b125b438b7deeacda238d7e6a2 | 392 | # typed: strong
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irre... | 32.666667 | 59 | 0.704082 |
f8ca3da4d3ea67f28f0c46df948f805b4f23f3b0 | 231 | module ExceptionHandler
extend ActiveSupport::Concern
class HubspotError < StandardError; end
included do
rescue_from HubspotError do |error|
@error = error
render template: 'events/index'
end
end
end
| 17.769231 | 41 | 0.714286 |
e2d78c0493966e47d82f6f3273e4b727e2978644 | 344 | module Hyperstack
def self.deprecation_warning(name, message)
return if env.production?
@deprecation_messages ||= []
message = "Warning: Deprecated feature used in #{name}. #{message}"
return if @deprecation_messages.include? message
@deprecation_messages << message
`console.warn.apply(console... | 31.272727 | 71 | 0.718023 |
f8208c97468867a30276bdc289eafba65d206e06 | 309 | Deface::Override.new(:virtual_path => 'spree/orders/_line_item',
:name => 'escape_variant_description_with_html_safe',
:replace => "erb[loud]:contains('line_item_description(variant)')",
:erb => '<%= line_item_description(variant).html_safe %>')
| 61.8 | 88 | 0.598706 |
e891e7ce0476e1e04e093028ce6f59914964ab55 | 240 | module Dandelion
module Adapter
class NoOpAdapter < Adapter::Base
def read(path)
end
def write(path, data)
end
def delete(path)
end
def symlink(path, data)
end
end
end
end | 14.117647 | 37 | 0.558333 |
f8ca6f84f3fe3f9f4f089181453d4e3dac534000 | 2,827 | module AdminData
class ActiveRecordUtil
attr_accessor :klass
def initialize(klass)
@klass = klass
end
# class User
# has_and_belongs_to_many :clubs
# end
#
# ActiveRecordUtil.new(User).declared_habtm_association_names
# #=> ['clubs']
def declared_habtm_association_na... | 27.446602 | 91 | 0.683056 |
0387ce8d39ad46eb23b24b64522e3e6a24860b1e | 1,467 | {
matrix_id: '2019',
name: 'ch6-6-b3',
group: 'JGD_Homology',
description: 'Simplicial complexes from Homology from Volkmar Welker.',
author: 'V. Welker',
editor: 'J.-G. Dumas',
date: '2008',
kind: 'combinatorial problem',
problem_2D_or_3D: '0',
num_rows: '5400',
num_cols: '2... | 34.116279 | 75 | 0.612815 |
7a78c15dc76c09fd25c574343d73b704165406bf | 2,476 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" d... | 28.136364 | 78 | 0.671244 |
f795c534cb71462c62ed757a867f9cae4a60d589 | 318 | module ActionCable
# Returns the version of the currently loaded Action Cable as a <tt>Gem::Version</tt>.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 5
MINOR = 1
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
end
| 19.875 | 88 | 0.644654 |
384c0a36e70b91e115437ddedbfa048c56f61b6c | 3,995 | require_relative '../../../../spec_helper.rb'
describe Salus::Scanners::PackageVersion::NPMPackageScanner do
let(:path) { 'spec/fixtures/package_version/npm_package_version_scanner/' }
let(:config_file) { YAML.load_file("#{path}/salus.yml") }
let(:config_file_with_block) { YAML.load_file("#{path}/salus_fail_with... | 44.388889 | 100 | 0.65582 |
7a492cc3e39eb0fa0c947236bbe6cb901851da8a | 1,146 | cask 'clamxav' do
if MacOS.release <= :tiger
version '2.2.1'
sha256 'e075b21fe5154f31dcbde86e492531c87c67ab44ad75294d3063f32ae1e58278'
elsif MacOS.release <= :leopard
version '2.5.1'
sha256 '02a7529c74d11724e2d0e8226ac83a0d3cfb599afb354d02f6609632d69d9eb1'
else
version '2.8.8'
sha256 'd9a4... | 29.384615 | 89 | 0.687609 |
0855313d6ac4e9135fa4baa710894fd560d1364b | 231 | require "opensupport/engine"
module Opensupport
# Your code goes here...
# Make this available in the host's initializer, e.g Opensupport.resource_names = ["products", "product_variants"]
mattr_accessor :resource_names
end
| 25.666667 | 116 | 0.766234 |
624b991dba3b376eec8044f76b1b9504650c2f3e | 4,185 | module Gollum
=begin
FileView requires that:
- All files in root dir are processed first
- Then all the folders are sorted and processed
=end
class FileView
def initialize pages
@pages = pages
end
def enclose_tree string
%Q(<ol class="tree">\n) + string + %Q(</ol>)
end
def ... | 27 | 89 | 0.538351 |
bb528530ebad64ea453c68a091200137299ca642 | 1,537 | require './models/grid'
require './errors/configuration_file_not_found_error'
class Game
attr_reader :current_grid, :previous_grid, :history, :round_count, :finish_reason
RESOURCE_FILE_PATH = 'file_samples'
USER_FILE_PATH = 'user_files'
SEPARATOR = File::Separator
FILE_EXTENSION = 'csv'
def initialize(gri... | 26.964912 | 109 | 0.703318 |
5d95792840af6f6df6a48ec3a16f460de4d128cd | 1,761 | require "rails_helper"
describe DogsController, type: :controller do
before do
sign_in create(:user)
end
describe "#index" do
context "not logged in" do
it "can't get to index" do
sign_out :user
get :index
expect(response).to redirect_to new_user_session_path
end
... | 20.476744 | 61 | 0.611584 |
1a8f4bdceb2d18e2c304a7f78dedfeefa4e467d7 | 522 | Spree::Order.class_eval do
checkout_flow do
go_to_state :address
go_to_state :delivery, if: ->(order) { order.delivery_required? }
go_to_state :payment, if: ->(order) { order.payment_required? }
go_to_state :confirm, if: ->(order) { order.confirmation_required? }
go_to_state :complete
remove... | 29 | 88 | 0.727969 |
189f326b492095dd30de7873addc496264572d71 | 322 | # 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 end
module Azure::ContainerRegistry end
module Azure::ContainerRegistry::Mgmt end
module Azure::ContainerRegistry::Mgmt::V2019_06_01_preview en... | 32.2 | 70 | 0.804348 |
f8732514edda920e55c07c92c3db614db5902584 | 19,165 | # frozen_string_literal: true
# encoding: UTF-8
require 'test_helper'
class FormBuilderTest < ActionView::TestCase
def with_custom_form_for(object, *args, &block)
with_concat_custom_form_for(object) do |f|
f.input(*args, &block)
end
end
test 'nested simple fields yields an instance of FormBuilder'... | 35.359779 | 148 | 0.727159 |
ac230a71783d0e89db53e1795801b8b7531fb8fb | 4,234 | module Bosh::Director
module Addon
DEPLOYMENT_LEVEL = :deployment
RUNTIME_LEVEL = :runtime
class Addon
extend ValidationHelper
attr_reader :name
def initialize(name, job_hashes, addon_include, addon_exclude)
@name = name
@addon_job_hashes = job_hashes
@addon_in... | 37.803571 | 126 | 0.679972 |
bf084529fd76d7e94b797d3eaf2e8018cc1ca5e3 | 2,176 | class PostTestApp < Sinatra::Base
register Sinatra::Chiro
app_description "POST parameter tester"
endpoint 'Form String tester', 'Tests the validation of a String type form parameter' do
form(:string, 'arbitrary parameter of string type', :type => String, :optional => false)
post '/test/form/string' do... | 33.476923 | 142 | 0.668658 |
7a7ca23265756f1dc80219df3ec9183c659567a8 | 214 | require 'facter'
Facter.add(:windows_common_appdata) do
confine :operatingsystem => :windows
if Facter.value(:osfamily) == "windows"
require 'win32/dir'
end
setcode do
Dir::COMMON_APPDATA
end
end
| 19.454545 | 41 | 0.714953 |
1a4e8245ce43179c8567f72bd6cdaee81d28ab41 | 275 | require_relative "../test_helper"
describe "list_buckets" do
it "should give list of buckets" do
response = CONNECTION.list_buckets
assert(response.is_a?(Excon::Response))
assert(response.body['buckets'].detect {|b| b['bucketName'] == TEST_BUCKET})
end
end
| 25 | 80 | 0.716364 |
792b059bf8a22f704f66f9fd572662ff6f38a48e | 967 | def authorize_key_for_root(config, *key_paths)
[*key_paths, nil].each do |key_path|
if key_path.nil?
fail "Public key not found at following paths: #{key_paths.join(', ')}"
end
full_key_path = File.expand_path(key_path)
if File.exists?(full_key_path)
config.vm.provision 'file',
r... | 31.193548 | 79 | 0.583247 |
79f13f3762b2d0f6c63637ba2da933023994f270 | 327 | name 'lvm'
maintainer 'Opscode, Inc.'
maintainer_email 'cookbooks@opscode.com'
license 'Apache 2.0'
description 'Installs lvm2 package'
version '1.2.3'
supports 'centos'
supports 'debian'
supports 'redhat'
supports 'sles'
supports 'ubuntu'
recipe 'lvm', 'Installs lvm2 pa... | 21.8 | 41 | 0.651376 |
e9d32c5c7dcc6a7dc4ae5849140f1bda666c7bfe | 8,215 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative '../process/fixtures/common'
describe "IO.popen" do
ProcessSpecs.use_system_ruby(self)
before :each do
@fname = tmp("IO_popen_spec")
@io = nil
@var = "$FOO"
platform_is :windows do
@var = "%FOO%"
en... | 30.202206 | 106 | 0.580158 |
bb7139608edbc3bc9ec3428ae466e9a4217b5498 | 221 | class FixVisibleUntil < ActiveRecord::Migration[4.2]
def self.up
rename_column :assignments , :visable_until, :visible_at
end
def self.down
rename_column :assignments, :visible_at, :visable_until
end
end
| 22.1 | 60 | 0.751131 |
018c7926b7d232bb6b33fb16731e674a1f310dd0 | 1,830 | # Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
#
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
# copy, modify, and distribute this software in source code or binary form for use
# in connection with the web services and APIs provided by Facebook.
#
# As with any so... | 53.823529 | 433 | 0.778689 |
ffe235eac4ea2b3d9f23a64cc526c35d5c30c1e2 | 632 | require 'fog/core/model'
module Fog
module Openstack
class Planning
class Role < Fog::Model
identity :uuid
attribute :description
attribute :name
attribute :uuid
def initialize(attributes)
# Old 'connection' is renamed as service and should be used instea... | 21.066667 | 77 | 0.620253 |
4ac824c57c5a11385da504799b4c8039dfe6e009 | 1,825 | require 'spec_helper'
describe "Shipping Methods" do
stub_authorization!
let!(:zone) { create(:global_zone) }
let!(:shipping_method) { create(:shipping_method, :zones => [zone]) }
after do
Capybara.ignore_hidden_elements = true
end
before do
Capybara.ignore_hidden_elements = false
# HACK: To ... | 28.076923 | 100 | 0.679452 |
61ae637764e80ed63cf4c1d077033d4085b9c605 | 568 | require File.join(File.dirname(__FILE__), 'abstract-php-extension')
class Php55Yac < AbstractPhp55Extension
init
homepage 'https://github.com/laruence/yac'
url 'https://github.com/laruence/yac.git', :branch => 'master'
head 'https://github.com/laruence/yac.git'
version 'latest'
def install
ENV.univers... | 27.047619 | 67 | 0.679577 |
382fcca14b8eef919f0ec38d9b080ce73133c0bf | 2,585 | class UsersController < Devise::RegistrationsController
def edit
render('sidebar/edit_profile', layout: 'sidebar')
end
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
if update_resource(resource, account_update_params)
yield resource if block_... | 38.014706 | 414 | 0.723017 |
03271b0ec8e37b6d9d1c6a574b6cd88a2f69b93a | 1,414 | # frozen_string_literal: true
require 'securerandom'
require 'tmpdir'
module ProxyCrawl
class ScreenshotsAPI < ProxyCrawl::API
attr_reader :screenshot_path, :success, :remaining_requests, :screenshot_url
INVALID_SAVE_TO_PATH_FILENAME = 'Filename must end with .jpg or .jpeg'
SAVE_TO_PATH_FILENAME_PATTER... | 26.679245 | 97 | 0.699434 |
26e0b0d6446f1286afe470dabfe761aed196001a | 4,737 | describe Canvas::Course do
let(:user_id) { Settings.canvas_proxy.test_user_id }
let(:canvas_course_id) { '1121' }
subject { Canvas::Course.new(:user_id => user_id, :canvas_course_id => canvas_course_id) }
it { should respond_to(:canvas_course_id) }
context 'whe... | 39.806723 | 153 | 0.640068 |
7a69286b83d507561a088e179dff45d824bb77bb | 1,150 | require File.dirname(__FILE__) + '/../../spec_helper'
# Returns an array containing the quotient and modulus obtained
# by dividing num by aNumeric. If q, r = x.divmod(y), then
# q = floor(float(x)/float(y))
# x = q*y + r
describe "Numeric#divmod" do
it "divmod right integers" do
13.divmod(4).should =... | 28.75 | 63 | 0.631304 |
f8acdcb51e9ec24f55afee8d9aac681e8d24e598 | 28,837 | require 'cases/helper'
require 'models/admin'
require 'models/admin/account'
require 'models/admin/randomly_named_c1'
require 'models/admin/user'
require 'models/binary'
require 'models/book'
require 'models/bulb'
require 'models/category'
require 'models/company'
require 'models/computer'
require 'models/course'
requi... | 32.076752 | 164 | 0.750494 |
0378f1dd2cb09aeeef8608d6cd10f3e5e787bc38 | 3,810 | # frozen_string_literal: true
describe 'Ridgepole::Client#diff -> migrate', condition: '>= 5.1.0' do
context 'with warning' do
let(:actual_dsl) do
erbh(<<-ERB)
create_table "dept_manager", force: :cascade do |t|
t.string "dept_no", limit: 4, null: false
t.date "from_date", n... | 33.130435 | 71 | 0.581102 |
879b5ed5afd41749cdf7391fd2cb678d22eb304a | 672 | class LoginController < ApplicationController
before_action :authenticate
def index
#render plain: "current_user_id: #{session[:current_user_id]} #{current_user.inspect}"
#raise current_user.class.to_s
redirect_to '/TaskBoard/' if current_user.is_a?(User)
end
private
# Basic auth against local use... | 28 | 90 | 0.739583 |
ed24b8f94ac4f083b16ad0478f2e6a2447698b72 | 126 | class RemoveActiveFromTeams < ActiveRecord::Migration[5.0]
def change
remove_column :teams, :active, :boolean
end
end
| 21 | 58 | 0.753968 |
1dc5c6abb2e133922a001c5e043b790de6980195 | 8,524 | # frozen_string_literal: true
require "test_helper"
class IntegrationTest < ActionDispatch::IntegrationTest
test "rendering component in a view" do
get "/"
assert_response :success
assert_select("div", "Foo\n bar")
end
if Rails.version.to_f >= 6.1
test "rendering component with template annot... | 28.700337 | 106 | 0.731699 |
11790e3766c70cdd84a798ef9a7aea9eee87c278 | 2,828 | # coding: utf-8
=begin
File : mvm_fw_test_gcov_helper.rb
Author : Francesco Prelz
e-mail : francesco.prelz@mi.infn.it
Revision history :
6-May-2020 Original release
Description: Digest gcov output and produce an overall coverage
report.
=end
class Mvm_Fw_Test_Gcov_Helper
... | 23.764706 | 76 | 0.531471 |
62e8a114ba1d44d369ecf9525ee01b156e0b5ee8 | 174 | class AddNumMetareviewsRequiredToAssignments < ActiveRecord::Migration
def change
add_column :assignments, :num_metareviews_required, :integer, :default => 3
end
end
| 29 | 79 | 0.798851 |
1cf94ac358d0f2d7f2dcb130fb617af60a2f080a | 4,819 | # frozen_string_literal: true
require 'test_helper'
class PaginatableArrayTest < ActiveSupport::TestCase
setup do
@array = Kaminari::PaginatableArray.new((1..100).to_a)
end
test 'initial state' do
assert_equal 0, Kaminari::PaginatableArray.new.count
end
test 'specifying limit and offset when initi... | 23.975124 | 101 | 0.650965 |
791209c7c9be93d54ec446158de9cff1f0e1373d | 1,183 | require 'json'
module Razorpay
# Entity class is the base class for all Razorpay objects
# This saves data in a hash internally, and makes it available
# via direct methods
class Entity
attr_reader :attributes
def initialize(attributes)
@attributes = attributes
end
# This method fakes a... | 25.170213 | 65 | 0.679628 |
28184d3618077e0318994b67de8f034687d564b3 | 120 | require 'spec_helper'
describe "reports/edit.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end
| 20 | 56 | 0.741667 |
b95e3690a72bf33ab89d87f663acc3944d433262 | 237 | module Spree
module Api
module V2
module Platform
class PromotionCategorySerializer < BaseSerializer
include ResourceSerializerConcern
has_many :promotions
end
end
end
end
end
| 16.928571 | 58 | 0.64557 |
5de3a3e8a1deacb738e0d6945687d9f9445dfcac | 3,481 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 33.471154 | 127 | 0.751221 |
4ad79ebd04de11d7ddaeaf035d778e43c0959375 | 500 | require "capybara/poltergeist"
POLTERGEIST_URL_BLACKLIST = %w{
tpc.googlesyndication.com
www.googletagservices.com
fonts.googleapis.com
www.google-analytics.com
api.mixpanel.com
cdn.mxpnl.com
tofu.example.com
www.googletagmanager.com
pagead2.googlesyndication.com
}
Capybara.register_driver :polterge... | 25 | 119 | 0.802 |
e971509c95213be1fa5aae60dc5e452352e33660 | 2,413 | module ICU
module Collation
def self.collate(locale, arr)
Collator.new(locale).collate(arr)
end
def self.keywords
enum_ptr = Lib.check_error { |error| Lib.ucol_getKeywords(error) }
keywords = Lib.enum_ptr_to_array(enum_ptr)
Lib.uenum_close enum_ptr
hash = {}
keywords... | 26.516484 | 88 | 0.588893 |
1c64830c0ec2daf7f63e6169de9da292666f240a | 3,757 | ###############################################################################
# Copyright 2012 MarkLogic Corporation
#
# 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... | 22.769697 | 85 | 0.591163 |
61e72fc485d3b586d97186e2071d0e4db374134d | 23,767 | # frozen_string_literal: true
# Copyright 2020 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... | 51.779956 | 155 | 0.554635 |
38fd43a8a92cc743de015dffb2718e2076a93a18 | 2,090 | # Copyright (c) 2020-2021 Andy Maleh
#
# 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, publish,
# d... | 35.423729 | 72 | 0.695215 |
87211ec264ef1e6c85c8697490156fd47369231f | 3,164 | #
# Author:: Serdar Sutay (<serdar@chef.io>)
# Copyright:: Copyright 2014-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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
#
# ... | 35.550562 | 99 | 0.675411 |
6a256c9254a798db6c4bb2fd1e9d851cd8cedb9b | 494 | require_relative '../../../../../test_helper'
module Deliverhq
module Request
class MessageListTest < Minitest::Test
def setup
@message_list_response = {'records' => [{
'id' => 1234,
'body' => 'foo'
}]}
end
def test_list
Deliverhq::Request::Ba... | 21.478261 | 99 | 0.548583 |
26692934456a8e9e628e3cd0043f528c19a3f488 | 14,671 | # frozen_string_literal: true
module SortingHelper
def sort_options_hash
{
sort_value_created_date => sort_title_created_date,
sort_value_downvotes => sort_title_downvotes,
sort_value_due_date => sort_title_due_date,
sort_value_due_date_later => sort_title_due_dat... | 26.292115 | 157 | 0.740645 |
03ea9f60ddca247e6a50ef555640555b4ff665d2 | 512 | class JobMessenger < ActiveRecord::Base
def message_for_user
case status
when 'queued'
'Job is currently queued'
when 'running'
'Job is currently running'
when 'failed'
"Job Has Failed: #{message}"
when 'succeeded'
'Job has processed successfully'
end
... | 16.516129 | 40 | 0.597656 |
1c0ae9487c4623bad7cb0a72eb270c5ca914a8e8 | 816 | module GovukTechDocs
class Redirects
LEADING_SLASH = %r[\A\/].freeze
def initialize(context)
@context = context
end
def redirects
all_redirects = redirects_from_config + redirects_from_frontmatter
all_redirects.map do |from, to|
# Middleman needs paths without leading slas... | 20.4 | 72 | 0.640931 |
39f1f50cac72f834500a8ae01f61326968f28e3d | 973 | # frozen_string_literal: true
require 'tzispa/utils/tz_string'
module Tzispa
module Utils
class Indenter
using Tzispa::Utils::TzString
DEFAULT_INDENT_CHAR = ' '
DEFAULT_INDENT_SIZE = 2
attr_reader :sbuff, :indent_char, :instr
def initialize(indent_size = nil, indent_char = nil)... | 18.358491 | 63 | 0.589928 |
333416577478203a59880bd2be18c754d50e4605 | 42,331 | # frozen_string_literal: true
require "spec_helper"
# TODO change some of these tests to use Rack::Test
describe Split::Helper do
include Split::Helper
let(:experiment) {
Split::ExperimentCatalog.find_or_create("link_color", "blue", "red")
}
describe "ab_test" do
it "should not raise an error when ... | 36.970306 | 145 | 0.63783 |
1d069282affe603c277c2d0c93dbbd77488c266e | 350 | # frozen_string_literal: true
class CreateReleases < ActiveRecord::Migration[6.0]
def change
create_table :releases do |t|
t.string :name
t.date :start_date
t.date :finish_date
t.text :description
t.boolean :active
t.references :project, null: false, foreign_key: true
t... | 20.588235 | 59 | 0.665714 |
f8c55a284936d6ab26a9b6cc82c7b7604e489bf7 | 8,335 | # -*- coding: binary -*-
require 'uri'
require 'rex/proto/http'
module Rex
module Proto
module Http
###
#
# HTTP request class.
#
###
class Request < Packet
PostRequests = ['POST', 'SEARCH']
##
#
# Some individual request types.
#
##
#
# HTTP GET request class wrapper.
#
class Get < Request
... | 23.21727 | 171 | 0.603119 |
e99abde007b4c8297200542d252799ff7af664c3 | 6,618 | Rails.application.routes.draw do
# Disable PUT for now since rails sends these :update and they aren't really the same thing.
def put(*_args); end
routing_helper = Insights::API::Common::Routing.new(self)
prefix = "api"
if ENV["PATH_PREFIX"].present? && ENV["APP_NAME"].present?
prefix = File.join(ENV["P... | 46.93617 | 103 | 0.574192 |
b9df021a9ef2f63d83ec11e62e8db88fc79312d3 | 1,166 | class Autobench < Formula
desc "Automatic webserver benchmark tool"
homepage "http://www.xenoclast.org/autobench/"
url "http://www.xenoclast.org/autobench/downloads/autobench-2.1.2.tar.gz"
sha256 "d8b4d30aaaf652df37dff18ee819d8f42751bc40272d288ee2a5d847eaf0423b"
bottle do
cellar :any_skip_relocation
... | 36.4375 | 95 | 0.711835 |
8750d72f2ab67368d9e9461a9bedb07a5b32647c | 1,078 | require 'spec_helper'
describe 'odoo' do
let(:pre_condition) do
[
'define ini_setting($ensure = nil,
$path,
$section,
$key_val_separator = nil,
$setting,
$value = nil) {}'
]
end
let!(:stdlib_stubs) do
MockFunction.new('create_... | 20.730769 | 69 | 0.585343 |
181d0f0936f81614224afee2469aaf783d96df62 | 1,451 | # 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
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-kinesisvide... | 27.377358 | 96 | 0.75603 |
262d9434ddf7b0ce74ee291656471e374b2b9b44 | 709 | require 'spec_helper'
feature 'Group activity page', feature: true do
let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user }
let(:group) { create(:group) }
let(:path) { activity_group_path(group) }
context 'when signed in' do
before do
sign_in(user)
visit pat... | 26.259259 | 91 | 0.699577 |
d5f1a12f3ebb14a3b2ae838ca37a11b33c3a380b | 1,114 | # Encoding: UTF-8
{fileTypes: ["svn-commit.tmp", "svn-commit.2.tmp"],
name: "svn-commit.tmp",
patterns:
[{captures: {1 => {name: "punctuation.definition.item.subversion-commit"}},
match: /^\s*(?<_1>•).*$\n?/,
name: "meta.bullet-point.strong"},
{captures: {1 => {name: "punctuation.definition.item.subver... | 42.846154 | 124 | 0.588869 |
bf752a1744666748803ea6e80468f8729dea0666 | 4,328 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataMigration::Mgmt::V2018_04_19
module Models
#
# Properties for the task that validates connection to SQL Server and also
# validates source ser... | 32.298507 | 87 | 0.465342 |
e95046a30d1839d03e9e0cb7d09a46ee7b63f91b | 1,847 | Pod::Spec.new do |s|
s.name = "iOSSnapshotTestCase"
s.module_name = "FBSnapshotTestCase"
s.version = "4.0.0"
s.summary = "Snapshot view unit tests for iOS"
s.description = <<-DESC
A "snapshot test case" takes a configured UIView or CALayer
and uses t... | 51.305556 | 177 | 0.663238 |
1d8034b4aad2a9fb7cb8944af30f96f4d4284664 | 538 | class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
if user.role? :super_admin
can :manage, :all
elsif user.role? :product_admin
can :manage, [Product, Asset, Issue]
elsif user.role? :product_team
can :read, [Product, Asset]
# manage ... | 24.454545 | 43 | 0.613383 |
bf98ca71ba843dc5bbabf244623ea383fa988c46 | 436 | require File.expand_path("../../../../base", __FILE__)
require "vagrant/registry"
describe Vagrant::Plugin::V2::Components do
let(:instance) { described_class.new }
describe "configs" do
it "should have configs" do
instance.configs.should be_kind_of(Hash)
end
it "should default the values to r... | 24.222222 | 83 | 0.711009 |
6ad9111e65bc08f26eb347ba7fa19b4552c9d3f0 | 628 | ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
Dir[File.dirname(__FILE__) + '/fabricators/*.rb'].each { |file| require file }
mongoid_file = File.join(File.dirname(__FILE__), "dummy", "config", "mongoid.yml")
@settings = YAML.load(ERB.new(File.... | 27.304348 | 82 | 0.708599 |
abc9096824632d8b23a996d8e36aa62cf72f7fe2 | 3,668 | module SmartAnswer
class NextStepsForYourBusinessFlow < Flow
def define
name "next-steps-for-your-business"
start_page_content_id "4d7751b5-d860-4812-aa36-5b8c57253ff2"
flow_content_id "981e0708-9fa5-42fb-baf5-ee5630a9b722"
status :draft
response_store :query_parameters
# ====... | 30.31405 | 79 | 0.430752 |
626aba200d15b60253757520466bbe3929aa7126 | 435 | Gitlab::Seeder.quiet do
Issue.all.limit(10).each_with_index do |issue, i|
5.times do
user = issue.project.team.users.sample
Gitlab::Seeder.by_user(user) do
Note.seed(:id, [{
project_id: issue.project.id,
author_id: user.id,
note: Faker::Lorem.sentence,
... | 21.75 | 51 | 0.563218 |
6106fe9a93d3aa48148f201a2afa8fcf6b7fb28e | 1,861 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/citizen_budget_model/version', __FILE__)
Gem::Specification.new do |s|
s.name = "citizen_budget_model"
s.version = CitizenBudgetModel::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Open North"]
s.email = ["info@openno... | 36.490196 | 90 | 0.672757 |
33e32580ad609e24222c82611ccdc1dce83eb50f | 4,655 | # frozen_string_literal: true
module Kindguardian
# Utils module
module Kindle
SECTIONS_DIR = "#{EDITION_DIR}/sections"
class << self
# Converts HTML edition to Kindle mobi format
# Having Calibre as an external dependency
# To handle the conversion process
def convert_to_mobi
... | 40.12931 | 117 | 0.529968 |
bf16161daf0c0e6542cfcfa8f33e8b6c2841ca68 | 106 | RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
FactoryBot.find_definitions
| 17.666667 | 44 | 0.820755 |
0800e6e87074fa72888261e189c6e456cb9b3699 | 622 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :facebook_post, :class => 'Services::Facebook::Post' do
message { Faker::Lorem.sentence }
icon { "http://facebook.com/icon.png" }
created_at { Time.now }
updated_at { Time.now }
association :author,... | 28.272727 | 93 | 0.692926 |
acab0e3ae08cafd6a834d8a281957d13316066ae | 3,468 | module Sigdump
VERSION = "0.2.4"
def self.setup(signal=ENV['SIGDUMP_SIGNAL'] || 'SIGCONT', path=ENV['SIGDUMP_PATH'])
Kernel.trap(signal) do
begin
dump(path)
rescue
end
end
end
def self.dump(path=ENV['SIGDUMP_PATH'])
_open_dump_path(path) do |io|
io.write "Sigdump at... | 23.275168 | 127 | 0.585928 |
ed1c8510c81b7eb62ca7760caa2ac966c95294dc | 1,551 | # -*- encoding: utf-8 -*-
# stub: logstash-filter-split 2.0.5 ruby lib
Gem::Specification.new do |s|
s.name = "logstash-filter-split"
s.version = "2.0.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.metadata = { "logstash_group" => "filter", "logsta... | 41.918919 | 192 | 0.680851 |
017f3a9fc7b00032085a34c1b98a7fe06508ee1f | 1,682 | # -*- encoding: utf-8 -*-
# stub: xpath 3.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "xpath"
s.version = "3.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Jonas Nicklas"]
s.cert_chain = ["gem-pub... | 35.787234 | 105 | 0.62069 |
4acb2c6fbb43676e873606f35378e1edcefa48f0 | 1,266 | require 'test_helper'
class ProductsControllerTest < ActionDispatch::IntegrationTest
setup do
@product = products(:one)
@title = "The Great Book #{rand(1000)}"
end
test "should get index" do
get products_url
assert_response :success
end
test "should get new" do
get new_product_url
a... | 25.32 | 160 | 0.71643 |
01483aa5e0ed826a0647d23a85a34c033f2aab8c | 132 | require 'test_helper'
class Webcore::Test < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Webcore
end
end
| 16.5 | 45 | 0.75 |
384b038443e1fff04027c764f3659697c01c98e5 | 2,245 | #
# Copyright (C) 2009-2011 the original author or authors.
# See the notice.md file distributed with this work for additional
# information regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | 41.574074 | 85 | 0.77461 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.