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 |
|---|---|---|---|---|---|
f7f0acaf0e5b6c576ea3e30e2e09d01eca50e362 | 224 | class StatusesController < ApplicationController
def show
status = Status.new(delayed_job_scope: Delayed::Job.all)
render json: { status: status.status, failures: status.failures }, status: status.status
end
end | 32 | 92 | 0.758929 |
ffacb5fd510a206943c44bcbe9bc21cf9e4fcf1d | 2,493 | module Refinery
module Resources
include ActiveSupport::Configurable
config_accessor :dragonfly_insert_before, :dragonfly_secret, :dragonfly_url_format, :dragonfly_url_host,
:max_file_size, :pages_per_dialog, :pages_per_admin_index,
:s3_backend, :s3_bucket_name, :s3_re... | 34.625 | 138 | 0.697553 |
1a3471a18863deafa6b91b0428e10116f1c9cd01 | 1,330 | =begin
class UserSessionsController < ApplicationController
def create
#logger.debug("Params for user_session: #{params.inspect}")
#logger.debug("previous page: #{params[:user_session][:redirect_url]}")
@user_session = UserSession.new(params[:user_session])
puts "\n--------------\ncreated user sessio... | 28.913043 | 96 | 0.692481 |
8731565f8431f697b1804448d12ebaf0807d87db | 128 | require 'spec_helper'
require 'linkser'
describe Linkser do
it "should be valid" do
Linkser.should be_a(Module)
end
end | 16 | 31 | 0.742188 |
6a8638ee77b02d513c5391cf793abfdadab421ab | 99 | # desc "Explaining what the task does"
# task :graphql_voyager_rails do
# # Task goes here
# end
| 19.8 | 38 | 0.717172 |
91f6bc0cd61c63e9905d29ae08ca79089136264e | 5,336 | # frozen_string_literal: true
require('timecop')
module Veriff
RSpec.describe Session do
subject(:session) { described_class.new(params) }
let(:params) { { id: 123 } }
describe '#create' do
before do
allow(Veriff)
.to receive(:post)
.with('/sessions', body: instance_o... | 33.142857 | 129 | 0.568028 |
393955ecfb1b28d383b3b50eafbfb6185d5a480d | 1,180 | require 'spec_helper'
describe Billimatic::Resources::EmailTemplate do
let(:entity_klass) { Billimatic::Entities::EmailTemplate }
let(:http) { Billimatic::Http.new('bfe97f701f615edf41587cbd59d6a0e8') }
subject { described_class.new(http) }
it 'has a instance of Billimatic::Http' do
expect(subject.http).t... | 29.5 | 81 | 0.689831 |
034a063f146f014002fe4ef365d0e5a7cf2ceaa5 | 2,059 | require 'spec_helper'
require 'rails/generators/ripple/model/model_generator'
shared_examples_for :model_generator do
it("should create the model file"){ model_file.should exist }
it { should contain(class_decl) }
it("should create the attribute declarations") do
attributes.each do |name, type|
should ... | 31.676923 | 79 | 0.739194 |
f8152891454a703c8c6033b4f75f5c7be24a2ed8 | 663 | # -*- coding: utf-8 -*-
require_relative 'atom'
module MIKU
class Macro
include Atom
def initialize(args, list)
@args = args
@list = list
end
def macro_expand(*args)
if not(args.is_a? StaticCode) and args.car.is_a?(StaticCode)
args.extend(StaticCode).staticcode_copy_info(ar... | 24.555556 | 82 | 0.606335 |
081f654fd08f303dc80ab4daeeb3bc8a3ae33152 | 356 | module UsersHelper
# Returns the Gravatar for the given user.
def gravatar_for(user, options = { size: 80 })
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.... | 32.363636 | 80 | 0.702247 |
6224971f6842214eae70d8226d1b2944d9003ee7 | 1,795 | #
# Author:: Hans Chris Jones <chris.jones@lambdastack.io>
# Cookbook Name:: cepheus
#
# Copyright 2018, LambdaStack
#
# 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/... | 33.240741 | 121 | 0.704735 |
394454b1e9851028acbee0e0de5c5391f704b63e | 1,462 | #
# Author:: Doug MacEachern <dougm@vmware.com>
# Cookbook Name:: windows
# Recipe:: ivy
#
# Copyright 2010, VMware, 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.a... | 26.107143 | 74 | 0.69357 |
26b86a79ab1613dd7c2caa152752cd02d635426c | 3,031 | require 'spec_helper'
describe 'neutron::agents::metadata' do
let :pre_condition do
"class { 'neutron': rabbit_password => 'passw0rd' }"
end
let :params do
{ :package_ensure => 'present',
:debug => false,
:enabled => true,
:auth_url => 'http://localhost:3... | 34.83908 | 129 | 0.672055 |
ed97ee1b8977779db72027c2bf006a0a98142ccf | 116 | class AddStatusToReviews < ActiveRecord::Migration
def change
add_column :reviews, :status, :string
end
end
| 19.333333 | 50 | 0.758621 |
f78b20f4e0f6163d59ace44fcb5e9255e4f3442b | 399 | Rails.application.config.middleware.insert 0, Rack::Attack
if Rails.env.production?
Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout
Rack::Timeout.timeout = 10 # seconds
end
Rails.application.config.middleware.insert_after ActiveRecord::QueryCache, Rack::Protection,
... | 39.9 | 95 | 0.704261 |
d5486656bb3501c7ba843d63fa6b1f0ce1ec28be | 2,078 | class MData
attr_accessor :order
def initialize(path)
@serial = 0
@highs = []
@lows = []
@ask = 0
@bid = 0
@pip = 0
@atr = 0
@basis = 0
@seconds = 0
@path = path
@order = nil
end
def collect
File.open(@path, 'r').each do |line|
arr = line.strip.split('_')
case arr[0].downcase
when ... | 20.174757 | 79 | 0.546198 |
1d62e95f318f6d4678a47e6cdba42e21203f9873 | 820 | #
# Be sure to run `pod lib lint LBPropertyAccessor.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = '... | 41 | 109 | 0.641463 |
b9b10393c45952bce4a466f5e87795e3e4b1583c | 1,877 | # 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::IotHub::Mgmt::V2018_04_01
module Models
#
# Input for testing route
#
class TestRouteInput
include MsRestAzure
... | 26.069444 | 70 | 0.498135 |
bbe12583afcb66f59e6dfec31316f22b7efb005f | 135 | class AddColumnToLocation < ActiveRecord::Migration[5.2]
def change
add_reference :locations, :zone, foreign_key: true
end
end
| 22.5 | 56 | 0.762963 |
e960aeef9394af97f570e40efb8fa74468b11deb | 3,541 | # frozen_string_literal: true
# LICENSE
#
# MIT License
#
# Copyright (c) 2017-2018 Cryptomover
#
# 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 limit... | 37.670213 | 97 | 0.763909 |
f7b2ff4a5188df78a1b3cdcaefafd272a1db02cd | 289 | class AddExpressTokenToOrders < ActiveRecord::Migration
def self.up
add_column :orders, :express_token, :string
add_column :orders, :express_payer_id, :string
end
def self.down
remove_column :orders, :express_payer_id
remove_column :orders, :express_token
end
end
| 24.083333 | 55 | 0.754325 |
9185a1c1ab45b7c9ce82602a7890486c0e6425f2 | 9,458 | # A time period during which Organizations, including {HbxProfile}, who are eligible for a {BenefitSponsorship}, may offer
# {BenefitPackage}(s) to participants within a market place. Each {BenefitCoveragePeriod} includes an open enrollment
# period, during which eligible partipants may enroll.
class BenefitCoveragePe... | 40.418803 | 187 | 0.740643 |
381fcad1de085fbd278c6eb8a66af935aaef3934 | 1,282 | # frozen_string_literal: true
module Mutations
module AuditEvents
module ExternalAuditEventDestinations
class Create < Base
graphql_name 'ExternalAuditEventDestinationCreate'
authorize :admin_external_audit_events
argument :destination_url, GraphQL::Types::String,
... | 31.268293 | 122 | 0.662246 |
61b4b2a59c2e1e02a4ba6461f539ebec0ddc91d2 | 11,442 | # frozen_string_literal: true
require 'spec_helper'
describe 'a simple mounted api' do
before :all do
class CustomType; end
class SimpleMountedApi < Grape::API
desc 'Document root'
get do
{ message: 'hi' }
end
desc 'This gets something.',
notes: '_test_'
g... | 35.206154 | 189 | 0.468712 |
e8f6db28b30a6d3cb5516031491fe01cd5603582 | 1,414 | unless defined?(Sass::MERB_LOADED)
Sass::MERB_LOADED = true
module Sass::Plugin::Configuration
# Different default options in a m environment.
def default_options
@default_options ||= begin
version = Merb::VERSION.split('.').map {|n| n.to_i}
if version[0] <= 0 && version[1] < 5
... | 28.857143 | 76 | 0.584866 |
7a5ef27d2060b54b004418ff272370e236519671 | 4,261 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.... | 44.852632 | 129 | 0.744192 |
ac0f1fd4541a137d3791ff71333057a4091dcca6 | 694 | cask 'munki' do
version '3.4.1.3557'
sha256 '3da472f032a2bd1e37ccaca9d8398f382fe5c0f16f654fe71fb632cd2b7e9bf8'
# github.com/munki/munki was verified as official when first introduced to the cask
url "https://github.com/munki/munki/releases/download/v#{version.major_minor_patch}/munkitools-#{version}.pkg"
app... | 36.526316 | 112 | 0.667147 |
7a0ced1af0d1001f576e0cce0e3dfcdf1cf90705 | 237 | # frozen_string_literal: true
module Meals
# Join model for Meals and Communities
class Invitation < ApplicationRecord
acts_as_tenant :cluster
belongs_to :meal, class_name: "Meals::Meal"
belongs_to :community
end
end
| 19.75 | 47 | 0.751055 |
e9b5acfc1e663441a24c4fafcbf159ca7d457b74 | 673 | # -*- coding: utf-8 -*-
module DataMapper
module Validation
module Fixtures
class BasketballPlayer
#
# Behaviors
#
include DataMapper::Resource
#
# Properties
#
property :id, Serial
without_auto_validations do
propert... | 19.228571 | 75 | 0.558692 |
f7d0e42b48da8bcae07df3519517a92d38bfcb9d | 1,248 | # encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_hero_carousel'
s.version = '0.0.9'
s.summary = 'Carousel with large and small images, and optional free-form HTML, for each position'
s.description = 'Carousel with large and small images, and op... | 39 | 104 | 0.703526 |
79ae39004156e0dbd6a1267d03620a5915b08046 | 6,555 | require_relative '../fixtures/classes'
require_relative '../fixtures/encoded_strings'
describe :array_join_with_default_separator, shared: true do
before :each do
@separator = $,
end
after :each do
$, = @separator
end
it "returns an empty string if the Array is empty" do
@subject.new([]).send(@... | 36.016484 | 107 | 0.676583 |
bf5d910ffad3b58c17156b17e963fee57583987e | 865 | require 'spec_helper'
describe "gws_monitor_admins", type: :feature, dbscope: :example do
let(:site) { gws_site }
let(:g1) { create(:gws_group, name: "#{site.name}/g-#{unique_id}") }
let(:g2) { create(:gws_group, name: "#{site.name}/g-#{unique_id}") }
let(:item1) do
create(
:gws_monitor_topic, attend... | 28.833333 | 124 | 0.643931 |
ff4950d0376a71916b87d54946bc411e248ae5dc | 512 | module Dossier
class Query
attr_reader :string, :report
def initialize(report)
@report = report
@string = report.sql.dup
end
def to_s
compile
end
private
def compile
string.gsub(/\w*\:[a-z]{1}\w*/) { |match| escape(report.public_send(match[1..-1])) }
end
... | 16.516129 | 90 | 0.558594 |
6aae8e2303c598561862eae247306a0fd2842048 | 830 |
require 'songdown_compiler/nodes/chords_line'
require 'songdown_compiler/nodes/lyrics_line'
class SongdownCompiler
class VersesHandler
def self.handle_common_verse(lines)
lines.each_with_index.map do |line, i|
current_line_number = i + 1 # Undo 0-based index
# Every odd-numbered line is c... | 25.151515 | 72 | 0.678313 |
61179b2cf3e0f59dff42ae064add64c3609a1f6a | 186 | class AddOauthSettings < ActiveRecord::Migration[5.1]
def change
add_column :applications, :oauth_precedence, :string, default: "global,user,application_instance,course"
end
end
| 31 | 108 | 0.784946 |
79b24e651e5365ef6462d433830524e5616f6a21 | 3,507 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::FILEFORMAT
def initialize(info={})
super(update_info(info,
'Name' ... | 36.154639 | 114 | 0.558027 |
79231911600350cd42cbabc8bc8ba627e095b83b | 1,824 | class Aubio < Formula
desc "Extract annotations from audio signals"
homepage "https://aubio.org/"
url "https://aubio.org/pub/aubio-0.4.9.tar.bz2"
sha256 "d48282ae4dab83b3dc94c16cf011bcb63835c1c02b515490e1883049c3d1f3da"
revision 2
livecheck do
url "https://aubio.org/pub/"
regex(/href=.*?aubio[._-]v... | 41.454545 | 106 | 0.726425 |
5d7ab9118c0e201248b1144914797e6e1d5e016a | 448 | require File.dirname(__FILE__) + '/../../../spec_helper.rb'
module Spec
module Runner
module Formatter
describe "ProgressBarFormatterDryRun" do
before(:each) do
@io = StringIO.new
@formatter = ProgressBarFormatter.new(@io)
@formatter.dry_run = true
end
it "should not produce summary... | 20.363636 | 59 | 0.638393 |
18249fd9c5855400cb2ec10b93bdd993a9e58b3d | 1,486 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../../lib/rubocop/cop/sorbet/constants_from_strings'
RSpec.describe(RuboCop::Cop::Sorbet::ConstantsFromStrings, :config) do
subject(:cop) { described_class.new(config) }
def message(method_name)
"Don't use `#{method_name}`, it makes th... | 28.576923 | 98 | 0.580754 |
b9a664e6a46e0363d3531f0516b238f7a9c48a8a | 1,602 | # frozen_string_literal: true
require "net/http"
EXAMPLE_APP_DIR = File.expand_path(File.join("..", "example"), __dir__)
RSpec.describe "Express" do
before(:context) do
@app = AppRunner.new("npm run start", EXAMPLE_APP_DIR)
@app.run
@app.wait_for_start!("Example app listening at")
end
after(:contex... | 25.03125 | 85 | 0.631086 |
5dd441fc93c94383e6b68b76118e4815238042a2 | 2,633 | require 'fetchers/base_list_fetcher'
module VCAP::CloudController
class PackageListFetcher < BaseListFetcher
class << self
def fetch_all(message:)
filter(message, joined_dataset)
end
def fetch_for_spaces(message:, space_guids:)
dataset = joined_dataset.where(table_column_name(A... | 32.506173 | 98 | 0.636536 |
bb07ad53b529dc35a955e8aa681abe204e246683 | 1,086 | require 'spec_helper'
describe Quill::Command do
describe "being built" do
it "takes a command string and an execution context to run in" do
context = stub_everything("Execution Context")
command = Quill::Command.build "QUIT\n", context
command.should be_kind_of Quill::Command
command.nam... | 33.9375 | 86 | 0.690608 |
01d60aa48ecb4215510253cb2f87da2c5a8210ca | 665 | require 'spec_helper'
require 'utils/numeric'
describe String do
before do
@int = '123'
@float = '-123.567'
@alpha = 'hello'
@nan = '4ha444.6'
end
context "when checking if it is numeric" do
it "should detect integers" do
@int.should be_integer
@float.should_not be_integer
... | 20.151515 | 45 | 0.640602 |
1c47b7546c1d766281287d60409ad2e9af3f148a | 444 | module Knife
class PartialSearch
class FakeNode < Hash
def name
self['name']
end
def chef_environment
self['chef_environment']
end
def run_list
self['run_list'].join(', ')
end
def [](key)
super(key.to_s)
end
def kind_of?(klass... | 15.857143 | 37 | 0.493243 |
d59af8562ef661a6d219f40e9479d904d55e7af8 | 268 | module Gifts
class TableBase
extend Forwardable
def_delegators :table, :count, :records, :select, :size
def initialize(database)
@db = database
define_schema
end
protected
def table
Groonga[table_name]
end
end
end
| 14.105263 | 59 | 0.645522 |
f8a5d7527aa97947c0a645cec39e68237ec7d134 | 294 | class UsersController < ApplicationController
get '/home' do
redirect '/login' if !logged_in?
@user = current_user
@rec_plants = @user.recent_plants
@overdue_plants = @user.overdue_plants
@fert_overdue_plants = @user.fert_overdue_plants
erb :'/users/home'
end
end
| 22.615385 | 52 | 0.710884 |
bfa6d496d0d61fb7f6c2e0e0e2f1c3d755b999c8 | 1,820 | ## Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO [, ANY ADDITIONAL AFFILIATION]
## ALL RIGHTS RESERVED.
##
## 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/licen... | 41.363636 | 77 | 0.757692 |
0334f8f8ef3f187d942fe52ffa88b0d59f8263a1 | 35,253 | # 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... | 53.091867 | 207 | 0.633393 |
b9e592a194f49fb371f6ee6e468a8976781ff6a6 | 179 | class PlanSerializer < ActiveModel::Serializer
attributes :id, :name, :plan_type, :city, :published, :color, :timeframes, :user_id
has_many :timeframes
belongs_to :user
end
| 29.833333 | 85 | 0.75419 |
268d34a4191f910fd597a57a79fa8cb7a45e9fa3 | 342 | module VCAP::CloudController
module V3
class CreateServiceCredentialBindingJobActor
def display_name
'service_bindings.create'
end
def resource_type
'service_credential_binding'
end
def get_resource(resource_id)
ServiceBinding.first(guid: resource_id)
... | 19 | 48 | 0.681287 |
f7f93668ec8e543ee239e3822c4aa022503911ce | 319 | # This file acts as the environment
require_relative "./uniquely_you/version"
require_relative './uniquely_you/cli'
require_relative './uniquely_you/api'
require_relative './uniquely_you/bag'
require_relative './uniquely_you/product'
require 'pry'
require 'httparty'
require 'word_wrap/core_ext'
require 'word_wrap'
| 22.785714 | 41 | 0.802508 |
0359a82d6028b227ab4a52d0f5ad5d5ef87a0e55 | 4,516 | require_relative 'app_helpers_test_base'
class TipTest < AppHelpersTestBase
def self.hex_prefix
'Qd4'
end
include TrafficLightTipHelper
test 'D52',
'traffic light tip for individual kata does not have avatar-image' do
in_new_kata do |kata|
files = kata.files
stdout = file("Expected: 42... | 33.701493 | 133 | 0.577502 |
f7d853e28b44f0c9e6cc9cf1aa45b87a6d32a811 | 3,406 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 31.247706 | 80 | 0.662948 |
8785d0c59d348067565436f98815f03ec7efd921 | 418 | # frozen_string_literal: true
class ReviewableUserSerializer < ReviewableSerializer
attributes :link_admin, :user_fields
payload_attributes(
:username,
:email,
:name
)
def link_admin
scope.is_staff? && object.target.present?
end
def user_fields
object.target.user_fields
end
def... | 16.076923 | 64 | 0.729665 |
f89d608678c14e084d84d0df2d69275d9b8e207a | 803 | TAP_MIGRATIONS = {
"aimage" => "homebrew/boneyard",
"blackbox" => "homebrew/boneyard",
"boost149" => "homebrew/versions",
"cmucl" => "homebrew/binary",
"colormake" => "homebrew/headonly",
"comparepdf" => "homebrew/boneyard",
"denyhosts" => "homebrew/boneyard",
"drizzle" => "homebrew/boneyard",
"grads"... | 32.12 | 40 | 0.633873 |
181111540629bf427b95c4ebe355c7e9277682d1 | 3,519 | require 'forwardable'
require 'resource'
require 'checksum'
require 'version'
require 'build_options'
require 'dependency_collector'
require 'bottles'
class SoftwareSpec
extend Forwardable
attr_reader :name
attr_reader :build, :resources, :owner
attr_reader :dependency_collector
def_delegators :@resource, ... | 25.135714 | 82 | 0.677181 |
01ef2f36369277aecb6484c42ea90db3b82cfbd3 | 98 | # frozen_string_literal: true
module PartialUniverseButtonComponent
extend ComponentHelper
end
| 16.333333 | 37 | 0.867347 |
1ce2e90b4cbf2cf36dbeddea532d947d00fdbb61 | 328 | # frozen_string_literal: true
require 'happymapper'
require 'jacoco/model/counter'
module Jacoco
# Jacoco method model
class Method
include HappyMapper
tag 'method'
attribute :name, String
attribute :desc, String
attribute :line, Integer
has_many :counters, Jacoco::Counter, xpath: '.'
... | 17.263158 | 51 | 0.710366 |
26c1684999bbd76e1e50015997e024f2c5147aa8 | 772 | class Figgy
# The backing object for a {Figgy} instance.
class Store
def initialize(finder, config)
@finder = finder
@config = config
@cache = {}
end
# Retrieve the value for a key, expiring the cache and/or loading it
# if necessary.
#
# @raise [Figgy::FileNotFound] if n... | 22.057143 | 78 | 0.59715 |
62328eea8f30aeb96c166626adf19f81bc8f84ec | 670 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module LindaBelcherDancing
class Application < Rails::Application
# Initialize configuration defaults for originally gener... | 33.5 | 82 | 0.768657 |
3968649ff7e25fbae92f05e8836e532af7e20157 | 616 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.image... | 38.5 | 82 | 0.761364 |
618e9fa39eeb006feb132e9871a108cd98dc04ff | 522 | require 'rom/schema'
RSpec.describe ROM::Schema, '#canonical' do
subject(:schema) {
define_schema(:users, id: :Integer, name: :String)
}
it 'returns self by default' do
expect(schema.canonical).to be(schema)
end
it 'returns canonical schema from a projected schema' do
expect(schema.project(:id)... | 21.75 | 58 | 0.701149 |
6ab87e1e1019b90df65e5e17a866926868e20cf6 | 159 | desc "This task is called by the Heroku scheduler add-on to sync up NDBNMember records"
task :sync_ndbn_members => :environment do
SyncNDBNMembers.sync
end
| 26.5 | 87 | 0.792453 |
1df3bfbd137ec26be18e605fa9da8760fc6abeb6 | 10,165 | # frozen_string_literal: true
require_relative 'support/test_helper'
describe DataStructures::List do
subject { DataStructures::List.new }
describe '#append' do
it do
expect(subject.size).must_equal(0)
subject.append('1')
expect(subject.size).must_equal(1)
expect(subject.inspect).mus... | 29.042857 | 78 | 0.603345 |
2632e0c221d8354c29efec9b98879500eccb4f83 | 473 | # encoding: utf-8
require 'helper'
class TestFakerNamePH < Test::Unit::TestCase
PH_REGEXP = /\A([\wñÑú-]+\.? ?){2,5}\z/
def setup
@tester = FFaker::NamePH
end
def test_name
assert_match(PH_REGEXP, @tester.name)
end
def test_last_name
assert_match(PH_REGEXP, @tester.last_name)
end
def t... | 16.892857 | 54 | 0.67019 |
d523b09a882313d2820eb6794988810c6c314580 | 847 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "IO#ioctl" do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_io.ioctl(5, 5) }.should raise_error(IOError)
end
platform_is :os => :linux do
it "resizes an empty S... | 29.206897 | 72 | 0.635183 |
87d94a69f53d9b8e1ebfab3f1cfc8551d9a29380 | 2,896 | class ProjectsController < ApplicationController
before_filter :authenticate_user!
# GET /projects
# GET /projects.json
def index
@projects = Project.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @projects }
end
end
# GET /projects/1
# GET /... | 23.933884 | 103 | 0.631215 |
08b1686ed272c9be5bbb1a7a91c9c78e8073dcd6 | 2,138 | class Cvsync < Formula
desc "Portable CVS repository synchronization utility"
homepage "https://www.cvsync.org/"
url "https://www.cvsync.org/dist/cvsync-0.24.19.tar.gz"
sha256 "75d99fc387612cb47141de4d59cb3ba1d2965157230f10015fbaa3a1c3b27560"
license "BSD-3-Clause"
livecheck do
url :homepage
regex(... | 37.508772 | 107 | 0.724509 |
33172e159a2cb104543818a2829cc9633a8a0ae5 | 45,738 | require "tmpdir"
require "digest/md5"
require "benchmark"
require "rubygems"
require "language_pack"
require "language_pack/base"
require "language_pack/ruby_version"
require "language_pack/helpers/nodebin"
require "language_pack/helpers/node_installer"
require "language_pack/helpers/yarn_installer"
require "language_p... | 34.914504 | 259 | 0.68993 |
b958b78e099222700fbd9ee8a6708a784fb94a53 | 107 | FactoryGirl.define do
factory :adesao do
user
topico { FactoryGirl.create(:proposta) }
end
end
| 15.285714 | 44 | 0.700935 |
ed5835f52042c65d6d1f56f841c60f35da742b5f | 1,578 | require 'multi_sync/target'
require 'multi_sync/resources/remote_resource'
module MultiSync
class LocalTarget < Target
attribute :connection, Fog::Storage, lazy: true, default: lambda { |target, _|
Fog::Storage.new(target.credentials.merge(provider: :local))
}
def files
files = []
dir... | 32.875 | 142 | 0.68948 |
264b822ee96cfdcd02d70781b8f890f69ef373d0 | 1,289 | module Microtest
def Microtest.run(tests)
n_tests = 0
n_failed = 0
tests.methods
.select {|symbol| symbol.to_s.start_with? 'test_' }
.each do |symbol|
tests.state = SingleTestState.new symbol.to_s
tests.run_one_test symbol
n_tests += 1
unless tests.state.ok
n_failed += 1
end
en... | 18.15493 | 76 | 0.645462 |
08b2f113b008a52e33a95c304b6f32649fdd76a4 | 40 | module ProgramClassificationsHelper
end
| 13.333333 | 35 | 0.925 |
28ab6f91f7bde5e79a03dee7a1ddb83b896a6e10 | 608 | module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
html = <<-HTML
<div class="alert alert-danger alert-dismissible show" role="alert">
<button type="button" class="close" data-dismiss="ale... | 25.333333 | 83 | 0.661184 |
1c07151a2d3d71d6d6c02f5816681e61ed6b2774 | 5,256 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 29.2 | 86 | 0.673516 |
79b559e6c74cf74893482952254ae12baf8864eb | 916 | # coding: utf-8
module Ruboty
module CalendarAlert
class Alert
attr_reader :event
def initialize(event)
@event = event
end
def margin
10
end
def id
event.uid.to_s
end
def body
body = "#{event.summary} まで#{margin}分です。"
body... | 18.693878 | 92 | 0.545852 |
bf14ef426a285498d07b93443ee34924a0ae6f00 | 755 | namespace :versioner do
desc "Get the app's version number"
task :version => :environment do
puts Versioner.version
end
desc "Increment the major version number by 1"
task :increment_major => :environment do
puts Versioner.increment_major
end
desc "Increment the minor version number by 1"
task... | 27.962963 | 74 | 0.725828 |
f8d030ca12a10dac2ed500e24ce2cc7b632a172a | 4,895 | module VmShowMixin
extend ActiveSupport::Concern
def explorer
@explorer = true
@lastaction = "explorer"
@timeline = @timeline_filter = true # need to set these to load timelines on vm show screen
if params[:menu_click] # Came in from a chart context menu click
@_params[:id] = ... | 33.758621 | 133 | 0.665986 |
ab4394eb15fc836094e65a5c576106f0a06395ba | 1,626 | Rails.application.routes.draw do
resources :apartments
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# ... | 27.559322 | 84 | 0.648831 |
61cb5b25b69a6db472db027571ee55b3cbbd8db6 | 320 | # frozen_string_literal: true
module NgpVan
class Client
module SurveyQuestions
def survey_questions(params: {})
get(path: 'surveyQuestions', params: params)
end
def survey_question(id:, params: {})
get(path: "surveyQuestions/#{id}", params: params)
end
end
end
end
| 20 | 58 | 0.640625 |
79426fadfa4b9881f4d883f744c9da2a94bf2dda | 238 | class ChangeProjectsIdentifierLimit < ActiveRecord::Migration
def self.up
change_column :projects, :identifier, :string, :limit => nil
end
def self.down
change_column :projects, :identifier, :string, :limit => 20
end
end
| 23.8 | 64 | 0.726891 |
87899521dd82958d72e905fb58839bc2a96fb932 | 998 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jekyll-diagrams/version'
Gem::Specification.new do |spec|
spec.name = 'jekyll-diagrams'
spec.summary = 'Jekyll plugins for diagrams support'
spec.version = Jekyll::Diagrams::VERSION
spe... | 34.413793 | 111 | 0.674349 |
7a8f5c1b198d60d11fa03d13dd8476faa30b3b11 | 1,142 | require 'rails_helper'
RSpec.configure do |c|
c.use_transactional_examples = false
c.order = 'defined'
end
RSpec.feature 'Users' do
before(:each) do
@user = User.create(name: 'user1')
@grp = @user.groups.build(name: 'Grade-1', Icon: 'far fa-address-card')
@grp.save
@ts = @user.time_spents.build(... | 30.864865 | 75 | 0.682137 |
bba75215ab1646ac05ad6b8c4de2085f5ebcb1fa | 157 | class Contact < ActiveRecord::Base
belongs_to :user
has_many :last_interactions
has_many :contact_plans
has_many :plans, through: :contact_plans
end
| 22.428571 | 42 | 0.789809 |
39b0e80599a9191ed91ec0a01dc34b8c08684fd2 | 40,555 | # 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::Network::Mgmt::V2018_11_01
#
# VirtualHubs
#
class VirtualHubs
include MsRestAzure
#
# Creates and initializes a new inst... | 41.552254 | 149 | 0.697818 |
1d58f3750a3dd4ca3cb58c8e7a15eac72e894090 | 220 | Rails.application.routes.draw do
devise_for :users
root 'alerts#index'
get '/plugin', to: 'alerts#plugin'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 24.444444 | 101 | 0.740909 |
f732b851bb7fc74797a1cbc1e411c9e02a9acc0d | 73 | class View < ApplicationRecord
belongs_to :post
belongs_to :user
end
| 14.6 | 30 | 0.780822 |
1de0e7e6c26127a0c34fb17029a0ba8857fc65bd | 4,690 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Settings do
describe 'omniauth' do
it 'defaults to enabled' do
expect(described_class.omniauth.enabled).to be true
end
end
describe '.load_dynamic_cron_schedules!' do
it 'generates a valid cron schedule' do
expect(Fugit:... | 30.454545 | 149 | 0.660341 |
21efbb855a45c8918502e0038d39947c1821b9c0 | 2,158 | module MySettings
module Generators
class TestGenerator < Rails::Generators::Base
public_command :add_test_settings
desc "generate test setting"
def add_test_settings
if yes?("Would you like to use rspec?")
setting_rspec
else
setting_minitest
end
... | 27.316456 | 91 | 0.540778 |
9156c4d63edefc81b47ca536345f053d11962ec5 | 1,933 | require "rails_helper"
describe "As a Visitor" do
before :each do
@accessory_1 = create(:accessory)
@accessory_2 = create(:accessory, name: "Small Hoops")
end
describe "when I visit /bike-shop" do
it "I can click add to cart for an item" do
visit bike_shop_path
first(".accessory-card").... | 28.850746 | 66 | 0.658044 |
91f6aee931d2b5efdfab0a2793946e951104cf40 | 4,650 | require 'cases/helper'
require 'minitest/mock'
module ActiveRecord
class AttributeTest < ActiveRecord::TestCase
setup do
@type = Minitest::Mock.new
end
teardown do
assert @type.verify
end
test "from_database + read type casts from database" do
@type.expect(:type_cast_from_data... | 32.517483 | 95 | 0.690108 |
91fa0db65e1c463bbc6f4da75e7e72bb06f79744 | 160 | class AddGithubUpdatedAtToCheckRuns < ActiveRecord::Migration[6.1]
def change
add_column :check_runs, :github_updated_at, :datetime, default: 0
end
end
| 26.666667 | 69 | 0.78125 |
b9bf340e0b3b3a36278dc7ed0c3a3248845df419 | 19 | module Sinatra
end
| 6.333333 | 14 | 0.842105 |
4a7e9939d0ee7014e13f6eb796d799536eb4bcb0 | 861 | # frozen_string_literal: true
require 'sinatra/base'
require 'sinatra/reloader'
require 'omniauth'
require 'omniauth/strategies/indieauth'
module Demo
# The demo application.
class Application < Sinatra::Base
configure :development do
register Sinatra::Reloader
end
enable :sessions
use Omn... | 18.319149 | 53 | 0.617886 |
012ef623f599a04ab3c63b56faeb017537a3b8ce | 1,735 | # frozen_string_literal: true
##
# Provides a single method +deprecate+ to be used to declare when
# something is going away.
#
# class Legacy
# def self.klass_method
# # ...
# end
#
# def instance_method
# # ...
# end
#
# extend ActiveModelSerializers::Deprecate
# ... | 30.438596 | 105 | 0.630548 |
d5485eb266650098a627a58e5d60f4afb04a15d2 | 481 | # frozen_string_literal: true
module Types
class QueryType < Types::BaseObject
field :scores, [Types::ScoreType], null: false do
argument :page, Integer, required: false
argument :order, String, required: false
argument :column, String, required: false
end
field :total_movies, Int, nul... | 21.863636 | 53 | 0.66736 |
abd8c44711b36baf7b48094dffaa493195933b12 | 147 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_mood-dictionary_session'
| 36.75 | 85 | 0.809524 |
e856e6d24ad682d89789ebeb49266601fa42fcb8 | 279 | AlgoliaSearch.configuration = {
application_id: ENV.fetch('THREADABLE_ALGOLIA_APPLICATION_ID'),
api_key: ENV.fetch('THREADABLE_ALGOLIA_API_KEY'),
}
module AlgoliaSearch::ClassMethods
def algolia_index_name(options = nil)
"#{Rails.env}-#{table_name}"
end
end
| 23.25 | 65 | 0.74552 |
e83e4c70aa9a593489daa14393ad4e3d5772cf14 | 545 | require 'ipaddr'
describe "IPAddr#to_s" do
it "displays IPAddr using short notation" do
IPAddr.new("0:0:0:1::").to_s.should == "0:0:0:1::"
IPAddr.new("2001:200:300::/48").to_s.should == "2001:200:300::"
IPAddr.new("[2001:200:300::]/48").to_s.should == "2001:200:300::"
IPAddr.new("3ffe:505:2::1").to_... | 27.25 | 93 | 0.649541 |
260de9b5b4f095b9b05e9c8562d8e48464250243 | 359 | module Pages
class LocationSearch < SitePrism::Page
set_url '/locations'
element :postcode, '.t-postcode'
element :submit, '.t-submit'
sections :locations, '.t-location' do
element :name, '.t-name'
element :distance, '.t-distance'
element :availability, '.t-availability'
elem... | 22.4375 | 46 | 0.635097 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.