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 |
|---|---|---|---|---|---|
abe89139e377c2168beb26c21b5735a938886239 | 503 | require 'simp/cli/config/items/data/cli_use_internet_simp_yum_repos'
require 'rspec/its'
require_relative '../spec_helper'
describe Simp::Cli::Config::Item::CliUseInternetSimpYumRepos do
before :each do
@ci = Simp::Cli::Config::Item::CliUseInternetSimpYumRepos.new
end
context "#recommended_value" do
it ... | 25.15 | 68 | 0.733598 |
01a700fbe3e80ccb0ce7b74b8f9572db5c5254ba | 99 | module ActiverecordUnitwise
module Validators
extend ActiveSupport::Concern
end
end
| 11 | 33 | 0.747475 |
e83a3e04b48a10886bc86f86ddba6713bd863779 | 2,228 | # frozen_string_literal: true
require 'fileutils'
require 'git'
require 'logger'
require 'tempfile'
module LearnTest
module Git
module Wip
class Base < ::Git::Path
TEMPFILE = '.wip'
attr_reader :working_branch, :wip_branch
def initialize(base:, message:)
@base = base
... | 26.211765 | 97 | 0.552065 |
bb07719626683c73571c39c795f08fbcc5772381 | 3,889 | class Auth::CasSessionsController < Devise::SessionsController
include DeviseCasAuthenticatable::SingleSignOut::DestroySession
skip_before_action :verify_authenticity_token, :only => [:single_sign_out]
def new
if memcache_checker.session_store_memcache? && !memcache_checker.alive?
raise "memcache is d... | 30.382813 | 198 | 0.721522 |
919a1975eabadeda189167ca26d4d5c16fad2a95 | 5,036 | class MongoPubsub
def crash!
fail 'test'
end
def ping
:pong
end
def subscriptions?
!subscriptions.empty?
end
end
describe MongoPubsub, :celluloid => true do
describe '.publish' do
it 'sends message to channel subscribers' do
david = spy(:david)
lisa = spy(:lisa)
messa... | 27.221622 | 135 | 0.599484 |
03d9184687025e1503d11fa4b67d2c958c312edc | 195 | require "../bf.rb"
bm = BrainMem.new(true)
bm.exec do
n = alloc(10)
n.gets
s = alloc(120)
s.gets
s.puts
end
# 実行
# bm.bf.make.dump_run(0.1)
bm.bf.run_dump
# # コード生成
puts bm.bf.to_s | 10.263158 | 26 | 0.615385 |
5dd0248c3f65ff56e5e3a6f601a57eda7f7bc85c | 317 | module SolscanApiRuby
module Client
module HttpCodes
HTTP_OK_CODE = 200
HTTP_BAD_REQUEST_CODE = 400
HTTP_UNAUTHORIZED_CODE = 401
HTTP_FORBIDDEN_CODE = 403
HTTP_NOT_FOUND_CODE = 404
HTTP_UNPROCESSABLE_ENTITY_CODE = 429
HTTP_INTERNAL_SERVER_ERROR = 500
end
end
end
| 22.642857 | 42 | 0.712934 |
6155ed4c95b823afd9662247afc2617f71e79571 | 151 | json.array!(@volunteers) do |volunteer|
json.extract! volunteer, :id, :lang_id, :title, :body
json.url volunteer_url(volunteer, format: :json)
end
| 30.2 | 55 | 0.728477 |
3357d0683a6c75a363867722bc3d24fb3037dbfd | 460 | # frozen_string_literal: true
module Course::Material::FoldersHelper
# Find the proper display name for the folder, if folder is root we will display the name of
# material component.
#
# @param [Course::Material::Folder] folder The folder to be displayed.
# @return [String] The proper display name of the fol... | 38.333333 | 95 | 0.743478 |
bb9c10104086917b2b6a219ba12059c225b0cb44 | 527 | require "spec_helper"
describe SimonAsks::Comment do
describe "structure" do
it { should belong_to(:owner) }
it { should belong_to(:user) }
it { should validate_presence_of(:content) }
end
describe "validations" do
it "should be passed" do
comment = SimonAsks::Comment.new
comment... | 19.518519 | 48 | 0.664137 |
ab1c43cec307a0cf2fbd4042cbd16e04d1006950 | 85 | require 'test_helper'
class IncidentStockTypesHelperTest < ActionView::TestCase
end
| 17 | 57 | 0.847059 |
08e26f018be9970c8f6bad660b94fdb702a5fd8f | 1,498 | #
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: sudo
# Resource:: default
#
# Copyright 2011-2013, Bryan w. Berry
#
# 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
#
# ... | 38.410256 | 74 | 0.67223 |
e8015f5f4a9e1cf29960efe62cf0975d56982c25 | 842 | require './lib/open-uri-post'
require 'rexml/document'
TRANSLATION_URL = 'http://api.microsofttranslator.com/V2/Http.svc/Translate'
class Translator
Languages = [
'ja', # Japanese
'en', # English
'fr', # French
'de', # German
'it', # Italian
'ru', # Russian
'es', # Spanish
'el' # Gre... | 21.589744 | 77 | 0.611639 |
f82c2018decdb34fe95ead530523f5d8c704abcb | 60 | template '/tmp/index.html' do
source 'index.html.erb'
end
| 15 | 29 | 0.716667 |
8747679b86b57ea3fd37bdcbfd3f97b924222b36 | 1,089 | require 'rails_helper'
RSpec.describe 'POST /login', type: :request do
let(:user) { Fabricate(:user) }
let(:url) { '/login' }
let(:params) do
{
user: {
email: user.email,
password: user.password
}
}
end
context 'when params are correct' do
before do
post url, pa... | 21.352941 | 61 | 0.640037 |
288a891f97c7f2c3a1cff870bc96ebc305b9f218 | 7,830 | module Shoppe
class Order < ActiveRecord::Base
# The associated delivery service
#
# @return [Shoppe::DeliveryService]
belongs_to :delivery_service, class_name: 'Shoppe::DeliveryService'
# The country where this order is being delivered to (if one has been provided)
#
# @return [Shoppe::... | 34.043478 | 157 | 0.695402 |
387a2600123b570e4c3372aca66ced0405a7090c | 89 | class Post < ApplicationRecord
validates :title, :body, :published, presence: true
end
| 22.25 | 53 | 0.764045 |
e8db66ba49c745ba23c833d30f74bd0c7f872cb3 | 2,647 | #
# Copyright:: Copyright (c) 2017 Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | 32.679012 | 93 | 0.677748 |
e9331c59cbcacf35137a9c6cfb924cc798cd7f14 | 188 | module Codebreaker
module Errors
class WrongArgumentError < StandardError
def initialize(message = 'Wrong argument given. ')
super(message)
end
end
end
end
| 18.8 | 56 | 0.675532 |
bb1bfdf5ac2aad5bdbb1f07cf15f91ffd3636b89 | 1,841 | # (C) Copyright 2018 Hewlett Packard Enterprise Development LP
#
# 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 app... | 32.875 | 137 | 0.704508 |
39e3dcd3a0b1768f7aebb27f8e92e1ce5c8edf5d | 196 | class OrderInfoBrand < ApplicationRecord
belongs_to :order_info, class_name: 'OrderInfo'
belongs_to :brand, class_name: 'Brand'
validates_uniqueness_of :order_info_id, scope: :brand_id
end
| 28 | 58 | 0.80102 |
1af63a338dd7a9b310a149bec6bd84abdb60cd69 | 1,390 | <% if false # the license inside this if block assertains to this file -%>
# Copyright 2018 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/LI... | 34.75 | 74 | 0.706475 |
ab20a9a611589c8f98d58a15807c7c7ec18fadd7 | 1,460 | # frozen_string_literal: true
require_relative "lib/limpio/version"
Gem::Specification.new do |spec|
spec.name = "limpio"
spec.version = Limpio::VERSION
spec.authors = ["Mario Viapiano"]
spec.email = ["marioeviapiano@gmail.com"]
spec.summary = "Hash/Array cleaner"
spec.... | 38.421053 | 88 | 0.678082 |
e238d3c1ede0063b909e30520da5382e039391f1 | 279 | module BooleanCoercion
extend ActiveSupport::Concern
included do
columns_hash.each_pair do |attribute, adapter|
next unless adapter.type == :boolean
define_method "#{ attribute }=" do |value|
super !!value
end
end if table_exists?
end
end | 23.25 | 50 | 0.677419 |
4a00175e17fb46d269ea2b702d9239ebbcc217fc | 6,480 | # frozen_string_literal: true
require 'test_helper'
class OrganizationTest < ActiveSupport::TestCase
let(:org) { create(:organization) }
it 'unclaims projects when destroyed and reclaims them when undestroyed' do
proj1 = create(:project)
proj2 = create(:project)
proj1.update(organization_id: org.id)
... | 32.079208 | 109 | 0.700154 |
614d6d49a68779b237e7363d0ecb09c4322dd844 | 2,527 | # encoding: UTF-8
require 'sqlite3'
require 'httparty'
require 'open3'
require 'daemons'
require 'logger'
require "timeout"
WORKING_DIRECTORY = Dir.pwd
# Daemons.run_proc('cointrader_runner.rb') do
TIMEOUT = 5*60*60
API_URL = 'https://poloniex.com/public?command=returnTicker&period=60'
MIN_VOLUME = 1000.0
ACT... | 30.817073 | 125 | 0.600712 |
ed11a4dbb68476e5e0e0fdd7d1bd638858b4246a | 3,323 | require "administrate/base_dashboard"
class CommonApplicationDashboard < Administrate::BaseDashboard
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute is displayed
# on pag... | 32.90099 | 83 | 0.752031 |
d5843b2d5105d1f3613ec6cf12207512f50f78b6 | 1,225 | # frozen_string_literal: true
module CzechPostB2bClient
module Services
class DeliveringInspector < CzechPostB2bClient::Services::Communicator
attr_reader :parcel_codes
def initialize(parcel_codes:)
@parcel_codes = parcel_codes
end
private
def request_builder_args
... | 25 | 75 | 0.67102 |
21e0a69026a83c4f91e94f7599e6b18532d47fc9 | 1,114 | #!/usr/local/opt/ruby/bin/ruby
# coding: utf-8
$test_basic_private_methods = private_methods(false)
#p $test_basic_private_methods
#$basic_public_methods = public_methods(false)
require "cutep"
require "autoreload"
#qp private_methods(false)
qp private_methods(false) - $test_basic_private_methods; $test_basic_private_... | 32.764706 | 109 | 0.773788 |
21ba0f1c33a18da837aa342348a2866f6d3f40de | 3,077 | #
# Author:: Daniel DeLeo (<dan@opscode.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | 33.086022 | 74 | 0.797855 |
62e0999036470060596b3434b82117b6aa59cffa | 3,373 | # frozen_string_literal: true
require "yaml"
module Licensed
module Commands
class Status < Command
# Create a reporter to use during a command run
#
# options - The options the command was run with
#
# Returns a Licensed::Reporters::StatusReporter
def create_reporter(options)... | 38.770115 | 123 | 0.67062 |
b9a2a12f611aab6f0390007c36fb08020b1fde65 | 6,936 | # -*- encoding : utf-8 -*-
require 'helper'
class CampaignTest < Test::Unit::TestCase
context "Campaign" do
setup do
@test_campaign_hash = {
:name => "hustokrutě megapřísně - #{Time.now.strftime("%Y.%m.%d %H:%M:%S")}",
:status => :running,
:cpc => 3.5,
:budget => 15.0,
... | 45.631579 | 202 | 0.597174 |
e2ef106fdf420410616b45b8c937182b3181c937 | 3,940 | ###-----------------------------------------------------------------------------
# Skill Display script v1.0
# Created by Neon Black
# V1.0 - 1.9.2013 - Version created for release
# Created for both commercial and non-commercial use as long as credit is
# given to Neon Black.
###----------------------------------... | 28.550725 | 83 | 0.638071 |
b9a46b4cfe1efec37562e86d9ba13b3937923a75 | 457 | require_relative '../helper'
VER.spec do
describe 'Buffer instance methods' do
buffer = VER::Buffer.new(Tk::Toplevel.new)
buffer.open(:Scratch)
it 'deletes trailing whitespace' do
buffer.value = <<-TEXT.chomp
some
lines
TEXT
buffer.touch!('1.0', 'end')
buffer.handle_pendin... | 19.041667 | 46 | 0.658643 |
1ad35780d0eea33ca9e3aba795ca36878b314ddc | 992 | #
# Copyright 2021 ThoughtWorks, 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 ... | 34.206897 | 74 | 0.758065 |
38f4964ed74d48b8ea1a6989f8fa4c191c2c3d00 | 1,514 | class Day2
attr_accessor :policies
def initialize(input)
@policies = read_policies(input)
end
def problem_1
count_valid
end
def problem_2
count_updated_valid
end
def count_valid
@policies.select(&:valid?).length
end
def count_updated_valid
@policies.select(&:updated_... | 16.27957 | 69 | 0.655878 |
0105210002b69ef2f7fe74ad8bf190819b43efae | 5,033 | require 'active_support/notifications'
require 'faraday'
require 'typhoeus'
require 'typhoeus/adapters/faraday'
require 'faraday_middleware'
require 'yotpo/core/response_parser'
require 'yotpo/version'
require 'yotpo/api/account'
require 'yotpo/api/account_platform'
require 'yotpo/api/account_social'
require 'yotpo/api... | 28.925287 | 149 | 0.659845 |
26da8165fa58dec5891a8892dcfe1db7c7bc81a0 | 751 | # frozen_string_literal: true
# Specify the client certificate for connecting to the Puppet Enterprise ENC. This must be specified along with
# --pe-enc-ssl-client-key in order to work.
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modif... | 44.176471 | 111 | 0.745672 |
08126285e5a7d5518601b49c5f8471dd42bf9da5 | 1,158 | module Solargraph
module Pin
module YardPin
class Method < Pin::Method
include YardMixin
def initialize code_object, location, name = nil, scope = nil, visibility = nil
comments = (code_object.docstring ? code_object.docstring.all : nil)
super(location, code_object.names... | 32.166667 | 189 | 0.600173 |
3994680e5c7e828f2ac5af1b6ad3f23ac3c33ca5 | 839 | # frozen_string_literal: true
require File.expand_path("spec_helper", __dir__)
module Danger
describe Danger::DangerLcov do
it "should be a plugin" do
expect(Danger::DangerLcov.new(nil)).to be_a Danger::Plugin
end
#
# You should test your custom attributes and methods here
#
describe ... | 28.931034 | 193 | 0.674613 |
edbd8d7152bda8d97f059ca3b8b3d5fa966671ee | 293 | module UsersHelper
# 引数で与えられたユーザーのGravatar画像を返す
def gravatar_for(user)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
end
| 32.555556 | 72 | 0.716724 |
ff64324efdf8eedfddca9ed0e0f3b12e0c128ccf | 1,265 | module TestTrackRailsClient::AssignmentHelper
def stub_test_track_assignments(assignment_registry) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
raise "Cannot stub test track assignments when TestTrack is enabled" if TestTrack.enabled?
split_registry = TestTrack::Fake::SplitRegistry.instance.to_h.d... | 42.166667 | 110 | 0.705138 |
d55c79482fe08721f2af3b6ffcc8fa3010d30dc0 | 466 | cask 'screenflow' do
version '8.2.3'
sha256 '8d3db51b4c2b9ba1dfc962eea853811a0e0ec00ec8782ad499e0a3010d158c00'
url "https://www.telestream.net/download-files/screenflow/#{version.major_minor.dots_to_hyphens}/ScreenFlow-#{version}.dmg"
appcast 'https://www.telestream.net/updater/screenflow/appcast.xml'
name '... | 31.066667 | 125 | 0.772532 |
3902a88ecf950f8a90aa125d7bd6acc27251c5eb | 111,135 | # frozen_string_literal: true
require_relative 'meta'
require_relative '../base'
require_relative 'step/buy_sell_par_shares'
require_relative 'step/draft'
require_relative 'step/track'
require_relative 'step/destinate'
require_relative 'step/token'
require_relative 'step/reassign_switcher'
require_relative 'step/route... | 34.269195 | 126 | 0.496342 |
28b7305f7b0f47770c000c6c31b4ac53e326201c | 594 | # frozen_string_literal: true
module Users
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_action :authenticate_user!
def google_oauth2
@user = User.from_omniauth(request.env['omniauth.auth'])
if @user.persisted?
sign_in_and_redirect @user, event: :au... | 24.75 | 89 | 0.700337 |
acf803de3f2d02355ec2db33214bf15d92bc2438 | 33,041 | require "test_helper"
class VersionTest < ActiveSupport::TestCase
should belong_to :rubygem
should have_many :dependencies
context "#as_json" do
setup do
@version = build(:version, summary: "some words", created_at: Time.now.in_time_zone)
end
should "only have relevant API fields" do
js... | 35.875136 | 132 | 0.654036 |
f742c9843a4d865272d94a3f71c53227a96cc07d | 8,921 | # typed: false
# Frozen_string_literal: true
require "livecheck/livecheck"
describe Homebrew::Livecheck do
subject(:livecheck) { described_class }
let(:f) do
formula("test") do
desc "Test formula"
homepage "https://brew.sh"
url "https://brew.sh/test-0.0.1.tgz"
head "https://github.com... | 33.163569 | 116 | 0.651048 |
e2964bf70092c85a3febe6c0d0efd669220f5928 | 2,010 | require 'spec_helper'
describe 'artifactory::artifact' do
let(:title) { 'namevar' }
let(:pre_condition) { "class { artifactory : endpoint => 'https://repo.jfrog.org/artifactory' }" }
describe 'with exisiting artifact_id' do
let(:params) do
{
group_id: 'org.artifactory',
artifact_id: 'a... | 21.612903 | 100 | 0.548259 |
f7297ab8c452a452f6b8effa1c01d43fb6fb5deb | 17,834 | module Claim
class BaseClaimAbstractClassError < RuntimeError
def initialize(message = 'Claim::BaseClaim is an abstract class and cannot be instantiated')
super(message)
end
end
class BaseClaim < ApplicationRecord
include SoftlyDeletable
self.table_name = 'claims'
auto_strip_attribute... | 27.692547 | 117 | 0.692105 |
ffd6a9b6331af909fe9678c9d0b2769ca70e34e5 | 1,181 | # frozen_string_literal: true
require_relative '../test_helper'
class InstancePageTest < MiniTest::Test
include Rack::Test::Methods
def app
Inferno::App.new
end
def setup
@fhir_server = "http://#{Inferno::SecureRandomBase62.generate(32)}.example.com/"
post Inferno::BASE_PATH, fhir_server: @fhir_... | 28.804878 | 97 | 0.731583 |
e83f1c39ac6c422842f0617a65d351fc7f1a6749 | 924 | require 'minitest/autorun'
require_relative 'binary'
class BinaryTest < MiniTest::Unit::TestCase
def test_binary_1_is_decimal_1
assert_equal 1, Binary.new("1").to_decimal
end
def test_binary_10_is_decimal_2
skip
assert_equal 2, Binary.new("10").to_decimal
end
def test_binary_11_is_decimal_3
... | 21 | 59 | 0.751082 |
5d95ce59ac229a2665e91d5e2a66e186ee43a968 | 3,735 | require 'spec_helper'
require 'bundler/audit/database'
require 'tmpdir'
describe Bundler::Audit::Database do
let(:vendored_advisories) do
Dir[File.join(Bundler::Audit::Database::VENDORED_PATH, 'gems/*/*.yml')].sort
end
describe "path" do
subject { described_class.path }
it "it should be a directory... | 26.870504 | 130 | 0.651138 |
ed928f7c2043a7eb18437cade3c75cdd7dcce935 | 579 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::InputObject do
let(:input_object) do
Dummy::DairyProductInput.new(
{ source: 'COW', fatContent: 0.8 },
defaults_used: Set.new,
context: GraphQL::Query::NullContext)
end
describe '#to_json' do
it 'returns JSO... | 28.95 | 100 | 0.709845 |
1ca3915e3b037a6c4e20e1f576ab291cf5637bea | 68 | module Carrierwave
module Mongoid
VERSION = "1.1.0"
end
end
| 11.333333 | 21 | 0.676471 |
39d11caa98cf299594cf93f5961d467b977db058 | 33,678 | # frozen_string_literal: true
require_relative 'spec_helper'
describe 'Asciidoctor::PDF::Converter - Admonition' do
it 'should advance block to next page to avoid splitting it if it will fit on page' do
pdf = to_pdf <<~EOS, analyze: true
#{(['paragraph'] * 20).join %(\n\n)}
[NOTE]
====
#{(['adm... | 35.33893 | 169 | 0.636202 |
08665ffa6072d0323669523795503b13d1765928 | 868 | require 'formula'
class Chicken < Formula
homepage 'http://www.call-cc.org/'
url 'http://code.call-cc.org/releases/4.9.0/chicken-4.9.0.1.tar.gz'
sha1 'd6ec6eb51c6d69e006cc72939b34855013b8535a'
head 'git://code.call-cc.org/chicken-core'
bottle do
sha1 "18413b340d0dc2486f132dbd3997911d00eb3706" => :maver... | 28 | 74 | 0.68318 |
e22cbe9525d16516b6d3a6d3314fe191e86ad6fc | 19,217 | require 'active_support/descendants_tracker'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/class/inheritable_attributes'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/kernel/singleton_class'
module ActiveSupport
# Callbacks are hooks into the life... | 31.975042 | 112 | 0.568871 |
ed1933000c9864a9806bc8398be0c0bd2dd50f5a | 592 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe JSONAPIHelpers::Serializers::Errors do
context 'with no errors' do
subject { described_class.new.to_h }
it 'returns empty array' do
expect(subject).to eq(errors: [])
end
end
context 'with errors' do
subject do
error... | 20.413793 | 54 | 0.638514 |
acac1fd16c6f1b68007aacd4147eb2fbc9177b08 | 7,665 | #!/usr/bin/env ruby
require 'fileutils'
require 'yaml'
require 'open3'
require 'io/console'
require_relative './client.rb'
module BitShares
class TestNet
attr_reader :delegate_node, :alice_node, :bob_node, :running
TEMPDIR = 'tmp'
def initialize(logger = nil)
@logger = logger
@delegate_n... | 33.76652 | 211 | 0.637704 |
915e092ed578a99a56dd591cd0a72eb9f4b46fbc | 3,549 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
#
# 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.
# ... | 33.8 | 80 | 0.677092 |
083500735c0ed14ddad1514a396017f462e15539 | 468 | class AddSubmissionTypes < ActiveRecord::Migration
def self.up
create_table :submission_types do |t|
t.column :name, :string
t.column :short_label, :string
t.column :long_label, :string
t.column :validator, :string
t.column :type_params, :string
t.column :description, :string
... | 24.631579 | 50 | 0.675214 |
283b33446af4beec5c973445eb1681cda7a1cac6 | 781 | require File.dirname(__FILE__) + '/../../spec_helper'
require 'csv'
describe "CSV.parse_row" do
it "parses 'foo\nbar' one row at a time" do
parse_me = "foo\nbar"
parsed_row = []
parsed_count, next_row_index = CSV::parse_row parse_me, 0, parsed_row
parsed_count.should == 1
next_row_index.s... | 26.931034 | 87 | 0.667093 |
4a8e8a0a530aecea57c4590a49b93f101ac1852a | 641 | # frozen_string_literal: true
class PostNotifier < ActionMailer::Base
default from: 'mailer@blackducksoftware.com'
def post_replied_notification(user, user_who_replied, post)
@user_who_needs_reply = user
@user_who_replied = user_who_replied
@topic = post.topic
@post = post
key = Account::Subsc... | 37.705882 | 105 | 0.767551 |
f7229f4cdaa416c9e79693aa41b145fd4d0afcb7 | 4,291 | require 'spec_helper'
module FakeDynamo
describe Item do
subject do
item = Item.new
key = Key.new
key.primary = Attribute.new('id', 'ananth', 'S')
item.key = key
item.attributes = {}
item
end
context "#update" do
it "should not allow to update primary key" do
... | 36.991379 | 116 | 0.578653 |
262c5c07c8c36654b2359b16da03dc5efc2bdc09 | 235 | class ProblemWithDeletedPresenter < ProblemPresenter
def as_json(options={})
problems.map(&method(:problem_as_json))
end
def problem_as_json(problem)
super.merge({
deleted_at: problem.deleted_at
})
end
end
| 16.785714 | 52 | 0.714894 |
2867afae70f579ee311e7fc13ba54eb64a5e6ce3 | 7,886 | require 'urnon/script/runtime'
module Client
HELP_MENU = <<~HELP
Urnon v#{Urnon::VERSION}
built-in commands:
#{$clean_lich_char}<script name> start a script
#{$clean_lich_char}force <script name> start a script even if its already running
#{$clean_lich_char}pause <script ... | 44.303371 | 245 | 0.551103 |
612ea8c0fe6a7c823fadad82b558030e0008eb12 | 633 | module Zxcvbn
module Matchers
class Repeat
def matches(password)
result = []
i = 0
while i < password.length
cur_char = password[i]
j = i + 1
while cur_char == password[j]
j += 1
end
if j - i > 2 # don't consider length 1... | 20.419355 | 61 | 0.406003 |
1c50365e52132021156c9b05ed00e816e72e69b1 | 631 | Gem::Specification.new do |gem|
gem.name = "musique"
gem.version = "0.0.2"
gem.required_ruby_version = ">= 1.9.2"
gem.description = %q{Musique is a gem for manipulating with musical constructs, such as notes, chords and intervals.}
gem.summary = gem.description
gem.homepage = "... | 31.55 | 121 | 0.616482 |
bbcc49a1cbd847c0be8dbb3e4c5079d6574ca9aa | 1,399 | class Kore < Formula
desc "Web application framework for writing web APIs in C"
homepage "https://kore.io/"
url "https://kore.io/releases/kore-4.0.1.tar.gz"
sha256 "bc8bf755133faf67755c3a4ea53db49f208986efeed734ce6be562a3e5a81057"
license "ISC"
head "https://github.com/jorisvink/kore.git"
bottle do
s... | 34.975 | 93 | 0.70336 |
087c017b644e0a2ce1eb1f571228ea2107abfe98 | 1,690 | require_relative '../../../../../lib/bookbinder/config/checkers/dita_section_checker'
require_relative '../../../../../lib/bookbinder/config/configuration'
module Bookbinder
module Config
module Checkers
describe DitaSectionChecker do
context 'when there is at least one ditamap_location' do
... | 31.886792 | 87 | 0.472781 |
1c42d5f014aad9798c79c10b2c6a17e3d80b7514 | 1,208 | # 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... | 38.967742 | 86 | 0.749172 |
bf141455ff6a2391ed44e56dcba0763f4571769d | 1,756 | # Copyright © 2011-2020 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list... | 58.533333 | 145 | 0.800114 |
1dbef7f6bc883011526f71ca55fa51e49d979459 | 360 | require File.dirname(__FILE__)+"/card_type.rb"
require File.dirname(__FILE__)+"/luhn.rb"
class CreditCard
include CardType
include Luhn
attr_accessor :number, :type, :validity
def initialize(card_number)
self.number = card_number
self.type = find_card_type(card_number)
self.validity = validate(card_n... | 21.176471 | 63 | 0.744444 |
4aa0c0ab5c218b4d84b51450cb91fefa091f8147 | 12,549 | require_relative 'helper'
class TestConnectionPool < Minitest::Test
class NetworkConnection
SLEEP_TIME = 0.1
def initialize
@x = 0
end
def do_something
@x += 1
sleep SLEEP_TIME
@x
end
def fast
@x += 1
end
def do_something_with_block
@x += yield... | 22.489247 | 109 | 0.65806 |
1de9b0761fe5a281499324297f5836a2427465e4 | 423 | class DestroyLocalBatchJob < ApplicationJob
queue_as :default
after_enqueue do |job|
local_batch_job = LocalBatchJob.find_by(id: job.arguments.first)
local_batch_job.update_attribute(:deleting, true)
end
def perform(local_batch_job_id)
local_batch_job = LocalBatchJob.find_by(id: local_batch_job_id... | 26.4375 | 68 | 0.782506 |
ab9748b0e1e728c25b57c0c69fcc8b0948530e0c | 5,878 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... | 44.530303 | 111 | 0.722865 |
1d4eff321ffa094843de97dfd6523178d422702e | 3,260 | #
# Fluentd
#
# 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, so... | 25.076923 | 77 | 0.597853 |
e2c5f4fd96ab8d4bd106c302da6a2eda3b247a6c | 124 | class RemoveActiveFromDocuments < ActiveRecord::Migration[6.0]
def change
remove_column :documents, :active
end
end
| 20.666667 | 62 | 0.774194 |
5d308713fe3d9990cfe0ce5c6f946382e56d06d9 | 1,473 | module API
module V1
module ExternalUsers
class Defendant < Grape::API
params do
optional :api_key, type: String, desc: I18n.t('api.v1.defendant.params.api_key')
optional :claim_id, type: String, desc: I18n.t('api.v1.defendant.params.claim_id')
optional :first_name, typ... | 33.477273 | 96 | 0.581127 |
e9667201c3fcbca4886080081eac3effe4e57156 | 1,837 | require "#{File.dirname(__FILE__)}/abstract_note"
module Footnotes
module Notes
class RoutesNote < AbstractNote
def initialize(controller)
@controller = controller
@parsed_routes = parse_routes
end
def legend
"Routes for #{@controller.class.to_s}"
end
def c... | 31.135593 | 129 | 0.634186 |
5dc7ba967225d65364c12c9f2a14b961fd82f184 | 957 | class SourceFile < ApplicationRecord
#attr_accessible :post_id, :file_name, :total_row, :published_at
belongs_to :post
has_many :reports, dependent: :destroy
has_many :mi_reports, dependent: :destroy
has_many :categories
has_many :companies, dependent: :destroy
has_many :income_statements, dependent: :destroy
... | 26.583333 | 69 | 0.761755 |
7a537a161476d3c2969ba65cafa84b8ace9f82e0 | 1,388 | class Tcptrack < Formula
desc "Monitor status of TCP connections on a network interface"
homepage "http://linux.die.net/man/1/tcptrack"
url "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/t/tcptrack/tcptrack_1.4.2.orig.tar.gz"
mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/t/tcptrack... | 37.513514 | 109 | 0.751441 |
9153cbbc08b69dfce031e930a9697a9df0a23695 | 15,775 | require 'faraday'
require 'ostruct'
# Represents a single triggered Service call. Each Service tracks the event
# type, the configuration data, and the payload for the current call.
class Service
dir = File.expand_path '..', __FILE__
Dir["#{dir}/events/helpers/*.rb"].each do |helper|
require helper
end
Di... | 26.828231 | 83 | 0.623772 |
917db6d4ca07839cd4dd11b6b15869c87e192ff1 | 5,459 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 25.629108 | 93 | 0.619161 |
383ec0620e6dca85e296b6c48577bb1c9003369b | 249 | class CreateBarkbacks < ActiveRecord::Migration[5.1]
def change
create_table :barkbacks do |t|
t.references :user, foreign_key: true
t.references :howl, foreign_key: true
t.text :content
t.timestamps
end
end
end
| 20.75 | 52 | 0.674699 |
1c8b00b8335a4fa83dc60f664061750cdd447a31 | 102 | helpers do
def current_user
@current_user ||= User.find(session[:id]) if session[:id]
end
end
| 17 | 61 | 0.686275 |
f880c42b2999bb8a382f9d37891d9b0dd00c5b6b | 199 | # configuration file
template "/etc/monit/conf.d/percona.monitrc" do
owner "root"
group "root"
mode "0644"
source "percona.monitrc.erb"
notifies :reload, "service[monit]", :delayed
end
| 22.111111 | 47 | 0.698492 |
793de26c86cf6e3cb3f73efec112628930462163 | 343 | # frozen_string_literal: true
require 'eac_ruby_gems_utils/tests/base'
module EacRubyGemsUtils
module Tests
class Rspec < ::EacRubyGemsUtils::Tests::Base
def bundle_exec_args
%w[rspec]
end
def dependency_gem
'rspec-core'
end
def test_directory
'spec'
... | 15.590909 | 49 | 0.635569 |
d5967fc79e1296910cab378f1704f7ecb7922fa6 | 108 | module ConfigLibrary
class KeyError < StandardError; end
class AssignmentError < StandardError; end
end
| 21.6 | 44 | 0.805556 |
33a28f3e0e38cf155da92073f97daf75b70cff30 | 917 | require 'spec_helper'
describe 'Donor' do
it 'does not save a donor without email' do
d1 = Donor.create(:name=>"test", :password=>"test")
expect(d1.valid?).to be false
end
it 'does saves a donor with email' do
d1 = Donor.create(:name=>"test", :email=>"a@b.com",:password=>"test")
expect(d1.valid?... | 24.131579 | 73 | 0.648855 |
e2f4651f3ea61746b3677a26ba19561c1041e4d0 | 3,355 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer::HTML
# Superceded by java_atomicr... | 28.432203 | 121 | 0.543666 |
f83f5cee41c652398a6615532c3bd7a73e81f407 | 2,017 | # config valid only for current version of Capistrano
lock '3.6.1'
set :application, 'Lynx'
set :app_version_number, '1.0-SNAPSHOT'
set :scm, :git
set :repo_url, 'git@github.com:CIII/Lynx.git'
set :user, "ubuntu"
set :stages, ["staging"]
set :default_stage, "staging"
# Default branch is :master
# ask :branch, `git... | 29.231884 | 161 | 0.6941 |
87c93a02637d7b0842a6c4737470391fe3acda88 | 1,107 | Pod::Spec.new do |s|
s.name = "VENPromotionsManager"
s.version = "0.2.1"
s.summary = "Definition, management and control of in-app location based promotions."
s.description = <<-DESC
VENPromotionsManager enables easy definition, management and control of in-app location bas... | 58.263158 | 148 | 0.633243 |
08f739bbaac494992a7d1e5408012e14338d0fd1 | 3,443 | # == Schema Information
#
# Table name: issues
#
# id :integer not null, primary key
# github_pull_request_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# number :integer
# url ... | 39.574713 | 78 | 0.556201 |
bf2474e1526dcc91c7fe032d86c100a6d2d9a3d4 | 607 | class FailurePresenter
attr_reader :state
STATE_CONFIG = {
failure: {
icon: 'alert/fail-x.svg',
color: 'red',
},
locked: {
icon: 'alert/temp-lock.svg',
color: 'red',
},
warning: {
icon: 'alert/warning-lg.svg',
color: 'yellow',
},
}.freeze
def initial... | 13.488889 | 35 | 0.581549 |
e8581105587489a0cfb336d91c5346b4d5ee7ccc | 2,112 | # 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... | 40.615385 | 116 | 0.736269 |
1df7dc340b592e9fb6df3e51f5d5407e981e5c96 | 12,462 | require "spec_helper"
describe "JournalSettingsHelper" do
include ApplicationHelper
include PluginAdminActivity::JournalSettingsHelper
fixtures :projects, :users
let!(:project_2) { Project.find(2) }
before do
set_language_if_valid('en')
User.current = nil
end
describe "settings update" do
... | 52.142259 | 158 | 0.564917 |
337ba80d6eef18fd43617f5e3fe6815da8dbd38b | 395 | # frozen_string_literal: true
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 JakeWorthDotCom
class Application < Rails::Application
config.time_zone = 'Central T... | 23.235294 | 56 | 0.756962 |
03153465fcb7af200999eae30f3d6ea2e2c26248 | 5,709 | # frozen_string_literal: true
require 'spec_helper'
describe 'Acfs' do
before do
stub_request(:get, 'http://users.example.org/users').to_return response([{id: 1, name: 'Anon', age: 12}, {id: 2, name: 'John', age: 26}])
stub_request(:get, 'http://users.example.org/users/2').to_return response(id: 2, name: 'J... | 27.713592 | 148 | 0.629883 |
26fa4851a4fab392dd0e77f5fa67c13457ee4f87 | 547 | module Jets::Resource::ApiGateway
class RestApi < Jets::Resource::Base
def definition
{
rest_api: {
type: "AWS::ApiGateway::RestApi",
properties: {
name: Jets::Naming.gateway_api_name,
# binary_media_types: ['*/*'], # TODO: comment out, breaking form post
... | 23.782609 | 82 | 0.52468 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.