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 |
|---|---|---|---|---|---|
aba43b599afc4e0ea6dd713822acd148dc3a94bd | 1,142 | #
# Cookbook Name:: esri-tomcat
# Recipe:: openjdk
#
# Copyright 2021 Esri
#
# 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 requir... | 33.588235 | 135 | 0.718039 |
39cae463d5c51c7cc12338e3ef651b8fe843ded9 | 866 | class SchoolVacancyPresenter < BasePresenter
include DateHelper
include ActionView::Helpers::UrlHelper
def page_views
model.total_pageviews || 0
end
# rubocop:disable Naming/AccessorMethodName
def get_more_info_clicks
model.total_get_more_info_clicks || 0
end
# rubocop:enable Naming/AccessorMe... | 18.041667 | 50 | 0.76097 |
1dd3c5c3204c6f666b77c201b44ace36bb004bdd | 2,258 | # Copyright 2011-2013 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://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 30.931507 | 81 | 0.662533 |
d57c598b5424127b05fcd810c4423f2883fc17fb | 24,872 | # -*- coding: binary -*-
module Msf
module Serializer
# This class formats information in a plain-text format that
# is meant to be displayed on a console or some other non-GUI
# medium.
class ReadableText
#Default number of characters to wrap at.
DefaultColumnWrap = 70
#Default number of characters to indent.
... | 29.399527 | 125 | 0.598102 |
871d9a6e405c169b58d4b6f525718b387b345714 | 1,832 | # encoding: UTF-8
module Sources
class Site
attr_reader :url, :strategy
delegate :get, :get_size, :referer_url, :site_name, :artist_name, :profile_url, :image_url, :tags, :artist_record, :unique_id, :page_count, :file_url, :ugoira_frame_data, :image_urls, :to => :strategy
def self.strategies
[Str... | 26.550725 | 204 | 0.633734 |
1869d3fd0bf783eab7be71bb7ca2a7f9fa0d2439 | 566 | require File.join(File.dirname(__FILE__), 'shared')
module BcmsSupport
module Cucumber
include BcmsSupport::Shared
def login_as(user)
@current_user = User.current = user
cookies[:fake_user_id] = @current_user.id
end
end
end
if defined? ApplicationController
class ApplicationCont... | 24.608696 | 74 | 0.736749 |
e88827eedfc2cc7e7db2e2cadda195ff6e915bd7 | 22,572 | # encoding: utf-8
require 'tmpdir'
require 'stringio'
require 'zip/zipfilesystem'
# Base class for all other types of spreadsheets
class Roo::Base
include Enumerable
TEMP_PREFIX = "oo_"
attr_reader :default_sheet, :headers
# sets the line with attribute names (default: 1)
attr_accessor :header_line
pr... | 27.97026 | 130 | 0.602383 |
2637d374d462c2a219b2ccc72fd160fdffef74d7 | 330 | require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
test "should get about" do
get :about
assert_response :success
end
test "should get contact" do
get :contact
assert_response :success
end
test "should get home" do
get :home
assert_response :success
... | 16.5 | 60 | 0.715152 |
e89af3133a9cb47089d4aeb93eda91a277db4194 | 1,638 | require 'time'
import 'org.apache.hadoop.hbase.client.HTable'
import 'org.apache.hadoop.hbase.client.Put'
import 'javax.xml.stream.XMLStreamConstants'
def jbytes( *args )
args.map { |arg| arg.to_s.to_java_bytes }
end
factory = javax.xml.stream.XMLInputFactory.newInstance
reader = factory.createXMLStreamReader(jav... | 34.125 | 74 | 0.622711 |
03748768b1cc0f774fe997deda64cf4ac5c48684 | 889 | {
matrix_id: '1604',
name: 'conf6_0-8x8-80',
group: 'QCD',
description: 'Quantum chromodynamics conf6.0-00l8x8-8000',
author: 'B. Medeke',
editor: 'R. Boisvert, R. Pozo, K. Remington, B. Miller, R. Lipman, R. Barrett, J. Dongarra',
date: '1999',
kind: 'theoretical/quantum chemistry probl... | 32.925926 | 123 | 0.662542 |
91687a188166ff88b762930b3fdc8f3ef91b176c | 1,474 | # require 'monkeyshines/utils/factory_module'
module Edamame
module Store
class Base
# The actual backing store; should respond to #set and #get methods
attr_accessor :db
def initialize options
end
#
# Executes block once for each element in the whole DB, in whatever order
... | 23.396825 | 79 | 0.531886 |
08e9070da07b7bcb762278c0bbd2da1938ff8e99 | 601 | class SonarCompletion < Formula
desc "Bash completion for Sonar"
homepage "https://github.com/a1dutch/sonarqube-bash-completion"
url "https://github.com/a1dutch/sonarqube-bash-completion/archive/1.1.tar.gz"
sha256 "506a592b166cff88786ae9e6215f922b8ed3617c65a4a88169211a80ef1c6b66"
license "Apache-2.0"
head "... | 33.388889 | 83 | 0.758735 |
62abf24e99a4f0201abe779187937e0b31f58e7c | 132 | class JwtBlacklist < ApplicationRecord
include Devise::JWT::RevocationStrategies::Blacklist
self.table_name = 'jwt_blacklist'
end | 26.4 | 53 | 0.825758 |
ff1905859f8154c51e9b1445920f52f8ec0e00a1 | 799 | # frozen_string_literal: true
module Yoti
module Sandbox
module DocScan
module Request
class LivenessCheck < Check
#
# @param [CheckResult] result
# @param [String] liveness_type
#
def initialize(result, liveness_type)
raise(TypeError, "... | 22.828571 | 99 | 0.556946 |
f7699f4e422fe055b900b61232903da4cc21559a | 140 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_refugees_session'
| 35 | 78 | 0.807143 |
8777d059167607495284e263ad93f66598386001 | 1,368 | module Fastlane
module Actions
class GetVersionNumberFromGitBranchAction < Action
def self.run(params)
if Helper.test?
branch = 'releases/release-1.3.5'
else
branch = Actions.git_branch
end
pattern = params[:pattern].dup
pattern["#"] = "(.*)"
... | 29.106383 | 124 | 0.516813 |
6a80b8f6057c3485b4490e01317097aa418d91c1 | 186 | # frozen_string_literal: true
desc 'Ensure PR changes are fully covered by tests'
task :undercover do |_t|
ret =
system('undercover --compare origin/main')
raise unless ret
end
| 20.666667 | 51 | 0.736559 |
1dea33a05ec8a193a9839515d8e225306be0ae04 | 1,729 | class Glew < Formula
desc "OpenGL Extension Wrangler Library"
homepage "http://glew.sourceforge.net/"
url "https://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz"
mirror "https://mirrors.kernel.org/debian/pool/main/g/glew/glew_1.13.0.orig.tar.gz"
sha256 "aa25dc48ed84b0b64b8d41cdd42c8f40f14... | 30.875 | 92 | 0.663968 |
abaf9f515ad6c36b68f26ecf4a7948ff963f98cd | 373 | class Address < ApplicationRecord
has_and_belongs_to_many :device
before_validation :ensure_has_slug
def to_s
"0x%02x" % address
end
def to_slug(string)
string.parameterize.truncate(80, omission: '')
end
def to_param
slug
end
private
def ensure_has_slug
if slug.nil? || slug.empty?... | 14.92 | 50 | 0.686327 |
87d8a48ea5cc9b3bc945087a60242529545f6ec8 | 267 | require 'spec_helper'
module BlockCypherClient
module Bitcoin
RSpec.describe BaseResponse do
it "inherits from BlockCypherClient::BaseResponse" do
expect(described_class < BlockCypherClient::BaseResponse).to be true
end
end
end
end
| 19.071429 | 76 | 0.734082 |
6a0340b96602adbf8805d6704621440a06c872cf | 2,668 | #
# Cookbook:: filesystem
# Provider:: filebacked
#
# Copyright:: 2013-2017, Alex Trull
#
# 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... | 31.023256 | 101 | 0.643553 |
ac9b4a460af6d7a43058f18c79fa6e6bce8d35af | 1,657 | # frozen_string_literal: true
require 'solidus_starter_frontend_helper'
RSpec.describe 'orders', type: :system do
let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:complete) }
let(:user) { create(:user) }
before do
order.update_attribute(:user_id, user.id)
allow_any_instance_of(Spree::Orders... | 28.568966 | 100 | 0.713941 |
284fa13aabc30911b49c0b30151b78f50288c5d8 | 1,326 | require 'rails_helper'
RSpec.describe CoUsersController, type: :controller do
let!(:user) { create :user }
let(:account) { create :account }
let(:rule) { create(:rule, spending_limit: 0.0)}
let!(:usr_acc) { create(:account_user,
user_id: user.id,
account_id: ... | 34 | 110 | 0.625189 |
2838ca4307c7db5746aa09da2f133054732afe6b | 5,056 | users_list = [
["Bob", "bob@gmail.com", "23reu"],
["Hongki","ft@island.com", "rhagfsdr"],
["Jessice","jauf@yahoo.com","dsfg"],
["Amber","kehai@hotmail.com","fsdg"],
["Roger","bewrany@aol.com","fdsg"],
["Jaebum","jpark@highergang.com","rgsafsrg"],
["Alex","ewtkfho@icloud.com","fsgs"],
["J... | 48.152381 | 265 | 0.661986 |
01381cb9e7bfc5d787520ebd7c9ae0ff437308ae | 1,599 | # Description : This plugin checks code blocks created using `or```
# in their markdown state for special characters that can cause problem in terminal.
# Authour : Reza R <54559947+frozenprocess@users.noreply.github.com>
#####
Jekyll::Hooks.register :pages, :pre_render do |post|
# do nothing if url indicates lega... | 44.416667 | 94 | 0.52783 |
1afe2b46a4602309c4c8d7c75a2c1686ed3dc661 | 261,455 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
... | 47.641217 | 945 | 0.659666 |
1af5ee54981437099d0a353be25a382d9feb3607 | 280 | class Store < ActiveRecord::Base
has_and_belongs_to_many(:brands)
validates :name, length: {minimum: 2,
too_long: "Thats too short for a store name."}
before_save(:format_input)
private
define_method(:format_input) do
self.name = self.name.capitalize()
end
end
| 23.333333 | 50 | 0.732143 |
38523bc96230c1bf1e9b06f0f6f2464b6b3bde14 | 559 | # frozen_string_literal: true
module DashboardHelper
def encoded_social_quote(my_neutral_months)
quote = I18n.t('i_have_lived_climate_neutral_for_join_me', count: my_neutral_months)
CGI.escape("#{quote} -> #{root_url}")
end
def encoded_social_quote_without_subscription_months
CGI.escape("#{t('share_... | 29.421053 | 88 | 0.799642 |
bf814a0f5e99bb92e569f324f8a98a51c570baa8 | 9,387 | require 'spec_helper'
module Bosh::Director
describe DeploymentPlan::NetworkPlanner::VipPlanner do
include IpUtil
subject(:planner) { DeploymentPlan::NetworkPlanner::VipPlanner.new(network_planner, logger) }
let(:network_planner) { DeploymentPlan::NetworkPlanner::Planner.new(logger) }
let(:deployme... | 39.441176 | 110 | 0.626292 |
5d89d46d32eea05679c012bd352f8aea82fb2590 | 4,938 | namespace :spree_roles do
namespace :permissions do
desc "Create admin username and password"
task :populate => :environment do
admin = Spree::Role.where(name: 'admin').first_or_create!
user = Spree::Role.where(name: 'user').first_or_create!
user.is_default = true
user.save!
per... | 62.506329 | 120 | 0.640138 |
acc348c7598f34efc7929c0fadfc3213f5cc3d3f | 465 | # frozen_string_literal: true
module GlobalConstant
class Google
class << self
def usage_report_spreadsheet_id
config[:usage_report_spreadsheet_id]
end
def private_key
config[:private_key]
end
def client_email
config[:client_email]
end
def pr... | 14.090909 | 44 | 0.612903 |
7afc924420b5eb1315e071a36fbd375a25937e66 | 490 | class PassthroughController < ApplicationController
after_action :skip_authorization
def index
if first_permitted_format
redirect_to documents_path(document_type_slug: first_permitted_format.slug)
else
redirect_to error_path
end
end
def error; end
private
def first_permitted_format... | 22.272727 | 88 | 0.769388 |
bbb495e4b6ba000e9afc63e48fb8b5cbdfee775a | 2,810 | # -*- coding: utf-8 -*-
require 'gtk2'
module Plugin::ListForProfile
class ProfileTab < ::Gtk::ListList
include Gtk::TreeViewPrettyScroll
MEMBER = 0
NAME = 1
LIST = 2
SERVICE = 3
def initialize(plugin, dest)
type_strict plugin => Plugin, dest => User
@plugin = plugin
@des... | 36.493506 | 118 | 0.574377 |
397885806c4bd69309fa7126ba53d50c381f84e6 | 76,368 | # coding: utf-8
require 'rdoc/test_case'
class TestRDocParserRuby < RDoc::TestCase
def setup
super
@tempfile = Tempfile.new self.class.name
@filename = @tempfile.path
# Some tests need two paths.
@tempfile2 = Tempfile.new self.class.name
@filename2 = @tempfile2.path
@top_level = @sto... | 23.064935 | 98 | 0.679683 |
79422f024097c1777cbc72efc8f23078e87becc1 | 3,941 | #
# Cookbook Name:: jenkins
# HWRP:: credentials_password
#
# Author:: Seth Chisamore <schisamo@chef.io>
#
# Copyright 2013-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 Lice... | 28.766423 | 166 | 0.692718 |
38dece6c426d37b6ddf759cc84bfebca2621e54c | 1,515 | require 'spec_helper'
describe Spree::Promotion::Rules::UserIsNotReferred, type: :model do
let(:rule) { described_class.new }
describe 'applicability' do
subject { rule.applicable?(promotable) }
context "when the promotable is an order" do
let(:promotable) { Spree::Order.new }
it { is_expect... | 25.25 | 69 | 0.626403 |
5d9db1056af0f91fa21365c257bee2294579adb9 | 3,043 | # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 35.8 | 143 | 0.754847 |
bbc5b7195f7ea055130385d52c3d1cb9c0cf90bd | 464 | require 'bundler/setup'
require './lib/die'
require './lib/cup'
require './lib/scorecard'
require './lib/player'
require 'rspec'
require 'pry'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing... | 23.2 | 66 | 0.737069 |
1127dbd8b64ecac21256a31b2c40cb8b1533c792 | 250 | # frozen_string_literal: true
# @see SubRequest
class SubRequestDecorator < Draper::Decorator
delegate_all
# @return [String] e.g. '4pm'
def time
at.strftime '%l%P'
end
def html_class
'highlight' if needs_sub_in_group?
end
end
| 15.625 | 45 | 0.704 |
d5f03fdf4bbc451e3acfe0a2b09afb90c7ae679a | 202 | class Bee < Cask
url 'http://neat.io/bee/download.html'
appcast 'http://neat.io/appcasts/bee-appcast.xml'
homepage 'http://neat.io/bee/'
version 'latest'
sha256 :no_check
link 'Bee.app'
end
| 22.444444 | 51 | 0.688119 |
26ccba5ee3a2d8b9bac05fa2eaac681f58e866c5 | 952 | #
# Cookbook Name:: percona
# Recipe:: replication
#
require 'shellwords'
passwords = EncryptedPasswords.new(node, node['percona']['encrypted_data_bag'])
server = node['percona']['server']
replication_sql = server['replication']['replication_sql']
# define access grants
template replication_sql do
source 'replicat... | 28 | 113 | 0.733193 |
3389f24839bc40a45e7eaabb3a353b0c9fbb0696 | 4,216 | RSpec.describe ResourceSharer do
before { allow(User).to receive_messages(:server_timezone => "UTC") }
describe "#share" do
subject do
described_class.new(:user => user,
:resource => resource_to_be_shared,
:tenants => tenants,
... | 34.842975 | 119 | 0.610294 |
e903f1b34f6bedd8a13b4d40c8536d8590ea87ab | 557 | module Admin::OverviewHelper
def render_events(events, later = false)
text = []
if events.any?
events.each_with_index { |evt, i| text << render(:partial => "#{evt.mode}_event", :locals => { :event => evt, :shaded => (i % 2 > 0), :later => later }) }
else
text << %(<li class="event-none shade">... | 34.8125 | 160 | 0.614004 |
f834c0538a9e6009c358774dc880a61bd6f45b18 | 198 | class UserDecorator < Draper::Decorator
include Draper::LazyHelpers
delegate_all
alias user object
def name
return "You" if user == current_user
user.name || user.email
end
end
| 15.230769 | 40 | 0.712121 |
1ab394111fb24d2cc2c70fabffc29a9ccaa11f0e | 8,626 | TAP_MIGRATIONS = {
"adobe-air-sdk" => "homebrew/binary",
"afuse" => "homebrew/fuse",
"aimage" => "homebrew/boneyard",
"aplus" => "homebrew/boneyard",
"apple-gcc42" => "homebrew/dupes",
"appswitch" => "homebrew/binary",
"archivemount" => "homebrew/fuse",
"arpon" => "homebrew/boneyard",
"asm6" => "homeb... | 33.434109 | 53 | 0.608161 |
1af0b664ef8ce65aa094f9dd6be19c6b65153686 | 2,429 | # frozen_string_literal: true
RSpec.describe GraphQL::AnyCable do
subject do
AnycableSchema.execute(
query: query,
context: { channel: channel, subscription_id: subscription_id },
variables: {},
operation_name: "SomeSubscription",
)
end
let(:query) do
<<~GRAPHQL
subscri... | 28.244186 | 118 | 0.664059 |
182946e14997147fa1db32b830b897a25a871557 | 380 | require "nutrella/board_name_resolver"
require "nutrella/cache"
require "nutrella/command"
require "nutrella/configuration"
require "nutrella/developer_keys"
require "nutrella/task_board"
require "nutrella/task_board_name"
require "nutrella/version"
#
# A command line tool for associating a Trello board with the curre... | 23.75 | 81 | 0.818421 |
bfc56ce45a69abf084d89b4b0782d974691a3f26 | 839 | module MoneyExample
class Money
attr_reader :amount, :currency
def initialize(amount, currency)
@amount = amount
@currency = currency
end
def equals?(another)
(self.amount == another.amount) && self.currency == (another.currency)
end
def times(multiplier)
MoneyExampl... | 21.512821 | 76 | 0.644815 |
188033fb5179871f580457ab2d743d7b60d7ebce | 2,348 | shared_examples "a checksum implementation:" do |success_spec_matrix, fail_spec_matrix|
describe "of" do
success_spec_matrix.each do |spec_item|
it "calculates checksum: #{spec_item[0]} => #{spec_item[1]}" do
expect(described_class.of(spec_item[0])).to eq(spec_item[1])
end
end
fail_s... | 36.123077 | 106 | 0.685264 |
ffe7be657e38348663a841e9f6f1493d6ad70e45 | 2,379 | # frozen_string_literal: true
require "json"
module Split
module Persistence
class CookieAdapter
def initialize(context)
@context = context
@request, @response = context.request, context.response
@cookies = @request.cookies
@expires = Time.now + cookie_length_config
e... | 25.042105 | 78 | 0.57377 |
1d4399f689dfee514aad3183bf5f4731fc140924 | 3,836 | require "spec_helper"
describe Mongoid::Relations::CounterCache do
describe '#reset_counters' do
context 'when counter is reset' do
let(:person) do
Person.create do |person|
person[:drugs_count] = 3
end
end
before do
Person.reset_counters person.id, :drugs
... | 20.513369 | 82 | 0.592544 |
385b04babcfa66dc5ca5d5d2b039aa49b03449bd | 20,093 | # frozen-string-literal: true
#
# The constraint_validations extension is designed to easily create database
# constraints inside create_table and alter_table blocks. It also adds
# relevant metadata about the constraints to a separate table, which the
# constraint_validations model plugin uses to setup automatic vali... | 41.343621 | 266 | 0.678047 |
8798f3c202bca9653e6cf9636d9593301f2bbceb | 325 | require "action_view"
require "action_controller"
require "deface/template_helper"
require "deface/original_validator"
require "deface/applicator"
require "deface/search"
require "deface/override"
require "deface/parser"
require "deface/environment"
module Deface
if defined?(Rails)
require "deface/railtie"
end... | 20.3125 | 35 | 0.796923 |
f72db972038c7bb6a8ae8eda39795015857a58c0 | 129 | class AddHandicapTypeToTeam < ActiveRecord::Migration[5.0]
def change
add_column :teams, :handicap_type, :string
end
end
| 21.5 | 58 | 0.75969 |
28bdf5faf37e5adca05504915677556ffde3fb51 | 21,060 | # frozen_string_literal: true
Doorkeeper.configure do
# Change the ORM that doorkeeper will use (requires ORM extensions installed).
# Check the list of supported ORMs here: https://github.com/doorkeeper-gem/doorkeeper#orms
orm :active_record
# This block will be called to check whether the resource owner is ... | 42.804878 | 109 | 0.738984 |
26d5f67e0d78febc244734f8b4b6a4bcf957496a | 3,981 | #!/usr/bin/env ruby
# Encoding: UTF-8
################################################################################
# Attempt to perform the 'determinePatterns' function from 'rooms.js'
# to determine what room map patterns can be applied to this dungeon.
# This is smaller in scope, however. We don't need to know w... | 32.900826 | 80 | 0.557146 |
bfbab01e43a71ca6f30b7547a8d359b16dccd5e2 | 1,177 | # frozen_string_literal: true
module AcaEntities
# individual market class
class AcaIndividualMarket < Dry::Struct
# Marketplaces
# People
# PersonName (add time period)
# Roles
# ConsumerRole (employee)
# MemberRole (employee)
# Organizations
# Profiles (roles)
# ... | 21.017857 | 42 | 0.609176 |
798d591726cc73a2783e84361b547c1d00784060 | 304 | class CreateCriteriaReviews < ActiveRecord::Migration[5.2]
def change
create_table :criteria_reviews do |t|
t.references :criterion, foreign_key: true
t.references :review, foreign_key: true
t.integer :score
t.text :comment
t.timestamps
end
end
end
| 23.384615 | 58 | 0.661184 |
87f957b8a51500b65c244daae26ca6e9a8f6e11e | 608 | module LogRunes
class LoggerFactory
def self.set(config, opts)
if Rails.env.development? || Rails.env.test?
# Use a stdout logger to avoid piling up a mostly useless giant log file
stdout_logger = ActiveSupport::Logger.new(STDOUT)
config.logger = ActiveSupport::TaggedLogging.new(stdout_logger)... | 25.333333 | 79 | 0.674342 |
619c7f082d4a041ccc79894d9630bfabbad119a8 | 907 | module YmPermalinks::Permalinkable
def self.included(base)
base.has_many :permalinks, :as => :resource, :autosave => true, :dependent => :destroy
base.has_one :permalink, :as => :resource, :conditions => {:active => true}, :autosave => true
base.before_validation :set_permalink_path
base.after_validat... | 28.34375 | 98 | 0.713341 |
1de7096666c604e60ceca4c620b0a34d2b5f8ea5 | 3,121 | RSpec.describe RVNC do
describe '.variables' do
it 'node_cvasgn' do
variables = RVNC.variables(File.expand_path('examples/node_cdecl.rb', __dir__))
expect(variables).to eq(
[
{ name: 'FOO', location: 'spec/examples/node_cdecl.rb:1' },
{ name: 'BAR', location: 'spec/examples... | 36.290698 | 90 | 0.57033 |
0133e399b42fd3d7e3a1c918c42e74d748753a8f | 1,766 | #
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require "thrift"
module Prey
module Thrift
module Status
NOT_CONFIGURED = 0
QUIESCENT = 1
READ_ONLY = 2
UP = 3
VALUE_MAP = {0 => "NOT_CONFIGURED", 1 => "QUIESCENT", 2... | 26.358209 | 114 | 0.556625 |
6a94f1812e7a90b60f93e8789cb168defa344514 | 1,709 | #!/usr/bin/env rspec
# frozen_string_literal: true
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrict... | 38.840909 | 89 | 0.760679 |
0125a9e3de5aabef2c45dfd2b4823fa3608b4893 | 1,624 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 37.767442 | 132 | 0.759236 |
ac99cd7ee36920e4f996f786328c117e636ce856 | 542 | #
# test_vmio.rb
#
# Copyright (c) 2011 by Daniel Kelley
#
# $Id:$
#
require 'test/unit'
require 'gmpforth'
require 'gmpforth/cli'
require 'noredef'
require 'vmio'
class TestVMIO < Test::Unit::TestCase
def setup
@vc = GMPForth::VMCompiler.new GMPForth::CLI::sysopt
# make addr 0-3 illegal
4.times {... | 16.9375 | 56 | 0.630996 |
33275f3bc59df25ea606a6b4cbbf20c69cf23751 | 652 | ones = [''] +
%w(one two three four five six seven eight nine) +
%w(ten eleven twelve thirteen fourteen fifteen) +
%w(sixteen seventeen eighteen nineteen)
tens = ['',''] + %w(twenty thirty forty fifty sixty seventy eighty ninety)
sum = 0
(1..1000).each do |i|
if i >= 1000
sum += ones[i/1000].length
sum... | 23.285714 | 74 | 0.588957 |
87a34e29bd504d845597fafcaeb4087478ccc280 | 658 | cask '1password-cli' do
version '0.2.1'
sha256 'fd15c2c0e429623e3d0bff17f7f94867cd5d8b55d10f69076c2ec277da755d77'
# cache.agilebits.com/dist/1P/op/pkg was verified as official when first introduced to the cask
url "https://cache.agilebits.com/dist/1P/op/pkg/v#{version}/op_darwin_amd64_v#{version}.zip"
appcas... | 38.705882 | 97 | 0.761398 |
5d5171b358c54907c13e105d4c2ab747cce19671 | 1,137 | require "discorb"
require "json"
client = Discorb::Client.new
client.once :standby do
puts "Logged in as #{client.user}"
end
def bookmark_channel(guild)
guild.channels.find { |c| c.is_a?(Discorb::TextChannel) && c.name == "bookmarks" }
end
def build_embed_from_message(message)
embed = Discorb::Embed.new
emb... | 27.071429 | 106 | 0.741425 |
21b824eba924cad11be78609401d14b51cb9a6a4 | 6,738 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/test_ca'
require 'puppet/certificate_factory'
describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
let :serial do OpenSSL::BN.new('12') end
let :name do "example.local" end
let :x509_name do OpenSSL::X509::Name.new([['CN', ... | 38.947977 | 104 | 0.638765 |
bf67344b1ea1e0cfb62a65b9a71fdf6cfa18307c | 1,635 | require 'test_helper'
class FollowingTest < ActionDispatch::IntegrationTest
def setup
@user = users(:jared)
@other_user = users(:archer)
log_in_as(@user)
end
test "following page" do
get following_user_path(@user)
assert_not @user.following.empty?
assert_match @user.following.count.to_s,... | 29.196429 | 82 | 0.708869 |
e2a2b89841b233356dc764bd2a29f4870c43c3b6 | 126 | FactoryBot.define do
factory :user do
sequence(:email) { |n| "test#{n}@email.com" }
password 'Password1!'
end
end
| 18 | 49 | 0.642857 |
0855fe38b50ace1b89226162f8b9b96862b37e60 | 8,287 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe 'validate_length_of' do
include ModelBuilder
# Defines a model, create a validation and returns a raw matcher
def define_and_validate(options={})
options = options.merge(:within => 3..5) if options.slice(:in, :within, :maximum, :m... | 42.280612 | 136 | 0.658019 |
e8b4c3f660b73fc98cb3f5be141c638770aee61c | 544 | # frozen_string_literal: true
require 'thor'
module Yomou
module Commands
class Clean < Thor
namespace :clean
desc 'novel [TYPE]', 'Command description...'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
def novel(type=ni... | 21.76 | 66 | 0.579044 |
182e38e0f01abfcc70001308c9bc90ad32d8c384 | 2,800 | RSpec.shared_examples 'required chart parameters' do
it 'requires country_id' do
get url, params: filter_params.except(:country_id)
expect(@response).to have_http_status(:bad_request)
expect(JSON.parse(@response.body)).to eq(
'error' => 'param is missing or the value is empty: Required param country... | 40.57971 | 99 | 0.716071 |
bb6dcc23f03801c12b38c8ba7621587319082270 | 489 | cask 'marker-import' do
version '2.1.5.0'
sha256 '4e38726e733bc0ad57bf38a4a44d4fe0d18ab665043f8a2baaa1d26391e4035e'
# digitalrebellion.com was verified as official when first introduced to the cask
url "http://www.digitalrebellion.com/download/markerimport?version=#{version.no_dots}"
name 'Kollaborate Marker... | 34.928571 | 88 | 0.789366 |
620031275cfd470744cd33ce09f91dd4a75461f7 | 918 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/sms_my_bus/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Matt Gauger", "Jaymes Waters", "Ashe Dryden"]
gem.email = ["matt.gauger@gmail.com", "jaymes@bendyworks.com", "ashedryden@gmail.com"]
gem.description = %q{A gem... | 41.727273 | 96 | 0.650327 |
1d77cfc6da1e9eb0cbb3044054103c9551acb697 | 1,040 | #!/usr/bin/env rackup
# frozen_string_literal: true
require_relative 'config/environment'
self.freeze_app
if UTOPIA.production?
# Handle exceptions in production with a error page and send an email notification:
use Utopia::Exceptions::Handler
use Utopia::Exceptions::Mailer
else
# We want to propate exceptions u... | 20.8 | 84 | 0.735577 |
03b49264acd33c13f42881a57b7ebe712782c33f | 2,203 | module Bot
module Commands
# command kicks a user from the server, requires user to have "kick members" permission
module Ban
extend Discordrb::Commands::CommandContainer
command :ban do |event, *args|
if event.user.permission?(:ban_members) && Bot::JADE.profile.on(event.server).permission... | 43.196078 | 157 | 0.575125 |
797517bf084b1ad9a3c1d80f3d34c409a7be6702 | 8,146 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_eSign
... | 28.989324 | 145 | 0.616744 |
267cca35723d21c007702f56abbb28b91ac369b2 | 249 | # frozen_string_literal: true
module Lightning
module Exceptions
class CannotSignWithoutChanges < StandardError
attr_accessor :commitments
def initialize(commitments)
@commitments = commitments
end
end
end
end
| 19.153846 | 50 | 0.722892 |
0815a8850adace81012e22802a4966d2d9517fac | 482 | require "attractor/ruby/version"
require "attractor"
require "attractor/registry_entry"
require "attractor/calculators/base_calculator"
require "attractor/calculators/ruby_calculator"
require "attractor/detectors/base_detector"
require "attractor/detectors/ruby_detector"
module Attractor
module Ruby
class Error... | 28.352941 | 128 | 0.817427 |
87e704def9102ee07c41d2849e8213358ce28182 | 369 | require "bundler/setup"
require "all_companies"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_wit... | 24.6 | 66 | 0.756098 |
38618e2126cae151b2227675c36805df7c6b4677 | 2,550 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ApiManagement::Mgmt::V2016_07_07
module Models
#
# Configuration of a virtual network to which API Management service is
# deployed.
#
cla... | 30 | 134 | 0.535294 |
1a9f2b24be401ae60e5a0502149ca92f1d66d374 | 1,868 | class ThinkingSphinx::Context
attr_reader :indexed_models
def initialize(*models)
@indexed_models = []
end
def prepare
ThinkingSphinx::Configuration.instance.indexed_models.each do |model|
add_indexed_model model
end
return unless indexed_models.empty?
load_models
add_indexed_m... | 25.243243 | 79 | 0.669165 |
1defaa0ef9ac302bc25753fc140e16a76716c165 | 184 | #!/usr/bin/env ruby
require 'cgi'
require './lotos/core.rb'
require './lotos/view.rb'
require './lotos/logic.rb'
module Lotos
def self.run
app = Lotos::App.new
end
end
| 10.823529 | 26 | 0.646739 |
01527541a6172c5257272f5f21bc499f611efe17 | 3,326 | require 'json'
module Databasedotcom
module Chatter
# Parent class of all feeds and inherits from Collection. This class is not intended to be instantiated. Methods should be called on subclasses, which are all are dynamically defined (except for FilterFeed). Defined feeds are *NewsFeed*, *UserProfileFeed*, *Rec... | 51.96875 | 358 | 0.646723 |
abd39fa302e98290a391885f6bfdf6503efe00d6 | 1,576 | module Bot::DiscordCommands
module Info
extend Discordrb::Commands::CommandContainer
command(:info) do |event|
event.channel.send_embed do |embed|
embed.colour = 0xff8040
embed.add_field name: "**Information**", value: " **Name** : CodeMonkey Games \n **Version** : 1.5 \n **Developer** : [@pdeba... | 63.04 | 560 | 0.668782 |
4a52ae8a24b497ba08188d4c72ee20c6f5886a72 | 1,725 |
Pod::Spec.new do |s|
s.name = "AFNetworkingTask"
s.version = "1.2.2"
s.summary = "AFNetworking Sample Task....."
s.homepage = "https://github.com/junhaiyang/AFNetworkingTask"
s.license = "MIT"
s.author = { "yangjunhai" => "junhaiyang@gmail.com" }
s.ios.d... | 24.295775 | 95 | 0.608116 |
1cebf97301a1f85689d2cb6a47dbb9554d7306dc | 390 | name "homebrew"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Install Homebrew and use it as your package provider in Mac OS X"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.2.0"
recipe... | 39 | 83 | 0.658974 |
39cc9ed2fa14d5a76aed4b14ee4d073bb7a6ca8d | 636 | Pod::Spec.new do |s|
s.name = 'NanoStore'
s.version = '2.1.4'
s.license = 'BSD'
s.summary = 'NanoStore is an open source, lightweight schema-less local key-value document store written in Objective-C for Mac OS X and iOS.'
s.homepage = 'https://github.com/tciuro/NanoStore'
s.... | 45.428571 | 150 | 0.597484 |
1d0b359143900f937853578efe70bab5aad6f496 | 1,043 | # This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") #nf patching generated spec_helper
#require File.dirname(__FILE__) + "/../config/environment" unless define... | 35.965517 | 110 | 0.73442 |
016a6d06165415fc71ede5bd1e34d944c3b3b68e | 5,990 | require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
require 'rubygems/commands/sources_command'
class TestGemCommandsSourcesCommand < RubyGemTestCase
def setup
super
@cmd = Gem::Commands::SourcesCommand.new
@new_repo = "http://beta-gems.example.com"
end
def test_execute
... | 21.781818 | 75 | 0.673289 |
ed9fe9479451415632d22b96f5f8602fd0216a06 | 55 | class Api::BaseController < ActionController::Base
end
| 18.333333 | 50 | 0.818182 |
d5ce82c902dcf4c49d0d83842323cfeece158eff | 12,251 | # frozen_string_literal: true
module Alchemy
module Admin
class PagesController < Alchemy::Admin::BaseController
include OnPageLayout::CallbacksRunner
helper "alchemy/pages"
before_action :load_page, except: [:index, :flush, :new, :order, :create, :copy_language_tree, :link, :sort]
aut... | 33.110811 | 137 | 0.61897 |
e98fa50cb1b8865db8d1a493996b8ce9b71c3b06 | 86 | # desc "Explaining what the task does"
# task :dynasore do
# # Task goes here
# end
| 17.2 | 38 | 0.674419 |
d5d8d0a3f39a25f470351f42845fc62b73bd0482 | 3,475 | #
# Copyright:: 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
#
# Unless required by applicable law or agreed to in wri... | 38.186813 | 129 | 0.746187 |
b98b988ffbead1bd5482c1a8c1a147832c3833a9 | 1,360 | class Ht < Formula
desc "Viewer/editor/analyzer for executables"
homepage "https://hte.sourceforge.io/"
url "https://downloads.sourceforge.net/project/hte/ht-source/ht-2.1.0.tar.bz2"
sha256 "31f5e8e2ca7f85d40bb18ef518bf1a105a6f602918a0755bc649f3f407b75d70"
license "GPL-2.0"
livecheck do
url :stable
e... | 32.380952 | 93 | 0.708824 |
189a94232655e4a87296482e996e969daf893be8 | 215 | require 'helper'
class UserStoreTest < Test::Unit::TestCase
context "A UserStore" do
should "know its version" do
store = CloudKit::UserStore.new
assert_equal 1, store.version
end
end
end
| 16.538462 | 42 | 0.683721 |
620697a8dc60c556f707f7e0faacfeac383c31d0 | 603 | class PostsController < ApplicationController
before_action :authenticate_user!
def index
@post = Post.new
timeline_posts
end
def create
@post = current_user.posts.new(post_params)
if @post.save
redirect_to posts_path, notice: 'Post was successfully created.'
else
timeline_pos... | 19.451613 | 77 | 0.706468 |
18bd28a166e558206573f7da0c15f61de612083c | 4,305 | # Patches for Qt must be at the very least submitted to Qt's Gerrit codereview
# rather than their bug-report Jira. The latter is rarely reviewed by Qt.
class Qt < Formula
desc "Cross-platform application and UI framework"
homepage "https://www.qt.io/"
url "https://download.qt.io/official_releases/qt/5.13/5.13.1/... | 31.654412 | 103 | 0.670151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.