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 |
|---|---|---|---|---|---|
e2747bef7d79892746a0b3caf1ee4cba7bca4f86 | 41 | module RailsHush
VERSION = '1.0.2'
end
| 10.25 | 19 | 0.682927 |
623e3f11a5d3822cfbbb00e4efb464da281e3a48 | 1,064 | #!/usr/bin/env ruby
require 'ipaddr'
module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module Net
###
#
# Represents a logical network route.
#
###
class Route
##
#
# Constructor
#
##
#
# Initializes a route instance.
#
def initialize(subnet, netmask, gateway, interface='', metric=... | 15.647059 | 87 | 0.700188 |
62e6fe2901c49b565578ad9ec90698b34b1c09fd | 398 | require 'spec_helper'
describe 'postgresql::pg_hba', :type => :define do
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'Debian',
:concat_basedir => tmpfilename('pg_hba'),
}
end
let :title do
'test'
end
let :params do
{
:target => tmpfilename('pg_hba_... | 18.952381 | 51 | 0.600503 |
18b2e5aed6a9118eddc8a24f3b5bfdbf2f662383 | 2,810 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | 44.603175 | 100 | 0.734875 |
38d4362190611b42789859bef94737c8db622b74 | 144 | class Apartment < ApplicationRecord
belongs_to :neighborhood
has_many :images, dependent: :destroy
validates :title, uniqueness: true
end
| 24 | 39 | 0.791667 |
39eb331bb37ac693836399876e48af72348ff87c | 617 | class RemoveBaseCurrencyFromCurrencyConversionRates < DbMigrationConnection
def up
run_migration_for_db(DbConnection::KitSaasSubenv) do
remove_index :currency_conversion_rates, name: 'cuk_1'
remove_column :currency_conversion_rates, :base_currency
end
end
def down
run_migration_for_db(DbC... | 38.5625 | 138 | 0.769854 |
e894652b021e4094dc48523c377fe4b2f51dfc18 | 5,838 | require "sensu/extensions/alert_once"
require "sensu/logger"
require 'webmock/rspec'
require File.join(File.dirname(__FILE__), "helpers")
describe "Sensu::Extension::Alertonce" do
include Helpers
before do
@extension = Sensu::Extension::Alertonce.new
@extension.settings = Hash.new
@extension.settings[... | 34.544379 | 162 | 0.639089 |
bb3f255b368164dcf823f86992e047102fc1d402 | 413 | module WorkingMan
class Actions
def self.close_applications apps
apps.each do |app_name|
`osascript -e "tell application \\"#{app_name}\\" to quit"`
end
end
def self.launch_applications apps
apps.each do |app_name|
`open -a "#{app_name}.app"`
end
end
def s... | 19.666667 | 67 | 0.585956 |
f7b22a6f0fd83b8e3bec3fa71f140c39b3fe2783 | 1,429 | # Make notifications to be based on inline resources
use_inline_resources
action :install do
template "#{new_resource.base_dir}/models/#{new_resource.name}.rb" do
mode "600"
source "model.rb.erb"
cookbook "backup"
variables({
:name => new_resource.name,
:description => new_resource.descri... | 28.019608 | 114 | 0.690693 |
214e1a3facce4e0c738951dfea6904b9aa1c7f3d | 265 | class Serializers
class SymbolSerializer < ObjectSerializer
def serialize(argument)
super("value" => argument.to_s)
end
def deserialize(argument)
argument["value"].to_sym
end
private
def klass
Symbol
end
end
end
| 14.722222 | 43 | 0.649057 |
f71f7241864b0c2ffca7aff78532c862c45a8052 | 3,519 | require_relative '../spec_helper'
describe CtGov::Location do
let(:raw_location) { Saxerator.parser(
'<location>
<facility>
<name>National Institutes of Health Clinical Center, 9000 Rockville Pike</name>
<address>
<city>Bethesda</city>
<state>Maryland</state>
... | 28.379032 | 139 | 0.627167 |
08722dcb9580a69002ce8946cbee0ed50ca0fb12 | 5,125 | # frozen_string_literal: true
require 'splunk-sdk-ruby'
require 'yaml'
require_relative 'erb_with_binding'
# Base class for syncing splunk objects (dashboards, alerts, etc...)
module Splunk
module Pickaxe
class Objects
attr_reader :service, :environment, :pickaxe_config
def initialize(service, envi... | 27.260638 | 113 | 0.58439 |
03fb97b0fce73b262896b0f9e9875a7b440043ab | 761 | # frozen_string_literal: true
json.settings @email_settings do |email_setting|
if (@course_user.phantom && email_setting.phantom) || (!@course_user.phantom && email_setting.regular)
json.component email_setting.component
json.component_title email_setting.title
json.course_assessment_category_id email_set... | 42.277778 | 104 | 0.821288 |
87290086eff7a517317aa0757606aa7ce240eec4 | 72 | class Current
def self.menu *name
Buffers.current *name
end
end
| 12 | 25 | 0.708333 |
6108ce87bfa70323eb744cf5090cca7b8d1b209c | 5,031 | # frozen_string_literal: true
require 'nokogiri'
require 'saml2/base'
require 'saml2/identity_provider'
require 'saml2/organization_and_contacts'
require 'saml2/service_provider'
require 'saml2/signable'
module SAML2
class Entity < Base
include OrganizationAndContacts
include Signable
# @return [Strin... | 27.194595 | 93 | 0.595707 |
2170bc1892c853a1315cc91f276dd0bb577326df | 957 | # frozen_string_literal: true
require_relative "lib/ruby_event_store/sidekiq_scheduler/version"
Gem::Specification.new do |spec|
spec.name = "ruby_event_store-sidekiq_scheduler"
spec.version = RubyEventStore::SidekiqScheduler::VERSION
spec.license = "MIT"
spec.author = ... | 35.444444 | 87 | 0.657262 |
115da0f50980559ccd1e70e7f5b5ea10604b363f | 562 | require 'spec_helper'
describe NotificationService::PushoverService do
it "it should send a notification to Pushover" do
# setup
notice = Fabricate :notice
notification_service = Fabricate :pushover_notification_service, :app => notice.app
problem = notice.problem
# hoi stubbing
notification... | 28.1 | 87 | 0.743772 |
e8f9e271d00123caf488382f71b2146969925a97 | 164 | class PagesController < ApplicationController
def index
p params[:controller]
end
def residential
end
def corporative
end
end
| 13.666667 | 45 | 0.646341 |
f848021ca3a843e155326236680efb962b8f757e | 2,413 | # Copyright 2018 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 applicable law or agreed to in writing, ... | 35.485294 | 102 | 0.665562 |
62e0d319b6aa315a63e624c584d83db315a83d60 | 2,517 | # Encoding: utf-8
require 'spec_helper'
AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cassandra.d/conf.yaml')
describe service(@agent_service_name) do
it { should be_running }
end
describe file(AGENT_CONFIG) do
it { should be_a_file }
it 'is valid yaml matching input values' do
generated = YAML.loa... | 25.424242 | 75 | 0.466826 |
5dd0125c89be1dde3db5cae2967556cb30f8b270 | 1,678 | class Driftctl < Formula
desc "Detect, track and alert on infrastructure drift"
homepage "https://driftctl.com"
url "https://github.com/cloudskiff/driftctl/archive/v0.9.1.tar.gz"
sha256 "6fa24042e1984ff34dfef9bceda3d9f4a342e1a2ac28c00b2033c99622e040c6"
license "Apache-2.0"
bottle do
sha256 cellar: :any... | 39.023256 | 122 | 0.735399 |
3888ecde724eb21a4c9648f5697ca317af1123fc | 410 | # Be sure to restart your server when you modify this file.
Habits::Application.config.session_store :cookie_store, key: '_habits_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails gen... | 45.555556 | 78 | 0.809756 |
91e5b9c1ce2c08acd370303d1936c96b34585ced | 3,027 | # encoding: utf-8
require "logstash/inputs/base"
require "logstash/namespace"
require "nats/client"
# .Compatibility Note
# [NOTE]
# ================================================================================
# This plugin does not support SSL authentication yet
#
# ===============================================... | 29.676471 | 103 | 0.629006 |
bb672001ddb7c9cee8ae632045c9dc8e2c63b07b | 462 | # NOTE: The middleware is called before Threescale::Middleware::DevDomain
# So we only have the original host in request that is good
if Rails.application.config.force_ssl
apicast_regexp = Regexp.compile(Rails.configuration.three_scale.apicast_internal_host_regexp.presence || '\A(?!.*)\Z'.freeze)
internal_request ... | 51.333333 | 127 | 0.777056 |
e97826c31089a710f5966a984308676777ad7018 | 574 | class AddTimingTypeToSeasons < ActiveRecord::Migration
def change
# ----------------- SEASONS -----------------------------------------------
change_table(:seasons) do |t|
t.references :timing_type
end
execute <<-SQL
ALTER TABLE seasons
ADD CONSTRAINT fk_seasons_timing_types
... | 26.090909 | 79 | 0.534843 |
1a0b77b5858a8d620668149e1a4db6228acc94b8 | 9,844 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 42.9869 | 255 | 0.699208 |
6a8457c41f3d08bc553ccea248211ffd8ec00958 | 449 | Gem::Specification.new do |s|
s.name = 'mooncal'
s.version = '0.1.1'
s.summary = "Moon Phases!"
s.description = "Print a moon phase calendar to your terminal!"
s.authors = ["Nikolai Kozak"]
s.email = "nikokozak@gmail.com"
s.executables << "moon"
s.files = ["lib/moon_calc.rb", "lib/moon_date.rb", "lib/mo... | 29.933333 | 67 | 0.652561 |
1d2c5522b7e91122803f5f1c5a079f03c5efc1b3 | 9,369 | require 'active_record/connection_adapters/postgresql_adapter'
require "active_record/connection_adapters/cockroachdb/schema_statements"
require "active_record/connection_adapters/cockroachdb/referential_integrity"
require "active_record/connection_adapters/cockroachdb/transaction_manager"
require "active_record/connec... | 37.031621 | 120 | 0.623439 |
ac28efeb3d76813aaa9cc246eb0e6004c80b3e11 | 28,976 | # frozen_string_literal: true
require 'bolt/applicator'
require 'bolt/executor'
require 'bolt/error'
require 'bolt/plan_result'
require 'bolt/util'
require 'bolt/config/modulepath'
require 'etc'
module Bolt
class PAL
# PALError is used to convert errors from executing puppet code into
# Bolt::Errors
cla... | 37.533679 | 118 | 0.622446 |
3331bf1ea70d4deab28bd2735157b6f3f5be556a | 1,226 | require 'forwardable'
module Abid
module DSL
# Common interface for RakeJob and AbidJob
class Job
extend Forwardable
def self.interface(name, args = [])
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}(#{args.join(', ')})
raise NotImplementedError
end
... | 20.779661 | 57 | 0.593801 |
18e3ac2cbbb76b3a937ac9b22cc170420d9ac563 | 138 | # rubocop:disable all
class AddMissingIndex < ActiveRecord::Migration
def change
add_index "services", [:created_at, :id]
end
end
| 19.714286 | 47 | 0.73913 |
18e646dea76837f1ec55798b86c014d265294e71 | 1,910 | class ProyectosController < ApplicationController
before_action :set_proyecto, only: [:show, :edit, :update, :destroy]
# GET /proyectos
# GET /proyectos.json
def index
@proyectos = Proyecto.all
end
# GET /proyectos/1
# GET /proyectos/1.json
def show
end
# GET /proyectos/new
def new
@pro... | 25.466667 | 95 | 0.665969 |
abed96bd9fc7cebca911cd0cad41694439051e06 | 3,835 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/logstash/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Jordan Sissel", "Pete Fritchman"]
gem.email = ["jls@semicomplete.com", "petef@databits.net"]
gem.description = %q{scalable log and event management (search, arch... | 45.117647 | 109 | 0.662842 |
ac6e15a18eff743b2eb1f05f92ce2b7ca6285f44 | 948 | require 'test_helper'
class CreateCategoriesTest < ActionDispatch::IntegrationTest
def setup
@user = User.create(username: "john", email: "john@example.com", password: "password", admin: true)
end
test "get new category form and create category" do
sign_in_as(@user, "password")
get new_category... | 30.580645 | 103 | 0.720464 |
bf6db16511bf281864227bc47f84cabefe1fdb19 | 993 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Dat... | 28.371429 | 102 | 0.769386 |
5d67a085d7936be230ff30f896d124f164ca64a4 | 210 | MaxFinder = Struct.new(:a, :b, :c) do
def getMaximum()
return findMax(findMax(self.a, self.b), self.c)
end
def findMax(x, y)
return x > y ? x : y
end
end
puts(MaxFinder.new(13, 23, 13).getMaximum());
| 19.090909 | 49 | 0.638095 |
0162275c4832f22c6e6072ed2a2cc7f980fefb85 | 7,248 | # FIXME: Add error case
#
require File.expand_path("../../fixtures/send_1.9.rb", __FILE__)
specs = LangSendSpecs
describe "Invoking a method" do
describe "with required args after the rest arguments" do
it "binds the required arguments first" do
specs.fooM0RQ1(1).should == [[], 1]
specs.fooM0RQ1(1,2... | 36.791878 | 108 | 0.589404 |
1a4ea8793c95a47944b809d750fef3f1efdfd065 | 324 | require 'faraday'
require 'slack/error'
module Slack
# Faraday response middleware
module Response
class RaiseError < Faraday::Response::Middleware
private
def on_complete(response)
if error = Slack::Error.from_response(response)
raise error
end
end
end
end
... | 16.2 | 55 | 0.657407 |
acde290b4135bf429f4f9bdb8f5d62ff63b2cf8a | 2,810 | # frozen_string_literal: true
require 'fileutils'
require 'open3'
module DummyAppHelpers
#
# Custom matchers
#
def self.included(_class)
RSpec::Matchers.define :have_file do |file_path|
match do |dummy_app_path|
File.exist? File.expand_path(File.join(dummy_app_path, file_path))
end
... | 21.12782 | 110 | 0.652669 |
e288b5171608b0d8fff0406734c8790e260ff32e | 35,511 | require 'abstract_unit'
require 'controller/fake_controllers'
require 'active_support/json/decoding'
require 'rails/engine'
class TestCaseTest < ActionController::TestCase
def self.fixture_path; end;
class TestController < ActionController::Base
def no_op
render plain: 'dummy'
end
def set_flash... | 29.107377 | 140 | 0.689674 |
110c2fc82d4a1204c252ca8a16bd41febfe835e2 | 3,187 | class Libressl < Formula
desc "Version of the SSL/TLS protocol forked from OpenSSL"
homepage "https://www.libressl.org/"
# Please ensure when updating version the release is from stable branch.
url "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.0.2.tar.gz"
mirror "https://mirrorservice.org/pub/OpenB... | 33.547368 | 94 | 0.695952 |
61c185cce794bce71cc59f398598f0004b2b57b3 | 2,922 | require_relative '../helper/fueled_helper'
module Fastlane
module Actions
class SetAppVersionsXcodeprojIosAction < Action
def self.run(params)
if params[:export_method] == "app-store"
version_string = "#{params[:build_number]}"
else
version_string = "#{params[:build_numb... | 31.085106 | 124 | 0.554073 |
1dac033114effa089abe24ca641b0809893a2eb1 | 6,952 | require 'mspec/runner/context'
require 'mspec/runner/exception'
require 'mspec/runner/tag'
require 'fileutils'
module MSpec
@exit = nil
@start = nil
@enter = nil
@before = nil
@after = nil
@leave = nil
@finish = nil
@exclude = nil
@include = nil
@leave = nil
@mode = nil
@load... | 23.972414 | 85 | 0.643268 |
28ed40ff395cea277ec2c7ff50936dc26e4c4e69 | 964 |
FactoryGirl.define do
factory :deal_event_wrapper, class: 'AlleApi::Wrapper::DealEvent' do
skip_create
remote_id 775599262
occured_at { Time.at 1369042031 }
remote_deal_id 896009896
remote_transaction_id 243241703
remote_seller_id 2783112
remote_auction_id 3263045863
remote_buyer_id ... | 26.054054 | 70 | 0.70332 |
d58f261562bb5dda4305adc3cb3b41aee94efd9a | 239 | class AddGroupTypeToGroupMemberships < ActiveRecord::Migration
def change
add_column :group_memberships, :group_type, :string
GroupMembership.reset_column_information
GroupMembership.update_all(group_type: 'Group')
end
end
| 29.875 | 62 | 0.807531 |
ac0fa3bc0832faeeaed9d3d2b7efd0864d335e09 | 149 | class AddActivatedFlagToProgramme < ActiveRecord::Migration
def change
add_column :programmes, :activated, :boolean, :default=>false
end
end
| 24.833333 | 65 | 0.778523 |
08698a3f61e8712238771f56e92390a77a993fa4 | 7,724 | # encoding: UTF-8
# Module for generating/reading generic contest log files
#
# Author:: N6RNO
#
# License:: © 2014 Northern California Contest Club
# 2-Clause BSD License
#
# This module can identify many different possible file formats
# that a user may attempt to submit to a contest. Most of these
#... | 31.917355 | 133 | 0.626489 |
1c42edf8c56e7fa262f93135393c41ce88c9e1b4 | 233 | # frozen_string_literal: true
class CreatePlans < ActiveRecord::Migration[6.0]
def change
create_table :plans do |t|
t.money :amount
t.string :description
t.string :name
t.timestamps
end
end
end
| 16.642857 | 48 | 0.660944 |
bbaa7b31ee9ecfdb4e4f97314f89b1d596ba43d0 | 78 | PREFIX : <http://example.com/ns#>
INSERT DATA {
<< :a :b :c >> :p :o .
}
| 13 | 33 | 0.474359 |
ffcf1f93d933538c3fc84e256d6190bc4c177c1c | 1,143 | module Graphiterb
class Sender
def initialize
open!
end
def open!
begin
Graphiterb.log.warn "Connecting to server #{Settings.carbon_server} port #{Settings.carbon_port}"
@socket = TCPSocket.new(Settings.carbon_server, Settings.carbon_port)
rescue StandardError => e
... | 24.319149 | 128 | 0.598425 |
b9581eafa7ae277c981440e58edadae3d5a82d60 | 515 | cask 'nestopia' do
version :latest
sha256 :no_check
url 'http://www.bannister.org/cgi-bin/download.cgi?nestopia'
name 'Nestopia'
homepage 'http://www.bannister.org/software/nestopia.htm'
license :closed
app 'Nestopia.app'
zap :delete => [
'~/Library/Application Support/Bannister/Ne... | 28.611111 | 89 | 0.636893 |
3849dd894e1c8a7d723557eac55d32d5adcb897e | 200 | class Marca < ActiveRecord::Base
has_many :produtos, dependent: :restrict_with_error
validates_uniqueness_of :nome, :case_sensitive => false
RailsAdmin.config {|c| c.label_methods << :nome}
end
| 33.333333 | 57 | 0.77 |
bfa8c8846b13f0e1f03d54795193082c6bc6b1df | 954 | module ShoppingCart
feature 'Add book into cart' do
given(:user) { create(:user) }
given!(:book) { create(:book) }
background do
login_as user
visit books_path
click_on 'Add to cart'
end
scenario 'Authorized user adds the book to the Cart' do
expect(page).to have_content ... | 28.058824 | 80 | 0.68239 |
f812a235e4aaa5ef8bed68685804f4249d7ead4f | 377 | #!/usr/bin/env ruby
# frozen_string_literal: true
require './app'
unless ARGV.length > 1
warn <<~USAGE
Usage:
command_line.rb check UPN
command_line.rb commit {add|update} UPN phone_number phone_type
USAGE
end
case ARGV[0]
when 'check'
p AuthPhoneMethods.check(ARGV[1])
when 'commit'
p AuthPho... | 18.85 | 69 | 0.700265 |
083f182fc0f6187d747aed7733c8bc1b0fecf495 | 7,280 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
# Windows XP systems that are not part of a domain default to treating all
# network logons as if they were Guest. This prevents SMB relay attacks from
# gaining administrative acce... | 33.394495 | 168 | 0.631181 |
3309bef0fe1e1b3f091f36ba75397b0480ecc67f | 413 | Given /^a user$/ do |params|
params = params.rows_hash
unless User.find_by({username: params[:username]})
assert_cucumber({
assersion: lambda{ User.new(params).save },
error: "could not create user"
})
end
end
Then /^users has username "([^']*)"$/ do |username|
assert_cucumber({
assers... | 25.8125 | 61 | 0.639225 |
217f50c3bd330ea168c3e599d2ad3e46d8cc0670 | 1,566 | # 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::ServiceFabric::V6_4_0_36
module Models
#
# Represents the health state of a service, which contains the service
# identifier and... | 27.473684 | 78 | 0.551724 |
33810431dc6c9b152ab2a002780ad97ccf9bf213 | 1,174 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 33.542857 | 85 | 0.738501 |
08c8286a5955c30dea3b86abadb1469fee8c1f83 | 38 | class Series < ActiveRecord::Base
end
| 12.666667 | 33 | 0.789474 |
5db0f7820a3c32f65add5b3f9a30a6fce97c378b | 72 | every :day, at: '1:00 am' do
runner "rake student_image:download"
end
| 18 | 38 | 0.708333 |
26786aab12cf39c4998b8e1adbf900e44a2a4051 | 10,179 | # frozen_string_literal: true
include ActionDispatch::TestProcess
FactoryBot.define do
factory :ci_build, class: 'Ci::Build' do
name { 'test' }
stage { 'test' }
stage_idx { 0 }
ref { 'master' }
tag { false }
add_attribute(:protected) { false }
created_at { 'Di 29. Okt 09:50:00 CET 2013' ... | 21.843348 | 126 | 0.569211 |
1c3e821b27e386a3cbb38b17b40aea3f14da4d71 | 1,204 | class Object
def lookup(dotted_path)
result = self
dotted_path.split('.').each do |dot_part|
dot_part.split('[').each do |part|
if part.include?(']')
index = part.to_i
result = result[index]
else
part = part.snakecase
case result
when Has... | 20.758621 | 60 | 0.456811 |
623a784e00d0bfe824fffce2047824aab61d87ba | 4,529 | unified_mode true
provides :macos_user
default_action :create
property :username, String, name_property: true
property :password, String, default: 'password'
property :autologin, [TrueClass]
property :admin, [TrueClass]
property :fullname, String
property :groups, [Array, String]
property :hidden, [true, false], defa... | 26.179191 | 177 | 0.667035 |
916d8b7b93308dbc629548e12b0a8ac837d9f838 | 580 | # STRINGS: puts
#
# Ruby has several methods for sending text to stdout, the most common of which is 'puts':
# puts "Welcome to the program!"
# Output:
# Welcome to the program!
#
# Notice that puts places a newline after whatever it prints. And puts can print any object, not just strings:
# puts 45
# Outp... | 19.333333 | 110 | 0.708621 |
03f5d0c8bc458522d409b6c733d67d93650e7678 | 39 | module CanCan
VERSION = "1.10.1"
end
| 9.75 | 20 | 0.666667 |
6a2c55a5e5588d085d17db2ac4dd12f8290f016c | 9,240 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::UnlinkForkService, :use_clean_rails_memory_store_caching do
include ProjectForksHelper
subject { described_class.new(forked_project, user) }
let(:project) { create(:project, :public) }
let!(:forked_project) { fork_project(project, ... | 35.813953 | 134 | 0.70303 |
b923e3f7d7ca1e56a73bcf4c74aa8935033aa028 | 7,049 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Dobby::Package do
let(:package_args) do
{
name: 'locales-all',
version: package_version,
target: target_version,
release: 'test'
}
end
let(:newer_package_args) do
{
name: 'locales-all',
ver... | 27.751969 | 96 | 0.61413 |
ffcdd9d7f88789f279328eacf2a322851f68ad9f | 4,870 | class RealestateByZipcode::CLI
def call
welcome
start
goodbey
end
def welcome
puts "*****************************"
puts "Welcom to RealestateByZipcode"
puts "*****************************"
end
def start
initialize_properties
display_properties
input = ""
while i... | 36.616541 | 95 | 0.431417 |
1da65d6e285b515ff44d7c63e8170d6e34de09e8 | 126 | require 'spec_helper'
describe "static_pages/home.html.haml" do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21 | 56 | 0.753968 |
f8edd649027a7b64c7280de3438fe7cab7acf69b | 114 | RSpec.describe Goeat do
it "has a version number" do
expect(Goeat::VERSION).not_to be nil
end
end
| 19 | 44 | 0.666667 |
62eccd377eec934f1214183761027f116ece5e85 | 1,233 | # Copyright (c) 2012 Red (E) Tools Ltd.
#
# 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 restriction, including without limitation the rights to use, copy, modify, merge, publish, distri... | 68.5 | 462 | 0.788321 |
391da091b26d8e76c60ca661a2c5438bedecce73 | 283 | class ContributionDecorator < Draper::Decorator
decorates :contribution
include Draper::LazyHelpers
def display_value
number_to_currency source.value, precision: 0
end
def display_confirmed_at
I18n.l(source.confirmed_at.to_date) if source.confirmed_at
end
end
| 20.214286 | 62 | 0.787986 |
626a29ff8fbb538febba8af2c60dedefd51a90ec | 1,073 | class CBlosc < Formula
desc "Blocking, shuffling and loss-less compression library"
homepage "https://blosc.org/"
url "https://github.com/Blosc/c-blosc/archive/v1.20.1.tar.gz"
sha256 "42c4d3fcce52af9f8e2078f8f57681bfc711706a3330cb72b9b39e05ae18a413"
license "BSD-3-Clause"
bottle do
cellar :any
sha2... | 30.657143 | 94 | 0.707363 |
ff1576d71e885598fc076461257604794a9d3b18 | 3,160 | # This file has been automatically generated from a template file.
# Please make modifications to
# `templates/gRPC-ProtoRPC.podspec.template` instead. This file can be
# regenerated from the template by running
# `tools/buildgen/generate_projects.sh`.
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache Licen... | 35.505618 | 90 | 0.696519 |
33179e6db7ce3b741d4be51e6225efdf6e6bbd4f | 1,072 | require_relative 'ip_operations'
module VagrantPlugins
module AwsRoute53Advoc8
module Action
class SetIp < IpOperations
def initialize(app, environment)
@app = app
end
def call(environment)
access_key_id, hosted_zone_id, instance_id, record_set, region, secret_a... | 32.484848 | 169 | 0.614739 |
26de404c0c3852dd138c0fdcd575e944cb29d704 | 61 | module Five9
module Client
VERSION = "0.1.1"
end
end
| 10.166667 | 21 | 0.639344 |
e817d6ecd8c21303021e7d8514d4d76e178325c2 | 251 | Kaminari.configure do |config|
config.default_per_page = 30
# config.max_per_page = nil
config.window = 0
# config.outer_window = 0
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
end
| 22.818182 | 35 | 0.693227 |
3301c5e8bdaf03d4f793d50910837af7f6bb8855 | 4,214 | =begin
title RGSS Font Setup
author jubin-park
refer MSDN
date 2015.12.31
syntax Ruby (XP)
=end
#===============================================================================
if $NEKO_RUBY.nil?
#-------------------------------------------------------------------------------
FindWindow =... | 35.711864 | 106 | 0.574751 |
f8752ea6ac7ead6c28ec20944de6999e8a03ac31 | 16,683 | # Eager loading makes it so that you can load all associated records for a
# set of objects in a single query, instead of a separate query for each object.
#
# Two separate implementations are provided. #eager should be used most of the
# time, as it loads associated records using one query per association. However,
... | 44.967655 | 157 | 0.719055 |
39afb352457f2d3d9d643b1d354d1b8b9687f323 | 680 | # frozen_string_literal: true
require 'spec_helper'
describe Vote do
let!(:vote) { create(:vote) }
describe 'validation' do
it 'has a valid factory' do
expect(build(:vote)).to be_valid
end
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:event_id) }
# This is testing the re... | 28.333333 | 104 | 0.692647 |
33e5a3af0026cd203e2900b39ca53e89220fe6c9 | 1,009 |
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require "minitest/rails/capybara"
#require "minitest/pride"
require 'minitest/reporters'
#require 'minitest/focus'
#require 'minitest/colorize'
reporter_options = { color: true}
... | 26.552632 | 118 | 0.755203 |
0892d93c4f6e8e338a67b9613df86d7bcca1dbe5 | 2,799 | #
# Cookbook:: consul
# Attribute:: default
#
# Copyright:: 2018, BaritoLog.
#
#
cookbook_name = 'consul'
# Choose to run consul as a server or client agent
default[cookbook_name]['run_as_server'] = true
# Hosts of the cluster (servers)
default[cookbook_name]['hosts'] = []
# User and group of consul process
default... | 28.561224 | 75 | 0.691676 |
01a33f8da23f0cb8d4d290ce2efb5194366fa802 | 541 | # This migration comes from stash_datacite (originally 20161007221310)
class MigrateDscDatesDateToString < ActiveRecord::Migration
def self.up
add_column(:dcs_dates, :new_date, :string, after: :date)
StashDatacite::DataciteDate.all.each do |date_obj|
unless date_obj.date.nil?
date_obj.update_co... | 25.761905 | 70 | 0.737523 |
ac409217d087db6ae37de17c8c2537a4b86ff946 | 86 | class Zipcode < ApplicationRecord
belongs_to :neighborhood
has_many :hotspots
end
| 17.2 | 33 | 0.813953 |
b9172d58ef06593341e9039938c08dfa4c3e7398 | 3,430 | require 'json'
require 'gherkin/formatter/model'
require 'gherkin/formatter/argument'
require 'gherkin/native'
require 'base64'
module Gherkin
class JSONParser
native_impl('gherkin')
include Base64
def initialize(formatter)
@formatter = formatter
end
# Parse a gherkin object +o+, which c... | 24.855072 | 151 | 0.583382 |
ab56a557c84cae5f241f5d8548db6eea311bcbbc | 1,355 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bitters/version"
Gem::Specification.new do |s|
s.add_development_dependency "bundler", "~> 2.1"
s.add_development_dependency "rake"
s.add_development_dependency "rspec"
s.add_development_dependency "sass... | 36.621622 | 81 | 0.702583 |
61b36f72ce5d99187637a311f1f8734d9dda3b10 | 331 | module Entangled
module Helpers
# Get Redis that user might be using or instantiate
# a new one
def redis
if defined?($redis) && $redis
Redis.new($redis.client.options)
elsif defined?(REDIS) && REDIS
Redis.new(REDIS.client.options)
else
Redis.new
end
end... | 20.6875 | 55 | 0.607251 |
2882c52d3c8350172e0f203a018e9d843e008136 | 1,626 | =begin
#DialMyCalls API
#The DialMyCalls API
OpenAPI spec version: 2.0.1
Contact: support@dialmycalls.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
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 ... | 27.1 | 103 | 0.749692 |
089ae9832097f356ad88aed2bb180b120d1aa78b | 237 | class CreateJoinTableAssetReservation < ActiveRecord::Migration
def change
create_join_table :assets, :reservations do |t|
# t.index [:asset_id, :reservation_id]
# t.index [:reservation_id, :asset_id]
end
end
end
| 26.333333 | 63 | 0.71308 |
03f87df7a60cf02657e813000516fea7dacef500 | 1,875 | class Spinach::Features::AdminSettings < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedAdmin
include Gitlab::CurrentSettings
step 'I modify settings and save form' do
uncheck 'Gravatar enabled'
fill_in 'Home page URL', with: 'https://about.gitlab.com/'
fill_... | 30.241935 | 88 | 0.713067 |
3344696e41f38e75ba8771bcd375d3724a9c4d86 | 700 | require 'test_helper'
class BoardAtomComponentTest < ViewComponent::TestCase
test 'should render' do
render_inline(BoardAtomComponent.new)
assert_selector('.board-atom')
assert_no_selector('.board-atom > *')
end
test 'should render default state' do
render_inline(BoardAtomComponent.new(nil))
... | 21.875 | 54 | 0.722857 |
08672e44c56786fc14f27ea82c21d0b6acfcd508 | 207 | require 'nokogiri'
require 'pry'
require 'open-uri'
require_relative "./top_movies/version"
require_relative './top_movies/cli'
require_relative './top_movies/movie'
require_relative './top_movies/scraper' | 23 | 39 | 0.797101 |
f7cb5a3afba87e08e1d3fcd718f0b9a28c59f0ff | 256 | module SportsDataApi
module Nfl
class TeamRoster
attr_reader :players
def initialize(json)
@players = []
json['players'].each do | player |
@players << Player.new(player)
end
end
end
end
end
| 17.066667 | 42 | 0.566406 |
bb87d4945d60d82f98e3012d330bf8c61e2c637b | 1,093 | class Api::SpellsController < ApplicationController
before_action :set_spell, only: [:show, :update, :destroy]
# GET /api/spells
def index
@spells = Spell.all
render json: @spells
end
# GET /api/spells/:id
def show
authorize @spell
render json: @spell
end
# POST /api/spells
def c... | 17.918033 | 69 | 0.651418 |
18538fdd4debeb0855909ec7e16f8080f5cbd85d | 676 | # frozen_string_literal: true
module Extensions::Legacy::ActiveRecord; end
# Undoes rails/rails#14579.
#
# We need this because we rely on the fact that +string+ is used for short strings, and +text+ is
# used for longer strings (possibly those involving newlines). Most of these strings would be
# used in short messag... | 56.333333 | 99 | 0.788462 |
ac5a6589f07a2a149d93ece0ede97e8288655615 | 230 | # frozen_string_literal: true
class AddUsernameToDeployTokens < ActiveRecord::Migration[5.1]
DOWNTIME = false
def change
add_column :deploy_tokens, :username, :string # rubocop:disable Migration/PreventStrings
end
end
| 23 | 92 | 0.782609 |
21e7e77637409e892b8c416b2429f12f0fab6ed6 | 1,072 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
def index
@posts = Post.all
end
# GET /posts/1
def show
end
# GET /posts/new
def new
@post = Post.new
end
# GET /posts/1/edit
def edit
end
# POST /posts
... | 17.866667 | 71 | 0.654851 |
38f65a252ca7ea604af52b7b0a67734b30d0d19c | 3,938 | module MiniHawk
RSpec.describe Client do
context 'hawk client authenticate (following hapijs/hawk tests)' do
let (:options) { {
id: '123456',
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
ext: 'ext',
algorithm: 'sha256',
host: 'example.com',
port: 8000
... | 45.790698 | 186 | 0.601067 |
1cf529a9357236a549f8c2999bfe477e7e4282cc | 8,092 | require 'addressable/uri'
module EventMachine
module WebSocket
class Connection < EventMachine::Connection
include Debugger
attr_writer :max_frame_size
# define WebSocket callbacks
def onopen(&blk); @onopen = blk; end
def onclose(&blk); @onclose = blk; end
def on... | 31.609375 | 136 | 0.607884 |
335c606f5abdb675180a67c0b2a7d4e238df9d33 | 148 | Sequel.migration do
up do
add_column :careers, :full_description, String
end
down do
drop_column :careers, :full_description
end
end | 16.444444 | 50 | 0.736486 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.