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 |
|---|---|---|---|---|---|
62d59c80629674a7e7b10120f06af0f1ecf04214 | 5,008 | require 'active_record'
require 'fileutils'
require_relative '../../../services/user-mover/export_user'
require_dependency 'file_upload'
require_dependency 'resque/user_migration_jobs'
require_dependency 'carto/ghost_tables_manager'
module Carto
class UserMigrationExport < ::ActiveRecord::Base
belongs_to :organi... | 32.519481 | 123 | 0.666733 |
910115ba57e685a620bb1021b93f6077013b2078 | 538 | class ApplicationError < StandardError
attr_reader :tags, :data
def initialize(subject, tags = '', data = {})
super(subject)
@tags = tags
@data = data
puts "#{'-'*10}\n#{@data}\n#{'-'*10}" if Rails.env.development?
Log.on_raise(self, caller(2))
end
# для логирования при бросании и в д... | 18.551724 | 67 | 0.652416 |
61fb0e295b6a496eac000abd7a9f6b625dc212ba | 388 | class AddCreatedAtToVariant < ActiveRecord::Migration[5.0]
def change
add_column :spree_variants, :created_at, :datetime
Spree::Variant.reset_column_information
Spree::Variant.unscoped.where.not(updated_at: nil).update_all('created_at = updated_at')
Spree::Variant.unscoped.where(updated_at: nil).updat... | 43.111111 | 113 | 0.780928 |
087a4628bf0fc35c5d9f06688b635774488dd2f7 | 941 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.448276 | 74 | 0.7322 |
266612e97206741a0945f2fda3f67b0fec26bd11 | 989 | module Jni
module J
module Android
module Webkit
class WebSettings < Java::Lang::Object
attach Void, "setJavaScriptEnabled", Boolean
end
class WebViewClient < Java::Lang::Object
attach_init
end
class WebView < Widget::AbsoluteLayout
attac... | 41.208333 | 144 | 0.644085 |
4ae196efdf7628cbacce04751108929c92f30bb4 | 8,007 | # Embedded model that stores a location address
class Address
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::History::Trackable
embedded_in :person
embedded_in :office_location
embedded_in :census_member, class_name: "CensusMember"
KINDS = %W(home work mailing)
OFFICE_KINDS = %... | 27.898955 | 107 | 0.663794 |
ff2cdbacd038db99745f00ad6cefa8ea1fe3846c | 2,578 | # frozen_string_literal: true
require 'spec_helper'
describe GemUpdater::GemFile do
subject(:gemfile) { GemUpdater::GemFile.new }
let(:old_spec_set) do
[
Bundler::LazySpecification.new(
'gem_up_to_date', '0.1', 'ruby', 'gem_up_to_date_source'
),
Bundler::LazySpecification.new(
... | 25.029126 | 82 | 0.657486 |
6aed105719972a632bd0e3ebc46d06224ca4cbe1 | 1,464 | require "rubygems"
require "bundler/setup"
require "ruby-transmitsms"
require "test/unit"
require "vcr"
VCR.configure do |c|
c.cassette_library_dir = "fixtures/vcr_cassettes"
c.hook_into :webmock
end
class NumbersApiTest < Test::Unit::TestCase
def setup()
@api = NumbersApi.new("15ad266c538fb36c4d90f01055ae... | 27.111111 | 95 | 0.678279 |
0885954db005a3184def36651abdc953f9146e52 | 231 | class ApplicationException < StandardError
def initialize(status: 500, title: nil)
@status = status
@title = title
end
attr_reader :status
def title
@title ||= Rack::Utils::HTTP_STATUS_CODES[status]
end
end
| 17.769231 | 53 | 0.69697 |
61943512e0d33ca966a843b1eab0ece1f9c42ccc | 24,801 | # 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/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::STS
# @api private
module ClientApi
include Seahorse::Mod... | 71.886957 | 181 | 0.779646 |
0325892a38c02800e5336e57f72bcb8246022bdc | 6,197 | require 'formula'
class Gcc46 < Formula
def arch
if Hardware::CPU.type == :intel
if MacOS.prefer_64_bit?
'x86_64'
else
'i686'
end
elsif Hardware::CPU.type == :ppc
if MacOS.prefer_64_bit?
'powerpc64'
else
'powerpc'
end
end
end
def os... | 34.049451 | 98 | 0.650799 |
6299e58f6ea6753791ecd8477afe2ad9baff27af | 785 | # 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... | 27.068966 | 74 | 0.732484 |
39d7207344bb2d9533f399988c61cfb73c2ee71b | 1,049 | require 'ruby/reflection/support/shift_reset'
require 'continuation' unless defined? callcc
module Ruby
class Reflection
class ThreadMirror < ObjectMirror
include AbstractReflection::ThreadMirror
include ShiftReset
reflect! Thread
Frame = Struct.new :method, :index, :file, :line, :thread
... | 21.854167 | 63 | 0.544328 |
bf124171e5b2de8fae9f9c48b1b2c512f31d0e3d | 18,811 | # Authorization
require File.dirname(__FILE__) + '/reader.rb'
require "set"
module Authorization
# An exception raised if anything goes wrong in the Authorization realm
class AuthorizationError < StandardError ; end
# NotAuthorized is raised if the current user is not allowed to perform
# the given operation ... | 37.622 | 124 | 0.635479 |
0393f430ed33c98a971e095b891938d96bf70caa | 7,842 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 29.81749 | 224 | 0.624968 |
01b697ec910d2dacf92c68e624a5ef54f2bfc25d | 314 | name 'cdo-postfix'
maintainer 'Code.org'
maintainer_email 'will@code.org'
license 'All rights reserved'
description 'Installs/Configures cdo-postfix'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.11'
depends 'apt'
depends 'postfix'
| 28.545455 | 72 | 0.678344 |
1d6678d0937d750f8591c26a27c2d3746f1ea646 | 2,596 | #encoding: utf-8
include ERB::Util
class WoodEggWT < Sinatra::Base
configure do
# set root one level up, since this routes file is inside subdirectory
set :root, File.dirname(File.dirname(File.realpath(__FILE__)))
set :views, Proc.new { File.join(root, 'views/wt') }
# re-use the Q&A public CSS
s... | 33.714286 | 327 | 0.597072 |
d5cdea941def581bad8577615a316225ec07bb89 | 745 | class TweakSourceColumns < ActiveRecord::Migration[4.2]
def change
add_column :sources, :day, :integer
remove_column :sources, :year
add_column :sources, :year, :integer
rename_column :sources, :LCCN, :doi
remove_column :sources, :ISBN
add_column :sources, :isbn, :string
remove_col... | 24.032258 | 55 | 0.69396 |
ed72d6fe13d19744bdbc1b1baaf5508d2d372883 | 1,494 | #!/usr/bin/env ruby
#
# Sensu-mutator
# ===
#
# DESCRIPTION:
# Base mutator class. All you need to do is extend this class and implement a
# #mutate function. Uses the autorun feature just like sensu-handler and sensu-plugin/cli
#
# Example Implementation: described https://sensuapp.org/docs/latest/mutators#examp... | 19.92 | 100 | 0.654618 |
2116dc33b803e5b811d9ed7a1a2969d0adc643b2 | 139 | module IconHelper
def check_icon(checked)
return if !checked
content_tag :i, 'done', class: 'material-icons check-icon'
end
end | 23.166667 | 62 | 0.719424 |
d5135cd0c715f81e1f660aa614663110190b1967 | 13,442 | require "test_helper"
class TypeCheckServiceTest < Minitest::Test
include Steep
include TestHelper
ContentChange = Services::ContentChange
TypeCheckService = Services::TypeCheckService
TargetRequest = Services::TypeCheckService::TargetRequest
def project
@project ||= Project.new(steepfile_path: Pathn... | 28.35865 | 115 | 0.673858 |
4a9070c894852a986e3625099c07bdbef1a36622 | 2,196 | class Libsecret < Formula
desc "Library for storing/retrieving passwords and other secrets"
homepage "https://wiki.gnome.org/Projects/Libsecret"
url "https://download.gnome.org/sources/libsecret/0.20/libsecret-0.20.5.tar.xz"
sha256 "3fb3ce340fcd7db54d87c893e69bfc2b1f6e4d4b279065ffe66dac9f0fd12b4d"
license "LG... | 29.28 | 99 | 0.60929 |
bf88006d3dc0c034ceadedb38325ca8e427d5545 | 2,473 | class PurchasesController < ApplicationController
before_action :authenticate_user!
before_action :set_purchase, only: [:show, :edit, :update, :destroy]
# GET /purchases
# GET /purchases.json
def index
@purchases = Purchase.all
end
# GET /purchases/1
# GET /purchases/1.json
def show
end
# G... | 27.477778 | 99 | 0.680954 |
1a776769f8ed370e0e7c03ddbc23ed4934cd4612 | 607 | ActiveAdmin.register User do
actions :index, :show
index do
selectable_column
id_column
column :email
column :full_name
column :postal_code
column :district do |obj|
obj.location.district
end
column :province do |obj|
obj.location.province
end
column :disaster do... | 20.931034 | 74 | 0.654036 |
611fb474d495d8fdffb13e82a9f0daa7f4cbdf05 | 259 | # Don't forget! This file needs to be 'required' in its spec file
# See README.md for instructions on how to do this
def fizzbuzz(int)
if int % 5 == 0 && int % 3 == 0
"FizzBuzz"
elsif int % 3 == 0
"Fizz"
elsif int % 5 == 0
"Buzz"
else nil
end
end
| 18.5 | 65 | 0.625483 |
b9bb1e44f186fb11e30e83c44f09f60727c66aea | 211 | class RemoveNotNullFromPiecesColumnPieceHeadId < ActiveRecord::Migration[5.2]
def change
execute <<-DDL.gsub /^\s+/, ''
ALTER TABLE pieces ALTER COLUMN piece_head_id DROP NOT NULL;
DDL
end
end
| 26.375 | 77 | 0.720379 |
1daa7ad161f6ff847cdcd1a776d2b8288a70ea6c | 363 | class TSheets::Repos::CurrentTotals < TSheets::Repository
url "/reports/current_totals"
model TSheets::Models::CurrentTotals
actions :report
filter :user_ids, [ :integer ]
filter :group_ids, [ :integer ]
filter :on_the_clock, :string
filter :page, :integer
filter :per_page, :integer
filter :order_by, ... | 27.923077 | 57 | 0.732782 |
ff59b354fa6aa54479ae36782e3db5059bbd2e10 | 524 | class GithubInfo
include Mongoid::Document
field :pushEvents
field :pullEvents
field :gistEvents
field :forkEvents
field :mostRecentEventDate
field :oldestEventDate
field :commits
field :lineAdditions
field :lineDeletions
field :commitMessages
field :languages
field :github_handle
field :fu... | 18.714286 | 28 | 0.76145 |
790f2b32876f31d067b8144c58d5777d4481aca2 | 4,378 | # enable all linting rules by default, then override below
all
# Some files hard-wrap lines to around 80 characters, others do not. We don't
# have a definitive guide in the GDS Way, so we shouldn't enforce either way here.
exclude_rule "line-length"
# Middleman starts .md files with Frontmatter (https://middlemanapp... | 37.101695 | 92 | 0.736638 |
ff8048a06401dcd7aedf79769d45f154ee794012 | 93 | class State < ActiveRecord::Base
# Remember to create a migration!
has_many :cities
end
| 15.5 | 35 | 0.741935 |
62c0b127eba269329ac0e47fee5a21360599c681 | 45 | module PrAppointment
VERSION = "0.1.0"
end
| 11.25 | 20 | 0.711111 |
bfa8815c3b2c5ac061a3aff37019c0272c48bdb7 | 225 | ENV['RACK_ENV'] ||= "development"
require 'bundler/setup'
Bundler.require(:default, ENV['RACK_ENV'].to_sym)
configure ENV['RACK_ENV'].to_sym do
set :database, "sqlite3:db/#{ENV['RACK_ENV']}.sqlite"
end
require_all 'app'
| 20.454545 | 55 | 0.715556 |
b9bfaf85febf88e54ef827479ae4c0664cac595c | 1,033 | #
# Be sure to run `pod lib lint ZPlaceholderTextView.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = ... | 35.62069 | 116 | 0.635044 |
5da1bea8b21ad32a4502c5aaa22a132cb89824a9 | 3,535 | =begin
* Name: bars.rb
* Creates the different smithing bars definitions
* Author: Davidi2 (David Insley)
* Date: November 11, 2013
=end
require 'java'
module Smithing
BARS = {}
class << self
def create_bar(name, &block)
BARS[name] = Bar.new block
SMITHING_TABLES[BARS[name]] = []... | 26.984733 | 142 | 0.568034 |
f84e42f0f56109b4845edd5f11a6f13d52612e2e | 767 | # This file was generated by GoReleaser. DO NOT EDIT.
class Wsgnatsd < Formula
desc "A websocket server proxy for nats-server"
homepage "https://github.com/aricart/wsgnatsd"
version "0.8.10"
bottle :unneeded
if OS.mac?
url "https://github.com/aricart/wsgnatsd/releases/download/v0.8.10/wsgnatsd-v0.8.10-da... | 29.5 | 107 | 0.740548 |
382ea7d16d835a0f3588302dbc4ec373b13ddb51 | 47 | module Canteen
module ImagesHelper
end
end
| 9.4 | 21 | 0.787234 |
ff84210585eed11d5d0db2c8ad5c2d99d7048989 | 1,114 | module S3Secure::Lifecycle
class Builder
# Note: put_bucket_lifecycle_configuration and put_bucket_lifecycle understand different payloads.
# put_bucket_lifecycle is old and shouldnt be used
RULE_ID = Base::RULE_ID
DEFAULT_RULE = {
expiration: {expired_object_delete_marker: true},
id: RULE... | 23.208333 | 102 | 0.623878 |
18ab7de768f3f3d1ae224bd7b81e1c0b94bef008 | 1,210 | # frozen_string_literal: true
RSpec.shared_examples_for 'auditable' do
let(:model) { described_class }
let(:model_name) { model.name.underscore.to_sym }
describe 'before validation' do
let(:current_user) { build_stubbed(:user, id: 1) }
let(:existing_user) { build_stubbed(:user, id: 2) }
it 'adds th... | 36.666667 | 94 | 0.713223 |
26270b1c3c9c9b4da0ec4c03f6a8d6fd861fbe70 | 14,155 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
require 'test_helper'
class Arvados::V1::FiltersTest < ActionController::TestCase
test '"not in" filter passes null values' do
@controller = Arvados::V1::ContainerRequestsController.new
authorize_with :admin
... | 43.823529 | 199 | 0.695585 |
1ae7cb9e6b775e31cf9a085d2f7bb6eaaec74547 | 3,157 | # frozen_string_literal: true
require 'spec_helper'
describe Lightning::Router::RouteFinder do
describe '#find' do
subject { described_class.find(source, target, updates, assisted_routes, assisted_channels) }
let(:public_key0) { '02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619' }
let... | 38.036145 | 106 | 0.672474 |
110c98c9589afdbb0a145f766300a71764c68854 | 375 | require 'test_helper'
require_relative 'lua_generator_test'
class Apicast::LuaThreescaleUtilsGeneratorTest < Apicast::LuaGeneratorTest
def test_filename
super
assert_equal 'threescale_utils.lua', @generator.filename
end
def test_emit
super
assert config = @generator.emit(mock('provider'))
as... | 23.4375 | 74 | 0.765333 |
28a2dd1dbc9245339bc58004f8675e4795960f38 | 886 | require 'spec_helper'
RSpec.describe LocaleSet do
describe "#for" do
subject { LocaleSet.new(['en_gb', 'EN-US', :es, :fr]).for(format) }
let!(:format) { :i18n }
it "converts each item to a string" do
subject.each do |item|
expect(item).to be_a(String)
end
end
it "removes ... | 19.688889 | 71 | 0.58465 |
011136b0691a012d0994122c118d07689d977728 | 1,651 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../lib/pedump')
describe 'corkami/imports_vterm.exe' do
# http://code.google.com/p/corkami/source/browse/trunk/asm/PE/imports_vterm.asm
#describe "import terminator in virtual space" do
before :a... | 31.150943 | 81 | 0.692913 |
e9be46097e6a4ed9ae0eb335a394081cbf00c8c8 | 15,051 | require_relative 'globals'
require_relative 'tunes/tunes_client'
module Spaceship
class Client
def handle_two_step_or_factor(response)
raise "2FA can only be performed in interactive mode" if ENV["SPACESHIP_ONLY_ALLOW_INTERACTIVE_2FA"] == "true" && ENV["FASTLANE_IS_INTERACTIVE"] == "false"
# extract ... | 41.808333 | 177 | 0.664607 |
f8e1361e18cd482922d6042c78cd2eb7202b387b | 167 | class RolesRepository
def all
@all ||= Role.includes(:users).all
end
def all_technical
all.technical
end
def all_by_name
all.by_name
end
end
| 11.928571 | 38 | 0.676647 |
2854376db7464646d5ebba282ef460110698ea04 | 231 | # frozen_string_literal: true
RSpec.describe DxrubyEditor do
it 'has a version number' do
expect(DxrubyEditor::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 19.25 | 48 | 0.692641 |
21de6750e0688fd69bab0416737a761d39cccc99 | 9,846 | #!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'rubygems'
require 'bundler'
Bundler.setup
require 'test/unit'
require 'active_shipping'
require 'mocha'
XmlNode # trigger autorequire
module Test
module Unit
class TestCase
include ActiveMerchant::Shipping
LOCAL_CR... | 48.502463 | 135 | 0.400264 |
bb65a115be01177f56138be4d89013d358b64aec | 144 | require 'elasticsearch/rails/instrumentation/railtie'
module Elasticsearch
module Persistence
module Instrumentation
end
end
end
| 13.090909 | 53 | 0.784722 |
ff60300902afef6572bf8d20f63b45ba3d9f43d1 | 1,069 | # frozen_string_literal: true
Rails.application.configure do
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.pu... | 30.542857 | 86 | 0.751169 |
fff57184292070c710dcbc1d034c2d0398ad8f8d | 4,027 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... | 44.744444 | 326 | 0.740998 |
ac91d3770e6eec327811c6e1143c11c269b54cee | 627 | require 'rails_helper'
module Subscribem
RSpec.describe AccountsController, type: :controller do
context 'creates the account schema' do
let!(:account) { Subscribem::Account.new }
before do
expect(Subscribem::Account).to receive(:create_with_owner).and_return(account)
allow(account).t... | 31.35 | 86 | 0.681021 |
ac2fb78b0a29cf90e4be9e6ff07f721527dd22c1 | 1,699 | module Abstractor
##
# A collection of helper methods used in the Abstactor user interface.
module UserInterface
#2/16/2014 MGURLEY Stolen from http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html. Rails 3.2.16.
# Removed the cleverness trying skip highlighting content it... | 38.613636 | 134 | 0.662743 |
bf9fc240aa9411ee2d20e037a8be9be4c9694c69 | 1,218 | require "csv"
module FlatFile
module CSV
# Read a CSV file and return its contents as an array of hashes.
#
# @param filepath [String] Path to the CSV file.
# @return [Array<Hash>]
def self.from_file(filepath)
rows = []
begin
::CSV.foreach(filepath, headers: true) do |row|
... | 22.981132 | 70 | 0.520525 |
9147e95a1f72ab65e08c67310e80328808a06432 | 53 | json.array! @tacos, partial: "tacos/taco", as: :taco
| 26.5 | 52 | 0.679245 |
f7730f9135d0c37b7f48cbf7d745400c87e651dd | 395 | module Api
module V1
class OneSidedFollowersController < ::Api::V1::Base
private
def summary_uids(limit: 3)
uids = @twitter_user.one_sided_followerships.limit(limit).pluck(:follower_uid)
size = @twitter_user.one_sided_followerships.size
[uids, size]
end
def list_... | 21.944444 | 86 | 0.663291 |
265977b6cfe5d65f520c7066d035d3f5ebb02d72 | 774 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 33.652174 | 74 | 0.760982 |
0806665c27f0044e4d3b66fe284397bd349d18f1 | 13,683 | # frozen_string_literal: true
# Tests the base functionality that should be identical across all cache stores.
module CacheStoreBehavior
def test_should_read_and_write_strings
assert @cache.write("foo", "bar")
assert_equal "bar", @cache.read("foo")
end
def test_should_overwrite
@cache.write("foo", "... | 28.387967 | 104 | 0.680626 |
87144afc8671b4ecd0a1c23b48a33bac2f1a3a9c | 5,628 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# Represents the Site resource information for a Span entity inclu... | 28.568528 | 120 | 0.618159 |
bf895d43f3d2498b8a4495d900c86cd1ea249e8e | 357 | class CreateLegalTermAcceptances < ActiveRecord::Migration
def self.up
create_table :legal_term_acceptances do |t|
t.references :legal_term
t.integer :legal_term_version
t.string :resource_type
t.integer :resource_id
t.timestamps
end
end
def self.down
drop_tab... | 21 | 58 | 0.70028 |
1dcc2583d4f88c519e2ecfc53458a905c39f8909 | 1,704 | # == Schema Information
#
# Table name: automation_rules
#
# id :bigint not null, primary key
# actions :jsonb not null
# active :boolean default(TRUE), not null
# conditions :jsonb not null
# description :text
# event_name :string not null
# ... | 32.150943 | 136 | 0.699531 |
26d50ee5f4ef046c9bf401cec69c739faed30876 | 4,849 | require 'test_helper'
class PublicSuffix::ListTest < Test::Unit::TestCase
def setup
@list = PublicSuffix::List.new
end
def teardown
PublicSuffix::List.clear
end
def test_initialize
assert_instance_of PublicSuffix::List, @list
assert_equal 0, @list.length
end
def test_initialize_creat... | 26.938889 | 121 | 0.707156 |
ff0d8502ec2868eec83ad67888b1a646d05060d0 | 10,985 | require 'rubygems'
require 'redis'
def init_external(r)
r.create_table("external", "(id int primary key, division int, health int, salary TEXT, name TEXT)")
r.create_index("external:division:index", "external", "division")
r.create_index("external:health:index ", "external", "health")
end
def init_healthplan(r)... | 33.187311 | 227 | 0.7066 |
1cd6c5c86c885de7aeba920742d4483bc6acea68 | 376 | require 'rails_helper'
describe Business do
it { should validate_presence_of :biz_name }
it { should validate_presence_of :biz_type }
it { should validate_presence_of :biz_address }
it { should validate_presence_of :biz_phone }
it { should validate_presence_of :biz_contact }
it { should validate_presence_o... | 31.333333 | 49 | 0.771277 |
f7a04cd1baa566c3ddb74b743cfacff50cb846c4 | 2,646 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 24.275229 | 103 | 0.640967 |
bf5e371bb6667536964c3790c9cd41fb7986ae08 | 118 | module Itamae
module Plugin
module Recipe
module Jq
VERSION = "0.1.0"
end
end
end
end
| 11.8 | 25 | 0.559322 |
7a4dc1e9be1ce33225c783baf9f8babe4de9940c | 258 | module MarkdownUI
class FieldTag < MarkdownUI::Shared::TagKlass
def initialize(_content, _klass = nil, __id = nil, _data = nil)
@content = _content
end
def render
"<field#{_id}#{klass}#{data}>#{@content}</field>"
end
end
end
| 21.5 | 67 | 0.631783 |
79cc5addd29dac40c0bed3001653f1bf43a395c1 | 2,786 | class Proftpd < Formula
desc "Highly configurable GPL-licensed FTP server software"
homepage "http://www.proftpd.org/"
url "https://github.com/proftpd/proftpd/archive/v1.3.7a.tar.gz"
mirror "https://fossies.org/linux/misc/proftpd-1.3.7a.tar.gz"
mirror "https://ftp.osuosl.org/pub/blfs/conglomeration/proftpd/pr... | 37.146667 | 108 | 0.654343 |
01926a8fc49aeaec3a694a33c370dd46eb10a58a | 268 | class CreateHtmlDocuments < ActiveRecord::Migration
def self.up
create_table :html_documents do |t|
t.references :document
t.string :name
t.string :path
t.timestamps
end
end
def self.down
drop_table :html_documents
end
end
| 17.866667 | 51 | 0.679104 |
ff26aa5671b9d5ef551c0a1ea4673e9df4c864b8 | 1,374 | module VacancyExpiresAtFieldValidations
extend ActiveSupport::Concern
included do
validate :expires_at_must_not_be_blank, unless: proc { |v| validate_expires_at?(v) }
validate :expires_at_must_be_in_correct_range, unless: proc { |v| validate_expires_at?(v) }
validate :expires_at_meridiem_must_not_be_bl... | 34.35 | 115 | 0.746725 |
28156eafa5c2b6494cb4f449ceae0eea399d37c3 | 1,125 | require_relative 'lib/bradley_view_tool/version'
Gem::Specification.new do |spec|
spec.name = "bradley_view_tool"
spec.version = BradleyViewTool::VERSION
spec.authors = ["PatBradley88"]
spec.email = ["patrick_bradley1@yahoo.co.uk"]
spec.summary = %q{Various view specific m... | 41.666667 | 87 | 0.662222 |
33e781412fa5832214485ceabed9e2f15dbc939c | 96 | begin
require 'spec'
rescue LoadError
require 'rubygems'
gem 'rspec'
require 'spec'
end
| 12 | 20 | 0.708333 |
edcedc172ae288ba2baf6efacd831c9f88bcc0c0 | 14,634 | class PeopleController < Devise::RegistrationsController
class PersonDeleted < StandardError; end
class PersonBanned < StandardError; end
skip_before_filter :verify_authenticity_token, :only => [:creates]
skip_before_filter :require_no_authentication, :only => [:new]
before_filter EnsureCanAccessPerson.new(... | 38.714286 | 208 | 0.715184 |
f7ea0f71e6d14614be22de5cf15e63aa48279a18 | 4,437 | module IMS::LTI
# Mixin module for managing LTI Launch Data
#
# Launch data documentation:
# http://www.imsglobal.org/lti/v1p1pd/ltiIMGv1p1pd.html#_Toc309649684
module LaunchParams
# List of the standard launch parameters for an LTI launch
LAUNCH_DATA_PARAMETERS = %w{
accept_media_types
a... | 26.568862 | 145 | 0.664638 |
2156934f1802623ccbf4e4a41101d9293b652c65 | 5,027 | require_relative '../spec_helper'
describe 'deploy instance_groups job', type: :integration do
with_reset_sandbox_before_each
it 're-evaluates job with new manifest job properties' do
manifest_hash = Bosh::Spec::NewDeployments.simple_manifest_with_instance_groups
manifest_hash['instance_groups'].first['jo... | 44.883929 | 122 | 0.713348 |
794eb69ddaba9034762c484c0729d38db8181b8e | 1,106 | describe 'Gratan::Client#export' do
context 'when function exists' do
let(:grantfile) {
<<-RUBY
user "scott", "%" do
on "*.*" do
grant "USAGE"
end
on "FUNCTION #{TEST_DATABASE}.my_func" do
grant "EXECUTE"
end
end
RUBY
}
subject { client }
before do
mysql do |cli|
... | 15.8 | 56 | 0.571429 |
18f28f87f0f5f81fb369f3ea805f4ecb1139b43b | 2,908 | require 'spec_helper'
describe Spree::Admin::TaxonomiesController, type: :controller do
stub_authorization!
let(:store) { create(:store) }
let(:new_store) { create(:store) }
let!(:taxonomy_1) { create(:taxonomy, store: store) }
let!(:taxonomy_2) { create(:taxonomy, store: store) }
let!(:taxonomy_3) { crea... | 31.608696 | 142 | 0.664374 |
edd75cfd0d8af69d60700600e2701d125514171e | 255 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :mechanize_store_freight, :class => MechanizeStore::Freight do
value 1.5
service "MyString"
delivery_time 1
zipcode "MyString"
end
end
| 23.181818 | 72 | 0.745098 |
110019febace5cc202fc0ee8cd007ab97b537c1b | 3,731 | #
# lolcat (c)2011 moe@busyloop.net
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it ... | 27.233577 | 95 | 0.573305 |
333d4858a5faff0299265a6272d022c710b19d3a | 1,118 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'socks_tunnel/version'
Gem::Specification.new do |spec|
spec.name = "socks_tunnel"
spec.version = SocksTunnel::VERSION
spec.authors = ["Weihu Chen"]
spec.email ... | 38.551724 | 106 | 0.650268 |
33c86a3c6cc6eae9807a61810534f64a992673fd | 85 | class UserController < ApplicationController
def index
end
def show
end
end
| 10.625 | 44 | 0.752941 |
7ad0f92ce4ab026cf9f3238ea978f09113809074 | 3,940 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.473684 | 102 | 0.758376 |
1da93910f418ad2c495712ac9c13b1d83022aaf0 | 23,492 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: quick-admin 4.2.1 ruby lib
Gem::Specification.new do |s|
s.name = "quick-admin"
s.version = "4.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= ... | 60.390746 | 128 | 0.726332 |
edf45ac673dd538a47f1c06b780944db365b5bc6 | 2,314 | class Openni < Formula
homepage "http://www.openni.org/"
head "https://github.com/OpenNI/OpenNI.git"
stable do
url "https://github.com/OpenNI/OpenNI/archive/Stable-1.5.7.10.tar.gz"
sha256 "34b0bbf68633bb213dcb15408f979d5384bdceb04e151fa519e107a12e225852"
# Fix for Mavericks
patch do
url "... | 29.666667 | 98 | 0.682368 |
e866cf337f946595b921421a7f80909c39866ea0 | 3,950 | require 'time'
require 'date'
class Time #:nodoc:
class << self
def mock_time
mocked_time_stack_item = Timecop.top_stack_item
mocked_time_stack_item.nil? ? nil : mocked_time_stack_item.time(self)
end
alias_method :now_without_mock_time, :now
def now_with_mock_time
mock_time || now... | 26.510067 | 85 | 0.662785 |
4ad9639a8df2e174d6d4b9af845dce967b581680 | 900 | require 'spec_helper'
describe OmniAuth::MLH do
subject do
OmniAuth::Strategies::MLH.new(nil, @options || {})
end
it_should_behave_like 'an oauth2 strategy'
describe '#client' do
it 'has correct MyMLH site' do
expect(subject.client.site).to eq('https://my.mlh.io')
end
it 'has correct a... | 24.324324 | 78 | 0.646667 |
1801e95e6dece3fd4566be945ae4472b1f3cc525 | 2,157 | require 'ddtrace/contrib/support/spec_helper'
require 'redis'
require 'ddtrace'
RSpec.describe 'Redis configuration resolver' do
let(:resolver) { Datadog::Contrib::Redis::Configuration::Resolver.new }
context 'when :default magic keyword' do
it { expect(resolver.resolve(:default)).to eq(:default) }
end
... | 25.987952 | 73 | 0.437645 |
d5d5548ff1810258f761829bea5e927d27acd822 | 1,577 | module UcbRails::LdapPerson
class TestFinder
PersonNotFound = Class.new(StandardError)
def find_by_uid(uid)
uid.presence and find_by_attributes(:uid => uid.to_s).first
end
def find_by_uid!(uid)
find_by_uid(uid) || raise(PersonNotFound, "uid=#{uid.inspect}")
end
def find_by_first... | 31.54 | 110 | 0.615726 |
bb146f143a7158ac39e13084b642c3610cb3d861 | 1,053 | module Sources
module Datapoints
class Error < StandardError; end
class NotFoundError < Error; end
class Base
def available?
true
end
def supports_target_browsing?
false
end
def supports_functions?
false
end
def custom_fields
... | 17.847458 | 75 | 0.51567 |
1869f9b594680548c356e46b0b02fcc1039ac3c8 | 1,717 | module Roby
module Interface
# Representation of a subcommand on {Interface} on the shell side
class SubcommandClient
# @return [ShellClient,ShellSubcommand] the parent shell /
# subcommand
attr_reader :parent
# @return [
# @return [Strin... | 32.396226 | 83 | 0.499126 |
e8b551e5608f6e69f0452974a9cc4773c410f4ea | 198 | module Mazi::Model
class Notification < Sequel::Model
def enable
self.enabled = true
self.save
end
def disable
self.enabled = false
self.save
end
end
end | 15.230769 | 36 | 0.611111 |
03e18543a17ca54fe9833194264a72ceca0a2923 | 5,723 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'date'
module VSphereAutomation
... | 29.050761 | 111 | 0.61943 |
4a996411e2e9cb2cbaaa4ffa357377aa3210bbad | 1,834 | # 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... | 35.269231 | 117 | 0.741003 |
28c05e284a02883212608df2e9bcd1b6949e4ccf | 2,588 | require 'test_helper'
require 'messente/omnimessage'
require 'messente/sending_error'
class OmnimessageTest < ActiveSupport::TestCase
def setup
super
@recipient = '+37250060070'
@text = 'Your text sms'
end
def test_initialization_requires_recipent_text_and_channel
instance = Messente::Omnimess... | 27.531915 | 97 | 0.697836 |
ab264607745ea8584657dd1ff2bd7425480b923e | 230 | cask "sync" do
version :latest
sha256 :no_check
url "https://www.sync.com/download/apple/Sync.dmg"
name "Sync"
desc "Store, share and access files from anywhere"
homepage "https://www.sync.com/"
app "Sync.app"
end
| 19.166667 | 52 | 0.691304 |
2193d4b911c47dd1c854d25bd7f1485fc9957956 | 351 | Puppet::Type.type(:database).provide :linux do
desc 'An example provider on Linux.'
confine kernel: 'Linux'
confine osfamily: 'RedHat'
defaultfor :kernel => 'Linux'
defaultfor :osfamily => 'RedHat', :operatingsystemmajrelease => '7'
has_feature :implements_some_feature
has_feature :some_other_feature
co... | 31.909091 | 69 | 0.740741 |
26471d6bf5ad891a152a8777691ab94cac623d16 | 3,439 | module VCloud
# Handles creating and managing a session in vCloud Director.
class Client < BaseVCloudEntity
tag 'Session'
has_links
attribute :type, String
attribute :href, String
attribute :user, String
attribute :org, String
LOGIN = 'login'
SESSION = 'sessions'
L... | 29.393162 | 121 | 0.633324 |
edba738930eafb0fd259e1fa74da4fc053c3064f | 1,296 | require 'test_helper'
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "unsuccessful edit" do
log_in_as(@user)
get edit_user_path(@user)
assert_template 'users/edit'
patch user_path(@user), params: { user: { name: "",
... | 30.857143 | 78 | 0.536265 |
3833eed74a54d6ff5cc04a2b4a0231def7a03be6 | 1,021 | #
# Symfony defaults
#
set :symfony_env, "prod"
# symfony-standard edition top-level directories
set :bin_path, "bin"
set :config_path, "config"
set :var_path, "var"
set :web_path, "public"
# Use closures for directories nested under the top level dirs, so that
# any changes to web/app etc do not require these to be... | 25.525 | 71 | 0.711068 |
e9a18d51659a29ba2828200ee7782316f7ae5f78 | 328 | # frozen_string_literal: true
module Canary
module Types
module Scalars
class DateTime < Canary::Types::Scalars::Base
def self.coerce_input(value, _ctx)
Time.zone.parse(value)
end
def self.coerce_result(value, _ctx)
value.iso8601
end
end
end
... | 18.222222 | 51 | 0.612805 |
b91dcb0567afda2a978dac21cda3149995251195 | 15 | require 'gosu'
| 7.5 | 14 | 0.733333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.