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 |
|---|---|---|---|---|---|
91b22e3fdbf096f8df4bf92f5aac818e3d115367 | 3,938 | 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... | 41.452632 | 102 | 0.758253 |
f81f6dc7324e4079d89824e7043bdb472f0bdf84 | 1,130 | # [PATCH] Deep merge in Rails 2.3.8 fails on HashWithIndifferentAccess
# https://rails.lighthouseapp.com/projects/8994/tickets/2732-deep_merge-does-not-work-on-hashwithindifferentaccess
# https://rails.lighthouseapp.com/projects/8994/tickets/2732/a/239457/deep_merge_replace_master.diff
# this should probably be in con... | 37.666667 | 130 | 0.676106 |
6216dca1b0b3b9d64d65ad2c98daa86b65e8ae1a | 3,997 | require 'test_helper'
class Hash
# override Hash#to_query to prevent sorting of params
def to_query(namespace = nil)
collect do |key, value|
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
end
end.compact * "&"
... | 35.371681 | 134 | 0.689767 |
1c6627e3c2dd1deecce635b1243028ae14e6f312 | 2,443 | # frozen_string_literal: true
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class Apple < OmniAuth::Strategies::OAuth2
option :name, 'apple'
option :client_options,
site: 'https://appleid.apple.com',
authorize_url: '/auth/authorize',
token_url: '... | 25.989362 | 102 | 0.573475 |
61b8d22530d5d68440df23c0772b32be3193c504 | 1,416 | require_relative '../../gen/ConstGenerator'
def gen_interfaceinfo_java(options)
ConstGenerator.new 'platform.interfaceinfo', options do |cg|
cg.include IS_WINDOWS ? "Ws2tcpip.h" : "net/if.h"
%w[
IFF_802_1Q_VLAN
IFF_ALLMULTI
IFF_ALTPHYS
IFF_AUTOMEDIA
IFF_BONDING
IFF_BRIDGE_P... | 20.823529 | 62 | 0.646186 |
61c92a78a1ee73472555aeec433cbc2a8a264025 | 579 | # frozen_string_literal: true
module Mutations
class CreateProject < BaseMutation
argument :brand_id, ID, required: true
argument :project_attributes, Types::ProjectAttributes, required: true
field :project, Types::ProjectType, null: false
def authorized?(brand_id:, project_attributes:)
@brand... | 26.318182 | 74 | 0.696028 |
e92a529ff23e608730eb0d513d73f09cc4d9380b | 5,672 | require 'chef/project'
require 'chef/version'
require 'digest'
class Chef
class ProjectCache
attr_reader :project
attr_reader :metadata_dir
def initialize(project, metadata_dir)
@project = project
@metadata_dir = metadata_dir
end
def fix_windows_manifest!(manifest, fix_up_to_version... | 27.009524 | 96 | 0.63452 |
abadd933c69deb270172252812182802e85fea87 | 306 | class RadiantPlayer < Cask
version '1.2.1'
sha256 'dc1ed98170e05c430779f527191717cb412e74f398324878286df4a2bbad79d4'
url 'https://github.com/kbhomes/google-music-mac/releases/download/v1.2.1/Radiant.Player.zip'
homepage 'http://kbhomes.github.io/google-music-mac/'
app 'Radiant Player.app'
end
| 30.6 | 95 | 0.781046 |
e23f69962761001d29b1b4f3112bcb17c5d461ff | 1,082 | cask "reaper" do
version "6.16.0,6.16"
if MacOS.version <= :mojave
sha256 "91edeba84d382159dd9b678052c73947a155c421d0b4c1b610a82d35f788c347"
url "https://www.reaper.fm/files/#{version.major}.x/reaper#{version.after_comma.no_dots}_x86_64.dmg"
else
sha256 "bf0b60552964bb42be6a48aac7afb3355e1fb96f2fcfc... | 34.903226 | 113 | 0.748614 |
accca83232384181c741d1499213062dfaf84b96 | 141 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_HelpQueue_session'
| 35.25 | 79 | 0.808511 |
d56d7d95a83c0edc31cd1402a4d3ad2e1c097f29 | 78 | require 'given_filesystem/spec_helpers'
require_relative '../lib/cli_tester'
| 19.5 | 39 | 0.820513 |
f79d02aa5e86c60295c3b8127dc5170d28c9ceca | 337 | # == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# nickname :string not null
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryGirl.define do
factory :user_with_valid_attributes, class: User do
nickname 'na... | 21.0625 | 53 | 0.62908 |
38a39e072519139b45a239230e1618e49e505428 | 182 | class CreateDistricts < ActiveRecord::Migration[5.0]
def change
create_table :districts do |t|
t.string :name
t.integer :area
t.timestamps
end
end
end
| 16.545455 | 52 | 0.653846 |
1854d3d29a2478dab74663ec3fb73244a2c1218b | 817 | class ZeroEightOhEight
def input
puts 'How bright a time? (Format: 23:59 or 2359)'
@t = gets.chomp.tr(':','')
calc_brightness(@t)
end
def autofind
24.times { |h| 60.times { |m| calc_brightness("#{"%02d" % h}#{"%02d" % m}") } }
end
def calc_brightness(time)
if time =~ /([01]\d|2[0-3])[0-5]\d/ && time.le... | 22.694444 | 81 | 0.564259 |
f8370df250a178425eb937df94abb519448968cc | 495 | class Group < ApplicationRecord
has_and_belongs_to_many :users
belongs_to :company
validates \
:name,
presence: true
validates \
:name,
uniqueness: {
case_insensitive: true
}
def active?
archived_at.blank?
end
def archived?
archived_at.present?
end
def archive!
write... | 13.378378 | 43 | 0.672727 |
3933e6a2a89144b32f3ca889a004fcddc41acefd | 10,358 | class SamlAuthenticator < ::Auth::OAuth2Authenticator
attr_reader :user, :attributes, :info
def info=(info)
@info = info.present? ? info.with_indifferent_access : info
end
def initialize(name, opts = {})
opts[:trusted] ||= true
super(name, opts)
end
def attribute_name_format(type = "basic")
... | 33.739414 | 145 | 0.674841 |
b9ac00cff1b47a6dc0612335939043f1e2f44b9e | 208 | # This migration comes from spree_annarbortees_twitter (originally 20141212051327)
class AddHashtagToProduct < ActiveRecord::Migration
def change
add_column :spree_products, :hashtag, :string
end
end
| 29.714286 | 82 | 0.8125 |
1a044e19a7ad86b55df71626fa94b6dc88b0cddf | 955 | # frozen_string_literal: true
require 'haml/template/options'
# check for a compatible Rails version when Haml is loaded
if (activesupport_spec = Gem.loaded_specs['activesupport'])
if activesupport_spec.version.to_s < '3.2'
raise Exception.new("\n\n** Haml now requires Rails 3.2 and later. Use Haml version 4.0.4... | 29.84375 | 99 | 0.679581 |
625912b94b10ead1b284849e3bc2e671ffc7d399 | 15,549 | require 'spec_helper'
describe 'cis_hardening::logaudit::accounting' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for default class
it { is_expected.to contain_class('cis_hardening::logaudit::accounting') }
# Ensure Auditing is enabled... | 34.324503 | 182 | 0.538748 |
39aee4c82fae9f81ef4a691e7d3e87d329dee180 | 7,597 | module Asciidoctor
# A base module for defining converters that can be used to convert {AbstractNode}
# objects in a parsed AsciiDoc document to a backend format such as HTML or
# DocBook.
#
# Implementing a converter involves:
#
# * including this module in a {Converter} implementation class
# * overri... | 32.32766 | 110 | 0.625115 |
1d5d26492cca5672906582c36591ddd93b60f110 | 1,379 | # 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::Compute::Mgmt::V2018_06_01
module Models
#
# Describes the parameters of differencing disk settings that can be be
# specified f... | 27.58 | 79 | 0.586657 |
b907f8b109f9eb8fb7e1ea978c7b257a7b1eaca1 | 366 | ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include ApplicationHelper
def is_log... | 22.875 | 82 | 0.754098 |
032f683a992dee0cfd9dbd9632936e7f5d4492cf | 895 | #
# Fluentd
#
# 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, so... | 21.309524 | 77 | 0.680447 |
d55b7694b5bbe782c63f379e381031b67812e604 | 1,203 | class Range
def bsearch
return to_enum(:bsearch) unless block_given?
from = self.begin
to = self.end
unless from.is_a?(Numeric) && to.is_a?(Numeric)
raise TypeError, "can't do binary search for #{from.class}"
end
midpoint = nil
if from.is_a?(Integer) && to.is_a?(Integer)
con... | 25.0625 | 100 | 0.551953 |
03e19004e2523e9debfed66f680757c6e9e05209 | 4,445 | # -*- encoding: utf-8 -*-
# stub: github-pages 90 ruby lib
Gem::Specification.new do |s|
s.name = "github-pages".freeze
s.version = "90"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["GitHub, Inc."... | 54.876543 | 338 | 0.652193 |
1d5b981f3d408be5ad0332ff0209ef81b3bd36d6 | 89 | if defined?(ActiveRecord::Migration)
ActiveRecord::Migration.maintain_test_schema!
end
| 22.25 | 47 | 0.831461 |
08a9e2878ffdc87cc9f1b1945b95eb548f590fdb | 990 | require "emque/stats/version"
require "emque/stats/configuration"
require "emque/stats/client"
module Emque
module Stats
class << self
attr_accessor :client
attr_writer :configuration
def logger
self.configuration.logger
end
def configure
yield(configuration)
... | 21.521739 | 66 | 0.648485 |
399c187d7a7b9f69af486c58768064602ca419eb | 4,240 | Huginn::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... | 41.568627 | 102 | 0.75283 |
793e3e698efa316c51c6bf60902034155da343e2 | 14,585 | # frozen_string_literal: true
module Homebrew
module EnvConfig
module_function
ENVS = {
HOMEBREW_ARCH: {
description: "Linux only: Pass the set value to a type name representing the compiler's `-march` option.",
default: "native",
},
HOMEBREW_ARTIFA... | 47.353896 | 117 | 0.56373 |
bb70df872b41ada30ff9847299ed8d40367e1ce2 | 1,068 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'smartystreets_ruby_sdk/version'
Gem::Specification.new do |spec|
spec.name = 'smartystreets_ruby_sdk'
spec.version = SmartyStreets::VERSION
spec.authors = ['SmartyStree... | 39.555556 | 80 | 0.661049 |
039435897b3e391ff915c9f415f219a32efd8bf4 | 176 | class PrintedThirdPartyConsentFormActivity < Activity
def self.from(appointment)
create!(appointment_id: appointment.id)
end
def owner_required?
false
end
end
| 17.6 | 53 | 0.767045 |
ac5cfabf9aaca5265d86be2bc487c1ea68965d04 | 923 | cask 'astro' do
version '3.0.15,4135'
sha256 '2a7ae8f9f88df720ee17f097c81f07a8cdb3f345e1783f36b5e5af7d7c146018'
# pexlabs-updates-xvuif5mcicazzducz2j2xy3lki.s3-us-west-2.amazonaws.com was verified as official when first introduced to the cask
url "https://pexlabs-updates-xvuif5mcicazzducz2j2xy3lki.s3-us-west-2... | 38.458333 | 132 | 0.717226 |
284256cbd742e988a7891c8ce4c534831c6d695f | 5,250 | class ProjectUser < ActiveRecord::Base
belongs_to :project
belongs_to :user
auto_subscribes :user, :to => :project
after_save :check_role, :remove_updates, :subscribe_to_assessment_sections_later
after_destroy :remove_updates
validates_uniqueness_of :user_id, :scope => :project_id, :message => "alread... | 33.43949 | 113 | 0.70381 |
79cc37df005379adf18f501b8bb727b2e3b5bee2 | 2,204 | # frozen_string_literal: true
module Crossbeams
module Layout
# Display one or more contact methods
class ContactMethod
include PageNode
attr_reader :contact_methods, :lookup_icon
def initialize(page_config, contact_methods, options = {})
@page_config = page_config
@nod... | 29 | 159 | 0.573956 |
1a38c9631eaded341109b2e60844cd3b8ede8b05 | 869 | require_relative 'adapters'
module Moltrio
module Config
class ChainContainer
def initialize(chains)
@chains = chains
end
delegate(*Adapter.instance_methods(false), to: :default_chain)
def default_chain
chain(:default)
end
def available_namespaces(chain_nam... | 20.209302 | 85 | 0.614499 |
bb27f7ee494483f9276879e19fb31f03751e051a | 1,198 | require 'spec_helper'
describe CertCheck::CLI do
let(:cli) { CertCheck::CLI.new }
describe '#array_to_hash' do
arr = [
['C', 'JP', 19],
['ST', 'TOKYO', 19],
['L', 'SHIBUYA', 19],
['O', 'EXAMPLE, Inc.,', 19],
['OU', '', 19],
['CN', 'www.example.com', 19]
]
expected = ... | 27.860465 | 77 | 0.586811 |
7a0199dafc7d16897e78b1ba25d54a1e3e2a8d51 | 646 | module Searchlight::Options
def self.empty?(value)
return true if value.nil?
return true if value.respond_to?(:empty?) && value.empty?
return true if /\A[[:space:]]*\z/ === value
false
end
def self.checked?(value)
!(['0', 'false', ''].include?(value.to_s.strip))
end
def self.excluding_e... | 23.071429 | 61 | 0.592879 |
116ea33b3a5528e4804cd02167918ec1c16144db | 984 | # Requires
require 'rails/generators'
require 'rails/generators/migration'
class PurgatoryGenerator < Rails::Generators::Base
include Rails::Generators::Migration
def self.source_root
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
end
def self.next_migration_number(dirname)
if ActiveR... | 27.333333 | 86 | 0.723577 |
38ea795bd76cd3a3e1a1453edbef74cdf4159642 | 6,733 | require 'set'
module Audited
# Audit saves the changes to ActiveRecord models. It has the following attributes:
#
# * <tt>auditable</tt>: the ActiveRecord model that was changed
# * <tt>user</tt>: the user that performed the change; a string or an ActiveRecord model
# * <tt>action</tt>: one of create, updat... | 33.497512 | 140 | 0.662706 |
5d8fadcb5ce8452238d3feb056b81bb8eb56e916 | 581 | cask :v1 => 'phpstorm7' do
version '7.1.4'
sha256 '618d05d39d8565677cddc63afee0fc9b50431a7efc6da930a18c54831ea102f5'
url "http://download.jetbrains.com/webide/PhpStorm-#{version}.dmg"
homepage 'http://www.jetbrains.com/phpstorm/'
license :commercial
app 'PhpStorm.app'
postflight do
plist_set(':JVMO... | 27.666667 | 75 | 0.643718 |
1d78e91cd582b05827efddef8e88e99c3f781c1f | 217 | class User < ActiveRecord::Base
has_secure_password
has_many :tweets
def slug
self.username.downcase.gsub(" ", "-")
end
def self.find_by_slug(slug)
self.all.find{|user| user.slug == slug}
end
end | 18.083333 | 43 | 0.682028 |
abefb264146dde7f0a25f8ebaa8451fc89853266 | 322 | class ContactMailer < ActionMailer::Base
default to: "info@sheffieldultimate.co.uk",
subject: "Message From Website Contact Form"
def contact(email)
@name = email.name
@email = email.email
@message = email.message
from = "#{@name} <#{@email}>"
mail(from: from, reply_to: from)
end
en... | 24.769231 | 54 | 0.649068 |
e940b506a6e25f783f97bd986af036f9c363996c | 159 | class OauthController < ApplicationController
before_filter :require_access_token, only: [:new]
def new
head :ok
end
def callback
end
end | 15.9 | 51 | 0.710692 |
0301261d7758fadf1c2a9532ae9c61f36b43b2c9 | 620 | cask 'pocketcast' do
version '1.25'
sha256 '01091dfc5f6819a800c5da51230e272dbecfdbac8a93d12124820a0cd0bb74b7'
url "https://github.com/mortenjust/PocketCastsOSX/releases/download/#{version}/PocketCast#{version.no_dots}.zip"
appcast 'https://github.com/mortenjust/PocketCastsOSX/releases.atom',
checkpoi... | 44.285714 | 114 | 0.793548 |
1812fddbbb79ac55eb6b726aedee6c633f40e7bf | 104 | # LANGUAGE: Ruby
# AUTHOR: Hannah Zulueta
# GITHUB: https://github.com/hanapotski
puts "Hello, World!"
| 17.333333 | 39 | 0.721154 |
62179cf39842ed6d206a31f02e32e8450b565c7c | 1,137 | require "rails_helper"
describe "fields/belongs_to/_show", type: :view do
let(:product) { create(:product) }
let(:product_path) { polymorphic_path([:admin, product]) }
let(:link) { "<a href=\"#{product_path}\">#{product.name}</a>" }
let(:associated_class) { "test_associated_class" }
let(:belongs_to) do
i... | 28.425 | 66 | 0.682498 |
e9764bd764f373f803790d20742178feaaa7c054 | 140 | class OrderSerializer < ActiveModel::Serializer
attributes :id, :address, :city, :state, :user_id, :total, :created_at, :order_number
end
| 35 | 87 | 0.757143 |
39286b494114267ab52da9f8f250eeb9539fd9ad | 403 | # frozen_string_literal: true
# Lamel:
RSpec.describe Funcky::ATransform::Lamel do
let(:instance) { described_class.new }
describe 'initialize' do
subject { instance }
it { is_expected.not_to be_nil }
end
describe '#parse' do
subject { instance.parse(value) }
let(:value) { nil }
c... | 17.521739 | 43 | 0.64268 |
d50ea687cf7a0fba297f4d96cac331400c802d1e | 283 | module Yuriita
class DynamicFilter
attr_reader :qualifier
def initialize(qualifier:, &block)
@qualifier = qualifier
@block = block
end
def apply(relation, input)
block.call(relation, input)
end
private
attr_reader :block
end
end
| 14.894737 | 38 | 0.650177 |
876fac6bde45d00ae44520aaa4f5f924e5377948 | 1,655 | #
# Cookbook:: end_to_end
# Recipe:: macos
#
# Copyright:: Copyright (c) Chef Software Inc.
#
chef_sleep "2"
execute "sleep 1"
execute "sleep 1 second" do
command "sleep 1"
live_stream true
end
execute "sensitive sleep" do
command "sleep 1"
sensitive true
end
timezone "America/Los_Angeles"
include_recipe ... | 18.388889 | 78 | 0.758912 |
bf202ea5d668c4b136bdd7193d20754832d1f56a | 1,316 | # frozen-string-literal: true
#
class Roda
module RodaPlugins
# The drop_body plugin automatically drops the body and
# Content-Type/Content-Length headers from the response if
# the response status indicates that the response should
# not include a body (response statuses 100, 101, 102, 204,
# a... | 30.604651 | 67 | 0.601824 |
211f5b4b19a31c94b530231e32a284da29c598d9 | 258 | class CreateBuyRequests < ActiveRecord::Migration[5.0]
def change
create_table :buy_requests do |t|
t.string :netid
t.string :status
t.integer :show_id
t.timestamps
end
add_foreign_key :buy_requests, :shows
end
end
| 21.5 | 54 | 0.670543 |
6151a9ce1bc52136fbfcabbc2d9ec01878b10a2d | 5,035 | # frozen_string_literal: true
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, a... | 43.782609 | 114 | 0.762661 |
f7fcdebfc2e45d92b12dd50e469a05bab8948dcb | 9,668 | require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class CronTest < Test::Unit::TestCase
context "When parsing time in minutes" do
should "raise if less than 1 minute" do
assert_raises ArgumentError do
parse_time(59.seconds)
end
assert_raises ArgumentError do
... | 38.672 | 124 | 0.635705 |
e800470964a6f63cbe07d5337eb30f84856690f0 | 351 | # encoding: UTF-8
require 'helper'
class TestFakerName < Test::Unit::TestCase
def setup
@tester = FFaker::Name
end
def test_name
assert @tester.name.match(/(\w+\.? ?){2,3}/)
end
def test_prefix
assert @tester.prefix.match(/[A-Z][a-z]+\.?/)
end
def test_suffix
assert @tester.suffix.mat... | 15.954545 | 49 | 0.615385 |
e2cad3c055d9166d305ff9cf135291fdeeaa2ebf | 1,450 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.ripe.net/va/status_available.expected
#
# and regenerate the tests with the following rake task
#
# $ rake genspec:parsers
#
require 'spec_helper'
require... | 23.770492 | 83 | 0.68 |
08cffeef3cc8c39b6b944face216e4d2434d5412 | 1,714 | require "spec_helper"
RSpec.describe Scalingo::Auth::TwoFactorAuth do
describe_method "status" do
let(:stub_pattern) { "status" }
it_behaves_like "a singular object response"
end
describe_method "initiate" do
context "success" do
let(:arguments) { Scalingo::Auth::TwoFactorAuth::DEFAULT_PROVID... | 24.485714 | 73 | 0.656359 |
382b5df7a181b0d4c69f692fbc03f0e0665efff2 | 735 | require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
ENV['RAILS_ENV'] ||= 'test'
requ... | 29.4 | 82 | 0.693878 |
2876baf0dbb73ea6e746a75eec3609e9b0bd9315 | 1,305 | require 'spec_helper'
describe OrderBid do
subject { create(:order_bid) }
its(:compute_locked) { should == subject.volume*subject.price }
context "compute locked for market order" do
let(:price_levels) do
[ ['100'.to_d, '10.0'.to_d],
['101'.to_d, '10.0'.to_d],
['102'.to_d, '10.0'.to_... | 31.071429 | 128 | 0.655172 |
18bf77e1645818ce63333ad54cc355b949746089 | 707 | describe "/lines/new", :type => :view do
let(:context) { Chouette.create { line_provider } }
let!(:workbench) { assign :workbench, context.workbench }
let!(:line_referential) { assign :line_referential, context.line_referential }
let!(:line) { assign :line, context.line_provider.lines.build(name: 'Test') }
... | 30.73913 | 80 | 0.681754 |
b917974f8bfeda42327e9b1034b7291d9f28fe1c | 1,992 | class Comment4sController < ApplicationController
before_action :set_comment4, only: [:show, :edit, :update, :destroy]
# GET /comment4s
# GET /comment4s.json
def index
@comment4s = Comment4.all
end
# GET /comment4s/1
# GET /comment4s/1.json
def show
end
# GET /comment4s/new
def new
@com... | 26.56 | 105 | 0.669679 |
ed7f3f8e0c128555a6192a1ad5900bbdeaf4145d | 359 | cask "google-featured-photos" do
version "1.0.0.208"
sha256 "4d4abc378b38278b0cd247e99a008c730a3b6b77824437b01db0bf8beaf24bfb"
url "https://dl.google.com/featuredphotosscreensaver/GoogleFeaturedPhotos-#{version}.dmg"
name "Google Featured Photos"
homepage "https://plus.google.com/featuredphotos"
screen_sa... | 32.636364 | 91 | 0.799443 |
bb03b2b1eae22631de8bc3b2d5e16965193f425f | 117 | class UnitCategory < ActiveRecord::Base
has_many :units, :dependent => :destroy
validates_presence_of :name
end
| 19.5 | 41 | 0.769231 |
2183a5ad795b1a395abeafd01495b0a6fbb7e153 | 2,178 | require 'rails_helper'
feature "User Sign In" do
extend SubdomainHelpers
let!(:account) {FactoryGirl.create(:account)}
let!(:sign_in_url) {"http://#{account.subdomain}.example.com/sign_in"}
let!(:root_url) {"http://#{account.subdomain}.example.com/"}
within_account_subdomain do
scenario "signs in as an a... | 35.704918 | 74 | 0.693756 |
d5d9074f40ab145355aa347bf8723cd9655a8a4c | 439 | # == Schema Information
#
# Table name: users
#
# id :bigint(8) not null, primary key
# name :text
# email :text
# password_digest :text
# admin :boolean
# created_at :datetime not null
# updated_at :datetime not null
#
class User < Ap... | 23.105263 | 58 | 0.583144 |
2180b7290909cc95ba42ece78bc7b0f248989262 | 14,038 | describe HttpStub::Server::Application::Routes::Stub, "when a server is running" do
include_context "server integration"
let(:response_document) { Nokogiri::HTML(response.body) }
describe "that has multiple scenarios configured" do
let(:configurator) { HttpStub::Examples::ConfiguratorWithExhaustiveScenario... | 43.4613 | 120 | 0.628793 |
b965f72ebe267c42d1e539180f324a7108107be9 | 2,089 | describe :fiber_resume, :shared => :true do
it "can be invoked from the root Fiber" do
fiber = Fiber.new { :fiber }
fiber.send(@method).should == :fiber
end
it "passes control to the beginning of the block on first invocation" do
invoked = false
fiber = Fiber.new { invoked = true }
fiber.send(@... | 30.720588 | 77 | 0.667305 |
edcf54e67bb71f10202342a8cb54f1d4ac550d1e | 229 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :address do
street "MyString"
street2 "MyString"
city "MyString"
state "MyString"
zip "MyString"
end
end
| 19.083333 | 68 | 0.707424 |
261ea2da1d00eb1d287fa8f6264196267f94aea1 | 582 | class Tasks
def initialize(communicator)
@communicator=communicator
end
def start(taskid)
@communicator.do_post "/deployit/task/#{taskid}/start", ''
end
def get(taskid)
TaskInfo.new @communicator.do_get "/deployit/task/#{taskid}"
end
def start_and_wait(taskid)
start taskid
while no... | 18.774194 | 64 | 0.680412 |
62af05b0ee2c13564ae3bc948821e1548e7ccb49 | 163 | require 'spec_helper'
RSpec.describe ScenicSqlserverAdapter do
it "has a version number" do
expect(ScenicSqlserverAdapter::VERSION).not_to be nil
end
end
| 20.375 | 57 | 0.785276 |
e9d6ffb4df63ae886f50e14b176ddb63501ad276 | 2,333 | # frozen_string_literal: true
require 'slack/version'
require 'slack/field'
require 'slack/message'
require 'slack/attachment'
require 'json'
require 'faraday'
module Slack
class Poster
attr_accessor :options
# Define getters and setters for the options hash keys. This will make assign of the options
#... | 33.328571 | 99 | 0.67724 |
0382de83a55352c32f5ed88286e98f7f51dc8e5e | 1,032 | # A filled-in form on a {#web_site}.
class Mdm::WebForm < ApplicationRecord
#
# Associations
#
# {Mdm::WebSite Web site} on which this form is.
belongs_to :web_site,
class_name: 'Mdm::WebSite',
inverse_of: :web_forms
#
# Attributes
#
# @!attribute created_at
# When ... | 19.111111 | 77 | 0.630814 |
03a868a4906cd66a48bdf36535120f45c0b50b0a | 435 | default['firewall']['allow_ssh'] = true
default['awesome_customers_delivery']['open_ports'] = [80, 443]
default['awesome_customers_delivery']['user'] = 'web_admin'
default['awesome_customers_delivery']['group'] = 'web_admin'
default['awesome_customers_delivery']['document_root'] = '/var/www/customers/public_html'
def... | 48.333333 | 117 | 0.767816 |
21ed2d42bfb1a8c0f19ace3050cccdada755cc57 | 262 | class Prime::Accounts::Cosmos < Prime::Account
def details
@details ||= ::Cosmos::AccountDecorator.new(::Cosmos::Chain.find_by(slug: network.primary.slug), address)
end
def rewards
@rewards ||= network.primary.client.prime_rewards(self)
end
end
| 26.2 | 109 | 0.717557 |
e90f983b49c2ddff04d9e29d3b302c69ffa7ae89 | 893 | json.total_count @end_user_used_deals.total_count
json.deals @end_user_used_deals do |end_user_deal|
deal = end_user_deal.deal
json.id end_user_deal.deal_id
json.store_name deal.store.name
json.title deal.title
json.is_expired deal.expired?
json.booking_code end_user_deal.booking_code.coupon_code
json.bo... | 42.52381 | 109 | 0.806271 |
914186da23eb1c5b8ff0b8b722677fe4801468e5 | 4,772 | # Copyright (c) 2008 [Sur http://expressica.com]
module SimpleCaptcha #:nodoc
module ViewHelpers #:nodoc
include ConfigTasks
# Simple Captcha is a very simplified captcha.
#
# It can be used as a *Model* or a *Controller* based Captcha depending on what options
# we are passing to the metho... | 33.843972 | 150 | 0.639983 |
6a2f8cbe25faedc0741471066b4bab1309da6d4e | 155 | require 'test_helper'
module DanvanthiriCore
class CityTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
end
| 15.5 | 42 | 0.683871 |
d54468efa4f72d769ef5e621442198f1d9214d67 | 5,427 | # The MIT License (MIT)
#
# Copyright (c) 2021 Losant IoT, Inc.
#
# 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, ... | 42.732283 | 188 | 0.698544 |
ab339e8d2977eab23e7cd39c563cf40a1dba2960 | 3,340 | # frozen_string_literal: true
class Release < ActiveRecord::Base
NUMBER_REGEX = /\A#{Samson::RELEASE_NUMBER}\z/.freeze
VERSION_REGEX = /\Av(#{Samson::RELEASE_NUMBER})\z/.freeze
belongs_to :project, touch: true, inverse_of: :releases
belongs_to :author, class_name: "User", inverse_of: nil
before_validation :... | 33.4 | 138 | 0.735329 |
335e0905b7dbda14f654bfaee06626bdec96c0c1 | 1,925 | class Ipfs < Formula
desc "Peer-to-peer hypermedia protocol"
homepage "https://ipfs.io/"
url "https://github.com/ipfs/go-ipfs.git",
tag: "v0.8.0",
revision: "ce693d7e81e0206b3afbce30333c21a36a9f094b"
license all_of: [
"MIT",
any_of: ["MIT", "Apache-2.0"],
]
head "https://github.com/... | 31.048387 | 121 | 0.661818 |
26bcfd36bb730c3ff32f5309822b92afc6b7866d | 859 | #
# Cookbook Name:: mongodb3-test
# Recipe:: custom
#
# Copyright 2016, Sunggun Yu
#
# 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
#
# Unles... | 35.791667 | 100 | 0.733411 |
5d4d94f128a553791b1692f3dcc3599a9473a83f | 388 | # frozen_string_literal: true
# ypserv_service.rb
# Check if ypserv services is enabled
Facter.add('srv_ypserv') do
confine :osfamily => 'RedHat'
setcode do
ret = ''
ypserv = Facter::Core::Execution.exec('systemctl is-enabled ypserv')
if (ypserv =~ %r{^Failed}) or (ypserv.empty?) then
ret = 'dis... | 19.4 | 72 | 0.634021 |
0382c87c74fc77f642b687ce25a67846a1c4bc3c | 13,594 | require 'chunky_png/canvas/png_encoding'
require 'chunky_png/canvas/png_decoding'
require 'chunky_png/canvas/adam7_interlacing'
require 'chunky_png/canvas/stream_exporting'
require 'chunky_png/canvas/stream_importing'
require 'chunky_png/canvas/data_url_exporting'
require 'chunky_png/canvas/data_url_importing'
require ... | 36.44504 | 109 | 0.643225 |
e85a57abfcb132fabb59a498d3fc49b5df767797 | 1,346 | require_relative 'lib/potter_world/version'
Gem::Specification.new do |spec|
spec.name = "potter_world"
spec.version = PotterWorld::VERSION
spec.authors = ["Olivia Cubela"]
spec.email = ["oliviacubela@gmail.com"]
spec.summary = %q{TODO: Write a short summary, because RubyG... | 44.866667 | 87 | 0.665676 |
f81bcec332f4b82dc8db4e38eb3858cb5ea62450 | 471 | require 'httparty'
class Movie < ApplicationRecord
include HTTParty
has_many :user_queues
has_many :users, through: :user_queues
default_params :output => 'json'
format :json
def self.get_movies
get("https://api.themoviedb.org/3/search/movie?api_key=3d6fab529007c80701a5d4ed2a0df61e&language=en-US&que... | 31.4 | 250 | 0.653928 |
d538fbf2231479250447575fbc0e06a5688593bc | 7,927 | require 'test_helper'
class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
def fixture(name)
File.open(File.join("#{File.expand_path(File.dirname(__FILE__))}", 'fixtures', name)).read
end
def test_command_line
doc = ExtendedMarkdownFilter.to_document(fixture('command_line.md'), {})
asse... | 38.480583 | 156 | 0.712249 |
e90ffe0cb033708b0d238f79685665993f1d5f4e | 2,522 | # frozen_string_literal: true
require "active_record_doctor/detectors/base"
module ActiveRecordDoctor
module Detectors
# Detect indexes whose function can be overtaken by other indexes. For example, an index on columns A, B, and C
# can also serve as an index on A and A, B.
class ExtraneousIndexes < Bas... | 26.547368 | 115 | 0.584853 |
6266c51e3c242fd09555309e8a0778aec8fcf5d4 | 2,146 | # server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:
# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
# server "example.com", user: "deploy", roles: %w{ap... | 34.063492 | 88 | 0.669152 |
1af1ebb63d7faa5571917956271cf2cda3659853 | 447 | #
# Cookbook Name:: cookbook-openshift3
# Recipe:: adhoc_reset
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
server_info = OpenShiftHelper::NodeHelper.new(node)
is_control_plane_server = server_info.on_control_plane_server?
openshift_reset_host node['fqdn'] do
not_if { is_control_plane_server }
end
incl... | 23.526316 | 63 | 0.794183 |
edb85b55c7fe986479a1542e4728411a7c06caaf | 1,879 |
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE.txt file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
... | 30.803279 | 81 | 0.691325 |
01c92f92a884511f7826065af7a9d49aaa8a55f8 | 1,989 | # frozen_string_literal: true
RSpec.describe Lic::Plugin::API::Source do
let(:uri) { "uri://to/test" }
let(:type) { "spec_type" }
subject(:source) do
klass = Class.new
klass.send :include, Lic::Plugin::API::Source
klass.new("uri" => uri, "type" => type)
end
describe "attributes" do
it "allo... | 23.963855 | 78 | 0.600804 |
bb9d61a6b16a3e77ad13f1caa008655081a1f1e8 | 3,153 | # Play nice with Ruby 3 (and rubocop)
# frozen_string_literal: true
module PafsCore
module StandardOfProtection
STANDARD_OF_PROTECTION_FLOODING = %i[
very_significant
significant
moderate
low
].freeze
STANDARD_OF_PROTECTION_COASTAL_BEFORE = %i[
less_than_one_year
one_... | 29.745283 | 91 | 0.697748 |
abfca768ecad2f51488891e48451a277a6527e2e | 1,983 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
appPackage = JSON.parse(File.read(File.join('..', 'app', 'package.json')))
coreVersionDetected = appPackage['version']
coreVersionRequired = package['peerDependencies'][appPackage['name']]
firebase_sdk_version = appPackage['sdkVersions'... | 43.108696 | 193 | 0.660615 |
79404691b1ad66cecd3410df0edd9eaad02a81a4 | 820 | module Battle
module Effects
class Ability
class BadDreams < Ability
# Function called at the end of a turn
# @param logic [Battle::Logic] logic of the battle
# @param scene [Battle::Scene] battle scene
# @param battlers [Array<PFM::PokemonBattler>] all alive battlers
... | 34.166667 | 85 | 0.639024 |
79206c1004b837421c4b96f7395958023b6cbfc2 | 766 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'RNXMPP'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.homepage = package['h... | 33.304348 | 119 | 0.558747 |
016cdeb94f01acefb775ea707358f991aa628538 | 1,031 | # frozen_string_literal: true
require 'rails_helper'
require 'models/shared_examples/shared_examples_for_loadable'
require 'models/shared_examples/shared_examples_for_exportable'
RSpec.describe IpedsIcPy, type: :model do
it_behaves_like 'a loadable model', skip_lines: 0
it_behaves_like 'an exportable model', skip... | 28.638889 | 73 | 0.739088 |
f7a02a72e99d843f401c65b8a6a7a01314345be0 | 1,827 | module SemanticFormHelper
def wrapping(type, field_name, label, field, options = {})
help = %Q{<span class="help">#{options[:help]}</span>} if options[:help]
to_return = []
to_return << %Q{<div class="#{type}-field #{options[:class]}">}
to_return << %Q{<label for="#{field_name}">#{label}#{help}... | 35.134615 | 121 | 0.592775 |
6ad685524c03f370dea0054e9b8bccbb433fafeb | 6,650 | #
# Cookbook Name:: rabbitmq
# Recipe:: default
#
# Copyright 2009, Benjamin Black
# Copyright 2009-2013, Opscode, Inc.
# Copyright 2012, Kevin Nuckolls <kevin.nuckolls@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | 33.25 | 161 | 0.699398 |
280b981223017c7ebd562a9d695b2ee11f10ea12 | 10,630 | # frozen_string_literal: true
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is ... | 32.408537 | 106 | 0.667074 |
1ca9979ce0326c45822ec034179bd782489ba9cb | 821 | $:.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "embed_me/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "embed_me"
spec.version = EmbedMe::VERSION
spec.authors = ["Tobias Bohn"]
spec.email = ["info@t... | 39.095238 | 129 | 0.700365 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.