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 |
|---|---|---|---|---|---|
33363975df5946feb30fcf5aaa7bd29eee4836a5 | 1,462 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 37.487179 | 122 | 0.751026 |
38c32378d3473404b3915f38afb40deb0f459c39 | 118 | class AddReportCoordsIndex < ActiveRecord::Migration[5.1]
def change
add_index :reports, [:lat, :lng]
end
end
| 19.666667 | 57 | 0.720339 |
e27d7020c408aa612d07a19adba4a9bf681d96e0 | 406 | cask 'atext' do
version '2.21'
sha256 '8ef2fc8f136f15ab4c1218a74097a9a83407ede3f79e6e616eade920bfff02ba'
url 'https://www.trankynam.com/atext/downloads/aText.dmg'
appcast 'https://www.trankynam.com/atext/aText-Appcast.xml',
checkpoint: '9d96d77e7584acfe70ee83f0d00342fbe0b9d0b39e23685f9c92001bbd12f983... | 31.230769 | 88 | 0.770936 |
ab744e67bbd7d4d90e2e2f487b2abcadbada7368 | 2,703 | require_relative 'config.rb'
require_relative 'valuefirst.rb'
module Valuefirst
class Valuefirst
include Constants
attr_reader :config
def initialize(opts = {}, &block)
@config = Config.new(opts)
yield(@config) if block_given?
@config.validate
end
def self.error_desc error_... | 31.8 | 117 | 0.718461 |
edd5bb575c482d6c01b051e8b365dacfec2ddcc6 | 1,770 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require 'rubygems'
require 'bundler'
if %w(true 1).include?(ENV['COVERAGE'])
require 'simplecov'
SimpleCov.start do
add_filter '/test_app/'
add_filter '/spec/support'
end
end
require File.expand_path("... | 34.038462 | 97 | 0.726554 |
01e0cb32d582024457fff5c51681abdc526dd073 | 1,238 | require 'spec_helper'
require 'guard'
require 'guard/compass_helper'
describe Guard::CompassHelper do
subject {self}
include Guard::CompassHelper
before :each do
Pathname.stub!(:pwd).and_return(Pathname.new('/test/me'))
end
describe "pathname method" do
it "retrieve pwd when nothing given" d... | 30.195122 | 160 | 0.647819 |
e89ea6d1d7e9de3d12ecba8d9910b03fd31abf5d | 1,247 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
describe ConfigurationStore do
before(:each) do
@instance = ConfigurationStore.new
end
it "should have a default_template accessor" do
@instance.should respond_to(:default_template)
@instance.should respond_to(:defau... | 28.340909 | 86 | 0.708099 |
ab637f4e34b0a992f3dea0dd3d599818a9b3c2ad | 1,022 | class PapersController < ApplicationController
def index
if params.key?(:year)
@paper = Paper.all.year_until(params[:year])
else
@paper = Paper.all
end
end
def show
@paper = Paper.find(params[:id])
end
def new
@paper = Paper.new
e... | 18.25 | 79 | 0.528376 |
bb1021cde37b5f545869a6ac04b7e987369ba6c5 | 3,178 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/aiplatform/v1/index_endpoint.proto
require 'google/cloud/aiplatform/v1/index_pb'
require 'google/api/field_behavior_pb'
require 'google/api/resource_pb'
require 'google/cloud/aiplatform/v1/machine_resources_pb'
require 'google/protobuf/t... | 49.65625 | 180 | 0.753304 |
030343e006f6f1db35820dcb0872b678ee7b39fd | 5,029 | ; IBM852 UCS-2 decoding rule
; source: ftp://dkuug.dk/i18n/charmaps/IBM852
any [
#{00C7} (insert tail result #{80}) |
#{00FC} (insert tail result #{81}) |
#{00E9} (insert tail result #{82}) |
#{00E2} (insert tail result #{83}) |
#{00E4} (insert tail result #{84}) |
#{016F} (insert tail result #{85}) |
#{0107} (i... | 37.529851 | 46 | 0.583018 |
f7bb54557f402b73d8db12eb1c051c92e4964edb | 986 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.nic.it/it/property_status_pendingdelete_redemptionperiod.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
req... | 24.65 | 101 | 0.72211 |
5d49b5b1b44e72fd2271e9170c7944b0e5740634 | 2,283 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be prese... | 28.898734 | 78 | 0.663163 |
397e25e509be0d3e4a0a4648b3dc3cc35df19a15 | 9,587 | #
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class Hhvm471 < Formula
desc "JIT compiler and runtime for the Hack language"
homepage "http://hhvm.com/"
head "ht... | 35.772388 | 125 | 0.707938 |
21a05d872672a793a96ab86c63d9d0011d4973dc | 434 | # frozen_string_literal: true
module Logux
class Client
attr_reader :logux_host
def initialize(logux_host: Logux.configuration.logux_host)
@logux_host = logux_host
end
def post(params)
client.post(params.to_json,
content_type: :json,
accept: :json)
... | 19.727273 | 73 | 0.638249 |
8771b3d6b2305d4c9cf52d7150d8697b9552df49 | 1,840 | class Avrdude < Formula
desc "Atmel AVR MCU programmer"
homepage "https://savannah.nongnu.org/projects/avrdude/"
url "https://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz"
mirror "https://download-mirror.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz"
sha256 "0f9f731b6394ca7795b88359689... | 33.454545 | 90 | 0.727174 |
f7ada6436ad10d41cd6e758c2ccd983050b61832 | 1,327 | module GnarusActivity
class ExercisesController < ApplicationController
before_filter :authenticate_user! if defined?(Devise)
def index
@exercises = Exercise.all.select{|e| e.author.id == current_user.id}
end
def show
@exercise = Exercise.find(params[:id])
end
def new
... | 23.696429 | 77 | 0.634514 |
62dfebc8f686b728dbe5dc26f304b7f3457867d1 | 165 | require "ecm/core/backend/configuration"
require "ecm/core/backend/engine"
module Ecm
module Core
module Backend
extend Configuration
end
end
end
| 15 | 40 | 0.733333 |
1ca447463576b917a6d3106c527d448177b0583b | 164 | class CreateAccounts < ActiveRecord::Migration[5.1]
def change
create_table :accounts do |t|
t.string :iban_string
t.timestamps
end
end
end
| 18.222222 | 51 | 0.682927 |
4a83688813a8e9e2f6e4953c5b45cc1463e74174 | 6,105 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rackspace'))
module Fog
module Rackspace
class Databases < Fog::Service
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
class BadRequest... | 34.106145 | 170 | 0.62932 |
bf223621ee57c9b8768b19e77d2b6f272b78bc5d | 1,131 | # frozen_string_literal: true
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------... | 34.272727 | 85 | 0.680813 |
e896673e5fc2233c95a350943c1a1590d1dab1bd | 106 | require 'rails_helper'
module StashApi
RSpec.describe UsersController, type: :controller do
end
end
| 13.25 | 54 | 0.783019 |
ace78920fa8620aa51f1c0f9777f4b91b9df3f5a | 1,582 | require "spec_helper"
describe Bump::CLI::Commands::Deploy do
it 'calls the server and exit successfully if success' do
stub_bump_api_validate('versions/post_success.http')
expect do
new_command.call(id: '1', token:'token', file: 'path/to/file', specification: 'openapi/v2/json')
end.to output(/New... | 31.019608 | 105 | 0.695954 |
b97c621042da8596578c865c13e51bf5fa81a5b4 | 2,170 | module TocHelper
def get_h3s_toc(node)
node.css('h3').map do |c_node|
{
level: c_node.name[1].to_i,
value: c_node.children.map { |child| child.to_s }.join,
anchor: c_node['id']
}
end
end
def get_toc(page_content, options = {})
doc = Nokogiri::HTML(page_conten... | 27.820513 | 128 | 0.567281 |
91a967051e38086519c47e790e8fa61fcb03f77e | 1,441 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'beezup_api/version'
Gem::Specification.new do |spec|
spec.name = "beezup_api"
spec.version = BeezupApi::VERSION
spec.authors = ["Fabien Piette"]
spec.email = ... | 37.921053 | 104 | 0.675226 |
1a46e92f24d458155b3f1096b877d5f2c050b9e2 | 1,255 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-dynamodbstreams/types'
require_relative 'a... | 26.145833 | 91 | 0.759363 |
18b0ed1c78673f08c4b9623efe241fab3c9ca833 | 1,628 | require 'omniauth/oauth'
require 'multi_json'
module OmniAuth
module Strategies
#
# Authenticate to T163 via OAuth and retrieve basic
# user information.
#
# Usage:
#
# use OmniAuth::Strategies::T163, 'APIKey', 'APIKeySecret'
#
class T163 < OmniAuth::Strategies::OAuth
de... | 28.068966 | 119 | 0.552826 |
ffe2c0e7e99d3a7889b10da7ff8ec6b9deb6ffae | 889 | command = Mixlib::ShellOut.new('echo ~root')
command.run_command
root_home_dir = command.stdout.to_s.strip
puts 'Homedir:' + root_home_dir
directory '/opt/chef/embedded/etc' do
owner 'root'
group 'root'
mode 00755
recursive true
end.run_action(:create)
file '/opt/chef/embedded/etc/gemrc' do
cont... | 20.674419 | 45 | 0.674916 |
7a4f11b4ab73ffddc4a2201d509c37a5a8a453fd | 5,743 | require "spec_helper"
describe Mongoid::Atomic do
describe "#atomic_updates" do
context "when the document is persisted" do
let(:person) do
Person.create
end
context "when the document is modified" do
before do
person.title = "Sir"
end
it "returns... | 27.878641 | 93 | 0.401706 |
bb51a692a7026b88cd585d0b7e68068a146bd6e5 | 1,327 | # frozen_string_literal: true
require 'rbnacl'
require 'base64'
# Verifies digitally signed requests
class SignedRequest
class VerificationError < StandardError; end
def initialize(config)
@verify_key = Base64.strict_decode64(config.VERIFY_KEY)
@config = config # For SIGNING_KEY during tests
e... | 27.645833 | 65 | 0.721176 |
1155026d3a40b009c2b9f55eb4c10e0a7a97e816 | 590 | class ApplicationController < Sinatra::Base
configure do
set :public_folder, 'public'
set :views, 'app/views'
enable :sessions
set :session_secret, "secret"
end
get '/' do
if logged_in?
redirect "/users/#{session[:user_id]}"
else
erb :'index'
end
end
def v... | 17.878788 | 81 | 0.583051 |
6a7a19b42c9f6371a9e798f9dce1110d14c452b2 | 872 | # frozen_string_literal: true
module ControllerHelpers
def sign_in
@account = Spina::Account.create name: 'My Website', preferences: {theme: 'default'}
@user = Spina::User.create name: 'admin', email: 'admin@example.com', password: 'password', admin: true
request.session[:spina_user_id] = @user.id
end
... | 32.296296 | 107 | 0.711009 |
d558b18f439c99c732c806fdc22ff731feda3275 | 142 | class AddFavouriteToImages < ActiveRecord::Migration[5.2]
def change
add_column :images, :favourite, :boolean, default: false
end
end
| 23.666667 | 60 | 0.753521 |
ac1693565dd787f1cf9d74a58723d7da17adc431 | 4,568 | # frozen_string_literal: true
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, a... | 40.070175 | 102 | 0.757881 |
61eba6bd0f9a8968e27ff8e070356d37ea72af44 | 1,095 | require 'swagger_helper'
describe 'Plans API', type: :request do
let(:gateway) { double }
let(:plans) { build_list(:plan, 3) }
let(:basic) { create(:member) }
before do
create(:permission, member: basic, name: :billing, enabled: true )
allow_any_instance_of(Service::BraintreeGateway).to receive(:conne... | 36.5 | 109 | 0.652968 |
e2101dcf63d78df5a866a6e3935046ad4a71f42c | 853 | class PalaceInvite < ApplicationRecord
attr_accessor :attendees_consent
belongs_to :form_answer
has_many :palace_attendees, dependent: :destroy, autosave: true
validates :form_answer_id, presence: true,
uniqueness: true
validates :attendees_consent, acceptance: { allow_nil: fa... | 20.309524 | 90 | 0.689332 |
1cba06f9f9329ce520d3720d4767655325be1afb | 1,048 | require 'rubygems'
require 'sinatra'
require 'sinatra/contrib/all'
get '/' do
erb "<p>Hello Epta</p>"
end
get '/about' do
erb :about
end
get '/contacts' do
erb :contacts
end
get '/visit' do
erb :visit
end
post '/visit' do
@customer =params[:customer]
@date = params[:date]
@phone = params[:phone]
... | 17.180328 | 78 | 0.614504 |
0323da8c55a7b05c3911a0da3474b223082f726e | 1,275 | module Aws
module EventStream
module Errors
# Raised when reading bytes exceed buffer total bytes
class ReadBytesExceedLengthError < RuntimeError
def initialize(target_byte, total_len)
msg = "Attempting reading bytes to offset #{target_byte} exceeds"\
" buffer length of ... | 26.5625 | 77 | 0.63451 |
5d13e033e62f784e7c413bb08171491b78eb7c02 | 66 | load(Rails.root.join( 'db', 'seeds', "#{Rails.env.downcase}.rb"))
| 33 | 65 | 0.636364 |
01ed0778c0d0102de0303f3a440bd95c6463cb18 | 2,180 | # http://www.mudynamics.com
# http://labs.mudynamics.com
# http://www.pcapr.net
require 'mu/testcase'
require 'mu/pcap/io_wrapper'
require 'mu/pcap/io_pair'
module Mu
class Pcap
class IOWrapper
class Test < Mu::TestCase
class MessageReader
def initialize msg_size=10
@msg_size = msg_size
... | 26.91358 | 85 | 0.603211 |
91a016345a9d0c0bc7e6d1495c1699b2dabc89d2 | 207 | require 'yaml'
require 'rdoba/os'
require 'schemic/generator'
module Schemic::Generator::YAML
class << self
def load_from file_name
::YAML.load_file(file_name).to_os
end
end
end
| 15.923077 | 42 | 0.676329 |
0853e30ed61453b5f425bc3329a9a8dcebcb0130 | 2,305 | # encoding: utf-8
require 'lokka'
module Lokka
class App < Sinatra::Base
include Padrino::Helpers::TranslationHelpers
configure :development do
register Sinatra::Reloader
end
configure do
enable :method_override, :raise_errors, :static, :sessions
YAML::ENGINE.yamler = 'syck' if YA... | 29.935065 | 66 | 0.62039 |
ac571fe26a9686e91d6dbb0ea9e2ece555f01edf | 669 | # == Schema Information
#
# Table name: fundraiser_tracker_relations
#
# id :integer not null, primary key
# fundraiser_id :integer not null
# tracker_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# ... | 26.76 | 79 | 0.701046 |
2685a29d3210c775cb1dff1324b1a2ea0064f57c | 3,822 | require_relative "../../test_helper"
require_relative "flow_unit_test_helper"
require "smart_answer_flows/marriage-abroad"
module SmartAnswer
class MarriageAbroadFlowTest < ActiveSupport::TestCase
include FlowUnitTestHelper
setup do
@calculator = Calculators::MarriageAbroadCalculator.new
@flow ... | 35.388889 | 97 | 0.644165 |
f7b02f117a8a5686e01185801fd50c6ed78e0d30 | 583 | class CommentsController < ApplicationController
http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy
def create
@article = Article.find(params[:article_id])
@comment = @article.comments.create(comment_params)
redirect_to article_path(@article)
end
def destroy
@ar... | 25.347826 | 78 | 0.713551 |
ff4b7a820b1223a4dfcb87b7de0ee5f922200356 | 138 | Sequel.migration do
change do
alter_table :geographical_area_memberships_oplog do
add_column :hjid, Integer
end
end
end
| 17.25 | 55 | 0.746377 |
1a08dd7fd9c376d3b25abd599c9bda2b39652968 | 496 | cask "panoply" do
version "4.12.5"
sha256 "4f882d7bde7ba39abadba79470d906f941605b2ccfacdd6915376f981d56ea57"
url "https://www.giss.nasa.gov/tools/panoply/download/PanoplyMacOS-#{version}.dmg"
appcast "https://www.giss.nasa.gov/tools/panoply/download/"
name "Panoply netCDF, HDF and GRIB Data Viewer"
desc "P... | 29.176471 | 84 | 0.743952 |
ab75c55bf8207f39ef228602445eef09b7ce377e | 1,613 | # 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... | 40.325 | 85 | 0.776813 |
f7e15b131a5d9c731f12d39a2dad7d0e8dbd31fe | 2,240 | module Stacks::Services::CanBeNatted
NatConfig = Struct.new(:dnat_enabled, :snat_enabled, :public_network, :private_network, :tcp, :udp) do
def create_rule(environment, type, hostname, site, port)
public_uri = uri(hostname, environment.domain(site, public_network), port)
private_uri = uri(hostname, en... | 29.473684 | 104 | 0.701339 |
388922ba9f7cdc3098d3ea4d1d3e0877c2a3d7c9 | 284 | list_item :bit_field, :type, :reserved do
register_map do
reserved
end
rtl do
generate_code_from_template :bit_field
def default_value
hex(0, width)
end
end
ral do
access :ro
hdl_path { "g_#{bit_field.name}.u_bit_field.i_value" }
end
end
| 14.947368 | 58 | 0.665493 |
6abfe3ba452911c535c9e6f1367aaeec90c274bd | 1,084 | $LOAD_PATH.push File.expand_path("../lib", __FILE__)
require 'r2d2/version'
Gem::Specification.new do |s|
s.name = "r2d2"
s.version = R2D2::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["ActBlue Technical Services"]
s.email = ["contact@actblue.com... | 37.37931 | 86 | 0.632841 |
2879ec3a5a0fdf95b93a18ff06a0be7ca80826a7 | 1,058 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 42.32 | 86 | 0.759924 |
1d5d683e3f7cb321d7f5301263ae4fab1cb20ec4 | 1,038 | module Fog
module Compute
class HP
class Real
# List all floating IP addresses
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'floating_ips'<~Array> -
# * 'id'<~Integer> - Id of the address
# * 'ip'<~St... | 24.714286 | 84 | 0.492293 |
6a701c9ee1c41f77ebc3ec1cfa99157edd90f6a9 | 5,931 | require 'sinatra'
require "sinatra/reloader" if development?
require 'byebug' if development?
require 'dotenv'
require 'haml'
require 'sequel'
require 'time'
require "httparty"
require 'json'
require 'sinatra/flash'
require 'sinatra/json'
require 'sinatra/cookies'
require_relative "lib/login_helper"
require_relative '... | 25.675325 | 82 | 0.701568 |
1a0e6bd0d6dad1eae05b39c7e65212f90f69a6f5 | 1,359 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe GitIssue do
describe '#main' do
context 'config issue.type does not configured' do
it{
GitIssue::Helper.should_receive(:configured_value).with("type").and_return("")
GitIssue::Helper.should_receive(:configured_value)... | 33.975 | 124 | 0.673289 |
7acdfff03c98b99ee654cff16f88dbecfd1fe734 | 978 | cask 'bettertouchtool' do
if MacOS.version <= :mavericks
version '2.05'
sha256 '41013cfeffee286a038363651db3dd315ff3a1e0cf07774d9ce852111be50a5a'
# bettertouchtool.net/releases was verified as official when first introduced to the cask
url "https://bettertouchtool.net/releases/btt#{version}_final_10_... | 31.548387 | 93 | 0.735174 |
b95b0fbd8b3815e68383a68d4abffd62115a8cce | 239 | # frozen_string_literal: true
require 'botan/digest'
md5 = Botan::Digest::MD5.new
md5 << 'some '
md5 << 'data'
puts md5.hexdigest
hash = Botan::Digest.new('Comb4P(SHA-160,RIPEMD-160)')
hash << 'test'
puts Botan.hex_encode(hash.digest)
| 17.071429 | 54 | 0.707113 |
115d3b8318285e9fb52c04ab4767000a45282f2b | 72 | module Fastlane
module AwsDeviceFarm
VERSION = "0.3.21"
end
end
| 12 | 22 | 0.694444 |
f7e7504b0f183e5274360ba9c01a3ff98e3ee6eb | 2,283 | # frozen_string_literal: true
require 'graphql_devise/mutations/base'
require 'graphql_devise/mutations/login'
require 'graphql_devise/mutations/logout'
require 'graphql_devise/mutations/resend_confirmation'
require 'graphql_devise/mutations/resend_confirmation_with_token'
require 'graphql_devise/mutations/send_passwo... | 69.181818 | 185 | 0.761279 |
1dddfa7ca8d11ee557d7a6df6185c665e2fc0600 | 1,031 | begin
require_relative "lib/net/smtp/version"
rescue LoadError # Fallback to load version file in ruby core repository
require_relative "version"
end
Gem::Specification.new do |spec|
spec.name = "net-smtp"
spec.version = Net::SMTP::VERSION
spec.authors = ["Yukihiro Matsumoto"]
spec.ema... | 36.821429 | 97 | 0.656644 |
33f6dfe974efa82cd5bbe27873857753ab3fb7ac | 1,061 | require "rails_helper"
RSpec.feature "Searching Friends" do
before do
user1 = User.create!(email: "example_user1@example.com", username: "example_user1", password: "password1")
@user2 = User.create!(email: "example_user2@example.com", username: "example_user2", password: "password2")
login_as(user1)
... | 30.314286 | 111 | 0.711593 |
f85f9972a2bd7b2908a052d353ef46856a55ab34 | 9,409 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ElasticAPM do
describe 'life cycle' do
it 'starts and stops the agent', :mock_intake do
MockIntake.instance.stub!
ElasticAPM.start
expect(ElasticAPM::Agent).to be_running
ElasticAPM.stop
expect(ElasticAPM::Agent).... | 28.950769 | 80 | 0.580721 |
ac037fe3e62567906f1bc3a0f829e75095ded2ee | 1,003 | require 'spec_helper'
describe 'Imdb::Season' do
subject { Imdb::Serie.new('1520211') }
let(:season) { subject.seasons.first }
it 'has 6 episodes' do
expect(season.episodes.size).to eq(6)
end
it 'can fetch a specific episode' do
episode = season.episode(1)
expect(episode.title).to match(/D... | 25.717949 | 52 | 0.667996 |
bf7a8e4e7ac423cb0a2eb6ebed5c60d8d16c2a28 | 1,078 | class Dtc < Formula
desc "Device tree compiler"
homepage "https://www.devicetree.org/"
url "https://www.kernel.org/pub/software/utils/dtc/dtc-1.4.7.tar.xz"
sha256 "6643e8f00ff86350f465bb54b2185058b5b1b7bac01a0842c81a52b86589cde7"
bottle do
cellar :any
sha256 "c230e06edc7710720e75e77319d3982f2d8e1e873... | 29.944444 | 94 | 0.705937 |
1a4848ba81ee37515b479a23f6af1ff478a28be1 | 409 | class TheaterPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.all
end
end
def new?
communicator_or_admin?
end
def edit?
communicator_or_admin?
end
def index?
@user.present? && @user.registered?
end
def show?
!@user.nil?
end
def update?
edit?
... | 11.361111 | 39 | 0.630807 |
795817488a8c7b0243fadac5950fde4d59fcdfbe | 836 | {
matrix_id: '563',
name: 'g7jac160sc',
group: 'Hollinger',
description: 'Jacobian from CEPII\'s \'G7marmotte\' OLG model, oldstack 160 (scaled)',
author: 'P. Hollinger',
editor: 'T. Davis',
date: '2001',
kind: 'economic problem',
problem_2D_or_3D: '0',
num_rows: '47430',
num... | 30.962963 | 126 | 0.667464 |
62ee39615f96f4c24f022fcba33479ebcb6ed4d3 | 52 | class UsersController < ApplicationController
end
| 13 | 45 | 0.846154 |
91a11710418992c2c38d605e7f33087880ed49c0 | 150 | #Kata: Sort by Last Char
#URL: https://www.codewars.com/kata/57eba158e8ca2c8aba0002a0
def last(x)
return x.split(/\s+/).sort_by{|i| i[-1]}
end | 25 | 61 | 0.68 |
1da4a79cbc7b1c835f3617c63e5c2b5d0eb310be | 7,758 | require 'pathname'
Puppet::Type.newtype(:dsc_xwindowsupdateagent) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xWindowsUpdateAgent resource type.
Automatically gener... | 35.587156 | 256 | 0.677236 |
39958992468381d7fbed2aeb420fc9ad48b88224 | 1,951 | class TagNameValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
normalized = Tag.normalize_name(value)
case normalized
when /\A_*\z/
record.errors[attribute] << "'#{value}' cannot be blank"
when /\*/
record.errors[attribute] << "'#{value}' cannot contain ast... | 44.340909 | 104 | 0.596105 |
4a62e696cd9a3008d49f2c4bd0ba3acc70873b01 | 4,646 | require 'spec_helper'
describe TreeHelper do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:sha) { 'c1c67abbaf91f624347bb3ae96eabe3a1b742478' }
def create_file(filename)
project.repository.create_file(
project.creator,
filename,
'test this',
... | 29.782051 | 91 | 0.665734 |
e281524f43ea0642d0afd9f315f81ee169722f90 | 1,727 | class Sphinx < Formula
desc "Full-text search engine"
homepage "https://sphinxsearch.com/"
url "https://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz"
sha256 "6662039f093314f896950519fa781bc87610f926f64b3d349229002f06ac41a9"
license "GPL-2.0"
revision 3
head "https://github.com/sphinxsearch/sphinx.g... | 31.4 | 109 | 0.733642 |
e8d140cf36d19f15d7900c00289c1994abe6af6d | 5,189 | module Travis::API::V3
class Service
DEFAULT_PARAMS = [ "include".freeze, "@type".freeze ]
private_constant :DEFAULT_PARAMS
def self.result_type(rt = nil)
@result_type = rt if rt
@result_type ||= parent.result_type if parent and parent.respond_to? :result_type
raise 'result type not s... | 27.310526 | 169 | 0.641357 |
28221a2d368ba584f129e6e762acc8dec2a3d12f | 4,081 | #!/usr/bin/env ruby
require 'date'
require 'runt'
module Runt
# :title:PDate
# == PDate
# Date and DateTime with explicit precision.
#
# Based the <tt>pattern</tt>[http://martinfowler.com/ap2/timePoint.html] by Martin Fowler.
#
#
# Author:: Matthew Lipper
class PDate < DateTime
include DPreci... | 24.584337 | 92 | 0.649351 |
ab506770d2b7246d5f198b5710f920870726ff98 | 1,969 | module GOVUKDesignSystemFormBuilder
module Elements
class ErrorSummary < Base
include Traits::Error
def initialize(builder, object_name, title)
@builder = builder
@object_name = object_name
@title = title
end
def html
return nil unless object_has_errors?
... | 23.722892 | 98 | 0.583545 |
282b710b7516170188655dc81ea745daefed1888 | 95 | module ApexParser
ApexClassCreator.new do |c|
c.add_class(:Crypto, %i[public])
end
end
| 15.833333 | 36 | 0.705263 |
1cf768b0ddb58c75f4afbcbcd43b786d8400777e | 21,457 | #
# Author:: Prajakta Purohit (prajakta@chef.io)
# Copyright:: Copyright 2012-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lice... | 54.321519 | 183 | 0.717435 |
5d7dbfa3c3d3f6c3070a60c7241f33644febb23f | 7,071 | # A visitor for converting a Sass tree into a source string.
class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
# Runs the visitor on a tree.
#
# @param root [Tree::Node] The root node of the Sass tree.
# @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
# @param ... | 26.885932 | 111 | 0.533871 |
4ac6dee5de90d74ede117b5c66aef4016c5bf839 | 18,894 | module JRails
@@config = {
:google => false,
:jquery_version => "1.4.2",
:jqueryui_version => "1.8.4",
:compressed => true
}
def self.load_config
config_file = File.join(Rails.root, "config", "jrails.yml")
if File.exist? config_file
loaded_config = YAML.load_file(c... | 41.163399 | 158 | 0.562083 |
6ab2cee2a6f850c2a34ec1c31d9b3707d8cea52e | 1,600 | ##
# Bootstrap tests for Exceptions
assert('BS Exception 1') do
begin
1+1
ensure
2+2
end == 2
end
assert('BS Exception 2') do
begin
1+1
begin
2+2
ensure
3+3
end
ensure
4+4
end == 4
end
assert('BS Exception 3') do
begin
1+1
begin
2+2
ensure
... | 10.062893 | 32 | 0.446875 |
180244cbbafc94b9e655270060f74735ff079513 | 1,094 | require 'serialcaster/episode_days'
module Serialcaster
RSpec.describe EpisodeDays do
let(:friday) { Date.new(2016, 11, 11) }
let(:monday) { Date.new(2016, 11, 14) }
let(:wednesday) { Date.new(2016, 11, 16) }
subject { EpisodeDays.new(:wednesday, :friday) }
it "thinks a Friday is available" do
... | 28.789474 | 90 | 0.660878 |
5d487a84d40dedaa2d785b0d102d7a8d948902f3 | 1,332 | # 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
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-redshiftdata... | 40.363636 | 126 | 0.678679 |
b9ed0a0ac22d4bc6ddad7a8534e4244ffb2ab813 | 926 | class CreateArtists < ActiveRecord::Migration[4.2]
def self.up
create_table :artists do |t|
t.column :name, :string, :null => false
t.column :creator_id, :integer, :null => false
t.column :is_active, :boolean, :null => false, :default => true
t.column :is_banned, :boolean, :null => false, ... | 38.583333 | 199 | 0.705184 |
bf95daebc3ac0d42eb0c24d9b9e2684da924bd7c | 59 | class Tartarus
module Rb
VERSION = "0.5.0"
end
end
| 9.833333 | 21 | 0.627119 |
6a06b70a8e71e96ff949cd5de0db4e42dc0302f5 | 263 | class CreateMarriages < ActiveRecord::Migration
def change
create_table :marriages do |t|
t.belongs_to :husband, index: true, foreign_key: true
t.belongs_to :wife, index: true, foreign_key: true
t.timestamps null: false
end
end
end
| 23.909091 | 59 | 0.69962 |
33e2bc50c4e17c37a5f35334df8ec1a6df410c49 | 369 | # Copyright (c) Universidade Federal Fluminense (UFF).
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.
class UpdateOffsetsColumnsOfNotification < ActiveRecord::Migration[5.1]
def up
change_column :notifications, :query_offset, :string
change_column :notifications, :notifica... | 28.384615 | 84 | 0.772358 |
61ede813775c7fd08c180f9eb589128b6407ded4 | 7,071 | ##
# Hash
#
# ISO 15.2.13
class Hash
##
# Equality---Two hashes are equal if they each contain the same number
# of keys and if each key-value pair is equal to (according to
# <code>Object#==</code>) the corresponding elements in the other
# hash.
#
# ISO 15.2.13.4.1
def ==(hash)
return true if ... | 22.957792 | 81 | 0.549286 |
9117a673794395e433f98778afe6ce678ec40940 | 2,548 | # frozen_string_literal: true
require 'support/encrypted_event'
require 'support/dummy_repository'
module EventStoreClient
RSpec.describe Mapper::Encrypted do
let(:data) do
{
'user_id' => 'dab48d26-e4f8-41fc-a9a8-59657e590716',
'first_name' => 'Anakin',
'last_name' => 'Skylwalker',... | 28.954545 | 87 | 0.600863 |
87a536ddb037cc9e891b23bde8a67417c12cf010 | 953 | Pod::Spec.new do |spec|
spec.name = 'CCHMapClusterController'
spec.version = '1.6.6'
spec.license = 'MIT'
spec.summary = 'High-performance map clustering with MapKit for iOS and OS X. Integrate with 4 lines of code.'
spec.homepage = 'https://github.com/choefele/CCHMapClusterController'
spec.authors ... | 50.157895 | 198 | 0.751312 |
1ad7e78550488342d276a9584a45813139c3eb9a | 7,618 | class Factory
class << self
attr_accessor :factories #:nodoc:
# An Array of strings specifying locations that should be searched for
# factory definitions. By default, factory_girl will attempt to require
# "factories," "test/factories," and "spec/factories." Only the first
# existing file wil... | 29.413127 | 86 | 0.663035 |
ffc2430f3db0582befb3b70a464dd75ba0fa9a5f | 399 | class CreateSocMedLikes < ActiveRecord::Migration[6.0]
def change
create_table :soc_med_likes do |t|
t.references :target, null: false, polymorphic: true
t.references :owner, null: false, polymorphic: true
t.timestamps
end
add_index :soc_med_likes, %i[target_id target_type owner_id own... | 30.692308 | 135 | 0.739348 |
4ad13ac26efe4d038b13687ca05d3f88e9819e8f | 5,226 | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
$block_number = 0 # message block number
$block = ... | 30.034483 | 154 | 0.565059 |
186d8c95b085f3f5ad3c2bb7c51ed8fd5d2313f0 | 129 | require 'test_helper'
class SearchAssignee1Test < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16.125 | 51 | 0.72093 |
017731998c9fd16594bcea2e2817e29d9021abea | 571 | module Rack::App::SingletonMethods::Settings
def cli(&block)
@cli ||= Rack::App::CLI.new
@cli.instance_exec(&block) unless block.nil?
@cli
end
protected
def headers(new_headers=nil)
middleware do |b|
b.use(Rack::App::Middlewares::HeaderSetter,new_headers)
end if new_headers.is_a?(Ha... | 19.689655 | 63 | 0.686515 |
33c26adb4e6f591f091342a07cc35a49fabbaadf | 2,303 | require 'spec_helper'
include WebMock::API
describe VCloud::RestApi do
describe 'when receiving an HTTP error code' do
it 'should handle a HTTP 401 error when logging in with a bad password' do
stub_request(:post, 'https://someuser%40someorg:badpassword@some.vcloud.com/api/sessions').
with(:header... | 47 | 128 | 0.653061 |
f71ceb46d3501ec922bedd558ddd82d6d89c6746 | 285 | class NotificationSchema
include JSON::SchemaBuilder
root :notifications
def create
root do |root_object|
additional_properties false
end
end
def update
root do
additional_properties false
boolean :delivered, required: true
end
end
end
| 15 | 40 | 0.701754 |
21113fa4c408358c5bbb431ab03bdabe8abc1f30 | 90 | class CreateProject
def initialize(attributes)
Project.create!(attributes)
end
end | 18 | 31 | 0.777778 |
91b31f3d4a1820bcce620ce6e3ca30da58a7e2e0 | 1,640 | module MCollective
module Data
class Resource_data<Base
activate_when do
require 'mcollective/util/puppet_agent_mgr'
true
end
def sanitize_val(result_value, default_value)
if result_value.nil?
return default_value
end
result_value
end
... | 42.051282 | 111 | 0.64878 |
08f4be93f73e9a2c036b09ce5290f71ddbf5be3e | 358 | # frozen_string_literal: true
require 'phoner'
# Validate phone numbers
class PhoneValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if Phoner::Phone.valid? value, country_code: '1'
record.errors[attribute] << (options[:message] ||
'is... | 27.538462 | 63 | 0.675978 |
e8593492f8b1c163b5b53353a441f6eaa0178dbf | 423 | class TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::ConnectingRailwayLine::FromStationFacilityPage < TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::ConnectingRailwayLine::MetaClass
def initialize( request , connecting_railway_line_decorated )
@display_another_station_info = true
... | 42.3 | 211 | 0.810875 |
61003413b6900c83a364dc5dceb57e2fdd44dffd | 977 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXAdsFacebook'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s... | 36.185185 | 188 | 0.612078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.