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 |
|---|---|---|---|---|---|
0139c3af708deae9619e38d294e80640d205761a | 756 | module Dynamic
module Schema
module Attribute
autoload :Base, 'dynamic/schema/attribute/base'
autoload :Boolean, 'dynamic/schema/attribute/boolean'
autoload :Float, 'dynamic/schema/attribute/float'
autoload :Integer, 'dynamic/schema/attribute/integer'
autoload :String, 'dynamic/schem... | 42 | 82 | 0.739418 |
26f5a22c336e7d4f5ea0ac616103c40962798bae | 4,593 |
Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in de... | 36.744 | 250 | 0.581755 |
bf6ca40e1105eb3739c6620ef5266d6bf08d2cac | 298 | module SolidusSearchkick
module Spree
module TaxonsControllerDecorator
def autocomplete
keywords = params[:keywords] ||= nil
json = ::Spree::Taxon.autocomplete(keywords)
render json: json
end
::Spree::TaxonsController.prepend self
end
end
end
| 21.285714 | 52 | 0.661074 |
1dac3323e0370a8ceef16864b91b58ac55346ebb | 3,079 | require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
describe "pg_auto_parameterize extension" do
before do
@db = Sequel.connect('mock://postgres', :quote_identifiers=>false)
@db.synchronize{|c| def c.escape_bytea(v) v*2 end}
@db.extend_datasets{def use_cursor(*) clone end}
@db.... | 46.651515 | 146 | 0.612212 |
ab79d000cc13e94e750aebc4f88a4ab5bb9ca149 | 1,103 | Gem::Specification.new do |s|
s.name = 'wheretz'
s.version = '0.0.6'
s.authors = ['Victor Shepelev']
s.email = 'zverok.offline@gmail.com'
s.homepage = 'https://github.com/zverok/wheretz'
s.summary = 'Fast and precise time zone by geo coordinates lookup'
s.licenses = ['MIT']
s.files = `git ls-... | 25.068182 | 68 | 0.68631 |
87b835d41a0bd080bcaf286eb090f8a81068a8ae | 720 | require 'rails_helper'
RSpec.describe "tasks/index", :type => :view do
before(:each) do
assign(:tasks, [
Task.create!(
:name => "Name",
:description => "Description",
:billable => false,
:rate => "9.99"
),
Task.create!(
:name => "Name",
:descripti... | 24.827586 | 67 | 0.527778 |
38e9c3a7572bc3f53881f6937c6955d313bc1201 | 647 | require 'rails_helper'
RSpec.describe "infos/index", type: :view do
before(:each) do
assign(:infos, [
Info.create!(
:repos => 2,
:followers => 3,
:following => 4,
:owner => nil
),
Info.create!(
:repos => 2,
:followers => 3,
:following => 4... | 22.310345 | 57 | 0.511592 |
111fab42941c59a7d9e43c62a5c2ce1ff0b85450 | 139 | def passthrough(enumerable, to_pass, &block)
enumerable.each do |element|
to_pass = block.call(to_pass, element)
end
to_pass
end
| 19.857143 | 44 | 0.733813 |
1a32ddf47b44f64002c3868adcb3fe49b03d5e29 | 717 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'ABI36_0_0EXCalendar'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s... | 32.590909 | 67 | 0.627615 |
ac854197558eaae81b0adb4d4452be089d487d5b | 2,081 | =begin
#Finnhub API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.2.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit t... | 29.309859 | 107 | 0.730418 |
ff27110de24735b8c5d6207afa99e89864e89193 | 6,244 | class EApp
# set base URL to be prepended to all controllers
def map url
@base_url = rootify_url(url).freeze
end
def base_url
@base_url || ''
end
# set/get app root
def root path = nil
@root = ('%s/' % path).sub(/\/+\Z/, '/').freeze if path
@root ||= (::Dir.pwd << '/').freeze
end
al... | 28.642202 | 104 | 0.587124 |
d5d9f259c5af653b0a43715f940f21ef8ac63956 | 2,862 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'postgresql::server::default_privileges:' do
let(:db) { 'grant_role_test' }
let(:user) { 'psql_grant_role_tester' }
let(:group) { 'test_group' }
let(:password) { 'psql_grant_role_pw' }
# Check that the default privileges were revoked
... | 30.446809 | 175 | 0.594689 |
62acba8f979a2125f5994b59cfefb61ad8abee13 | 222 | Cloudinary.config do |config|
config.cloud_name = ENV.fetch('CLOUDINARY_CLOUD_NAME')
config.api_key = ENV.fetch('CLOUDINARY_API_KEY')
config.api_secret = ENV.fetch('CLOUDINARY_API_SECRET')
config.secure = true
end
| 31.714286 | 56 | 0.774775 |
114552a9623541076982984af2cbabdcb830cff9 | 614 | require 'js'
require 'negasonic/looped_event/part'
require 'negasonic/looped_event/pattern'
require 'negasonic/looped_event/cycle'
module Negasonic
module LoopedEvent
class << self
def start(looped_element, duration)
looped_element.loop = true
looped_element.loop_end = duration
loop... | 21.928571 | 42 | 0.594463 |
01dc3852c213e90cc00e7a11177d1af26fe0e4c2 | 448 | require_relative '../../../../automated_init'
context "Message" do
context "Metadata" do
context "Correlated" do
context "Category Input" do
context "No Correlation Stream Name" do
metadata = Controls::Metadata.example
metadata.correlation_stream_name = nil
test "Is ... | 22.4 | 54 | 0.611607 |
0801fd4d03f9621b1f1fb42e71aeb6f9da4d023e | 3,941 | # frozen_string_literal: true
module Git
class BaseHooksService < ::BaseService
include Gitlab::Utils::StrongMemoize
include ChangeParams
# The N most recent commits to process in a single push payload.
PROCESS_COMMIT_LIMIT = 100
def execute
create_events
create_pipelines
exec... | 25.927632 | 96 | 0.669881 |
085945ad9da10771fa452e8cff4a69e8a7ce0a90 | 391 | class ApplicationPolicy
attr_reader :account, :record
def initialize(account, record)
@account = account
@record = record
end
def new?
create?
end
def edit?
update?
end
class Scope
attr_reader :account, :scope
def initialize(account, scope)
@account = account
@sc... | 13.033333 | 34 | 0.624041 |
874b30734a11f137e0481088146f9197433d3801 | 899 | require 'rack'
module Houser
class Middleware
attr_accessor :options
def initialize(app, options={})
@options = options
@options[:subdomain_column] ||= "subdomain"
@options[:class] = Object.const_get(options[:class_name])
@options[:tld_length] ||= 1
@app = app
end
def ... | 23.657895 | 83 | 0.615128 |
33d316d2ea4b42c68a0ba1da7b173f37180c387d | 10,847 | require "plek"
require "artefact_action" # Require this when running outside Rails
require_dependency "safe_html"
class CannotEditSlugIfEverPublished < ActiveModel::Validator
def validate(record)
if record.changes.keys.include?("slug") && record.state_was == "live"
record.errors[:slug] << "Cannot edit slug... | 30.728045 | 128 | 0.651885 |
79d9810f2f8fe3bbb86e7bb848d473ebcb1c3a65 | 119 | class AddPictureToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :picture, :string
end
end
| 19.833333 | 54 | 0.739496 |
e2147badc18632e4edf2d9cb1c6f023e4b54531b | 6,916 | # -- Imports -------------------------------------------------------------------
require ENV['TM_SUPPORT_PATH'] + '/lib/escape'
require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes'
require ENV['TM_SUPPORT_PATH'] + '/lib/osx/plist'
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/Ruby/indent'
# -- Class ------------------------... | 33.410628 | 80 | 0.562319 |
edd30ca9992df9ece8a8fafbe9548199e322e71a | 1,147 | module Spree
module Admin
TaxonsController.class_eval do
def selected_for_question
@question = load_question
@taxons = @question.taxons
respond_with(:admin, @taxons)
end
def available_for_question
@question = load_question
@taxons = params[:q].blank? ? [... | 24.934783 | 120 | 0.600697 |
ed8e78bd103c84d70dae640a96181eee1d3051d6 | 2,650 | # encoding: utf-8
# copyright: 2016, you
# license: All rights reserved
# date: 2015-08-28
# description: All directives specified in this STIG must be specifically set (i.e. the server is not allowed to revert to programmed defaults for these directives). Included files should be reviewed if they are used. Procedure... | 56.382979 | 681 | 0.769057 |
ac1538affb348b36de8f95d2af204f076cf9b351 | 419 | # == Schema Information
#
# Table name: verse_pages
#
# id :bigint not null, primary key
# page_number :integer
# mushaf_id :integer
# page_id :integer
# verse_id :integer
#
# Indexes
#
# index_verse_pages_on_page_number_and_mushaf_id (page_number,mushaf_id)
# index_verse_pages_on_ve... | 20.95 | 74 | 0.677804 |
1cf8f4b041dbfe51c6b02caddfd37c7a3a44d163 | 2,198 | class Scalapack < Formula
desc "High-performance linear algebra for distributed memory machines"
homepage "https://www.netlib.org/scalapack/"
url "https://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
sha256 "0c74aeae690fe5ee4db7926f49c5d0bb69ce09eea75beb915e00bba07530395c"
revision 11
bottle do
cellar... | 43.96 | 99 | 0.681529 |
ff108d157bf3722982791d29d3bece9ad55d98cb | 244 | module FactoryGirl
def self.preload(&block)
Preload.preloaders << block
end
module Syntax
module Default
class DSL
def preload(&block)
::FactoryGirl.preload(&block)
end
end
end
end
end
| 15.25 | 39 | 0.602459 |
4aa1e32a146a1721b9079ea4f04fd27905322d77 | 39 | class Breakman
VERSION = "0.0.1"
end
| 9.75 | 19 | 0.666667 |
b93c73746121cb5411cfaf5801ab8f1de55edc4c | 963 | # frozen_string_literal: true
module Kobot
# Configuration definition includes static ones hardcoded and
# dynamic ones that can be specified by command line options.
class Config
class << self
attr_accessor :clock,
:loglevel,
:skip,
:auto_ski... | 28.323529 | 63 | 0.475597 |
398a912449bce9b96b4000a1657aff64acea02cd | 65 | json.array! @courses, partial: 'api/courses/course', as: :course
| 32.5 | 64 | 0.723077 |
287a68eedb51496b3953012f99dccb5955955456 | 2,086 | # frozen_string_literal: true
require_relative "../../../../../test_helper"
class Comfy::Admin::Cms::Revisions::SnippetControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@snippet = comfy_cms_snippets(:default)
@revision = comfy_cms_revisions(:snippet)
end... | 33.111111 | 93 | 0.756951 |
1c7a8a26a38b57f4fba51d9eee2ec9bed5b8978a | 140 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_finechat_session'
| 35 | 78 | 0.807143 |
1c2160723822dcc116d921eeafe36d17e2df6f1d | 5,623 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE
def initialize(info = {})
s... | 34.286585 | 119 | 0.614263 |
acc68b261e01010d2c851dee380ff5d697f15880 | 2,204 | # Author: Piotr Wojcieszonek
# e-mail: piotr@wojcieszonek.pl
# Copyright 03.08.2021 Piotr Wojcieszonek
# frozen_string_literal: true
require_relative "field"
require "comparable"
module Lib
module TL1
module Message
class Autonomous
include Comparable
attr_reader :sid, :date, :time, :alarm... | 28.25641 | 113 | 0.580309 |
797cf5b33b3782e536b74f0de5abd079f81c7971 | 1,184 | class Connection < ApplicationRecord
belongs_to :source, class_name: 'Node', foreign_key: :source_id, primary_key: :id
belongs_to :target, class_name: 'Node', foreign_key: :target_id, primary_key: :id
def self.connected?(nodes)
return false if nodes.blank?
node_ids = nodes.map(&:id)
# group present... | 33.828571 | 83 | 0.696791 |
ac2b9910a84c18f72001e866d62c0e125307d3cd | 60 | class Account < SnitchRecord
self.table_name = "users"
end | 20 | 28 | 0.766667 |
79d879ba86f68388e8098c9d83a1cc1d989e26cb | 475 | require "rails_helper"
RSpec.describe "OrdnanceSurvey initializer" do
describe "OrdnanceSurvey.configuration.client.base_url" do
it "returns string from env var" do
expect(OrdnanceSurvey.configuration.client.base_url).to eq("https://api.os.uk")
end
end
describe "OrdnanceSurvey.configuration.client... | 29.6875 | 86 | 0.741053 |
ab77702595151aac69dbfaa121fff2de7f6c2c49 | 1,049 | # frozen_string_literal: true
# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require 'simplecov'
SimpleCov.start do
add_filter %r{/test/}
end
require_relative '../test/dummy/config/environment'
ActiveRecord::Migrator.migrations_paths = [
File.expand_path('../test/dummy/db/migrate', __dir__)
]
require '... | 27.605263 | 78 | 0.78837 |
7abe3d31cb2ec9b8413fbb807c16c0e530e5a366 | 1,208 | require 'spec_helper'
describe Refinery::Videos::Admin::VideosController, type: :controller do
render_views
before do
@user = Refinery::Authentication::Devise::User.create!(:username => 'admin@admin.com',
:email => 'admin@admin.com',
:passw... | 30.2 | 95 | 0.607616 |
edcc66cc09d5e2e04cee2e55ecd02c65ef1ab17b | 367 | cask :v1 => 'font-rosarivo' do
# version '1.003'
version :latest
sha256 :no_check
url 'https://github.com/google/fonts/trunk/ofl/rosarivo',
:using => :svn,
:revision => '50',
:trust_cert => true
homepage 'http://www.google.com/fonts/specimen/Rosarivo'
license :ofl
font 'Rosarivo... | 22.9375 | 59 | 0.640327 |
5d6d2d88b3849c834f33ebfa2a9bccc7d8fe9f21 | 1,581 | require 'time'
Gem::Specification.new do |gem|
gem.name = 'vanagon'
gem.version = %x(git describe --tags).tr('-', '.').chomp
gem.date = Date.today.to_s
gem.summary = "All of your packages will fit into this van with this one simple trick."
gem.description = "Vanagon is a tool to build a single package... | 41.605263 | 132 | 0.693865 |
6a29af7591217dec422586494ee2b910fb36e862 | 396 | module BootstrapEmail
module Converter
class Card < Base
def build
each_node('.card') do |node|
node.replace(template('table', classes: node['class'], contents: node.inner_html))
end
each_node('.card-body') do |node|
node.replace(template('table', classes: node['c... | 26.4 | 92 | 0.606061 |
031ba7196601b36c05bfd9d6efec96ce22267476 | 158 | # frozen_string_literal: true
# Main application controller
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
| 22.571429 | 52 | 0.835443 |
3862f03673121d24deedea00533b9d97c9e587ce | 582 | module Fastlane
module Helper
class CodePushLoginHelper
def self.log_in(access_key)
Action.sh("code-push login --accessKey #{access_key}", print_command: false)
rescue
UI.user_error!("something went wrong during login with access key #{access_key}")
end
def self.log_out
... | 22.384615 | 89 | 0.592784 |
e2173dad94b04b650c8bb79a12989ece1b8b61d5 | 13,497 | require 'pathname'
Puppet::Type.newtype(:dsc_xrdsessioncollectionconfiguration) 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 xRDSessionCollectionConfiguration resource t... | 36.088235 | 422 | 0.688301 |
4a76ce13d005883f328d13d153297853f4993ac3 | 900 | # Purpose: Determine information about Rackspace cloud instances
#
# Resolution:
# If this is a Rackspace Cloud instance, populates rsc_ facts
#
# Caveats:
# Depends on Xenstore
#
# Source: https://github.com/katzj/facter/blob/cc5b2e4fa26371fe392a7ba858a779e76afba223/lib/facter/rackspace.rb
Facter.add(:is_rsc) do
... | 25 | 111 | 0.708889 |
bfec7fe89068a3de82216c166fa90fcca862d73d | 1,540 | # frozen_string_literal: true
require 'round_robin_tournament'
class Api::SeasonsController < ApplicationController
include GamesCreator, TeamsCreator, PlayersCreator, LeagueCalculator
def create
:authenticate_user!
cpu_opponent = User.create(email: 'cpu_opponent' + current_user.id.to_s + '@mail.com', p... | 28.518519 | 112 | 0.648052 |
7ac71f2d4c19ada30817dab262e360707cd221ce | 1,103 | class Infrakit < Formula
desc "Toolkit for creating and managing declarative infrastructure"
homepage "https://github.com/docker/infrakit"
url "https://github.com/docker/infrakit.git",
:tag => "v0.5",
:revision => "3d2670e484176ce474d4b3d171994ceea7054c02"
bottle do
cellar :any_skip_relocation
... | 32.441176 | 93 | 0.737081 |
1a2c0eb07c4474ccc06cf84e3696d5f7298d1606 | 450 | require "spec_helper"
RSpec.describe Schmuck do
it "has a version number" do
expect(Schmuck::VERSION).not_to be nil
end
let(:hashes) {
(1..5).map do |n|
{
integer: n,
float: n.to_f,
double: n * 2,
square: n ** 2,
multiples: [n * 2, n * 3, n * 4]
}
... | 17.307692 | 42 | 0.508889 |
28b24d84c63b00948c7cb7ea231ba1400ee1e7d4 | 1,511 | # frozen_string_literal: true
RSpec.feature 'category' do
let!(:category) { categories(:category_parent) }
let!(:category_child) { categories(:category) }
let(:user) { users(:admin_org) }
before do
visit subdomain_root_url
sign_in user
end
it 'allows user to create a category' do
visit catego... | 30.22 | 71 | 0.714758 |
39a74818a9320c67cb30466907191080670bcf75 | 188 | #!/bin/ruby
n,t = gets.strip.split(' ').map(&:to_i)
width = gets.strip.split(' ').map(&:to_i)
for a0 in (0..t-1)
i,j = gets.strip.split(' ').map(&:to_i)
puts width[i..j].min
end
| 18.8 | 43 | 0.56383 |
e96abeb8d98d642044297bdd26cf29dd400642f7 | 5,113 | require 'spec_helper'
describe Amalgalite::Statement do
before(:each) do
@db = Amalgalite::Database.new( SpecInfo.test_db )
end
after(:each) do
@db.close
end
it "a statement has a copy of the sql it was prepared with" do
stmt = @db.prepare( "SELECT strftime('%Y-%m-%d %H:%M:%S', 'now')")
stm... | 30.254438 | 89 | 0.610209 |
6174cad0cd5b9f92289d8df036f1b49ce7ab9f90 | 1,828 | class Libolm < Formula
desc "Implementation of the Double Ratchet cryptographic ratchet"
homepage "https://gitlab.matrix.org/matrix-org/olm"
url "https://gitlab.matrix.org/matrix-org/olm/-/archive/3.2.6/olm-3.2.6.tar.gz"
sha256 "9b61bd9182bb0ae0c5a800a8b0496b69600a0a22e3a21fce0aad119d2b1c99ae"
license "Apache... | 37.306122 | 122 | 0.666302 |
2132d6a9a5031f7c5c5cccb5a9e27e5b5c834ad1 | 2,123 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX - License - Identifier: Apache - 2.0
# Purpose
# This code example demonstrates how to list the access control lists (ACLs) for an
# object in an Amazon Simple Storage Service (Amazon S3) bucket.
# snippet-start:[s3.s3_get_bucket_objec... | 29.486111 | 84 | 0.634951 |
4a4cedc5662ae8de28dcae5e13d4372164169411 | 724 | class SmartphoneNavbarView < UIView
include NavbarModule
def init_with_frame(frame, titleText: titleText, delegate: delegate)
self.initWithFrame(frame)
init_view_with_delegate(delegate, titleText: titleText)
build_view
self
end
def init_view_with_delegate(delegate, titleText: titleText )
... | 21.294118 | 70 | 0.627072 |
d5935602544af5a4137778f8325eb4be46ca4398 | 126 | require 'bundler/setup'
Bundler.setup
require 'mdexport'
RSpec.configure do |config|
config.pattern = 'tests/*_spec*'
end
| 14 | 34 | 0.746032 |
bb918f53ea2f168f61416fdc815e5f6b78393499 | 312 | # frozen_string_literal: true
module MailerLite
module Middleware
# This middleware will convert empty response to {}
class FixUnparsedJson < Faraday::Response::Middleware
private
def on_complete(response)
response[:body] = {} if response[:body] == ''
end
end
end
end
| 20.8 | 57 | 0.669872 |
bbfbf8910c2ee1761ae00e26dcaf0dae4f3b26e9 | 556 | Given(/^I am on the "(.*?)" homepage$/) do |institution|
$ginstitution = institution
visit 'https://webapps' + env_config['server'] + '.cspace.berkeley.edu/' + institution
end
Then(/^I will sign in$/) do
fill_in "Username", :with => env_config['login'] + "@berkeley.edu"
fill_in "Password", :with => env... | 30.888889 | 90 | 0.595324 |
1aeaa0a98d54a65d841f580d2e1d11d2907665af | 1,869 | class Snap < Formula
desc "Tool to work with .snap files"
homepage "https://snapcraft.io/"
url "https://github.com/snapcore/snapd/releases/download/2.46/snapd_2.46.vendor.tar.xz"
version "2.46"
sha256 "c4f532018ca9d2a5f87a95909b3674f8e299e97ba5cb5575895bcdd29be23db3"
license "GPL-3.0-only"
livecheck do
... | 34.611111 | 122 | 0.725522 |
6a053053da2a392d64c928e38098143786e3f6b1 | 916 | #!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'cgi'
require 'json'
require 'config'
class JIRA
def self.issues
@issues ||= (
check_config!
url = "#{config['url']}/rest/api/2/search"
uri = URI.parse(url)
uri.query = URI.encode_www_form({
jql: config['query'],
... | 21.302326 | 64 | 0.576419 |
1a9f0c808fda1d3e27a8af19e58dfae8068e0846 | 3,397 | class OpenshiftCli < Formula
desc "OpenShift command-line interface tools"
homepage "https://www.openshift.com/"
license "Apache-2.0"
head "https://github.com/openshift/oc.git"
stable do
url "https://github.com/openshift/oc.git",
tag: "openshift-clients-4.6.0-202006250705.p0",
revisi... | 35.757895 | 189 | 0.709744 |
bb84ed1ff77d650ef703adf79d4ec0235aba29b9 | 2,153 | # encoding: utf-8
require 'spec_helper'
describe Github::Repos::Hooks, '#list' do
let(:user) { 'peter-murach' }
let(:repo) { 'github' }
let(:hook_id) { 1 }
let(:request_path) {"/repos/#{user}/#{repo}/hooks/#{hook_id}" }
let(:inputs) {
{
:name => 'web',
:config => {
:url => "http://so... | 27.602564 | 73 | 0.627497 |
26504e4e2d1cac339bae1bcd851e47550e02c323 | 1,317 | require "sequel"
require "pact_broker/repositories/helpers"
module PactBroker
module Deployments
class CurrentlyDeployedVersionId < Sequel::Model
plugin :upsert, identifying_columns: [:pacticipant_id, :environment_id, :target_for_index]
dataset_module do
include PactBroker::Repositories::Hel... | 42.483871 | 132 | 0.75019 |
ed09904b274a5f95d7f50c951c22a598949cee1f | 861 | class Artist < Actor
has_many :locations, :as => :addressable
has_many :transactions, :as => :recipient
# has_many :transactions, :as => :supplier
validates_presence_of :first_name, :last_name
def create_artwork(title:, height_in:, width_in:, media: [])
media_map = media.map(med => Mediu... | 30.75 | 95 | 0.659698 |
61c63284a92e52f153464299d2e0dab21ad6fb78 | 7,290 | require 'rails_helper'
RSpec.describe Admin::PetitionDetailsController, type: :controller, admin: true do
let(:petition) { FactoryBot.create(:sponsored_petition) }
describe 'not logged in' do
describe 'GET #show' do
it 'redirects to the login page' do
get :show, params: { petition_id: petition.... | 34.714286 | 161 | 0.617695 |
79381f20b552e66f3416b98e84403a088dd29064 | 2,115 | # coding: utf-8
class User < ActiveRecord::Base
# ВООБЩЕ-ТО В ЭТОЙ РЕАЛИЗАЦИИ ПРИЛОЖЕНИЯ name ВООБЩЕ НЕ НУЖЕН.
# ДЕЛАЮ, МОЖЕТ ПОТОМ ПРИГОДИТСЯ.
attr_accessible :ip, :name
# :name не делаю обязательным. В модели :null => true
# Для чего см. after_create. Т.к. name апдейтится после уже получения id
val... | 35.847458 | 113 | 0.707329 |
7a866b2db37ed1e551dd747316eaa833ef7aefc3 | 86 | ErrorappNotifier.configure do|config|
config.api_key = ENV['ERROR_APP_API_KEY']
end
| 21.5 | 43 | 0.802326 |
e97eedbcbf20f46bf1726c15a1bd0885b07f4d22 | 60 | module Mongoid
class Diff
VERSION = "0.0.1"
end
end
| 10 | 21 | 0.633333 |
5d48d0f1696eddd23d9d4997c556b451958d964a | 14,053 | # frozen_string_literal: true
require 'view/game/actionable'
require 'view/game/bank'
require 'view/game/buy_sell_shares'
require 'view/game/company'
require 'view/game/corporation'
require 'view/game/par'
require 'view/game/players'
require 'view/game/sell_shares'
require 'view/game/stock_market'
require 'view/game/b... | 36.981579 | 127 | 0.559453 |
edde87f4642332a5fb8002d07a0dfdedb7aa742c | 45 | array = [1,2,2,"vijay"]
a,b = array
puts a,b
| 11.25 | 23 | 0.577778 |
017826921ff849c48cf11f22f7d8e50940fee84a | 1,499 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe WhatsNewHelper do
describe '#whats_new_storage_key' do
subject { helper.whats_new_storage_key }
context 'when version exist' do
let(:release_item) { double(:item) }
before do
allow(ReleaseHighlight).to receive(:versions... | 25.844828 | 83 | 0.694463 |
916f4ddee172c7329a49abbb3a200d50e9b549b2 | 1,224 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'copy_method/version'
Gem::Specification.new do |spec|
spec.name = "copy_method"
spec.version = CopyMethod::VERSION
spec.authors = ["Alexa Grey"]
spec.email = ... | 37.090909 | 104 | 0.669118 |
611fef8da8cb48dd57f8afad4d65021891d92f3e | 1,239 | # frozen_string_literal: true
require "spec_helper"
describe Mongoid::Extensions::Regexp do
describe ".demongoize" do
let(:value) do
Regexp.demongoize(/[^abc]/)
end
it "returns the provided value" do
expect(value).to eq(/[^abc]/)
end
end
describe ".mongoize" do
context "when... | 16.972603 | 51 | 0.557708 |
b9738c14e817e083d2e7052b7f01640f7d8b461b | 1,903 | #
# Author:: Joshua Timberman <joshua@opscode.com>
# Cookbook Name:: couchdb
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# h... | 27.185714 | 108 | 0.683132 |
6243b5c51b7bc3ded3f76afdc1d3f552aa049be7 | 7,458 | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class NestedParametersPermitTest < ActiveSupport::TestCase
def assert_filtered_out(params, key)
assert_not params.has_key?(key), "key #{key.inspect} has not been filtered out"
end
test "permitted neste... | 35.345972 | 153 | 0.632341 |
08517fe0df761e24798bd2ce8a88b165e3e6b1e7 | 413 | class ProjectSerializer < ActiveModel::Serializer
attributes :id, :name
has_many :notices
def notices
release = object.releases.order(date: :desc).first
if release
release.notices
end
end
class NoticeSerializer < ActiveModel::Serializer
attributes :id, :heading, :body, :target_elemen... | 18.772727 | 61 | 0.707022 |
38a4539f34ab0e566c5ad9528aeddc823da3c2aa | 2,297 | # frozen_string_literal: true
module Resolvers
class TodoResolver < BaseResolver
type Types::TodoType, null: true
alias_method :user, :object
argument :action, [Types::TodoActionEnum],
required: false,
description: 'The action to be filtered'
argument :author_id, [GraphQL... | 25.241758 | 76 | 0.633435 |
6208e5096b2dfdaad5dd410322f8970ad7658b1e | 1,249 | require 'hpricot'
module Relevance
module Tarantula
class AttackHandler
include ERB::Util
def attacks
Relevance::Tarantula::FormSubmission.attacks.select(&:output)
end
def handle(result)
return unless attacks.size > 0
regexp = '(' + attacks.map {|a| Regexp.esca... | 28.386364 | 80 | 0.417934 |
26d312f35b60d0fc53a4e31ee345cf8dceb1a7e5 | 1,344 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'active_job/uniqueness/version'
Gem::Specification.new do |spec|
spec.name = 'activejob-uniqueness'
spec.version = ActiveJob::Uniqueness::VERSION
spec.authors ... | 35.368421 | 107 | 0.690476 |
62d5aeab0e58e336ecebe73def351636c447d854 | 794 | require 'ffi_dry'
module FFI
module PCap
extend FFI::Library
ffi_lib ['pcap', 'libpcap.so.1', 'wpcap']
end
Pcap = PCap
end
require 'ffi/pcap/crt'
require 'ffi/pcap/exceptions'
# FFI typedefs, pointer wrappers, and struct
require 'ffi/pcap/typedefs'
require 'ffi/pcap/bsd'
require 'ffi/pcap/addr'
requi... | 21.459459 | 54 | 0.753149 |
bf6331dd9909c41a7217cb89b8a8ee2481369816 | 2,583 | require 'rails_helper'
feature "Accounts" do
scenario "Creating an account" do
visit subscribem.root_path
click_link "Account Sign Up"
fill_in "Name", with: "Test"
fill_in "Subdomain", with: "test"
fill_in "Email", with: "subscribem@example.com"
fill_in "Password", with: "password"
fill_i... | 36.9 | 94 | 0.6988 |
0854fe30aed21f2de35b487ce9595f3c308040fb | 929 | cask "webull" do
dl_arch, livecheck_arch = Hardware::CPU.intel? ? ["us", "qt_mac_global"] : ["usm1", "qt_m1_global"]
version "5.10.5"
if Hardware::CPU.intel?
sha256 "ab818bc24ce34d511584e66253dc8fd5f1e74829c2e13320194753ac881f8300"
else
sha256 "e777371e5a4207ca45d74939b5d148d8146f8ff53b53961f71dc9468d... | 29.967742 | 106 | 0.73197 |
1ae069e8b05f1c99fac6cf649caec20e28b00bdb | 1,518 | require "rails_helper"
RSpec.describe ScheduledJob do
it "re-enqueues the job to run in 15 minutes from now if wait until is longer that 15 minutes" do
travel_to(Time.zone.local(2018, 1, 1)) do
job_args = ["AFakeJob", 1, foo: "bar", wait_until: 1.hour.from_now.to_f]
ScheduledJob.perform_now(*job_args... | 37.02439 | 99 | 0.703557 |
e930ccb4f3d7bc2c6b052b09747f980aeacb53a9 | 3,025 | # encoding: UTF-8
require 'base64'
require 'multi_json'
require 'polipus'
require 'polipus-elasticsearch'
module Polipus
module Storage
class ElasticSearchStore < Base
BINARY_FIELDS = %w(body headers user_data)
DEFAULT_INDEX = Polipus::ElasticSearch::Page
attr_accessor :index, :index_name, :ex... | 28.809524 | 92 | 0.574876 |
3969b5cbd0ed18b6bd2406995c47b44d2f760d5c | 1,100 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'guard/autoupload/version'
Gem::Specification.new do |spec|
spec.name = "guard-autoupload"
spec.version = Guard::AutouploadVersion::VERSION
spec.authors = ["Jyrki Lilja"... | 39.285714 | 84 | 0.66 |
e84b07ec2ef2ba4661b32d96ad47263d95dce788 | 9,631 | require 'spec_helper'
describe 'Dropdown label', js: true do
include FilteredSearchHelpers
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:filtered_search) { find('.filtered-search') }
let(:js_dropdown_label) { '#js-dropdown-label' }
let(:filter_dropdown) { find("#{js_dropdown_label} ... | 33.210345 | 198 | 0.711349 |
33eb4e1c6ed8607dde4b2763d40aecdd81955358 | 1,768 | module Jekyll
module SnippetCut
class SnippetCutTag < Liquid::Block
@@DEFAULTS = {
:name => 'myfile.yaml',
:url => '/asdasda/myfile.yaml',
:limited => false
}
def self.DEFAULTS
return @@DEFAULTS
end
def initialize(tag_name, markup, tokens)
... | 30.482759 | 194 | 0.598982 |
ffa4f389ca69b94aaf0faa722d4cfb3bec62251f | 6,623 | # frozen_string_literal: true
RSpec.describe Football::Butler::Scorers do
before do
stubs_scorers
end
after do
Football::Butler::Configuration.reset
Football::Butler::Configuration.reconfigure(api_token: 'my_dummy_token')
end
describe 'when by_competition' do
context 'success' do
it '... | 28.063559 | 97 | 0.547939 |
ed10e92618adedc888ea3e3453e9e3331e647f43 | 434 | class CreateContacts < ActiveRecord::Migration[5.2]
def change
create_table :contacts do |t|
t.integer :account_id
t.integer :company_id
t.string :first_name
t.string :last_name
t.string :job_title
t.string :email
t.string :phone
t.string :mobile
t.string :fax... | 21.7 | 51 | 0.631336 |
ed74776f5c28c20e2af53dfb0d84815881d73dd2 | 5,398 | # frozen_string_literal: true
describe 'CORS', type: :request do
include_context 'doorkeeper authentication'
let(:ranger_url) { 'https://ranger.barong.io' }
let(:frontend_url) { 'https://frontend.barong.io' }
let(:origin_header) { { 'Origin' => ranger_url } }
context 'when API_CORS_ORIGINS is not set' do
... | 47.769912 | 133 | 0.709707 |
d581ce1243964dbfa8f4a7539dd4cdc416f006f9 | 655 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get 'elements/index', to: 'elements#index'
get 'elements/layout', to: 'elements#layout'
get 'elements/typography', to: 'elements#typography'
get 'elements/colour', to: 'elemen... | 34.473684 | 101 | 0.722137 |
ff9c06882f7880af72ee3d77728ebfb3a2936c5d | 103 | require "ftw/namespace"
# :nodoc:
module FTW
# The version of this library
VERSION = "0.0.42"
end
| 12.875 | 31 | 0.679612 |
28cf6c174c900f0fa236fb543ba780f6196938e2 | 201 | if ENV["RAILS_ENV"] == "production"
worker_processes 2 # amount of unicorn workers to spin up
else
worker_processes 1
end
timeout 30
# this is required for New Relic to log data
preload_app true
| 18.272727 | 59 | 0.761194 |
18e04645d067d7678b2fbd1ae1aa0f49e5abbe4a | 292 | module HTTP
# Generic error
class Error < StandardError; end
# Generic Request error
class RequestError < Error; end
# Generic Response error
class ResponseError < Error; end
# Request to do something when we're in the wrong state
class StateError < ResponseError; end
end
| 20.857143 | 57 | 0.736301 |
6243f41dbd7416c9cb88122db7bf3787e3e10762 | 2,051 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "kramdown"
s.version = "1.9.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Thomas Leitner"]
s.date = "2015-10-01"
s.description = "kramdown is yet-another-markdown-par... | 40.215686 | 158 | 0.618235 |
1c8a99370830fbf24808dde30526678c31408131 | 297 | class CreateMainTasks < ActiveRecord::Migration[5.1]
def change
create_table :main_tasks do |t|
t.string :name, required: true
t.datetime :planned_finish, required: true
t.references :user, index: true, null: false, foreign_key: true
t.timestamps
end
end
end
| 22.846154 | 69 | 0.683502 |
6132da0cdfc33dfbd9d9a1306b3c0d3ecee043c0 | 553 | # frozen_string_literal: true
module GraphQL
module FragmentCache
module Ext
# Add ability to access fragments via `context.fragments`
# without dupclicating the storage logic and monkey-patching
refine GraphQL::Query::Context do
def fragments?
namespace(:fragment_cache)[:frag... | 23.041667 | 66 | 0.627486 |
e95199a94948d67885963f1c71a9dac02598a511 | 3,897 | require 'spec_helper'
require 'cloud_controller/drain'
module VCAP::CloudController
describe Drain do
let(:log_dir) { Dir.mktmpdir }
subject(:drain) { Drain.new(log_dir) }
def log_contents
File.open(File.join(log_dir, 'drain', 'drain.log')) do |file|
yield file.read
end
end
... | 27.638298 | 94 | 0.625353 |
f73c8aa377519d8042a11d5fe838f675458f789b | 1,553 | require 'spec_helper'
describe AmplitudeAPI::Identification do
user = Struct.new(:id)
context 'with a user object' do
describe '#body' do
it "populates with the user's id" do
identification = described_class.new(user_id: user.new(123))
expect(identification.to_hash[:user_id]).to eq(123)
... | 27.732143 | 98 | 0.654218 |
91e23159698d1091a9d758e2b1d77308434d56b4 | 1,152 | class UserspaceRcu < Formula
desc "Library for userspace RCU (read-copy-update)"
homepage "https://liburcu.org"
url "https://lttng.org/files/urcu/userspace-rcu-0.12.1.tar.bz2"
sha256 "bbfaead0345642b97e0de90f889dfbab4b2643a6a5e5c6bb59cd0d26fc0bcd0e"
livecheck do
url "https://www.lttng.org/files/urcu/"
... | 31.135135 | 106 | 0.707465 |
d54fe729311b6cfa9c09ae2b149cc29e8b66211b | 1,289 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "oddsmaker/version"
Gem::Specification.new do |spec|
spec.name = "oddsmaker"
spec.version = Oddsmaker::VERSION
spec.authors = ["Paul Hoffer"]
spec.email = ["gi... | 42.966667 | 228 | 0.688906 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.