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 |
|---|---|---|---|---|---|
39725585c7e88e0954a274c2cfbafdbff2b7e8ec | 867 | class User < ActiveRecord::Base
has_many :user_profiles
has_many :events, foreign_key: "organizer_id"
has_one :user_detail
after_create -> { create_user_detail }
accepts_nested_attributes_for :user_detail
delegate :name, :to => :user_detail
def create_event(params)
events.create(params)
end
def... | 27.09375 | 82 | 0.755479 |
b99ac0e436ce1dfb0e09284b2dbb21c32b883273 | 628 | # This migration comes from tabo (originally 20150724134658)
class CreateFriendlyIdSlugs < ActiveRecord::Migration
def change
create_table :friendly_id_slugs do |t|
t.string :slug, :null => false
t.integer :sluggable_id, :null => false
t.string :sluggable_type, :limit => 50
... | 36.941176 | 83 | 0.694268 |
627806bf8e871f024279755d3402ac45d9fa3691 | 1,157 | module Fog
module ApplicationGateway
class AzureRM
# URL Path Map model class for Application Gateway Service
class UrlPathMap < Fog::Model
identity :name
attribute :id
attribute :default_backend_address_pool_id
attribute :default_backend_http_settings_id
attrib... | 37.322581 | 153 | 0.67675 |
01d0176b8f71cc42b64e313a44eb22923424f9db | 533 | require 'spec_helper'
describe 'Word Count Enrichment' do
it 'should enrich the item with the items wordcount' do
item = Consummo::SimpleItem.new(content: "One Two Three")
sut = Consummo::WordCountEnricher.new
expect(sut.enrich(item)).to eq({:word_count => 3})
end
context 'when there is no content' ... | 29.611111 | 61 | 0.684803 |
115b633414a1d9a90ed62d2fbf096288c9f75a5d | 1,248 | class Team < ActiveRecord::Base
ADMINS = 'admins'
DTO_NONE = 0b000
DTO_DESIGN = 0b100
DTO_TRANSITION = 0b010
DTO_OPERATIONS = 0b001
DTO_ALL = 0b111
CLOUD_SERVICES = 0b100
CLOUD_COMPLIANCE = 0b010
CLOUD_SUPPORT = 0b001
CLOUD_ALL = 0b111
belongs_to :organization
has... | 32 | 124 | 0.702724 |
b9cb590eea0c74b6bdc08d452e0a17023b333d83 | 1,307 | module MobileDevicePool
class IoStream
class << self
def redirect_command_output(cmd, &blk)
begin
output = IO.popen(cmd)
while (line = output.gets)
blk.call(line)
end
rescue Exception => e
puts e.message
puts e.backtrace.inspect
... | 28.413043 | 103 | 0.523336 |
396d3dd18f08d2e068f691feded8cdf385e25181 | 876 | #cagegory encoding: UTF-8
require 'helper/require_unit'
describe Siba::InstalledPlugins do
before do
@cls = Siba::InstalledPlugins
end
it "should call all_installed" do
@cls.all_installed.must_be_instance_of Hash
@cls.all_installed.wont_be_empty
end
it "should call installed?" do
@cls.inst... | 23.675676 | 74 | 0.715753 |
e20c08da4e352c900534c9b5fec4b972e616755c | 2,243 | require 'abstract_unit'
class StarStarMimeController < ActionController::Base
layout nil
def index
render
end
end
class StarStarMimeControllerTest < ActionController::TestCase
def test_javascript_with_format
@request.accept = "text/javascript"
get :index, format: 'js'
assert_match "function a... | 24.11828 | 93 | 0.727151 |
ac47e233ad6002a401f808de8b3ad7f103de39b8 | 100 | CfhighlanderTemplate do
Name 'c1'
Parameters do
ComponentParam 'bubbleParam'
end
end | 8.333333 | 32 | 0.71 |
394eff733144c857ba1863c055375466e50f1ee2 | 5,349 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe GoodJob::Scheduler do
let(:performer) { instance_double(GoodJob::JobPerformer, next: nil, name: '', next_at: []) }
after do
described_class.instances.each(&:shutdown)
end
context 'when thread error' do
let(:error_proc) { double("Erro... | 33.223602 | 143 | 0.647598 |
acce2f5a9072e1b2307c244c073233f5a071ac34 | 143 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def hello
render html: "hello,world"
end
end
| 14.3 | 52 | 0.79021 |
ff5001cd348cdce6449d799f8258d3b13ab6a14a | 1,312 | # frozen_string_literal: true
require 'test_helper'
module SexpExamples
def self.included(base)
base.let(:sexp_with_initialize) { parse_file('road_bike.rb') }
base.let(:sexp_without_initialize) do
RubyParser.new.parse(<<~EMPTY_CLASS_DEFINITION)
class Scooter
end
EMPTY_CLASS_DEFIN... | 29.155556 | 81 | 0.758384 |
4a2631910a2a99095058803cdedaba965bacb958 | 94 | module Socialite
class Identity < ActiveRecord::Base
include Models::Identity
end
end
| 15.666667 | 37 | 0.755319 |
01f6a78c8ae21134d10713f7eb19b24d2120ad1e | 25,629 | # Copyright 2019 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 applicable law or agreed to in writing, ... | 49.572534 | 95 | 0.62441 |
4a40bf7cd61c4cd9141024c0b54c23a81f469ad5 | 288 | ENV["RAILS_ENV"] = "test"
require 'test/unit'
require 'rubygems'
gem 'rails', '>= 1.2.6'
require 'active_support'
require 'action_controller'
require 'action_controller/test_process'
require File.dirname(__FILE__) + '/../lib/filter_table'
require File.dirname(__FILE__) + '/test_stubs.rb' | 32 | 55 | 0.753472 |
91468dd231bdeeb92baaf20dd78f0d8db39f8804 | 46 | module FinanceManager
VERSION = '0.1.0'
end
| 11.5 | 21 | 0.717391 |
bffa75922140012bac53b73cb3e79e157071c2c2 | 1,167 | require 'spec_helper'
module Bosh::Director
module DeploymentPlan
module Steps
describe UnmountInstanceDisksStep do
subject(:step) { UnmountInstanceDisksStep.new(instance) }
let(:instance) { Models::Instance.make }
let!(:vm) { Models::Vm.make(instance: instance, active: true) }
... | 35.363636 | 108 | 0.658955 |
33d60e3d021b0c06182f58f7d2bead38c2ece6c0 | 609 | require_relative 'rails_api_auth_migration'
class CreateLogins < RailsAPIAuthMigration
def change
create_table :logins, primary_key_options(:id) do |t|
t.string :identification, null: false
t.string :password_digest, null: true
t.string :oauth2_token, null: false
t.string :facebook_u... | 23.423077 | 91 | 0.712644 |
1dd74295dacc56bc9a16e1fd17f58c07f9d815cc | 8,655 | require 'capybara'
require 'selenium-webdriver'
require_relative '../capybara_configuration'
require_relative '../capybara_ext/selenium/driver'
require_relative '../capybara_ext/session'
module Kimurai::BrowserBuilder
class SeleniumChromeBuilder
class << self
attr_accessor :virtual_display
end
att... | 40.633803 | 140 | 0.6684 |
6251cae26ae0965642739d0be1b91371e9a4e330 | 2,738 | require 'spec_helper'
describe V1::ServiceHooksController do
let(:user) { Factory(:user, :login => 'svenfuchs', :github_oauth_token => 'github_oauth_token') }
let(:repository) { Factory(:repository, :owner_name => 'svenfuchs', :name => 'minimal') }
let(:hooks_url) { 'repos/svenfuchs/minimal/hooks' }
let... | 35.558442 | 115 | 0.643535 |
331a0f1812b61821bf2c1977f30724459af9952e | 2,774 | # config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'ctgov'
set :repo_url, 'git@github.com:tibbs001/ctgov.git' # Edit this to match your repository
set :branch, :development
set :deploy_to, '/home/deploy/ctgov'
set :pty, true
set :linked_files, %w{config/database.yml config/application... | 33.02381 | 129 | 0.713771 |
624bf4c974e1498322bb8920bc6b405ef3872f85 | 165 | require 'mxx_ru/cpp'
MxxRu::Cpp::exe_target {
required_prj 'so_5/prj_s.rb'
target 'sample.so_5_extra.enveloped_msg.delivery_receipt_s'
cpp_source 'main.cpp'
}
| 16.5 | 60 | 0.769697 |
1d6bce98b392148c13badb0f59082342c546556a | 57,480 | # 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
module Aws::NetworkManager
module Types
# You do not have sufficient access to perform this action.
#... | 28.797595 | 136 | 0.592902 |
3943389598d0f043f71ca35b16b5284fe18cbe55 | 1,138 | class Scalariform < Formula
desc "Scala source code formatter"
homepage "https://github.com/scala-ide/scalariform"
url "https://github.com/scala-ide/scalariform/releases/download/0.2.10/scalariform.jar"
sha256 "59d7c26f26c13bdbc27e3011da244f01001d55741058062f49e4626862b7991e"
head do
url "https://github.... | 26.465116 | 89 | 0.670475 |
abea1ef4e18a6049b1f01f28e9284fd20e0d235b | 1,668 | class Libomp < Formula
desc "LLVM's OpenMP runtime library"
homepage "https://openmp.llvm.org/"
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/openmp-10.0.0.src.tar.xz"
sha256 "3b9ff29a45d0509a1e9667a0feb43538ef402ea8cfc7df3758a01f20df08adfa"
bottle do
cellar :any
sha256 "... | 34.040816 | 102 | 0.640288 |
6a121d8b0352cc942acfa4eba3c77fe156276473 | 1,129 | class Aap < Formula
desc "Make-like tool to download, build, and install software"
homepage "http://www.a-a-p.org"
url "https://downloads.sourceforge.net/project/a-a-p/aap-1.094.zip"
sha256 "3f53b2fc277756042449416150acc477f29de93692944f8a77e8cef285a1efd8"
bottle do
cellar :any_skip_relocation
rebuil... | 37.633333 | 94 | 0.765279 |
62c99d18d00d334576151f91b06dc25118cb788c | 171 | class AnswerPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.all
end
end
def update?
user.admin? || user == record.user
end
end
| 14.25 | 38 | 0.649123 |
5d1cbbc720f30baf6a7ef5c242fbd09a9f7594e6 | 967 | # frozen_string_literal: true
require 'spec_helper'
describe 'rundeck' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:params) do
{
gui_config: {
'rundeck.gui.title' => 'Test title',
'rundeck.gui.brand.html' => '... | 31.193548 | 76 | 0.585315 |
626b1931395664ce2f0b61657787a75ca37c00b8 | 508 | Rails.application.routes.draw do
devise_for :users, controllers: { registrations: 'users/registrations' }
root to: 'weather_data#daily'
get 'daily', to: 'weather_data#daily'
get 'weekly', to: 'weather_data#weekly'
get 'monthly', to: 'weather_data#monthly'
get 'yearly', to: 'weather_data#yearly'
resource... | 22.086957 | 74 | 0.69685 |
5d0f82130ddb33ec05072254b19de2caa323db8c | 19,634 | require "thread"
require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/object/duplicable"
require "active_support/core_ext/string/filters"
module ActiveRecord
module Core
extend ActiveSupport::Concern
included do
##
# :singleton-method:
#
# Accept... | 33.79346 | 119 | 0.632933 |
f75561e8c319192ae07bff840e9aa3fd15b6b92a | 1,415 | describe Catalog::UnshareResource, :type => :service do
let(:portfolio) { create(:portfolio) }
let(:group1) { instance_double(RBACApiClient::GroupOut, :name => 'group1', :uuid => "123") }
let(:permissions) { ['read', 'update'] }
let(:rs_class) { class_double("Insights::API::Common::RBAC::Service").as_stubbed_co... | 44.21875 | 142 | 0.708834 |
e83f4e5cbf7ecb539cdb50b087d1dddd16ab903e | 1,662 | module Intrigue
class UriCheckSecurityHeaders < BaseTask
include Intrigue::Task::Web
def metadata
{
:name => "uri_check_security_headers",
:pretty_name => "URI Check Security Headers",
:authors => ["jcran"],
:description => "This task checks for typical HTTP security headers on a we... | 29.157895 | 101 | 0.600481 |
e93077c42e1110c81e0a9db2cb3c18a165f70523 | 4,641 | # frozen_string_literal: true
RSpec.shared_examples 'resource mentions migration' do |migration_class, resource_class|
it 'migrates resource mentions' do
join = migration_class::JOIN
conditions = migration_class::QUERY_CONDITIONS
expect do
subject.perform(resource_class.name, join, conditions, fal... | 43.373832 | 151 | 0.751347 |
5d82ed5f626d17ffa9ebebae2abfbe164fe2d608 | 585 | class Node < Struct.new(:value, :left, :right)
end
root = Node.new(10,
Node.new(5,
Node.new(1)),
Node.new(50,
Node.new(40),
Node.new(100)))
def count(node, low, high, cunt)
return true if node.nil?
left ... | 21.666667 | 54 | 0.504274 |
f786b4404d50dd05f6422e4b829f34698532b1df | 622 | require_relative './github_lib'
require_relative './drone'
module Active_builds
def Active_builds.get_builds(repo_names, builds_server, builds_server_token, fn_get_builds, fn_get_active_branches)
branches_all_repos = fn_get_active_branches.call(repo_names)
builds = fn_get_builds.call(repo_names, builds_serve... | 38.875 | 117 | 0.78135 |
38872148298f19a31443e84e5a12aa6f8351c70a | 3,072 | # frozen_string_literal: true
module UiRules
class MarketingOrderRule < Base
def generate_rules # rubocop:disable Metrics/AbcSize
@repo = ProductionApp::OrderRepo.new
@party_repo = MasterfilesApp::PartyRepo.new
@calender_repo = MasterfilesApp::CalendarRepo.new
make_form_object
apply... | 38.886076 | 134 | 0.607422 |
9146451f518603c74e3a701b07810c4c5e8da597 | 2,230 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
end
test "should get new" do
get signup_path
a... | 26.235294 | 73 | 0.686996 |
ed7a71fb44ef68dcf6644308010e4e4d7a8b89b7 | 125 | class AddColumnToCharacter < ActiveRecord::Migration[6.0]
def change
add_column :characters, :image, :string
end
end
| 20.833333 | 57 | 0.752 |
ab0f0bb5c3efa62cd643307e689b95fe209558e2 | 1,153 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module BigTwoScoreboard
class Application < Rails::Application
# Settings in config/environments/* t... | 41.178571 | 99 | 0.734605 |
1a9dc7acbe44373b959e4fc74616a8df46cd8196 | 37 | module Daiku
VERSION = "0.2.2"
end
| 9.25 | 19 | 0.648649 |
2830618e6a36bb58efdc864dbd4720a3f4273b69 | 245 | require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'
set :database, "sqlite3:database.db"
# class Client < ActiveRecord::Base
# validates :name, presence: true, length: { minimum: 3 }
# end
get '/' do
erb :index
end | 18.846154 | 59 | 0.714286 |
3823e3f7e86d0ae53a4952b754eab39ad156739e | 6,577 | # frozen_string_literal: true
require './spec/spec_helper'
EXPECTED_TILE_UPGRADES = {
'18Chesapeake' => {
'X3' => %w[X7],
'X4' => %w[X7],
'X5' => %w[X7],
'X7' => %w[],
},
'1889' => {
'blank' => %w[7 8 9],
'city' => %w[5 6 57],
'town' => %w[3 58 437],
'3' => %w[],
'5' => %w[12... | 28.720524 | 117 | 0.459784 |
1d4522ed61afc9160ef4589067a2408b43cee982 | 2,720 | # == Schema Information
#
# Table name: sawmills
#
# id :integer not null, primary key
# name :string
# lat :float
# lng :float
# is_active :boolean default("true"), not null
# operator_id :integer not null
# created_at :datetime not null
# u... | 28.631579 | 87 | 0.597059 |
6190e8c11bdafa63daaf31957e5c93ce3556e4dc | 21,467 | require 'semantic_puppet'
module SemanticPuppet
# A Semantic Version Range.
#
# @see https://github.com/npm/node-semver for full specification
# @api public
class VersionRange
UPPER_X = 'X'.freeze
LOWER_X = 'x'.freeze
STAR = '*'.freeze
NR = '0|[1-9][0-9]*'.freeze
XR = '(x|X|\*|' + NR + '... | 29.206803 | 152 | 0.584292 |
e2fd8216d68af9f60700bb45774e0f10cc84e42e | 633 | module Frodo
class Query
class Criteria
module LambdaOperators
# Applies the `any` lambda operator to the given property
# @param property [to_s]
# @return [self]
def any(property)
set_function_and_argument(:any, property)
end
# Applies the `any` la... | 22.607143 | 65 | 0.578199 |
38ba15bff3728bd67f31bbf384584b095296ca98 | 123 | # frozen_string_literal: true
FactoryBot.define do
factory :roster do
sequence(:name) { |n| "Name #{n}" }
end
end
| 15.375 | 39 | 0.666667 |
390e8436978ad6966bff352a0f3fee1b98676010 | 1,573 | Pod::Spec.new do |spec|
spec.name = "AurorKit"
spec.version = "0.1.0"
spec.summary = "Swift extensions and tools"
spec.homepage = "https://github.com/almazrafi/AurorKit"
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = { "Almaz Ibragimov" => "almazrafi@gmail.com" }
spec.source = { :git... | 30.25 | 98 | 0.682772 |
d5d317939e16da7fa1a59c109e1b6f93678e379a | 805 | # frozen_string_literal: true
require "rails_helper"
describe Api::Eve::ManufacturingItemsController do
before { Setting.use_image_proxy = true }
describe "#index" do
it "returns list of manufacturing items" do
create(:eve_type,
type_id: 24_698,
name: "Drake",
published: true,
... | 25.967742 | 104 | 0.604969 |
4acdee2f88428efc2e3791262ad8387ff4d33a3f | 1,226 | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "minimal-mistakes-jekyll"
spec.version = "4.16.5"
spec.authors = ["Michael Rose"]
spec.summary = %q{A flexible two-column Jekyll theme.}
spec.homepage = ... | 42.275862 | 112 | 0.600326 |
282b2f1fb42ba78f115e1e723ef2424cc128b9d4 | 544 | Given(/^I navigate to the clientside form validation async submit demo page$/) do
click_link('clientside-form-validation/async-submit')
end
Given(/^I have filled out the async submit form$/) do
fill_in('Full name', :with => 'Foo')
end
Then(/^I am asked to wait while the form submits$/) do
assert_text('Waiting f... | 32 | 81 | 0.726103 |
0344933af7e29d50cfc9d9fb36f6a6298b5989ca | 3,047 | # frozen_string_literal: true
# Copyright (c) 2018 Yegor Bugayenko
#
# 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, co... | 40.092105 | 102 | 0.707581 |
870befbd9171a5b34e4df275e8b73667c154ac9f | 216 |
describe file('/etc/profile.d/rbenv.sh') do
it {should exist}
end
describe command('source /etc/profile.d/rbenv.sh; rbenv global') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match /2\./ }
end | 24 | 68 | 0.680556 |
013b8895f67c7f52f5991cf6f00e58af606ce32f | 1,533 | require 'spec_helper'
describe Gitlab::ImportExport::RepoRestorer do
describe 'bundle a project Git repo' do
let(:user) { create(:user) }
let!(:project_with_repo) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let!(:project) { create(:project) }
let(:export_... | 34.066667 | 118 | 0.688193 |
7953f9178703fedcbb34c41a8e8c3053c5edae53 | 825 | require 'yaml'
module Yello
class << self
def to_yaml(lists)
Yello::ToYaml.convert(lists)
end
end
module ToYaml
class << self
def convert(lists)
{}.tap{|h|
lists.each{|l|
h[l.name] = list(l)
}
}.to_yaml
end
def list(l)
... | 16.5 | 79 | 0.436364 |
33ef675fa655e62c99d62d1d136d1f397274406a | 720 | require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = 'Ruby on Rails Tutorial Sample App'
end
test 'should get home' do
get root_path
assert_response :success
assert_select('title', @base_title)
end
test 'should get help' do
get ... | 22.5 | 73 | 0.704167 |
8784adefa8ea5d7fe47ceaf74f83979591161a2c | 850 | module EventStore
module HTTP
module Controls
module NetHTTP
module Request
module Post
def self.example
stream_name = "testStream-#{SecureRandom.hex 7}"
request = Net::HTTP::Post.new "/streams/#{stream_name}"
request.body = text
... | 22.972973 | 69 | 0.464706 |
e202ee6d26d701dece55f85f0d1cd1d2d1f91f6e | 6,148 | require 'active_support'
require_relative '../ext/ext'
require_relative 'array_with_type'
require_relative 'default_validators'
require_relative 'type_conversion_support'
require_relative 'date_time_validator'
require_relative 'association_validator'
module Sequent
module Core
module Helpers
# Provides fun... | 35.537572 | 127 | 0.555465 |
b9fc58aac9abbebe85718752bf46d5e5128764c0 | 735 | module Helpers
class ErrorHandler
def self.handle_error(error, occured_when: nil)
yield
rescue error => e
error_log_response(occured_when, e)
end
def self.error_log_response(occured_when, error)
occured_when = " when #{occured_when}" unless occured_when.nil?
log_message = "An ... | 36.75 | 97 | 0.658503 |
e8eeb03219defbc552b97964cdaefc7104ccf59a | 1,011 | class ProviderProfilePolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.where(
user_id: user.id
)
end
end
def create?
# if the user doesn't have a provider profile already
user.provider_profile.nil?
end
def update?
user.provider_profile.present?
end
... | 19.442308 | 62 | 0.658754 |
396e84032a4570ab4e71d0049828481da7546edc | 1,878 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "sc... | 39.957447 | 85 | 0.771565 |
084ffdfbaa125f8ee1ff6db584df77f6ff3414cc | 159 | require 'test_helper'
class RestControllerTest < ActionController::TestCase
test "should get rest" do
get :rest
assert_response :success
end
end
| 15.9 | 53 | 0.748428 |
7aff8b6db0848f1e19e385cc3dfd5cbef72562f1 | 3,054 | require 'alerty'
require 'aws-sdk'
require 'dotenv'
require 'json'
Dotenv.load
class Alerty
class Plugin
class AmazonCloudwatchLogs
def initialize(config)
params = {}
params[:region] = config.aws_region if config.aws_region
params[:access_key_id] = config.aws_access_key_id if config... | 33.195652 | 205 | 0.596267 |
ac8e64984831e68d3da4c82e595ea9fbb56aa18b | 1,263 | # frozen_string_literal: true
require 'sprockets/digest_utils'
require 'sprockets/source_map_utils' if Gem::Version.new(::Sprockets::VERSION) >= Gem::Version.new('4.x')
class Terser
# A wrapper for Sprockets
class Compressor
VERSION = '1'
def initialize(options = {})
options[:comments] ||= :none
... | 25.26 | 105 | 0.627078 |
b905041c8d1bf8eb5e33bbbce970b54f4b3f8558 | 3,587 | # frozen_string_literal: true
require 'spec_helper'
describe Panoptes::Endpoints::JsonApiEndpoint do
let(:endpoint) do
described_class.new(auth: {}, url: 'http://example.com')
end
describe '#paginate' do
let(:payload) do
{
'subjects' =>
[
{
'id' => '1',... | 33.212963 | 110 | 0.526624 |
6a4f5ab7caaed38af06c55bac91545cb14009415 | 105,029 | # frozen_string_literal: true
require_relative 'spec_helper'
describe 'Asciidoctor::PDF::Converter - Running Content' do
context 'Activation' do
it 'should not attempt to add running content if document has no body' do
pdf = to_pdf <<~'EOS', enable_footer: true, analyze: true
= Document Title
... | 33.782245 | 186 | 0.635482 |
4a1e56641b4872c7a6f22b8672edb0c06f5d1547 | 206 | class AddDeletedAtOnCheckedItems < ActiveRecord::Migration
def self.up
add_column :checked_items, :deleted_at, :datetime
end
def self.down
remove_column :checked_items, :deleted_at
end
end
| 20.6 | 58 | 0.76699 |
ed07165ef48f9987d34296f3c84d5fddfe846c8f | 1,202 | cask "lilypond" do
version "2.22.1-1"
sha256 "efdc9ecd5da2e13804258ad739063fad3b0f587aac9fe0a0f89314e784474f58"
url "https://lilypond.org/downloads/binaries/darwin-x86/lilypond-#{version}.darwin-x86.tar.bz2"
name "LilyPond"
desc "Music engraving program"
homepage "https://lilypond.org/"
livecheck do
... | 25.574468 | 97 | 0.671381 |
1a47bf3e20115fe0def9ad6c69a5cbb50e082dc0 | 244 | class CreateDonations < ActiveRecord::Migration[6.0]
def change
create_table :donations do |t|
t.belongs_to :donor, null: false, foreign_key: true
t.float :amount
t.date :entered_on
t.timestamps
end
end
end
| 20.333333 | 57 | 0.668033 |
612403ea8007cfe2a885dde0bf9c79789fce469d | 2,406 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013 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 License at
#
# http://www.apache.org/licenses/LICEN... | 35.910448 | 118 | 0.709476 |
ab0279023fc1a3c691c6bf678fd7a4f5d67e3a32 | 6,414 | # frozen_string_literal: true
class ProposalsController < ApplicationController
before_action :authenticate_user!, except: [:show, :new, :create]
load_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, parent: false, thr... | 35.436464 | 124 | 0.686155 |
bb5e5d55648dcfea27df82ae443910379f31f53f | 327 | FactoryGirl.define do
factory :sys_user, class: SS::User do
name "sys_user"
email "sys@example.jp"
in_password "pass"
#sys_role_ids
end
factory :sys_user_sample, class: SS::User do
name { unique_id.to_s }
email { "user#{unique_id}@example.jp" }
in_password "pass"
#sys_role_ids
e... | 20.4375 | 46 | 0.666667 |
f708d0565f0655df673d7a30b03a93b5c56b6a19 | 1,210 | module APIv2
class K < Grape::API
helpers ::APIv2::NamedParams
desc 'Get OHLC(k line) of specific market.'
params do
use :market
optional :limit, type: Integer, default: 30, values: 1..100, desc: "Limit the number of returned data points, default to 30."
optional :period, type: I... | 43.214286 | 244 | 0.623967 |
03c46e96ec2802da8fb328e7d9bf1420218ed0ac | 1,731 | begin
require 'bdb'
rescue LoadError
puts "You need bdb gem to use Bdb moneta store"
exit
end
module Moneta
class Berkeley
def initialize(options={})
file = options[:file]
@db = Bdb::Db.new()
@db.open(nil, file, nil, Bdb::Db::BTREE, Bdb::DB_CREATE, 0)
unless options[:skip_ex... | 20.855422 | 103 | 0.552282 |
ab8a4dd0aa17c3ec984a45f3d73aacf8fc81485e | 3,708 | class Gitlab::Client
# Defines methods related to milestones.
# @see https://docs.gitlab.com/ce/api/milestones.html
module Milestones
# Gets a list of project's milestones.
#
# @example
# Gitlab.milestones(5)
#
# @param [Integer, String] project The ID or name of a project.
# @param... | 39.870968 | 99 | 0.66397 |
919c76ab4c71f5a0af80a4cb9338fad7f22df512 | 741 | # frozen_string_literal: true
module JiraConnect
class SyncFeatureFlagsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: 3
queue_namespace :jira_connect
feature_category :integrations
data_consistency :delayed, feature_flag: :load_balancing_f... | 27.444444 | 85 | 0.775978 |
79e83af82f0ba96aebec893bda53ba0f423113a6 | 1,449 | require File.dirname(__FILE__) + '/../../orawls_core'
module Puppet
#
Type.newtype(:wls_foreign_jndi_provider_link) do
include EasyType
include Utils::WlsAccess
extend Utils::TitleParser
desc 'This resource allows you to manage a datasource in an WebLogic domain.'
ensurable
set_command(... | 27.865385 | 123 | 0.692892 |
286d872937bd78200b55f7c957238de0671a0a50 | 50 | class PhysicalExamination < ApplicationRecord
end
| 16.666667 | 45 | 0.88 |
289b337b454037321c4296172a0b3998ef548820 | 1,479 | # 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::Web::Mgmt::V2015_08_01
module Models
#
# Routing rules in production experiments.
#
class Experiments
include MsRestA... | 26.410714 | 70 | 0.497634 |
7a3cfcc383f31f3f87f5f2b82f8fc36cc79dab22 | 143 | module Private::Withdraws
class BitcoinCashController < ::Private::Withdraws::BaseController
include ::Withdraws::Withdrawable
end
end
| 23.833333 | 68 | 0.783217 |
01e842d9b46bdb18a249cc993b30c024446ce002 | 109 | class TechnicalsController < ApplicationController
before_action :authenticate_user!
def index; end
end
| 18.166667 | 50 | 0.825688 |
ff3b235fdcf8c9c5c2ee4768818005305303f441 | 1,141 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'faraday_middleware/reddit/version'
Gem::Specification.new do |spec|
spec.name = "faraday_middleware-reddit"
spec.version = FaradayMiddleware::Reddit::VERSION
spec.authors ... | 40.75 | 90 | 0.67397 |
61f086d54a80caf46f09393dea3b3a90fecd76af | 427 | module MaintenanceNoticeHelper
def maintenance_notice
(start_time, end_time) = ENV['SHOW_DOWNTIME_BANNER'].split(',').map do |d|
Time.zone.parse(d.strip).strftime("%l%P")
end
day = I18n.localize(
Time.zone.parse(ENV['SHOW_DOWNTIME_BANNER'].split(',').last.strip), format: "%e %B %Y"
)
... | 30.5 | 99 | 0.681499 |
edd9c951f8469ff43254ccad944d203bd11045ab | 375 | class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :name
t.string :password_digest
t.string :email
t.integer :photo
t.integer :height
t.integer :weight
t.integer :bodyfat
t.integer :calorie_limit
t.boolean :admin... | 17.857143 | 48 | 0.626667 |
39c792cf3b9c60f3a8a822e5a7a088d7887dc0a7 | 3,922 | #
# Resource:: kernel_module
#
# The MIT License (MIT)
#
# Copyright 2016-2018, Shopify Inc.
# Copyright 2018, Chef Software, Inc.
require "chef/resource"
class Chef
class Resource
class KernelModule < Chef::Resource
resource_name :kernel_module
description "Use the kernel_module resource to manage... | 29.051852 | 168 | 0.609128 |
e90f712b4f776ebab72ef483efd1fa60ce609a5d | 855 | require 'test_helper'
class ProgrammeEditionTest < ActiveSupport::TestCase
setup do
stub_request(:get, /.*panopticon\.test\.gov\.uk\/artefacts\/.*\.js/).
to_return(:status => 200, :body => "{}", :headers => {})
end
def template_programme
p = ProgrammeEdition.new(:slug=>"childcare", :title=>"Childr... | 26.71875 | 120 | 0.68538 |
bfb02535d970a892efd7b0184c3371468e8292c5 | 1,973 | describe "fetching pacts to verify", pending: 'not yet implemented' do
before do
# td.create_pact_with_hierarchy("Foo", "1", "Bar")
# .create_consumer_version_tag("feat-1")
# .create_provider_version_tag("master")
end
let(:path) { "/pacts/provider/Bar/verifiable" }
let(:query) do
# need to p... | 46.97619 | 186 | 0.698429 |
91a0c1cbf6736272190249cc1ab6a81a9541e346 | 3,598 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
... | 27.052632 | 114 | 0.609783 |
b9bb1cca88af1004695ff4e8ba95d4b70205d1b5 | 367 | require 'httparty'
module Proz
class GetSingleWiwoEntry
include HTTParty
base_uri "https://api.proz.com/v2"
attr_reader :token, :wiwo_id
def initialize(token:, wiwo_id:)
@token = token
@wiwo_id = wiwo_id
end
def get
self.class.get("/wiwo/#{wiwo_id}", headers: { 'Authorizati... | 20.388889 | 92 | 0.632153 |
0359471a4cdbfbaadfc3ced343a04c2e80be38cf | 11,694 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_postgresql'
module Azure::Postgresql::Profiles::Latest
module Mgmt
Servers = Azure::Postgresql::Mgmt::V2017_12_01::Servers
Replicas =... | 47.730612 | 277 | 0.733624 |
791d3c662fd5e8df39d422e7acaf2535d64977b5 | 2,457 | # Frozen-string-literal: true
# Copyright: 2012 - 2018 - MIT License
# Encoding: utf-8
module Jekyll
module Assets
class Default < Extensible
# --
# @param [String] type the content type.
# @param [Hash] args the args from the liquid tag.
# Get all of the static defaults.
# @return ... | 26.138298 | 78 | 0.527473 |
6a8031c30b15e0d8853505e555d654fd6bcb49ff | 320 | require 'spec_helper'
describe Seek::Indexer do
subject { described_class.new }
describe 'add' do
let(:document) { Seek::Indexer::Document.new('xxy', 'I know where he is') }
it 'should add a document' do
subject.add(document)
expect(subject.dictionary['know']).to include 'xxy'
end
end
end
| 26.666667 | 79 | 0.671875 |
f8d820b776b625c26d516924fda7c27e6632d842 | 11,209 | require 'puppet/parser/parser'
require 'puppet/util/warnings'
require 'puppet/util/errors'
require 'puppet/util/inline_docs'
require 'puppet/parser/ast/leaf'
require 'puppet/dsl'
class Puppet::Resource::Type
Puppet::ResourceType = self
include Puppet::Util::InlineDocs
include Puppet::Util::Warnings
include Pup... | 32.6793 | 199 | 0.686413 |
394ee6cef56c0bfb3d299bd601d9a090a1d29b5c | 147 | class LinkingDepartment < ActiveRecord::Migration
def change
change_table :courses do | t |
t.belongs_to :department
end
end
end
| 18.375 | 49 | 0.707483 |
d55f09f70e26d545438626c88db573b1c61e6636 | 2,271 | require 'rails_helper'
include Warden::Test::Helpers
RSpec.describe Admin::PressSummariesController do
let!(:admin) {create(:admin, superadmin: true)}
let!(:form_answer) {create(:form_answer)}
let!(:press_summary) {create(:press_summary, form_answer: form_answer)}
before do
sign_in admin
end
describe... | 36.629032 | 125 | 0.713342 |
383888c2c0c01b7f585f58dbae2b370d57c8a3d4 | 1,148 | Gem::Specification.new do |s|
s.name = 'logstash-input-unix'
s.version = '3.0.2'
s.licenses = ['Apache License (2.0)']
s.summary = "Read events over a UNIX socket."
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeli... | 39.586207 | 205 | 0.646341 |
f89a87261a3542a28cf33567a052e4a7b18b53cb | 543 | describe WelcomeController, type: :controller do
describe 'ability to disable cabinet UI' do
before { ENV['DISABLE_CABINET_UI'] = nil }
context 'when cabinet UI is enabled' do
it 'should return HTTP 200' do
get :index
expect(response).to have_http_status(200)
end
end
con... | 24.681818 | 50 | 0.644567 |
bb1e016850bf3a4bcd499763016cd93109fc5dbc | 10,150 | # encoding: utf-8
require 'adhearsion/punchblock_plugin'
require 'adhearsion/linux_proc_name'
require 'rbconfig'
module Adhearsion
class Initializer
class << self
def start(*args, &block)
new(*args, &block).start
end
end
DEFAULT_PID_FILE_NAME = 'adhearsion.pid'
attr_reader :pa... | 28.672316 | 151 | 0.631921 |
01b468512d6d5533ea1bd02ecee25d1b857b0399 | 2,601 | # rubocop:disable Layout/LineLength, Lint/RedundantCopDisableDirective
# == Schema Information
#
# Table name: permissions
#
# id :bigint not null, primary key
# permission :string not null
# created_at :datetime not null
# updated_at :date... | 35.148649 | 101 | 0.723183 |
4a8cc25739f38406df7c078712a041486c47a459 | 161 | class CreateEnemies < ActiveRecord::Migration[6.0]
def change
create_table :enemies do |t|
t.string :name
t.integer :room_id
end
end
end
| 17.888889 | 50 | 0.664596 |
e86185635cbefebb57ae60f89a109286fe16ba0a | 1,306 | # frozen_string_literal: true
require 'ibm-cloud-sdk'
require_relative 'vpc_vcr'
RSpec.describe 'Test vpc response exceptions', :vcr do
let(:log) { Logger.new($stdout).tap { |l| l.level = Logger::DEBUG } }
let(:vpc) { VCR.use_cassette('Test_vpc_API/vpc', { tags: %i[require_2xx token_request] }) { IBM::CloudSDK.ne... | 34.368421 | 144 | 0.712098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.