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 |
|---|---|---|---|---|---|
4a80638f7dcacdcc27eb080336658b906f0d6ecf | 192 | FactoryGirl.define do
factory :carrier_profile do
organization { FactoryGirl.create(:organization, legal_name: "United Health Care", dba: "United") }
abbrev "UHIC"
end
end
| 27.428571 | 104 | 0.703125 |
ac0f0c8d968dc26307ec7388435f7943c12d0ca6 | 71 | module JQueryComplexify
module Rails
VERSION = "0.3.1"
end
end
| 11.833333 | 23 | 0.690141 |
ff2afa6df53e5c92b51de4b92ca11d1689a11a3e | 608 | # frozen_string_literal: true
# == Schema Information
#
# Table name: pdf_templates
#
# id :bigint not null, primary key
# name :string
# content :text
# language_code :string
# program_id :integer
# created_at :datetime not null
# updated_at :datetime ... | 23.384615 | 64 | 0.654605 |
ed16fee393c4e647e95b32fb0a8e7f7216224773 | 900 | class Dialog < Formula
desc "Display user-friendly message boxes from shell scripts"
homepage "https://invisible-island.net/dialog/"
url "https://invisible-mirror.net/archives/dialog/dialog-1.3-20190728.tgz"
sha256 "e5eb0eaaef9cae8c822887bd998e33c2c3b94ebadd37b4f6aba018c0194a2a87"
bottle do
cellar :any_s... | 34.615385 | 94 | 0.781111 |
91a1c5db03e7eef1b0784dd0f1c388eed74e5bda | 795 | cask "waterfox-classic" do
version "2021.08.1"
sha256 "a07a436d08b73e56f4f1763e55442f2d2127073dffe75bbcc890920ada1e9179"
url "https://cdn.waterfox.net/releases/osx64/installer/Waterfox%20Classic%20#{version}%20Setup.dmg"
name "Waterfox Classic"
desc "Web browser"
homepage "https://www.waterfox.net/"
liv... | 33.125 | 141 | 0.734591 |
e932c6e7ffe1be5e694c7c0ff9c2ec13e78a0100 | 5,612 | require "switchman/test_helper"
module Switchman
# including this module in your specs will give you several shards to
# work with during specs:
# * Shard.default - the test database itself
# * @shard1 - a shard possibly using the same connection as Shard.default
# * @shard2 - a shard using a dedicated co... | 35.295597 | 119 | 0.591589 |
e823b5613012e03c0590cc95956b8b648f9e7e0c | 1,929 | require 'volt/page/bindings/base_binding'
module Volt
# TODO: We need to figure out how we want to wrap JS events
class JSEvent
attr_reader :js_event
def initialize(js_event)
@js_event = js_event
end
def key_code
`this.js_event.keyCode`
end
def stop!
`this.js_event.stop... | 25.051948 | 118 | 0.629342 |
26d502f68ebe1033c814f2c4a0204bbeeae9ba6b | 647 | require "rails_helper"
describe DailyMessageSender do
describe "#run" do
it "sends scheduled messages to employees" do
scheduled_message = create(:scheduled_message)
employee = create(:employee)
message_sender_double = double(run: true)
matcher_double = double(run: [employee])
allo... | 30.809524 | 111 | 0.735703 |
61c56e2b3df5d3e823e882fc85e705e5267e4422 | 3,962 | # frozen_string_literal: true
# TODO: Reduce complexity
module ManuscriptLinesControllerConcern
extend ActiveSupport::Concern
def read_file(ms_siglum, legend_siglum, notes)
exten = notes ? 'notes.json' : '*.seltxt'
path = if Rails.env.test?
Dir.glob(
Rails.root.join('spec', 'f... | 35.061947 | 115 | 0.675669 |
874dbcb176fdd0b970fdc4ce2063c6a4b98b1b4b | 483 | # frozen_string_literal: true
require "roda"
require "friendly_numbers"
require "blankman"
require_relative "models"
require_relative "helpers"
module AppPrototype
class App < Roda
include Helpers
use Rack::Session::Cookie, secret: ENV.fetch("SESSION_SECRET") { File.read(".session_secret") }
opts[:roo... | 19.32 | 99 | 0.687371 |
edfe257585abf29a6092bdcbaebf08373a777471 | 3,229 | class Deposit < ActiveRecord::Base
STATES = [:submitting, :cancelled, :submitted, :rejected, :accepted, :checked, :warning]
extend Enumerize
include AASM
include AASM::Locking
include Currencible
has_paper_trail on: [:update, :destroy]
enumerize :aasm_state, in: STATES, scope: true
alias_attribute ... | 23.230216 | 140 | 0.64695 |
1d3037e1d07028fc45a52e7e1b5df086a846d9e8 | 238 | require 'rails_helper'
RSpec.describe "Recipes", type: :request do
describe "GET /recipes" do
it "works! (now write some real specs)" do
get recipes_path
expect(response).to have_http_status(:success)
end
end
end
| 21.636364 | 52 | 0.693277 |
1131c27034d096059f5a47bd24497aad321e051e | 1,443 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Christopher Brown (<cb@opscode.com>)
# Copyright:: Copyright (c) 2008 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... | 28.294118 | 83 | 0.713098 |
39c567a26e3d57a7aaf559d96988a23c160dad01 | 91 | class PagesController < ApplicationController
def home
@issues = Issue.all
end
end
| 15.166667 | 45 | 0.747253 |
0340c50142681c05f72a35c1369b1f0bdfa1a10f | 54 | class AdminbsbsController < ApplicationController
end
| 18 | 49 | 0.888889 |
080907dfd3433c625d3e731f8581884a5e9dd472 | 3,951 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
'Name' ... | 28.630435 | 125 | 0.567957 |
91051c517b693be3c72ae88a9accf687a953c0f7 | 1,313 | module SolidusEventsTracker
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, :type => :boolean, :default => false
def add_javascripts
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_events... | 41.03125 | 167 | 0.681645 |
1d2c48a74bc8a23fcfd8e6e0481e8fa86a63509a | 6,666 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2017_03_30
module Models
#
# NetworkSecurityGroup resource.
#
class NetworkSecurityGroup < Resource
i... | 32.202899 | 79 | 0.439544 |
3812542d8cf96ee6dfc2d28b55ee65736682373d | 2,246 | require 'rails_helper'
RSpec.describe EmailAddressValidator do
let(:model_class) do
Class.new do
include ActiveModel::Model
attr_accessor :email
def self.name
'MyModel'
end
validates :email, email_address: true
end
end
it 'will validate a recognisable email addres... | 24.955556 | 91 | 0.707035 |
381a1e8ce20c09078b4218cd3d23206ddb7c7114 | 2,420 | require 'faraday'
require 'json'
module MercadoPago
module Request
class ClientError < Exception
end
MIME_JSON = 'application/json'
MERCADOPAGO_RUBY_SDK_VERSION = '0.3.4'
#
# This URL is the base for all API calls.
#
MERCADOPAGO_URL = 'https://api.mercadopago.com'
def self.de... | 27.191011 | 86 | 0.629752 |
6a7d713b1319545fa6f16bb5d863ccd51fba9df1 | 4,084 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause this
# file to always be loaded, without a need to explicitly require ... | 48.619048 | 129 | 0.745348 |
e80f78fed2e5640a0769f8ab6abbcb46a584fa09 | 392 | describe "Lore queries" do
include_context "db"
it do
assert_search_equal "lore:gideon", "gideon or t:gideon or ft:gideon"
assert_search_equal "lore:jaya", "jaya or t:jaya or ft:jaya"
assert_search_equal "lore:chandra", "chandra or t:chandra or ft:chandra"
assert_search_equal %[lore:"nicol bolas"],... | 35.636364 | 107 | 0.714286 |
335165a58daf929453876b0860c24e54e2aaf3b2 | 9,373 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::DCERPC
include Msf::Exploit::Remote::SMB::Client
def initializ... | 28.84 | 102 | 0.54881 |
f7d187d64b779f689f1e1a78a68c27dcbca7fdc0 | 712 | # frozen_string_literal: true
require_dependency 'spree/calculator'
module Spree
class Calculator::FlatPercentItemTotal < Calculator
preference :flat_percent, :decimal, default: 0
def compute(object)
order = object.is_a?(Order) ? object : object.order
preferred_currency = order.currency
c... | 29.666667 | 97 | 0.720506 |
1c130192ebad779a1a73018bb847cbe7a93eedef | 151 | module TonyCorreiaViewTool
class Renderer
def self.copyright name, msg
"© #{Time.now.year} | <b>#{name}</b> #{msg}".html_safe
end
end
end | 21.571429 | 62 | 0.682119 |
d54bd74443671f89fd6bf30324e4fb4b1c214e9b | 1,391 | require_relative 'lib/faster_jpath/version'
Gem::Specification.new do |spec|
spec.name = "faster_jpath"
spec.version = FasterJpath::VERSION
spec.authors = ["Vagmi Mudumbai"]
spec.email = ["vagmi.mudumbai@gmail.com"]
spec.summary = %q{Wraps over jmespath in Ruby to build a ... | 43.46875 | 90 | 0.672897 |
7a3f9e858e0fe4f07ee07c1a9f5ed10b4f6c1bf5 | 775 | Pod::Spec.new do |spec|
spec.name = "Trikot.http"
spec.version = "1.0.1"
spec.summary = "Trikot.http swift extensions."
spec.description = "Trikot.http swift extensions."
spec.homepage = "https://github.com/mirego/trikot.http"
spec.license = "MIT license"
spec.author ... | 38.75 | 105 | 0.64129 |
0196db3b8e8f8348f3c09c7603214c1ec3a3a48d | 738 | # frozen_string_literal: true
shared_examples_for 'resource_type_general' do
it 'has resource_type_general' do
expect(stubby.resource_type_general).to eq(['Sound'])
end
it 'has resource_type_general predicate' do
expect(rdf.should(include('http://purl.org/spar/datacite/hasGeneralResourceType')))
end
... | 30.75 | 121 | 0.771003 |
f885088ba17f7d239bdec7dbeaeefb70d44ba0c8 | 238 | # frozen_string_literal: true
module Scheduler
# cleanup notifications at 1 years ago
class NotificationCleanupJob < ApplicationJob
def perform
Notification.where("created_at < ?", 1.years.ago).delete_all
end
end
end
| 21.636364 | 66 | 0.743697 |
017a4b7938b14eda6271153482773e2919b60559 | 110 | class Object
unless new.respond_to?(:tap)
def tap
yield self
return self
end
end
end
| 11 | 30 | 0.609091 |
e296ebda1cf1619d9b8f7e81859a73c1df9d9bbe | 203 | class UserItemAble < ActiveRecord::Base
belongs_to :user
belongs_to :product_item
belongs_to :order
# after_update :check_count
# def check_count
# self.destory! if count <= 0
# end
end
| 18.454545 | 39 | 0.719212 |
ed0e72aab0124c8ded1006dba7e12b459f3ad492 | 6,877 | #
# Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "... | 36.005236 | 118 | 0.674277 |
38f86dfb2b5e1b0173fc340328fb52753dd93902 | 531 | require 'trello_todo/trello/board'
module TrelloTodo
class Member
attr_reader :username
def initialize(username:)
@username = username
@boards = []
end
# Get all the boards of a given user
def boards
return @boards unless @boards.empty?
endpoint = "/1/members/#{username... | 18.310345 | 55 | 0.612053 |
28df21ea991304ee7695e3d08bfd70a302a10ff0 | 496 | cask 'consul@1.8.3+ent' do
version '1.8.3+ent'
sha256 'ce49671ad580b7ef9e742d089c614a6b5ed5f1c00328d61b9b0900aa72aa2a9a'
# releases.hashicorp.com was verified as official when first introduced to the cask
url 'https://releases.hashicorp.com/consul/1.8.3+ent/consul_1.8.3+ent_darwin_amd64.zip'
appcast 'https:/... | 31 | 89 | 0.766129 |
7a1a5a4df71197d605cd9fe3c2c12861af4b3147 | 1,404 | class ProductsController < ApplicationController
def index
@product_recent = Product.recent
@product_most_reviews = Product.most_reviews
@products = Product.index(params[:page])
@products = @products.only_names(params[:name]) if params[:name].present?
@products = @products.search(params[:search]) ... | 23.4 | 80 | 0.680199 |
01d8af9a5ed2bbffd71ea492d36ad04307d5384f | 400 | require 'valid_email/all'
I18n.load_path += Dir.glob(File.expand_path('../../config/locales/**/*',__FILE__))
# Load list of disposable email domains
config = File.expand_path('../../config/valid_email.yml',__FILE__)
BanDisposableEmailValidator.config= YAML.load_file(config)['disposable_email_services'] rescue []
BanFre... | 57.142857 | 97 | 0.78 |
18791886c4a6513113a94df918de40344c43891a | 1,189 | #
# Author:: Jordan Running (<jr@chef.io>)
# Copyright:: Copyright 2013-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 License at... | 30.487179 | 75 | 0.704794 |
395c562eec137dcaf1650b5b39df45f1597ee4be | 679 | # frozen_string_literal: true
module Teamwork
module Client
module Task
module Collect
# port监控告警拆分开来, 收集,告警,恢复,脚本
class Port < Base
def process(ops = {})
port = ops['port'] || []
port.map!(&:to_i)
listen_port = listen_ports
msg.merg... | 25.148148 | 130 | 0.511046 |
187c310cf7c89328121dd85c9b5a7026958377ec | 2,810 | # frozen_string_literal: true
module Alchemy
class Node < BaseRecord
VALID_URL_REGEX = /\A(\/|\D[a-z\+\d\.\-]+:)/
before_destroy :check_if_related_essence_nodes_present
acts_as_nested_set scope: "language_id", touch: true
stampable stamper_class_name: Alchemy.user_class_name
belongs_to :langua... | 29.270833 | 123 | 0.676157 |
f7c53d15b413a8fbb1bc7bc5681ccf04cc0ffd26 | 13,134 | #!/usr/local/bin/ruby
require 'readline'
require_relative './items.rb'
require_relative './locations.rb'
require_relative './monsters.rb'
# Turns off stdout buffering
$stdout.sync = true
YOU = {
:weapon_equipped => false,
:weapon => nil,
:shield_equipped => false,
:shield => nil,
:inventory => (1..3).ma... | 28.064103 | 179 | 0.621593 |
018f097a11ed3c4d50c67582e959bf8f9c5021ca | 236 | while count_object_on_map("apple") > 0
while is_clear_path()
walk_forward()
take()
end
turn_right()
end
say("I took #{ @robert.inventory.select { |object| object.is_a? GameObjects::Apple }.count } apples...") | 29.5 | 104 | 0.644068 |
91b9ce89a15426ac1f83a7b79a4dddc8024ab431 | 1,297 | # frozen_string_literal: true
require "test_helper"
# test methods used to count Observations by country
class CountryCounterTest < UnitTestCase
def test_wheres
cc = CountryCounter.new
wheres = cc.send(:wheres)
assert(wheres)
assert(wheres.member?("Briceland, California, USA"))
end
def test_loc... | 23.160714 | 62 | 0.723978 |
ff86c0892e270ec98ecafae8ba0c5bdbf16503e4 | 2,604 | #
# Cookbook Name:: supermarket
# Recipe:: ssl
#
# Copyright 2014 Chef Software, 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
#
# Un... | 32.55 | 85 | 0.692012 |
d5b72eae43e415481d96b847e22a57bc169ca9ef | 129 | require_relative 'utils/cli/base'
require_relative 'utils/daemon'
require_relative 'utils/statsd'
require_relative 'utils/stats'
| 25.8 | 33 | 0.837209 |
87e2c0e54ee709d96dbd8b6514c532d125a4ada6 | 4,700 | require File.expand_path(File.dirname(__FILE__) + '/helper')
class TestWepayRailsAccountMethods < ActiveSupport::TestCase
def setup
create_wepay_config_file(false, true)
initialize_wepay_config
@gateway = WepayRails::Payments::Gateway.new(TEST_ACCESS_TOKEN)
@accounts = []
end
def teardown
@a... | 35.074627 | 104 | 0.686809 |
6ad66c5624ace2e1046665dfa4fa206b625c590e | 1,324 | require 'spec_helper'
require 'pact/consumer_contract/request_decorator'
require 'pact/consumer/request'
module Pact
describe RequestDecorator do
let(:options) { { some: 'opts' } }
let(:body) { { some: "bod" } }
let(:headers) { { some: "header" } }
let(:query) { "param=foo" }
let(:request_params... | 24.981132 | 105 | 0.59139 |
212bf8660970a2f958a5e53b316464646a4a52d1 | 1,227 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
# Module generated by tools/modules/generate_mettle_payloads.rb
module MetasploitModule
CachedSize = 1030256
include Msf::Payload::Single
include Msf::Sessions::Meterpreter... | 27.886364 | 98 | 0.616137 |
1ca2f58b3c3c73ed68bbb0516089102ccac4775d | 3,299 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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,... | 29.990909 | 130 | 0.696878 |
f89e8b7be627b0cb0c9e1639a4b4b99111bcb758 | 16,306 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::DynamoDBStreams
# @api private
module ClientApi
include Seahorse::Model
AttributeMap =... | 64.450593 | 158 | 0.760579 |
39b73aa93351f91cf4fe2d0042d575056518a41d | 2,414 | module IRC
module RFC2812
# Public: Represents a WHOIS response.
class Whois
attr_reader :nick, :user, :host, :realname, :channels, :server,
:server_info, :seconds_idle
# Public: Gets the statuses Hash (`{ "#channel" => :status }`). The status
# is `nil` if there is no status.
... | 24.632653 | 80 | 0.53314 |
d51603bf043dc3cc875aaeaf8e88f70cb81b1bad | 542 | cask 'synalyze-it-pro' do
version '1.22'
sha256 '4d984d532e2b8615a7a138ee482a22b1196ece4ecc4ab640aa25671b82b01313'
# synalyze-it.com/Downloads was verified as official when first introduced to the cask
url "https://www.synalyze-it.com/Downloads/SynalyzeItProTA_#{version}.zip"
appcast 'https://www.synalyze-it... | 38.714286 | 88 | 0.776753 |
1d4c92d77825f1999e1c177a6dc191bd8d11d1b6 | 126 | module ApplicationHelper
attr_writer :page_title
def page_title
@page_title ||= "RSpec Rails Examples"
end
end
| 12.6 | 42 | 0.722222 |
0320903d483a82a447a07ffcbe547a2d627cbf30 | 2,748 | class Zim < Formula
desc "Graphical text editor used to maintain a collection of wiki pages"
homepage "https://zim-wiki.org/"
url "https://github.com/zim-desktop-wiki/zim-desktop-wiki/archive/0.73.5.tar.gz"
sha256 "9f983fac9655a61bfe1fa6f9e8cfa59bef099dadfdc4c003913999b184ed1342"
license "GPL-2.0-or-later"
... | 44.322581 | 134 | 0.716157 |
e26752eac2f923d865963784f0d2ca3e766aab85 | 1,464 | class DilHistory < ActiveRecord::Base
belongs_to :dil, :class_name => 'Dil', :foreign_key => :dil_id
belongs_to :atlanta_operator, :class_name => 'AtlantaOperator', :foreign_key => :atlanta_operator_id
belongs_to :atlanta_group, :class_name => 'AtlantaGroup', :foreign_key => :atlanta_group_id
validates_presence... | 58.56 | 102 | 0.798497 |
ab9c718f0f203f0e55650e6b0a4938f976cd3920 | 1,396 | # coding: utf-8
module RockFintech
module Api
module Query
module MoneyQuery
# 资金交易状态查询
#
# @return [ Hash ] 结果集
# * :result [String] "S"/"F"/"P"
# * :request_params [Hash] 请求参数
# * :response [Object] 请求返回对象
# * :code [String] 结果代码
# ... | 31.022222 | 337 | 0.534384 |
e9ff0298f4c6291f0b5aa0edf4f8925354419bed | 290 | # This migration comes from user_group (originally 20120927143037)
class CreateGroups < ActiveRecord::Migration
def change
create_table :groups do |t|
t.string :name
t.string :description
t.timestamps
end
add_index :groups, :name, :unique => true
end
end
| 22.307692 | 66 | 0.696552 |
3964f6324731f506d16c1a968361d59a97b13860 | 106 | json.extract! item, :id, :label, :bought, :created_at, :updated_at
json.url item_url(item, format: :json)
| 35.333333 | 66 | 0.726415 |
1c5c7f224d562f03f007719082763f8c7590d873 | 675 | cask 'flash-player' do
version '32.0.0.255'
sha256 'fde13429546e81402f3aefe5a3580c787d3635b7b2a68868af9c15c11c344290'
url "https://fpdownload.adobe.com/pub/flashplayer/updaters/#{version.major}/flashplayer_#{version.major}_sa.dmg"
appcast 'https://fpdownload.adobe.com/pub/flashplayer/update/current/xml/version... | 37.5 | 114 | 0.70963 |
21a6c85c5a2acae9a7e389fdc7a441b2b406001c | 2,414 | module Bundler
# used for Creating Specifications from the Gemcutter Endpoint
class EndpointSpecification < Gem::Specification
include MatchPlatform
attr_reader :name, :version, :platform, :dependencies
attr_accessor :source, :remote
def initialize(name, version, platform, dependencies)
@nam... | 23.90099 | 67 | 0.674814 |
bb2d06354648bc341d5f0b281ecc85cd7132d39c | 1,563 |
Pod::Spec.new do |s|
s.name = 'JustTweak'
s.version = '6.2.0'
s.summary = 'A framework for feature flagging, locally and remotely configure and A/B test iOS apps.'
s.description = <<-DESC
JustTweak is a framework for feature flagging, locally and r... | 43.416667 | 119 | 0.579015 |
911b22ddf93f63b5818d0981b26bd58d5f949251 | 39 | module Onebox
VERSION = "1.5.29"
end
| 9.75 | 20 | 0.666667 |
ff2008b77ac97ae2cf010a86c8f84039bf67fbec | 1,904 | require 'test_helper'
require 'commit_parser'
class CommitParserTest < Test::Unit::TestCase
def test_extract_without_ticket
assert_equal({}, CommitParser.extract_items_with_actions('simple commit'))
end
def test_extract_with_single_ticket
result = {38209 => {:action => :cmd_close}}
assert_equal(resu... | 47.6 | 213 | 0.75105 |
bb956c8c03424f79a78c2d4d7a996e79ae84581c | 1,405 | require "test_helper"
require "thread"
require "glass_octopus/connection/ruby_kafka_adapter"
class GlassOctopus::RubyKafkaAdapterTest < Minitest::Test
TOPIC = "test_topic".freeze
GROUP = "test_group".freeze
KAFKA_HOST = "localhost:29092"
attr_reader :client, :producer
def teardown
@client.close if @cl... | 24.649123 | 94 | 0.712456 |
ffaf75e376270c6f936594fadd8a7e0d2e794e05 | 1,583 | # encoding: utf-8
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
process resize_to_limit: [400,400]
# Choose what kind of storage to use for this uploader:
if Rails.env.production?
storage :fo... | 28.267857 | 112 | 0.699305 |
ff3fed5e91575e9be46787c692b149f515bd63c3 | 13,628 | #!/usr/bin/env rspec
require 'spec_helper'
describe Puppet::Parser::AST::Leaf do
before :each do
@scope = stub 'scope'
@value = stub 'value'
@leaf = Puppet::Parser::AST::Leaf.new(:value => @value)
end
it "should have a evaluate_match method" do
Puppet::Parser::AST::Leaf.new(:value => "value").sh... | 32.997579 | 145 | 0.631934 |
5d915d4933e2cbad6a109c5c9bb75e7637fc1523 | 1,150 | #
# render.rb: Extend Redcarpet renderer with Alongslide syntax.
#
# Good resource for extending Redcarpet:
# http://dev.af83.com/2012/02/27/howto-extend-the-redcarpet2-markdown-lib.html
#
# Copyright 2013 Canopy Canopy Canopy, Inc.
# Author Adam Florin
#
require 'redcarpet'
module Redcarpet
module Render
cl... | 26.136364 | 128 | 0.623478 |
f78e217664fd53172f48643d10e8a1e527e42467 | 671 | # frozen_string_literal: true
require 'application_system_test_case'
class Footprint::ProductsTest < ApplicationSystemTestCase
test 'should be create footprint in product page' do
login_user 'komagata', 'testtest'
product = users(:yamada).products.first
visit product_path(product)
assert_text '見たよ'
... | 30.5 | 72 | 0.749627 |
1a4e537fe3f7d580953c59999b0dc7f650944b2d | 953 | require 'aws-sdk'
module Tfrb::Resource::AwsElasticacheSubnetGroup
extend Tfrb::Resource
def self.preload(base, environment_name, resource_type, new_resources)
new_resources.each do |resource_name, resource|
set_default(resource, 'name', resource_name.gsub('_', ' '))
end
end
def self.load(base,... | 32.862069 | 74 | 0.705142 |
6a5bb0bf95e44b34050fd8d76290915f12c464d0 | 1,620 | require_relative 'spec_helper'
# http://adventofcode.com/2017/day/6
describe Day6 do
describe "part1" do
it "scenario 1" do
input = "0\t2\t7\t0"
expected = 5
actual = Day6.part1(input)
actual.must_equal(expected)
end
end
describe "part2" do
it "scenario 1" do
input = "0... | 25.3125 | 54 | 0.621605 |
21309e023523c1b6020c71ac594d91e01cf31aa1 | 197 | class DropCategoryIdFromProducts < ActiveRecord::Migration
def self.up
remove_column :products, :category_id
end
def self.down
add_column :products, :category_id, :integer
end
end
| 19.7 | 58 | 0.756345 |
6a0b02dbedc6c7022fc139ae1f0279264191abd1 | 509 | #encoding: utf-8
require "model-base"
class DeviceData
include DataMapper::Resource
include Utils::DataMapper::Model
#extend Utils::DataMapper::Model
property :id , Serial
property :input , Text
property :remain , String
property :type , String
property :money ... | 22.130435 | 53 | 0.628684 |
010fa41dc436b82d95493d722b9a02fbd9a9b6a0 | 11,863 | def mock_bill()
response = '{
"uid": "6967-06",
"short_uid": "6967",
"title": "Declara feriado el día 7 de junio para la Región de Arica y Parinacota. ",
"creation_date": "2010-06-02T00:00:00Z",
"stage": "Tramitación terminada",
"sub_... | 36.956386 | 131 | 0.404282 |
e8f2be5c3690978c84c1eccdaf4534bfa0dcd8d4 | 142 | Rails.application.routes.draw do
devise_for :users
resources :users, only: [:show], param: :username, path: ""
root 'static#home'
end
| 17.75 | 61 | 0.697183 |
18fc5b31b2b4f52d45031da6ef1981471eb61cbb | 7,428 | require "rails_helper"
describe CallRouter do
describe "#normalized_source" do
it "returns the normalized source" do
call_router = described_class.new(source: "+0972345678")
call_router.trunk_prefix_replacement = "855"
expect(call_router.normalized_source).to eq("+855972345678")
call_ro... | 27.208791 | 86 | 0.652396 |
bb0425cd1e18d4f658b34ecf4d91802cb6270650 | 430 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the UnitsHelper. For example:
#
# describe UnitsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# ... | 26.875 | 71 | 0.704651 |
f79646e97aeb67fcd3b69c83d596196ba2a267a3 | 1,673 | # frozen_string_literal: true
class AdminFormBuilder < ActionView::Helpers::FormBuilder
include ApplicationHelper
delegate :capture, to: :@template
delegate :label_tag, to: :@template
delegate :link_to, to: :@template
delegate :tag, to: :@template
def ace_editor(method, options = {})
mode = options.d... | 30.418182 | 155 | 0.629408 |
e9021d1deef17630b1a68aac0d525cc5556acaf9 | 2,990 | require 'test_helper'
class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
context "The post replacements controller" do
setup do
@mod = create(:moderator_user, name: "yukari", can_approve_posts: true, created_at: 1.month.ago)
as(@mod) do
@post = create(:post, source: "https... | 36.024096 | 203 | 0.662542 |
6136fa20d73d54548b4e2b9560655701d6729342 | 204 | # frozen_string_literal: true
RSpec.describe AhlScraper::Games::Events::Shot do
let(:raw_data) do
{}
end
it "converts raw data into Shot record" do
described_class.new(raw_data)
end
end
| 17 | 49 | 0.715686 |
015f55db20bb3e7cb351f0551f9f5f9f64e6bff5 | 1,720 | # encoding: utf-8
module Mail
# ParameterHash is an intelligent Hash that allows you to add
# parameter values including the MIME extension paramaters that
# have the name*0="blah", name*1="bleh" keys, and will just return
# a single key called name="blahbleh" and do any required un-encoding
# to make that h... | 29.152542 | 95 | 0.573256 |
1cca443cf6c1d8aa886020757ff2303347db3949 | 39 | module Dashing
VERSION = '2.4.4'
end
| 9.75 | 19 | 0.666667 |
3357606af81de51b5ee857e5c8138ab5e1b3066f | 737 | module FattureInCloud_Ruby_Sdk
# The Operator class represents the operator enum.
class Operator
# Equal operator.
EQ = '='.freeze
# Greater Than operator.
GT = '>'.freeze
# Greater Than or Equal operator.
GTE = '>='.freeze
# Less Than operator.
LT = '<'.freeze
# Less Than or Equ... | 24.566667 | 52 | 0.61194 |
38ce525db79e30b544479ec1f3d56f6f8a834f8e | 1,316 | class VideoInfo
module Providers
class VimeoPlaylist < Vimeo
alias_method :playlist_id, :video_id
def self.usable?(url)
url =~ /((vimeo\.com)\/album)|((vimeo\.com)\/hubnut\/album)/
end
def videos
@videos ||= _data_videos.map do |video_data|
video = Vimeo.new(vid... | 20.5625 | 71 | 0.566109 |
bbfa1f877edc4df640a97ee85f44abdd9dfd1d51 | 1,359 | class Rdf::Builders::ClassBuilder < Rdf::Builders::BaseBuilder
include Rdf::Builders::Traversable
include Rdf::Builders::Context
IGNORE_PREDICATES = %w(rdf:type
rdfs:isDefinedBy
rdfs:seeAlso
dc:hasVersion
dc:issue... | 36.72973 | 107 | 0.593083 |
f77ff64096108ca058b23e35371fdcf5c765eddf | 3,465 | # frozen_string_literal: true
require 'aws-sdk'
module PWN
module AWS
# This module provides a client for making API requests to Amazon Cognito Identity.
module CognitoIdentity
@@logger = PWN::Plugins::PWNLogger.create
# Supported Method Parameters::
# PWN::AWS::CognitoIdentity.connect(
... | 37.258065 | 190 | 0.641847 |
7a5088eea9c64e478e06d179dba79b4464d6a9e4 | 1,014 | require 'csv_row_model/internal/dynamic_column_attribute_base'
module CsvRowModel
module Import
class DynamicColumnAttribute < CsvRowModel::DynamicColumnAttributeBase
attr_reader :source_headers, :source_cells
def initialize(column_name, source_headers, source_cells, row_model)
@source_heade... | 30.727273 | 102 | 0.716963 |
0852d9328b92bff83425cb36faf12f27d5e6b3d1 | 3,517 | # frozen_string_literal: true
require 'spec_helper'
require 'redis/connection/hiredis'
require 'connection_pool'
require 'simplefeed/providers/redis/driver'
class RedisAdapter
include ::SimpleFeed::Providers::Redis::Driver
end
RSpec.describe SimpleFeed::Providers::Redis::Driver do
shared_examples(:validate_adapt... | 31.972727 | 115 | 0.628661 |
0325c3ea781ae2ea032d1ae50849b3774743fbfe | 405 | module FarmwareInstallations
class Create < Mutations::Command
required do
string :url
model :device, class: Device
end
def execute
fwi = FarmwareInstallation.create!(create_params)
fwi.force_package_refresh!
fwi
end
private
def create_params
@create_param... | 18.409091 | 55 | 0.6 |
aceb5de503199d45ad448eae42649abd47f9046d | 1,743 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop checks for nested `File.dirname`.
# It replaces nested `File.dirname` with the level argument introduced in Ruby 3.1.
#
# @example
#
# # bad
# File.dirname(File.dirname(path))
#
... | 26.014925 | 89 | 0.580034 |
01fa2c3d26ef32500b429b968891acdd8ada0a5a | 7,784 | class Video < ApplicationRecord
has_and_belongs_to_many :legislators, index: { unique: true }
has_and_belongs_to_many :keywords, index: { unique: true }
belongs_to :user
belongs_to :committee
belongs_to :ad_session
paginates_per 9
validates_presence_of :youtube_url, message: '必須填寫youtube網址'
validates_pr... | 33.551724 | 141 | 0.633479 |
5d54266c16a45939942a9f33d5ca98dee8b15586 | 117 | require 'db/h2'
require 'serialize'
class H2SerializeTest < Test::Unit::TestCase
include SerializeTestMethods
end
| 16.714286 | 44 | 0.794872 |
abe90771285769319474a5e5982bc3b6e0c832de | 1,583 | #
# Be sure to run `pod lib lint FRLabel.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 = 'FRLabel'
s... | 36.813953 | 103 | 0.634239 |
017093880bd8bbb4f91325c121bbd4173f27cd93 | 2,227 | # 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.018868 | 116 | 0.704086 |
61668e4ea8e2b90ae20dfad16d1f1d05c3202757 | 9,361 | require 'volt/models/model_wrapper'
require 'volt/models/array_model'
require 'volt/models/model_helpers'
require 'volt/reactive/object_tracking'
require 'volt/models/model_hash_behaviour'
require 'volt/models/validations'
require 'volt/models/model_state'
class NilMethodCall < NoMethodError
def true?
false
e... | 25.787879 | 108 | 0.6604 |
f788cb1ed1d8e8374702ba00e4603436b97666f5 | 2,262 | # frozen_string_literal: true
namespace :bulwark do
namespace :migrations do
desc 'Retrieving thumbnail_location from Fedora and storing it in the database'
task add_thumbnail_location: :environment do
Repo.find_each do |repo|
begin
fedora_object = ActiveFedora::Base.find(repo.names.f... | 39.684211 | 125 | 0.655615 |
62072273aa4794fdba5db0b18365937d2c026948 | 775 | require "version"
class PkgVersion
include Comparable
RX = /\A(.+?)(?:_(\d+))?\z/
def self.parse(path)
_, version, revision = *path.match(RX)
version = Version.new(version)
new(version, revision.to_i)
end
def initialize(version, revision)
@version = version
@revision = version.head? ? ... | 16.847826 | 71 | 0.627097 |
611060fb3a525d010434051b119273028e1fbb38 | 1,306 | require_relative '../../spec_helper'
ruby_version_is '2.7' do
describe "Warning.[]=" do
it "emits and suppresses warnings for :deprecated" do
ruby_exe('Warning[:deprecated] = true; $; = ""', args: "2>&1").should =~ /is deprecated/
ruby_exe('Warning[:deprecated] = false; $; = ""', args: "2>&1").should... | 34.368421 | 108 | 0.593415 |
918c6624a7ae6f178a09fdfd04dab86ad324a37a | 3,764 | # frozen_string_literal: true
class BidirectionalLinksGenerator < Jekyll::Generator
def generate(site)
graph_nodes = []
graph_edges = []
all_notes = site.collections['notes'].docs
all_pages = site.pages
all_docs = all_notes + all_pages
link_extension = !!site.config["use_html_extension"] ? ... | 33.607143 | 91 | 0.615303 |
d5a181d3e278fa733dc41475269a7a545841151b | 1,019 | module ActiveRecord
module ConnectionAdapters
module SQLite3
module Quoting # :nodoc:
def quote_string(s)
@connection.class.quote(s)
end
def quote_table_name_for_assignment(table, attr)
quote_column_name(attr)
end
def quote_column_name(name)
... | 20.795918 | 71 | 0.499509 |
acff064bc8be94d3e7afd76116bd94d6b053e001 | 160 | class AddInactivityNotifiedToSpace < ActiveRecord::Migration[4.2]
def change
add_column :spaces, :inactivity_notified, :boolean, default: false
end
end
| 26.666667 | 70 | 0.78125 |
1afb9700a7361408776f8a0281e3b7c2856646c9 | 1,681 | # -*- encoding: utf-8 -*-
# stub: faraday 1.3.0 ruby lib spec/external_adapters
Gem::Specification.new do |s|
s.name = "faraday".freeze
s.version = "1.3.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https:... | 46.694444 | 314 | 0.696014 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.