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 |
|---|---|---|---|---|---|
1df5ee784cd056a419467769e1f82449075b332f | 1,867 | #
# Copyright (C) 2017 Lenovo, 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 writ... | 23.049383 | 74 | 0.626674 |
d59cbe3113b98b7d3f5c1594a4e1f9e5b05ced33 | 4,174 | # 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::EventGrid::Mgmt::V2019_06_01
#
# Azure EventGrid Management Client
#
class Operations
include MsRestAzure
#
# Creates and... | 35.07563 | 141 | 0.684236 |
f764faf80e18377e0e0ea24b4c039bc2328627ae | 1,055 | require_relative '../../../puppet/transaction/report'
require_relative '../../../puppet/indirector/yaml'
class Puppet::Transaction::Report::Yaml < Puppet::Indirector::Yaml
include Puppet::Util::SymbolicFileMode
desc "Store last report as a flat file, serialized using YAML."
# Force report to be saved there
d... | 30.142857 | 140 | 0.694787 |
ab5e78fcb61c3bb43566b81010af24c6a4c2839d | 3,403 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 40.035294 | 104 | 0.761681 |
0399150e94850f4fd6813b28480dbf2a61af28cc | 170 | FactoryGirl.define do
factory :survey, :class => "Rapidfire::Survey" do
name "Survey"
introduction "Please answer all the questions in this survey."
end
end
| 24.285714 | 66 | 0.711765 |
38786a86afc0e75fe1e435c917c357e55296e6ef | 526 | require 'forwardable'
require_relative 'restriction'
module ParamsReady
class QueryContext
include Restriction::Wrapper
extend Forwardable
attr_reader :data
def_delegator :data, :[]
def initialize(restriction, data = {})
@data = data.freeze
raise ParamsReadyError, "Restriction expect... | 23.909091 | 118 | 0.71673 |
338267598206c6d9cf6b282299ffb9a4cd728ee6 | 277 | ThinkingSphinx::Index.define :book, :with => :active_record, :delta => true do
indexes title, :sortable => true
indexes author, :facet => true
indexes [title, author], :as => :info
indexes blurb_file, :file => true
has year
has created_at, :type => :timestamp
end
| 27.7 | 78 | 0.6787 |
e22d701ce5458f3780ee2208e877a687ab29de2a | 1,382 | module Devise
module OmniAuth
class StrategyNotFound < NameError
def initialize(strategy)
@strategy = strategy
super("Could not find a strategy with name `#{strategy}'. " \
"Please ensure it is required or explicitly set it using the :strategy_class option.")
end
end
... | 30.043478 | 96 | 0.609986 |
e9dac37b9d37e008cfba5eadc613a1730081428f | 430 | class CreateRounds < ActiveRecord::Migration[6.0]
def change
create_table :rounds do |t|
t.string :name
t.string :deadline_time
t.boolean :finished
t.boolean :data_checked
t.integer :deadline_time_epoch
t.integer :deadline_time_game_offset
t.boolean :is_previous
t.b... | 23.888889 | 49 | 0.669767 |
e221464e7673f578750c2341519b0f683229ecb3 | 1,778 | class Flex < Formula
desc "Fast Lexical Analyzer, generates Scanners (tokenizers)"
homepage "https://github.com/westes/flex"
url "https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz"
sha256 "e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995"
bottle do
sha256 "0abf1278... | 32.925926 | 107 | 0.647919 |
e2e9a9480677156a28620d42f154a7878f6b219b | 2,168 | require 'spec_helper'
module Spree
describe Spree::ProductDuplicator do
let(:product) { create(:product, properties: [create(:property, name: "MyProperty")])}
let!(:duplicator) { Spree::ProductDuplicator.new(product)}
let(:image) { File.open(File.expand_path('../../../fixtures/thinking-cat.jpg... | 34.967742 | 152 | 0.664207 |
1c03cbb72e788ed7850ea1c7826f8b48ce8cdea2 | 1,074 | class Most < Formula
desc "Powerful paging program"
homepage "https://www.jedsoft.org/most/"
url "https://www.jedsoft.org/releases/most/most-5.1.0.tar.gz"
sha256 "db805d1ffad3e85890802061ac8c90e3c89e25afb184a794e03715a3ed190501"
head "git://git.jedsoft.org/git/most.git"
bottle do
cellar :any
sha256... | 34.645161 | 93 | 0.697393 |
ed067357810379bd3487c7f82a64186ca3e8211d | 222 | module Spaceship
module Tunes
# Represents a screenshot hosted on iTunes Connect
class AppScreenshot < Spaceship::Tunes::AppImage
attr_accessor :device_type
attr_accessor :language
end
end
end
| 20.181818 | 54 | 0.72973 |
6159e3fccf898862d74b49c0794c3b28422c8af1 | 1,561 | require 'rails_helper'
RSpec.describe InvoiceForm, type: :form do
let(:user) { create(:user) }
let(:account) { user.account }
let(:product) { create(:product, account: account) }
let(:variant) { product.variants.create(price: 100) }
let(:customer) { create(:customer, account: account) }
let(:invoice_form)... | 26.457627 | 76 | 0.636771 |
e88170bb247dae1d60236b072a585b7bb2796647 | 247 | class AddObjectChangesToVersions < ActiveRecord::Migration[4.2]
# The largest text column available in all supported RDBMS.
TEXT_BYTES = 1_073_741_823
def change
add_column :versions, :object_changes, :text, limit: TEXT_BYTES
end
end
| 27.444444 | 67 | 0.773279 |
9123d2e109fc3116ebb5115b76ff9e62a9aaf7e6 | 1,349 | describe :file_file, :shared => true do
before :each do
platform_is :windows do
@null = "NUL"
@dir = "C:\\"
end
platform_is_not :windows do
@null = "/dev/null"
@dir = "/bin"
end
@file = tmp("test.txt")
touch @file
end
after :each do
rm_r @file
end
it "... | 26.45098 | 84 | 0.64344 |
181fcf1e03f81aae28a556df75d5a29e1068d125 | 2,383 | # frozen_string_literal: true
# See LICENSE.txt at root of repository
# GENERATED FILE - DO NOT EDIT!!
require 'ansible/ruby/modules/base'
module Ansible
module Ruby
module Modules
# Sends arbitrary commands to an CNOS node and returns the results read from the device. The C(cnos_command) module includes a... | 66.194444 | 341 | 0.730592 |
e9c578767ce7d8ff619c55a9d578d848a4206af5 | 681 | require 'spec_helper'
RSpec.describe 'Legacy Jobs' do
describe ::BlobstoreDelete, job_context: :worker do
subject { ::BlobstoreDelete.new('key', 'blobstore-name') }
it { is_expected.to be_a(VCAP::CloudController::Jobs::Runtime::BlobstoreDelete) }
end
describe ::BlobstoreUpload do
subject { ::Blobsto... | 35.842105 | 85 | 0.722467 |
1c1834ea1a9a1219a20427401181b3bdda782384 | 397 | require '../test_helper'
class MoviesEmailTest < ActionMailer::TestCase
def setup
@user = User.new(:login => "Robert" , :email => "sseku@o2.pl" )
end
def test_movies_email
response = MoviesEmail.create_movies_email(@user)
assert_equal("Send list of movies" , response.subject)
assert_equal("sseku@... | 26.466667 | 67 | 0.697733 |
284eeca51ff0a8a099e32c3131b292ff9b918096 | 588 | class Category::Agents::Nodes::PageController < ApplicationController
include Cms::NodeFilter::View
helper Cms::ListHelper
before_action :accept_cors_request, only: [:rss]
def pages
Cms::Page.site(@cur_site).and_public(@cur_date).
where(@cur_node.condition_hash)
end
def index
@items = pages... | 20.275862 | 69 | 0.678571 |
ed367e191716bd76e2d00a6f71d8d9759c2755f2 | 10,050 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "query results spec" do
solr = RSolr.connect(url: ENV["SOLR_URL"])
let(:search_term) { search_terms.values.join(" ") }
let(:per_page) { 20 }
let(:response) { solr.get("search", params: { q: search_term, rows: per_page }) }
let(:ids) { (resp... | 31.114551 | 115 | 0.617015 |
e2d701e195f4370e58370cf7ea99f688efd88cbb | 185 | require 'time_travel/time_extensions'
Time.send(:include, TimeTravel::TimeExtensions)
def at_time(time)
Time.now = time
begin
yield time
ensure
Time.now = nil
end
end
| 14.230769 | 47 | 0.718919 |
bf03375db5268f33f659db08722898f3c87ffd13 | 1,477 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Monitor::Mgmt::V2015_05_01
module Models
#
# CDN REST API operation
#
class Operation
include MsRestAzure
# @return [String] Ope... | 25.465517 | 76 | 0.513202 |
7a5bde0301598502b950c456ca399e98eafe4fe6 | 25,962 | require "spec_helper"
require "integration/support/server"
require "json"
require "ostruct"
require "logger"
describe "Options" do
before :all do
@server = IntegrationServer.run
end
after :all do
@server.stop
end
context "global: endpoint and namespace" do
it "sets the SOAP endpoint to use to ... | 37.845481 | 149 | 0.66736 |
e810318842a2b9d2f9dd18e8bd372731d65f348c | 1,645 | module RSpec
module Matchers
module BuiltIn
class MatchArray < BaseMatcher
def match(expected, actual)
return false unless actual.respond_to? :to_ary
@extra_items = difference_between_arrays(actual, expected)
@missing_items = difference_between_arrays(expected, actual)
... | 31.634615 | 124 | 0.610334 |
ede38b21cbc1b2179c52fc2b5a45a85fd1bc7ef1 | 744 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | 35.428571 | 69 | 0.733871 |
219fcc896f26ee2359bf789b7135402087d479aa | 370 | module MoneyS3
module Parsers
class SeznamPredkontaci
include ParserCore::BaseParser
def predkontace
array_of_at(Predkontace, ['Predkontace'])
end
def to_h
hash = {}
hash[:attributes] = attributes
hash[:predkontace] = predkontace.map(&:to_h) if has? 'Pred... | 18.5 | 74 | 0.608108 |
1a721c45888e615dae6b89e8d7f1a498ab260aea | 3,852 | require 'spec_helper'
module VCAP::CloudController
describe ServiceBroker, :services, type: :model do
let(:name) { Sham.name }
let(:broker_url) { 'http://cf-service-broker.example.com' }
let(:auth_username) { 'me' }
let(:auth_password) { 'abc123' }
subject(:broker) { ServiceBroker.new(name: name... | 32.923077 | 158 | 0.634476 |
61f9836250846c4d47a51d8d2bc17ae0178c19fa | 963 | require 'rails_helper'
RSpec.feature "Public::Base", type: :feature do
let(:database) { FactoryBot.create(:database_basic) }
let(:subject) { FactoryBot.create(:subject) }
let(:landing_page) { FactoryBot.create(:landing_page) }
context "#index" do
before :each do
database.status = "production"
... | 34.392857 | 69 | 0.715472 |
617420050ba0241e6956c7b2bae72ff4686e4959 | 173 | class CreatePrograms < ActiveRecord::Migration
def change
create_table :programs do |t|
t.string :program_name
t.timestamps null: false
end
end
end
| 17.3 | 46 | 0.693642 |
1136fdf60cb32bcfa810070ad384b6e9bdbc2306 | 81,498 | require 'unit_spec_helper'
describe Shoulda::Matchers::ActiveRecord::AssociationMatcher, type: :model do
include UnitTests::ApplicationConfigurationHelpers
context 'belong_to' do
it 'accepts a good association with the default foreign key' do
expect(belonging_to_parent).to belong_to(:parent)
end
... | 35.965578 | 253 | 0.634457 |
ffdaa243ed250b8e028ff97af134e89466b7bf57 | 3,896 | require 'spec_helper'
describe 'apache::mod::proxy_html', :type => :class do
let :pre_condition do
[
'include apache::mod::proxy',
'include apache::mod::proxy_http',
]
end
it_behaves_like "a mod class, without including apache"
context "on a Debian OS" do
shared_examples "debian" do |lo... | 36.754717 | 107 | 0.518224 |
2101d9c180c2bac0b0b00a8b61ea6072b280a5b6 | 772 | require "rails_helper"
describe CasesController, type: :controller do
let(:case_being_drafted) { create :case_being_drafted,
:flagged_accepted }
let(:manager) { find_or_create :disclosure_bmt_user}
before do
sign_in manager
end
describe 'GET extend_for_pit' d... | 29.692308 | 75 | 0.670984 |
e93479c08f9c1eccd29e9694a4f5d58449bdc4b2 | 1,599 | require "json"
require "net/http"
class VaccineSpotter
API_URL = "https://www.vaccinespotter.org/api/v0/states".freeze
def self.find_in(state, vaccine_type: nil, zipcodes: [])
new(state, vaccine_type, zipcodes).find
end
def initialize(state, vaccine_type, zipcodes)
@state = state
@vaccine_type = ... | 35.533333 | 137 | 0.677298 |
5d33a33ffa3838391d9796a608df5f603e25b0e4 | 670 | require 'tuio-ruby'
@tc = TuioClient.new
@tc.on_object_creation do | to |
puts "New TUIO Object #{to.fiducial_id} at x: #{to.x_pos}, y: #{to.y_pos}"
end
@tc.on_object_update do | to |
puts "Updated TUIO Object #{to.fiducial_id} at x: #{to.x_pos}, y: #{to.y_pos}"
end
@tc.on_object_removal do | to |
puts "Remov... | 22.333333 | 80 | 0.673134 |
5d2d8dd167b5d574cbb6c71422f12ef8d466f737 | 769 | module Solargraph
module Parser
class NodeMethods
module_function
def unpack_name node
raise NotImplementedError
end
def infer_literal_type node
raise NotImplementedError
end
def calls_from node
raise NotImplementedError
end
def returns_f... | 17.477273 | 54 | 0.63329 |
e9d381edeb0706a016e6ed0d7b52ad02576ff924 | 1,867 | module CanadaPost
module Request
class Pickup < Base
def create(options)
@address = options[:address]
@contact = options[:contact]
@location = options[:location]
@pickup = options[:pickup]
@volume = options[:pickup_volume]
send_request :post, pickup_url, body... | 32.189655 | 83 | 0.552758 |
62323bd90d3ee5a17b1795031bd95d81430f67fa | 426 | cask :v1 => 'font-old-standard-tt' do
# version '2.0.2'
version :latest
sha256 :no_check
url 'https://github.com/google/fonts/trunk/ofl/oldstandardtt',
:using => :svn,
:revision => '50',
:trust_cert => true
homepage 'http://www.google.com/fonts/specimen/Old%20Standard%20TT'
license... | 25.058824 | 69 | 0.659624 |
38fa11218dc6f1ccdcf94c3c04c9d2803ee460a3 | 4,056 | # -*- coding:binary -*-
require 'spec_helper'
require 'rex/mime'
RSpec.describe Rex::MIME::Header do
let(:mime_headers_test) do
<<-EOS
Content-Type: text/plain;
Content-Disposition: attachment; filename="test.txt"
EOS
end
subject do
described_class.new
end
describe "#initialize" do
subjec... | 26.684211 | 130 | 0.630671 |
1a384377fe3c5aa8cc999d696f0747cda06430bf | 2,282 | # frozen_string_literal: true
# Copyright 2020 Matthew B. Gray
# Copyright 2020 Victoria Garcia
#
# 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.6 | 105 | 0.702016 |
bb07e2bbef847584ab1705ea77134da857f18204 | 277 | # https://leetcode.com/submissions/detail/34105802/
def delete_duplicates(head)
it = head
while it
while it && it.next && it.val == it.next.val
it.next = it.next.next
end
it = it.next unless it.nil?
end
return head
end
| 19.785714 | 52 | 0.574007 |
39c670f6b2b23939c9bca70123edf38a03f50e5f | 5,009 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 44.327434 | 114 | 0.762228 |
01794a2170c7df86d8b7c647f1f7fc4361d0ecf4 | 1,159 | module Elasticsearch
module DSL
module Search
module Aggregations
# A parent pipeline aggregation which executes a script which determines whether the current bucket will be retained in the parent multi-bucket aggregation.
#
# @example Passing the options as a Hash
#
... | 32.194444 | 164 | 0.605695 |
ed8bbdca24d7d876eb1206b940f0da792c736185 | 1,694 | class Bc < Formula
desc "Arbitrary precision numeric processing language"
homepage "https://www.gnu.org/software/bc/"
url "https://ftp.gnu.org/gnu/bc/bc-1.07.1.tar.gz"
mirror "https://ftpmirror.gnu.org/bc/bc-1.07.1.tar.gz"
sha256 "62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a"
bottle do
... | 33.88 | 94 | 0.723731 |
33c1ea7c429d11fcfc83e0ea1446ed9a816f9412 | 5,399 | require 'spec_helper'
describe Travis::Build::Script::Csharp, :sexp do
let(:data) { payload_for(:push, :csharp) }
let(:script) { described_class.new(data) }
subject { script.sexp }
it_behaves_like 'compiled script' do
let(:code) { ['TRAVIS_LANGUAGE=csharp'] }
end
it_behaves_like 'a build script se... | 41.852713 | 194 | 0.660493 |
3995a0bbaf69abbacdd51953f376e645edc73977 | 13,022 | # Copyright © 2011-2016 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... | 38.64095 | 179 | 0.695746 |
28dc44c576c915de1027d33648907b9a1026840f | 1,341 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
require 'msf/core/post/windows/netapi'
class Metasploit3 < Msf::Post
include Msf::Post::Windows::NetAPI
def initialize(info={})
super( upd... | 25.301887 | 88 | 0.592841 |
61aac57e62ac459e68e6c6418b0b2f31fc480031 | 1,238 | =begin
#Selling Partner API for Direct Fulfillment Orders
#The Selling Partner API for Direct Fulfillment Orders provides programmatic access to a direct fulfillment vendor's order data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.26
=end
r... | 29.47619 | 128 | 0.780291 |
1c20f240da529c793598a4d9e39f479f12ae270e | 1,030 | class ApplicationController < ActionController::Base
helper_method :logged_in?, :current_user
private
def current_user
if session[:user_id]
@user = User.find(session[:user_id])
end
end
def logged_in?
# Coerces return value into a Boolean
!!current_user
end
def login(user)
s... | 20.6 | 74 | 0.698058 |
081a7a2c890a359994d9c60f83a21c5e95ceb20f | 651 | require 'rails_helper'
describe User, type: :model do
context 'Associations' do
it { should have_many(:posts) }
it { should have_many(:comments) }
it { should have_many(:likes) }
it { should have_many(:friendships) }
it { should have_many(:requests_received), foreign_key: :friend_id, class_name: ... | 31 | 97 | 0.700461 |
e997dd5e1de5cf5b4743a0e3d1710042899847ae | 529 | def oddities(arr)
arr.select { |obj| arr.index(obj).even? }
end
def oddities2(arr)
odd_element = []
index = 0
while index < arr.length
odd_element << arr[index]
index += 2
end
odd_element
end
def evenies(arr)
odd_element = []
index = 1
while index < arr.length
odd_element << arr[index]
... | 16.030303 | 43 | 0.625709 |
33d9d5d58d0ab7d29ad8c406f261e21009527124 | 203 | module Users
module ReportManipulator
extend ActiveSupport::Concern
def can_view_reports?
super_admin? || report_admin?
end
def can_export?
super_admin?
end
end
end
| 14.5 | 35 | 0.679803 |
bb7bcf3dc369ce709976ce81cb0dc2fb12f345f1 | 1,105 | module GitVersionBumper
module VersionBumper
# Local represenation of Git::Object::Tag
# Created to allow for custom sorting of git tags
class Tag
include Comparable
attr_reader :major, :minor, :patch
def initialize(major, minor, patch)
@major = Integer(major)
@minor = ... | 21.666667 | 53 | 0.532127 |
4a52b13e6155467b89d4392d48bcda022cafc4ac | 717 | #---
# Excerpted from "The RSpec Book",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.p... | 29.875 | 82 | 0.718271 |
bfcf57c4ed1760b0bafccdafe65a99d5a48f5ae1 | 1,524 | require 'em-websocket'
require_relative 'lock'
require_relative 'vlc_client'
EventMachine.run do
@lock = Lock.new
@vlc_client = VLCClient.new
@vlc_client.play(ENV['FILENAME'])
@vlc_client.pause
# Track local VLC Player state changes in order to push them to clients
@vlc_client_status = @vlc_client.st... | 23.446154 | 100 | 0.605643 |
6a9d37985af61eba444e3d7f2290d8de5517e18d | 170 | require 'test_helper'
class CatarsePaymentPaypalExpressTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, CatarsePaymentPaypalExpress
end
end
| 21.25 | 63 | 0.817647 |
ab23c700a56c8c384a166ad77ae9319adb8be899 | 2,342 | feature 'Check available tasks counter', js: true do
before(:each) do
set_camunda_api_mock_file('spec/hbw/features/tasks/task_counter_mock.yml')
order_type = FactoryBot.create(:order_type, :support_request)
FactoryBot.create(:order, order_type: order_type) # ORD-1
user = FactoryBot.create(:user)
... | 30.025641 | 120 | 0.680615 |
79f845756b3aaa7615b916dccb01cd1459eea906 | 147 | class RemoveDownloadUrlFromExportJobs < ActiveRecord::Migration[5.2]
def change
remove_column :export_jobs, :download_url, :string
end
end
| 24.5 | 68 | 0.789116 |
f8f01a38636ef2820a928754eeac4ba7ebf3f5c9 | 361 | # frozen_string_literal: true
module Awspec::Helper
module Finder
module VpcEndpoints
def find_vpc_endpoint(id)
res = ec2_client.describe_vpc_endpoints({ vpc_endpoint_ids: [id] })
ret = res.vpc_endpoints.select do |vpce|
vpce.vpc_endpoint_id == id
end
ret.single_... | 20.055556 | 75 | 0.65097 |
218ae8cd730d0f541e488f22c061685a3cfd92bf | 45,772 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 52.672037 | 133 | 0.564406 |
bf97d5f903e523257c148a58e66d9ca514322eb6 | 2,691 | require "rexml/node"
module REXML
##
# A Child object is something contained by a parent, and this class
# contains methods to support that. Most user code will not use this
# class directly.
class Child
include Node
attr_reader :parent # The Parent of this object
# Constructor. Any in... | 27.742268 | 78 | 0.62579 |
e957184f0afb195769178007e1ec48d37f59456e | 1,125 | require File.expand_path('../boot', __FILE__)
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 ArtOfLivingManager
class Application < Rails::Application
# Settings in config/environments/*... | 41.666667 | 99 | 0.736 |
e2b815ed4062b7e703fab5dc36ed9c3c750a9350 | 204 | class Goodsync < Cask
version :latest
sha256 :no_check
url 'https://www.goodsync.com/download/goodsync-mac.dmg'
homepage 'http://www.goodsync.com'
license :commercial
app 'GoodSync.app'
end
| 18.545455 | 58 | 0.72549 |
abd9f882391442b5cd2a60e4d0a0cf16122f8b60 | 97 | require 'bundleup/version'
require 'bundleup/cli'
require 'bundleup/runner'
module Bundleup
end
| 13.857143 | 26 | 0.804124 |
7aebfcf4a57e428ca3e12712a72f9af548b5f659 | 88 | include Java
class A < java.TestClass
def boo?
end
end
a = A.new
a.bo#caret#o? | 9.777778 | 24 | 0.636364 |
5d4d43d6c7d045092a5b35c43c1cd17daff524b9 | 4,031 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 41.989583 | 100 | 0.758869 |
bb8538fafc87332e3736b1bc3bae211cdf218806 | 693 | require 'rails_helper'
RSpec.describe CallMeController, type: :api do
describe 'GET' do
it 'returns 200 when access to index' do
get '/call/me'
expect(last_response.status).to eq(200)
expect(json['message']).to start_with("Almost! It's not GET")
end
it 'returns 200 when access to callm... | 26.653846 | 69 | 0.655123 |
bfabfc4c2d4aa84cb76260b480fc3554007e9676 | 697 | Gem::Specification.new do |s|
s.name = 'rest_api_builder'
s.version = '0.1.0'
s.summary = "A simple wrapper for rest-client"
s.description = "A simple wrapper for rest-client aiming to make creation and testing of API clients easier."
s.authors = ["Alexey D"]
s.email = 'ord.alwo@gma... | 36.684211 | 111 | 0.64132 |
6ae087d95a3a3a52a72b041a72c4f8c08160c443 | 84 | require 'uri'
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:url => uri)
| 16.8 | 37 | 0.666667 |
1d57763a575201736a463a9c93c17ad52cfa2e8a | 2,617 | # here we define abilities for admins of providers account
Ability.define do |user|
if user && user.admin? && user.account.provider? && !user.account.master?
account = user.account
can :manage, account
# admins can actualy adjust visibility of the switch on the buyer side
account.settings.switches.... | 30.08046 | 113 | 0.676729 |
01468d52026341eb522a43ce9ec23aa35cd95011 | 37 | json.(widget, :id, :name, :position)
| 18.5 | 36 | 0.648649 |
1a4ee6b9d2de9ef310f215da5bf2b8f53f3d0e60 | 900 | 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 Hello
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specifi... | 37.5 | 82 | 0.732222 |
393bc145566a3fda138af9df6531d703671672a2 | 476 | module PanelsHelper
def will_close_at_string(panel: )
return 'unscheduled' if panel.end_datetime.blank?
panel.end_datetime.today? ? panel.end_datetime.strftime("%l:%M%P") : panel.end_datetime.strftime("%l:%M%P on %-m/%-d/%Y")
end
def will_open_at_string(panel: )
return 'unscheduled' if panel.start_da... | 39.666667 | 131 | 0.710084 |
bf712c2fd97bad9ea2e3028b0e53474d4b5d0eda | 234 | # encoding: utf-8
module NanocFuel
module Helpers
autoload "Facebook", "nanoc-fuel/helpers/facebook"
autoload "Google", "nanoc-fuel/helpers/google"
autoload "RuleTemplates", "nanoc-fuel/helpers/rule_templates"
end
end | 26 | 65 | 0.739316 |
21a08df89bc129fe62429d083bf49c3d25bb8a87 | 689 | class CreatePages < ActiveRecord::Migration[5.1]
def change
create_table :pages do |t|
t.string :behavior, default: 'pages', null: false
t.integer :parent_id
t.integer :lft
t.integer :rgt
t.integer :depth, default: 0, null: false
t.string :slug
t.stri... | 26.5 | 62 | 0.592163 |
bb88983e140376e447fbb61775c7115691e56bb4 | 2,424 | # frozen_string_literal: true
require 'spec_helper'
describe UserPreference do
let(:user_preference) { create(:user_preference) }
describe 'notes filters global keys' do
it 'contains expected values' do
expect(UserPreference::NOTES_FILTERS.keys).to match_array([:all_notes, :only_comments, :only_activit... | 27.235955 | 109 | 0.70132 |
1a7eba7f334dcea36461cf81da1d3bee27d1bb87 | 3,729 | # frozen_string_literal: true
require_relative 'util/bolt'
require_relative 'util/config'
require_relative 'util/machine'
class VagrantBolt::Runner
def initialize(env, machine, boltconfig = nil)
@env = env
@machine = machine
@boltconfig = boltconfig.nil? ? VagrantBolt::Config::Bolt.new : boltconfig
... | 41.898876 | 177 | 0.714132 |
037778f30acf35728faccd0311d2f9dda5e0faaf | 965 | # frozen_string_literal: true
module Id3Taginator
module Frames
module Url
class PaymentUrlFrame < Id3v2Frame
include HasId
frame_info nil, :WPAY, :WPAY
attr_accessor :url
# builds the payment url frame
#
# @param url [String] the url
# @param opti... | 23.536585 | 90 | 0.588601 |
b93d40bb74151198fd00538298475a779ad20cfb | 251 | require "peatio/adapter_registry"
module Peatio
module Gateway
VERSION = "1.0.0".freeze
class << self
def registry
@registry ||= Registry.new
end
end
class Registry < Peatio::AdapterRegistry
end
end
end
| 13.944444 | 44 | 0.629482 |
394b4f65fce41e5d4f27904ce97596a6b261d1f5 | 1,357 | module Dingtalk
module Api
class Sns < Base
ACCESS_TOKEN = "sns_access_token"
def initialize
@app_id = Dingtalk.sns_app_id
@app_secret = Dingtalk.sns_app_secret
end
def access_token
token = redis.get("#{redis_prefix}:#{ACCESS_TOKEN}")
token.to_s.empty? ? s... | 24.672727 | 91 | 0.61238 |
7a4ab7b0cccaa5bed704e70e1f5f8930940e24d0 | 906 | module CloudController
module Blobstore
# Central place to get download urls for a blob object stored in a blobstore
class Blob
CACHE_ATTRIBUTES = [:etag, :last_modified, :created_at]
attr_reader :file
def initialize(file, cdn)
@file = file
@cdn = cdn
end
def ... | 19.695652 | 80 | 0.593819 |
39fa527326af740337d79f6481fb3cdfea06dbaf | 7,538 | require 'rails_helper'
module Integral
module Backend
describe ListsController do
routes { Integral::Engine.routes }
let(:title) { 'foobar title' }
let(:description) { Faker::Lorem.paragraph(sentence_count: 8)[0..150] }
let(:resource_params) { { title: title, description: description } }... | 28.022305 | 96 | 0.525471 |
bb9240115b36102a17a906940d7ea21eae0c99e9 | 1,048 | =begin
#RadioManager
#RadioManager
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for RadioManagerClient::StoryRelationsTagsParams
# Automati... | 24.372093 | 103 | 0.763359 |
5d2008680f2294e2d03d8f1124b6c38dc0ca4819 | 479 | #
# Copyright (c) 2014, Christopher Aue <mail@christopheraue.net>
#
# This file is part of the ruby xlib gem. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this distribution and at
# http://github.com/christopheraue/ruby-xlib.
#
class Xlib::XRRNotifyEvent < FFI::Struct
... | 28.176471 | 79 | 0.661795 |
085c5dad6be295745ecd34cbc8a3e92e79d0d35f | 1,952 | require 'helper'
require 'yaml'
module Arel
module Nodes
describe 'sql literal' do
before do
@visitor = Visitors::ToSql.new Table.engine.connection_pool
end
describe 'sql' do
it 'makes a sql literal node' do
sql = Arel.sql 'foo'
sql.must_be_kind_of Arel::Nod... | 27.885714 | 71 | 0.566086 |
7a41afbe0f10247830bea938f4f3c0fa794108ce | 160 | require 'generators/devise/orm_helpers'
module Mongoid
module Generators
class DeviseInvitableGenerator < Rails::Generators::NamedBase
end
end
end
| 17.777778 | 65 | 0.78125 |
bf1ab1a5ed00f100dc8abd3e89bfcf9be8db695c | 2,105 | require 'spec_helper'
module Galaxy
module Invaders
RSpec.describe 'Radar integration' do
describe 'radar on using classifier_builder' do
let(:radar) { Radar.new }
context 'with radar sample 1' do
let(:enemies) { radar.lookup_enemies(sample) }
let(:sample) do
... | 27.337662 | 77 | 0.535867 |
6a53c00e3403fe3b329f4a6bb5052008a62038bc | 2,345 | module Food
class Menu
attr_reader :nombre, :descripcionp, :conjPlatos, :conjPrecios
def initialize(nombre, &block)
@nombre = nombre
@descripcionp = ""
@conjPlatos = []
@conjPrecios = []
if block_given?
if block.arity ==... | 26.954023 | 110 | 0.462687 |
ede62ba66cbcf227e6f6a0e0d4544420c7b1bd2d | 77 | require 'spec_helper'
describe AnonymousUserRegistrationsController do
end
| 12.833333 | 48 | 0.87013 |
6238458d1ca8d38103046707bf7bab4213a6b8d1 | 1,096 | module Concerns
module ErrorHandling
extend ActiveSupport::Concern
included do
rescue_from StandardError do |e|
Sentry.capture_exception(e)
args = { message: e.message }
unless Rails.env.production?
args.merge!(
detail: e.class.name.underscore.to_sym,
... | 26.731707 | 89 | 0.631387 |
330086f55befd40dc70b2bad1e43d1a887dd5417 | 822 | unless Kernel.respond_to?(:require_relative)
module Kernel
def require_relative(path)
require File.join(File.dirname(caller[0]), path.to_str)
end
end
end
require_relative 'helper'
require 'eventmachine'
include EventMachine::DNSBL
require 'pp'
class TestDNSBLClient < Minitest::Test
def run_test(i... | 21.631579 | 88 | 0.703163 |
6a595460de8b5b412d0c9a9b5f6680f5acdbd22f | 213 | class AuthUseridPassword < Authentication
def password=(val)
@auth_changed = true if val != password
super val
end
def userid=(val)
@auth_changed = true if val != userid
super val
end
end
| 17.75 | 43 | 0.676056 |
03dec6f1580e7544d2b566953c46db74e4598bbc | 236 | # Sample code from Programing Ruby, page 694
require 'pp'
Customer = Struct.new(:name, :sex, :dob, :country)
cust = Customer.new("Walter Wall", "Male", "12/25/1960", "Niue")
puts "Regular print"
p cust
puts "\nPretty print"
pp cust
| 18.153846 | 64 | 0.686441 |
62172f8b5b666ca8f3230655c956482a56f871c3 | 971 | FactoryGirl.define do
factory :raster_file, class: FileSet do
initialize_with { new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
transient do
user { FactoryGirl.create(:user) }
content nil
cartographic_projection 'urn:ogc:def:crs:EPSG::6326'
end
after(:build) do |file, evaluat... | 26.972222 | 75 | 0.653965 |
acde40ea6d90a158416e58d2a927e58212696b21 | 1,109 | require_dependency "writefully/application_controller"
module Writefully
class SessionsController < ApplicationController
def new
@github_app = Writefully.github_app
end
def create
@auth = Writefully.github_app.get_token(params[:code])
@github = Github.new oauth_token: @auth.token
... | 23.104167 | 84 | 0.682597 |
01be41cd20bfbb7a2a7d62a4bbb132fbf61985e2 | 106 | module PetfinderCliMod1
class CLI
def initialize
puts "CLI coming soon..."
end
end
end | 11.777778 | 31 | 0.650943 |
e2ff27f3bc3ccf648205e8590c75de25439b0974 | 1,093 | require File.expand_path('../boot', __FILE__)
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 Inbox
class Application < Rails::Application
# Settings in config/environments/* take precede... | 40.481481 | 99 | 0.736505 |
ff28459bafeda1b72720b35c11f25bc9bd388b6a | 247 | FactoryGirl.define do
factory :service, :class => CFoundry::V2::Service do
sequence(:guid) { |n| "service-guid-#{n}" }
transient do
client { FactoryGirl.build(:client) }
end
initialize_with { new(guid, client) }
end
end
| 22.454545 | 54 | 0.639676 |
61613c2a210faa6d2f4be4917ccf9fcc60fa4b42 | 5,214 | require "uri"
require "httpi/version"
require "httpi/logger"
require "httpi/request"
require "httpi/query_builder"
require "httpi/adapter/httpclient"
require "httpi/adapter/curb"
require "httpi/adapter/excon"
require "httpi/adapter/net_http"
require "httpi/adapter/net_http_persistent"
require "httpi/adapter/em_http"
r... | 26.738462 | 148 | 0.67127 |
f77a382d965a158bf1d3be590ad0fe303cd17790 | 1,203 | require 'spec_helper'
RSpec.describe AmazonFeedValidator::FeedValidator do
describe '#validate' do
subject { instance.validate }
describe 'clothing' do
let(:instance) { described_class.new(feed, name: 'ProductClothing') }
context 'size/color variation' do
include_context :clothing_size_... | 44.555556 | 498 | 0.66251 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.