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 |
|---|---|---|---|---|---|
bf00128d8b38dcd90f418b675946937f213cac19 | 1,611 | module Noticed
module DeliveryMethods
class Base < Noticed.parent_class.constantize
extend ActiveModel::Callbacks
define_model_callbacks :deliver
attr_reader :notification, :options, :recipient, :record
def perform(args)
@notification = args[:notification_class].constantize.new(a... | 26.85 | 85 | 0.611421 |
2666f2777ee7c4e9311880604d3b3e70fb65f7a9 | 467 | # frozen_string_literal: true
module SardonyxRing
module Handlers
class EventHandler
def initialize(event_name, callback)
@event_name = event_name
@callback = callback
end
attr_reader :event_name
def run(app, event)
args = [event].slice(0, @callback.arity)
... | 19.458333 | 48 | 0.627409 |
87d092b4d3887b8afb4474cdecb8a4b9ee270f36 | 1,388 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_u... | 39.657143 | 99 | 0.752882 |
26b7d58520006ae068c290fffe01dd9050d5d87a | 2,739 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'spec_helper'
require 'json'
# Un... | 36.52 | 119 | 0.765608 |
1d7c4b579db5504546431b0f9bc254c780ba64f5 | 1,092 | class SessionsController < ApplicationController
def new
end
def create
if params[:session]
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
session[:user_id] = user.id
... | 32.117647 | 92 | 0.56685 |
086ca6866bbba7c9ba54d82656265e5b2473ff3b | 6,720 | require 'tmpdir'
module TDAmeritradeApi
module PriceHistory
include BinDataTypes
PRICE_HISTORY_URL='https://apis.tdameritrade.com/apps/100/PriceHistory'
INTERVAL_TYPE=[:minute, :daily, :weekly, :monthly]
PERIOD_TYPE=[:day, :month, :year, :ytd]
# +get_price_history+ allows you to send a price hi... | 37.333333 | 137 | 0.628869 |
5dc2147b7714370c208c7f0d88bacb4ca186c561 | 1,847 | # 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 source for your
# dat... | 41.977273 | 98 | 0.707634 |
91c6fd16ca88b68ef43d8e4154fcc1f9edf6d448 | 1,400 | module Spree
module Api
module V1
class ZonesController < Spree::Api::BaseController
def create
authorize! :create, Zone
@zone = Spree::Zone.new(zone_params)
if @zone.save
respond_with(@zone, status: 201, default_template: :show)
else
i... | 25 | 149 | 0.551429 |
2841a3cbc9126ef2c9b59a1632860d3948ba98e5 | 1,577 | class AccountsController < ApplicationController
before_action :require_login, :owner_access
before_action :include_account?, :only => [:show, :edit, :destroy]
#GET
def index
@user = current_user
@accounts = @user.accounts
end
def new
if params[:card_id]
@account = Account.new(:user_id => current_us... | 25.435484 | 120 | 0.700698 |
11603a2d368aec29c4c750ef7c84a8b4e99c793a | 2,091 | #
# Cookbook Name:: wazuh_server
# Library:: helpers
#
# Copyright 2015, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 30.75 | 76 | 0.630799 |
ede3fae820d6303fa760af1b740bc2069eb2654a | 158 | class Shapes::Primitives::FloatShadow < Shadows::Base
def form
render_shape(:form)
end
def form_for_struct
render_shape(:form_struct)
end
end
| 17.555556 | 53 | 0.734177 |
f7c7ca61ac38fd812e8e5f6bc46ca4cfd41b3090 | 15,181 | # encoding: utf-8
require 'test_helper'
class ServicesTest < Test::Unit::TestCase
# --- Google ---
def test_google_result_components
result = Geocoder.search("Madison Square Garden, New York, NY").first
assert_equal "Manhattan",
result.address_components_of_type(:sublocality).first['long_name']
e... | 35.804245 | 213 | 0.720045 |
01af64add067b788f0dc0715939d01112f1754c3 | 893 | # frozen_string_literal: true
module DeviseSecurity::Patches
module SessionsControllerCaptcha
extend ActiveSupport::Concern
included do
define_method :create do |&block|
if valid_captcha_if_defined?(params[:captcha])
self.resource = warden.authenticate!(auth_options)
set_fla... | 33.074074 | 76 | 0.683091 |
1a40eed0dc35df34137625eeb63ed9cc81161111 | 2,091 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 36.684211 | 85 | 0.76088 |
aca5b0e5d96af465706db3d12a92a639c0102764 | 288 | # Where the I18n library should search for translation files
I18n.load_path += Dir[Rails.root.join('lib', 'locale', '*.{rb,yml}')]
# Permitted locales available for the application
I18n.available_locales = [:cs]
# Set default locale to something other than :en
I18n.default_locale = :cs | 36 | 69 | 0.75 |
337362f8400da562de53a7c970302da6b8e90c2f | 9,756 | require 'spec_helper'
describe 'elasticsearch::plugin', :type => 'define' do
let(:title) { 'mobz/elasticsearch-head/1.0.0' }
let :facts do {
:operatingsystem => 'CentOS',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystemmajrelease => '6',
:scenario => '',
:common => ''
} end
... | 56.393064 | 350 | 0.661952 |
280d93e688300f40a8bed77c8edcd518ea79a102 | 1,147 | class FrogsController < ApplicationController
before_action :set_frog, only: [:show, :edit, :update, :destroy]
def index
@frogs = Frog.all
end
def show
end
def new
@frog = Frog.new
end
def edit
end
def create
@frog = Frog.new(frog_params)
... | 20.482143 | 89 | 0.56408 |
f840604cb4244ee45a3a8c17843e10ab76f59846 | 301 | require 'spec_helper'
describe 'bindings test', type: :feature, sauce: true do
it 'should change the title when changing pages' do
visit '/'
expect(page).to have_title 'KitchenSink - KitchenSink'
click_link 'Bindings'
expect(page).to have_title 'Bindings - KitchenSink'
end
end
| 23.153846 | 58 | 0.714286 |
91d2526cde28bece292cba0d12f59b6f26678c8d | 2,220 | # frozen_string_literal: true
def check_content_matches_extension!(file = double(read: nil, path: ''))
magic_file = UploadTypeCheck::MagicFile.new(file)
uploader.check_content_matches_extension!(magic_file)
end
shared_examples 'upload passes content type check' do
it 'does not raise error' do
expect { check... | 33.636364 | 91 | 0.768919 |
267e491a811417992016b0d6437ee36df0599ffb | 1,464 | class UsersController < ApplicationController
load_and_authorize_resource
skip_before_filter :authenticate_user!, :only => [ :index, :show ]
skip_before_action :verify_authenticity_token, :only => [:add_keyword, :delete_keyword ]
def index
@users = User.all
end
def show
@user = User.fin... | 24 | 90 | 0.663934 |
01dd270d088fa9c140ea23066be3c07c128521db | 6,955 | require 'core_ext/xml_mini'
require 'core_ext/hash/keys'
require 'core_ext/string/inflections'
require 'core_ext/object/to_param'
require 'core_ext/object/to_query'
class Array
# Converts the array to a comma-separated sentence where the last element is
# joined by the connector word.
#
# You can pass the foll... | 32.806604 | 134 | 0.597987 |
ff22e9f57b20e9d70daa2832fa39e421c7a64467 | 1,140 | # 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
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-datasync'
spec.version = File.read(Fil... | 38 | 117 | 0.659649 |
f8c15d1d52d50cb0ac9501753330ec923c5d5292 | 1,528 | require 'test_helper'
class MicropostsCreateTest < ActionDispatch::IntegrationTest
def setup
@user = users(:user)
end
test 'should error on empty content' do
login_as(@user)
assert_no_difference 'Micropost.count' do
post root_path, params: {
micropost: { content: '' }
}
end
... | 25.04918 | 83 | 0.659031 |
bbbe5ab87eb0c8055b82ab13eacc9ad748132734 | 1,823 | require 'spec_helper'
describe 'security_apache_bad_cipher' do
let(:msg) { 'Unsecure ciphers used (security!)' }
context 'with fix disabled' do
context 'code having unsecure ciphers' do
let(:code) { "
class { 'apache::mod::ssl':
ssl_compression => false,
ssl_options => [ 'StdEnvVa... | 36.46 | 602 | 0.657707 |
790d5270cc8a6337659d505133c9da4341fee2bb | 191 | class CreateRequesters < ActiveRecord::Migration
def change
create_table :requesters do |t|
t.string :email_address
t.integer :cart_id
t.timestamps
end
end
end
| 17.363636 | 48 | 0.685864 |
6a1d759c08a1067fe01eafe055c2077e47893845 | 295 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Load heroku vars from local file
heroku_env = File.join(Rails.root, 'config', 'heroku_env.rb')
load(heroku_env) if File.exists?(heroku_env)
# Initialize the rails application
Dealbook::Application.initialize!
| 29.5 | 61 | 0.779661 |
87e8470d6ccce38bef027fe8b8517a01fb3c06ce | 5,627 | # 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::Monitor::Mgmt::V2018_03_01
module Models
#
# Criterion for dynamic threshold.
#
class DynamicMetricCriteria < MultiMetricCri... | 31.971591 | 79 | 0.473254 |
286b0bddd5a5b74d3fac5b6b6cc93f3203456b69 | 222 | class CreateOrders < ActiveRecord::Migration[5.0]
def change
create_table :orders do |t|
t.references :user, foreign_key: true
t.references :event, foreign_key: true
t.timestamps
end
end
end
| 20.181818 | 49 | 0.68018 |
1c531baa262e119c6c7f0c6128c7fb2f85a8ae10 | 98 | Rails.application.config.after_initialize do
require 'redcloth_latex_formatter_patch/patch'
end
| 24.5 | 48 | 0.867347 |
e21fcd3fa8b5ee72d6a245ae54f65e96c9ad58c8 | 182 | class HomeController < ApplicationController
include CurrentLanguage
def index
@current_lang = current_language
@recommended_tags = Ohanakapa.recommended_tags
end
end
| 20.222222 | 50 | 0.796703 |
0114406e5ad8fae30f89351e14d1298c7d9b8480 | 2,010 | # frozen_string_literal: true
#
# This concern provides common reminder methods for lesson_plan_items, specifically reminders:
# - When the lesson_plan_item is open for students to attempt
#
# When including this concern, the model is to implement the following for the reminders:
# - #{Model-Name}::OpeningReminderJ... | 35.263158 | 98 | 0.759204 |
61e33fa202b52cbf70a12e8b12c2f0c32fc87fed | 124 | require 'test_helper'
class MySightingTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.5 | 46 | 0.709677 |
792ec18842770854e113d96e50a6aed53e90328e | 2,257 | #
# Author:: Adam Edwards (<adamed@chef.io>)
# Author:: Jay Mundrawala (<jdm@chef.io>)
# Copyright:: Copyright 2015-2016, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | 26.552941 | 85 | 0.590164 |
8751de7f271f63e8b6d2e7a4dfcee804217a4cde | 165 | class AddBrowserIdsToScreenshotJobs < ActiveRecord::Migration
def change
add_column :screenshots_jobs, :browser_ids, :text, array: true, default: []
end
end
| 27.5 | 79 | 0.769697 |
629860e04af1e57fe65ec103e2e503f033e01586 | 2,554 | describe Fastlane do
describe Fastlane::FastFile do
describe "Backup xcarchive Integration" do
let (:source_path) { "/tmp/fastlane/tests/fastlane" }
let (:destination_path) { "#{source_path}/dest" }
let (:xcarchive_file) { "fake.xcarchive" }
let (:zip_file) { "fake.xcarchive.zip" }
l... | 38.119403 | 155 | 0.61433 |
39bf7320f7dd45af1365a93769198cc373f771aa | 411 | # coding: utf-8
# Process :word_right
module MiniReadline
# Process :word_right
class Edit
# A little more to the right please!
def word_right(_keyboard_args)
if @edit_posn < length
right = @edit_buffer[(@edit_posn+1)..-1]
@edit_posn = (posn = right.index(/\s\S/)) ? @edi... | 20.55 | 79 | 0.588808 |
4a22e99675b75ee8ec2775adc92f83c7425372dc | 19,760 | # encoding: utf-8
require 'spec_helper'
describe RuboCop::Cop::Style::SpaceAroundOperators, :config do
subject(:cop) { described_class.new(config) }
let(:cop_config) { {} }
it 'accepts operator surrounded by tabs' do
inspect_source(cop, "a\t+\tb")
expect(cop.messages).to be_empty
end
it 'accepts ... | 37.709924 | 80 | 0.560172 |
5d8026a9ca14ace7dc47bf7dcd51f6acfb8602ed | 2,447 | require 'abstract_unit'
class TestAutoloadModule < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
module ::Fixtures
extend ActiveSupport::Autoload
module Autoload
extend ActiveSupport::Autoload
end
end
test "the autoload module works like normal autoload" do
module :... | 30.5875 | 93 | 0.729873 |
1d24298b4c892a6ecf092d4ce6c49c21125d910c | 856 | class DocumentationPage
@@templates = {}
def self.templates
@@templates.keys
end
def render(path, hash=nil)
@@templates[path] = File.read(path + ".html.erb") if @@templates[path].nil?
unless hash.nil?
hash.each do |key, value|
self.instance_variable_set("@#{key}".to_sym, value)
... | 17.833333 | 79 | 0.607477 |
1ae6a4fcc2a8c71c2d2ac5ad10eded6096858400 | 12,646 | $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require 'rubydoctest'
require 'statement'
require 'result'
require 'special_directive'
require 'code_block'
require 'test'
module RubyDocTest
class Runner
attr_reader :groups,... | 32.096447 | 109 | 0.530603 |
61d9fa26486c4a2dfaddb1da7eab33b7c413e64f | 2,289 | require 'cerberus/manager'
require 'cerberus/utils'
require 'cerberus/constants'
module Cerberus
class CLI
def initialize(*args)
say HELP if args.empty?
command = args.shift
cli_options = extract_options(args)
case command
when 'add'
path = args.shift || Dir.pwd
c... | 27.578313 | 94 | 0.609873 |
79aff51195af20c6181c8341f550b6a994f0d54a | 3,333 | # encoding: utf-8
Given /^I request the item view for (.*?)$/ do |bibid|
patiently do
visit "/catalog/#{bibid}"
page.find("#doc_#{bibid}", visible: :all)
end
end
Given /^I attempt the item view for (.*?)$/ do |bibid|
# this version does not check for bibid exists
visit "/catalog/#{bibid}"
end
Given("I... | 27.775 | 112 | 0.648065 |
1de61e5940b61e869e9ca13a653dab8b4d072535 | 691 | require 'active_support/concern'
module GeographicRatingAreaConcern
extend ActiveSupport::Concern
included do
include Mongoid::Document
include Mongoid::Timestamps
# An area that all issuers in the state must uniformly use as part of their rate setting
# Rating areas are made up of counties, metro... | 27.64 | 94 | 0.759768 |
acdd5c6f283339d0ed12f4451c377a78ac413643 | 13,271 | # frozen_string_literal: true
require "active_support/core_ext/hash/except"
require "rails/generators/rails/app/app_generator"
require "date"
module Rails
# The plugin builder allows you to override elements of the plugin
# generator without being forced to reverse the operations of the default
# generator.
#... | 28.975983 | 150 | 0.623314 |
1db6287529f82193f74c2d701c5b2ac24bcbd826 | 1,262 | class UserController < ApplicationController
get '/signup' do
if !logged_in?
erb :'users/signup'
else
redirect '/stories'
end
end
post '/signup' do
user = User.all.find{|user| user.username == params[:username]}
user ||= User.all.find{|user| user.email == params[:email]}
if u... | 23.37037 | 106 | 0.637084 |
6276028d71b040d1f396cd5a2fa65ded69c92826 | 1,628 | cask "iterm2" do
# NOTE: "2" is not a version number, but an intrinsic part of the product name
if MacOS.version <= :high_sierra
version "3.3.12"
sha256 "6811b520699e8331b5d80b5da1e370e0ed467e68bc56906f08ecfa986e318167"
else
version "3.4.13"
sha256 "b3c28d4e207e400baebbbfc7021ffb001fef1432b72b3ade... | 36.177778 | 142 | 0.738943 |
01fc6e6e2a348c81ccd4ac5e49d83b3ce8b124e0 | 456 | # frozen_string_literal: true
object @score_unit
attributes :id, :weight, :score_type, :title, :subdomain_id, :base_point_score,
:institution_type, :notes
node :question_identifiers, &:question_identifiers
node :option_score_count, &:option_score_count
node :domain_id, &:domain_id
child :option_scores ... | 25.333333 | 79 | 0.778509 |
d5502f5cb414f8dc769a41416e3f6b55916aac6d | 1,088 | # frozen_string_literal: true
require 'set'
require_relative 'base'
module TTFunk
module Subset
class Unicode < Base
SPACE_CHAR = 0x20
def initialize(original)
super
@subset = Set.new
use(SPACE_CHAR)
end
def unicode?
true
end
def to_unicode_... | 18.440678 | 69 | 0.544118 |
265cdff64308cf49d5e33bccae41d398f58baf2e | 802 | require 'formula'
class Mksh < Formula
homepage 'https://mirbsd.org/mksh.htm'
url 'http://mirbsd.org/MirOS/dist/mir/mksh/mksh-R50c.tgz'
sha1 '64af48cca823962b96720ed8a49621aad398dd0a'
bottle do
cellar :any
sha1 "372be194ac428fa9e0b9a8d0da0a61749d2d7371" => :mavericks
sha1 "ca9e90bb5732b0f03ec46c58... | 28.642857 | 87 | 0.690773 |
38bebbcb8e714bedf661396455e38f50d7bd12f6 | 183 | class ChangeTagsToTextOnItems < ActiveRecord::Migration
def self.up
change_column :items, :tags, :text
end
def self.down
change_column :items, :tags, :string
end
end
| 18.3 | 55 | 0.721311 |
1d9d713b3689d0649e86a8eda6ab056f743f2752 | 1,068 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Create a new work in a deposited collection', js: true do
let(:user) { create(:user) }
let(:collection_version) { create(:collection_version, :deposited, collection: collection) }
let(:collection) { create(:collection, :depositor_selects_acces... | 29.666667 | 94 | 0.722846 |
ab56ac4337b79bd3294d03f9a493b7efab6a0e4e | 1,193 | class Pinfo < Formula
desc "User-friendly, console-based viewer for Info documents"
homepage "https://alioth.debian.org/projects/pinfo/"
url "https://alioth.debian.org/frs/download.php/file/3351/pinfo-0.6.10.tar.bz2"
sha256 "122180a0c23d11bc9eb569a4de3ff97d3052af96e32466fa62f2daf46ff61c5d"
bottle do
sha2... | 35.088235 | 92 | 0.701593 |
e2a134c4420896e11b141fd31b25052712a11b97 | 6,553 | # frozen_string_literal: true
require 'json'
module Oso
module Polar
# A single Polar query.
class Query # rubocop:disable Metrics/ClassLength
include Enumerable
# @param ffi_query [FFI::Query]
# @param host [Oso::Polar::Host]
def initialize(ffi_query, host:)
@calls = {}
... | 36.814607 | 129 | 0.607355 |
f83828f78bdd60ff198a874b2cda6364a50dace4 | 143 | class Object
# Converts to a string to be uglified
# Example :NiceTitle -> nicetitle (String)
def uglify
self.to_s.uglify
end
end | 15.888889 | 44 | 0.699301 |
61301794dc3899b1949c75409027729c82614eb7 | 569 | class UsersController < ApplicationController
def index
begin
redirect_to User.first
rescue Exception
raise "Seems like you have'nt created any sample record. Please run: rake rest_in_place:create_sample"
end
end
def show
@user = User.find params[:id]
@roles = Role.f... | 20.321429 | 108 | 0.646749 |
f8a60d0a18d16797633cde12bd82aafcaf3838ab | 596 | # frozen_string_literal: true
require 'dry-struct'
module LoveLetterApplication
module Models
class Card
include Dry::Initializer.define -> do
option :id, ::Types::Coercible::Integer
option :rank, ::Types::Coercible::Integer
option :targetable?, as: :targetable, type: ::Types::Stri... | 24.833333 | 88 | 0.620805 |
aca9d8eb5f212248164b3c5a060a46428c884960 | 2,773 | # Copyright (c) 2007-2021 Andy Maleh
#
# 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,
# d... | 29.817204 | 108 | 0.617743 |
03fac98c6f6fa32f522702a4d4385fa2fc5b110e | 1,793 | configatron.product_name = "spidersuite"
# List of items to confirm from the person releasing. Required, but empty list is ok.
configatron.prerelease_checklist_items = [
"Sanity check the master branch.",
"Unit tests passed."
]
def package_version()
file = File.read "package.json"
data = JSON.parse(file)
d... | 31.45614 | 177 | 0.771891 |
ff0a457cf0447d5cfe7f8880bc264bdbd1a10926 | 192 | namespace :data_works do
desc "tell data_works that the model relationships are accurate"
task :bless => :environment do
DataWorks::StaleRelationshipChecker.create_snapshot!
end
end
| 27.428571 | 66 | 0.786458 |
872ebff20f1b6fb419f90ff77a17e84e1fae0fa6 | 1,291 | class Ugrep < Formula
desc "Ultra fast grep with query UI, fuzzy search, archive search, and more"
homepage "https://github.com/Genivia/ugrep"
url "https://github.com/Genivia/ugrep/archive/v2.5.3.tar.gz"
sha256 "83f2017ba05f7ce7ded74097832df071d2be89d41b357f45c4dce801c2a0cae6"
license "BSD-3-Clause"
bottle... | 34.891892 | 93 | 0.666925 |
f7ad1ebc2bfb6779948e8c142c718e8878d0e0b9 | 1,578 | module ActiveScaffold::Bridges
class CountrySelect
module FormColumnHelpers
def active_scaffold_input_country(column, options)
select_options = {:prompt => as_(:_select_), :priority_countries => column.options[:priority] || [:us], :format => column.options[:format]}
select_options.merge!(opt... | 40.461538 | 147 | 0.726869 |
01de202d11c1593a70fe6e458b35dae187b7e900 | 21,011 | require "cases/helper"
class PostgresqlArray < ActiveRecord::Base
end
class PostgresqlRange < ActiveRecord::Base
end
class PostgresqlTsvector < ActiveRecord::Base
end
class PostgresqlMoney < ActiveRecord::Base
end
class PostgresqlNumber < ActiveRecord::Base
end
class PostgresqlTime < ActiveRecord::Base
end
class... | 35.018333 | 179 | 0.717719 |
4ae897e5296012ad9f1a7a7ff9e2c29571d3c244 | 7,072 | # frozen_string_literal: true
# Copyright, 2018, 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 restriction, including withou... | 33.67619 | 204 | 0.704186 |
1a255d7a9ddff20a07251c8bb08f02d2d35d3b16 | 128 | class PagesController < ApplicationController
def index
end
def home
end
def profile
end
def explore
end
end
| 9.142857 | 45 | 0.710938 |
7a7c6209ab461a293ce090fcfa506e18164bde5a | 203 | RSpec.describe BlackwelderViewTool do
it "has a version number" do
expect(BlackwelderViewTool::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 20.3 | 54 | 0.73399 |
ab696e9b4a7e51f9896f9fd8a9da045c3c95074a | 1,089 | # The #tmp method provides a similar functionality
# to that of Dir.tmpdir. This helper can be overridden
# by different implementations to provide a more useful
# behavior if needed.
#
# Usage in a spec:
#
# File.open(tmp("tags.txt"), "w") { |f| f.puts "" }
#
# The order of directories below with "/private/tmp"
# pr... | 32.029412 | 71 | 0.663912 |
ac480eae917d8a9efa9eaf0732a1784258e4920a | 3,901 | # Copyright:: Copyright 2021 Trimble Inc.
# License:: The MIT License (MIT)
# SketchUp's drawing axes consist of three colored lines (red, green, blue),
# usually perpendicular to each other, displayed in the drawing area. The
# exception is when the user open an instance with a non-orthogonal
# transformation. The ro... | 26.006667 | 80 | 0.673161 |
082c72419517c1e3a9d807f8e960d90ea2b4cd2a | 4,709 | require 'rails_helper'
RSpec.describe BooksController, type: :controller do
before do
@user = FactoryGirl.create(:user)
end
describe "#index" do
before do
controller_sign_in_as(@user)
end
it "assigns all books to @books" do
get :index
expect(assigns(:books)).to match_array(Boo... | 24.398964 | 75 | 0.626035 |
bfd6b0955a567e1451fcf1851494487f854c630e | 73 | json.array! @components, partial: 'components/component', as: :component
| 36.5 | 72 | 0.767123 |
61620dda85790e09706a7c3565f001542c1dc59f | 147 | class AddColumnSubstanceToColumns < ActiveRecord::Migration
def change
add_column :columns, :substance, :string, after: :writer_id
end
end
| 24.5 | 63 | 0.77551 |
4a76583e71741ba8c020286c1d710a6dd86bdec5 | 1,143 | module Integral
# Handles listable behaviour
module ActsAsListable
class << self
# Keeps a track of listable objects
attr_writer :objects
end
# Accessor for listable objects
def self.objects
@objects ||= []
end
ActiveSupport.on_load(:active_record) do
# ActiveRecor... | 29.307692 | 122 | 0.63867 |
7a4bc908d54e8954abf18cd7deb424af5fd9c6bf | 6,077 | class Gws::UsersController < ApplicationController
include Gws::BaseFilter
include Gws::CrudFilter
model Gws::User
prepend_view_path "app/views/sys/users"
# navi_view "gws/main/conf_navi"
navi_view 'gws/user_conf/navi'
before_action :set_selected_items, only: [:destroy_all, :lock_all, :unlock_all]
p... | 27.008889 | 122 | 0.664966 |
082607f2fafa4d1a41f952e038740f8281769db7 | 13,005 | class Dbt < Formula
include Language::Python::Virtualenv
desc "Data build tool"
homepage "https://github.com/fishtown-analytics/dbt"
url "https://files.pythonhosted.org/packages/1e/a0/d75ae9f42939e40442422592847f10339e68cfcf83fa2566142c5eb2183b/dbt-0.7.1.tar.gz"
sha256 "47cfb828590e25420ebbcdbfcad2e5afde36b3... | 47.119565 | 157 | 0.811688 |
bf4506575a13bb921fb68817a3bf45bac6d83db7 | 69 | # frozen_string_literal: true
module Tolken
VERSION = "0.3.6"
end
| 11.5 | 29 | 0.724638 |
abafd57e27fa423eafbcf44fd043033e18bef682 | 1,866 | require 'test_helper'
ActionController::Base.prepend_view_path File.join(File.dirname(__FILE__), '..', '..', 'app', 'views')
ActionController::Base.prepend_view_path File.join(File.dirname(__FILE__), '..', 'fixtures', 'app', 'views')
class Flutie::StyleguidesControllerTest < ActionController::TestCase
def self.shou... | 32.172414 | 108 | 0.699357 |
2175887b6d6ebebbc2653ff496e2b331c09dc737 | 4,410 | # frozen_string_literal: true
module MesscadaApp
module CartonFactory
def create_carton(opts = {})
id = get_available_factory_record(:cartons, opts)
return id unless id.nil?
opts[:carton_label_id] ||= create_carton_label
opts[:palletizer_identifier_id] ||= create_personnel_identifier
... | 42.403846 | 102 | 0.693651 |
bfe34bb5bc2ad8ab3cf2e555959acc7c42c47384 | 541 | require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
require "minitest/pride"
require "logger"
require "byebug"
# for debugging
# ActiveRecord::Base.logger = Logger.new(STDOUT)
# migrations
def establish_connection
ActiveRec... | 21.64 | 82 | 0.774492 |
abd873e4bed6015532ede8d1a12c108d6d92b909 | 2,722 | # 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 source for your
# dat... | 33.604938 | 86 | 0.714181 |
03c1ad7a3ccd4c12feeff52776a06a7ad243ccd9 | 931 | # Copyright (c) 2014-2015 Pivotal Software, Inc.
# All rights reserved.
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIG... | 38.791667 | 124 | 0.73362 |
ab4759997dab2d36dfea5d462d29bb7b795818be | 2,103 | require 'pry'
require 'simplecov'
SimpleCov.start do
project_name "sentry-raven"
root File.join(__FILE__, "../../../")
coverage_dir File.join(__FILE__, "../../coverage")
end
if ENV["CI"]
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
require 'sentry_raven_without_integrations'
R... | 23.10989 | 78 | 0.728008 |
18ef34ae4c49c5e5bac14fd3ec9e1e0151b366cf | 32 | module PromotionCodesHelper
end
| 10.666667 | 27 | 0.90625 |
f753b458b851eb76cc62983a64a0cfa06e2a7705 | 370 | #
# Cookbook:: pathfinder-mono
# Recipe:: user
#
# Copyright:: 2018, Pathfinder CM.
#
#
group node[cookbook_name]['app_group'] do
system true
end
user node[cookbook_name]['app_user'] do
comment "#{node[cookbook_name]['app_user']} user"
group node[cookbook_name]['app_group']
system true
manage_home true
ho... | 18.5 | 51 | 0.708108 |
f80c5b22556224d411259ded4562f5a427a6567a | 2,959 | require File.expand_path("../../../../base", __FILE__)
require Vagrant.source_root.join("plugins/commands/ssh_config/command")
describe VagrantPlugins::CommandSSHConfig::Command do
include_context "unit"
include_context "virtualbox"
let(:iso_env) do
# We have to create a Vagrantfile so there is a root path... | 26.419643 | 100 | 0.639067 |
911719eebc3df99cf98951c7fe4315406599007b | 1,033 | require 'json'
require 'sinatra/base'
require 'sinatra/cross_origin'
require 'sinatra/cors'
class Settings
def self.set_psm(bool)
@psm = bool
end
def self.temperature
@temperature ||= 20
end
def self.psm
@psm ||= false
end
def self.city
@city ||= "London"
end
def self.set_temp(te... | 15.892308 | 54 | 0.647628 |
bfa6234fca8f761ff14cc71b83c218f49460892b | 131 | FactoryBot.define do
factory :access do
user
association :accessible, factory: :recipe
status { 'PUBLIC' }
end
end
| 16.375 | 45 | 0.679389 |
1d350ce667dd7a969f414e5bf814365e8c9b6578 | 8,828 | require 'pxp-agent/test_helper.rb'
require 'pxp-agent/bolt_pxp_module_helper.rb'
require 'digest/sha2'
test_name 'When certs have been revoked in CRL' do
tag 'audit:high', # module validation: no other venue exists to test
'audit:acceptance'
# init
test_env = 'bolt'
non_master_agents = agents.rejec... | 48.773481 | 118 | 0.689284 |
b9016c939595090aecfce96ad84b306052ae615a | 906 | Puppet::Type.newtype(:contrail_plugin_ini) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/contrail/contrail_plugin.ini'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
valu... | 21.069767 | 80 | 0.628035 |
7a7a40cf9a362181104e6b12f0441356b4718db1 | 3,075 | module Intrigue
module Ident
module SmbCheck
class Base
include Intrigue::Ident::BannerHelpers
def self.inherited(base)
Intrigue::Ident::Smb::CheckFactory.register(base)
end
def _protocol_capture(content, regex, filter = [])
return nil unless content['de... | 31.701031 | 76 | 0.614634 |
61fb8bae61644262cc871e259f2af0d4d1b0b83a | 1,623 | # frozen_string_literal: true
# typed: true
module WorkOS
# The Organization class provides a lightweight wrapper around
# a WorkOS Organization resource. This class is not meant to be instantiated
# in user space, and is instantiated internally but exposed.
class Organization
extend T::Sig
attr_acces... | 28.473684 | 103 | 0.667283 |
f89de1f711e83a92823ad1a134b3cb9c6921ef85 | 2,993 | require 'sprockets_test'
require 'shellwords'
require 'tmpdir'
class TestSprockets < Sprockets::TestCase
parallelize_me!
def setup
super
@env = Sprockets::Environment.new(".") do |env|
env.append_path(fixture_path('default'))
end
@dir = Dir.mktmpdir("sprockets")
end
def teardown
Fi... | 33.255556 | 200 | 0.66856 |
e2abf8007f56921e94d314119c6b8e9faa77c64a | 2,026 | #
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
# Cookbook Name:: git
# Attributes:: default
#
# Copyright 2008-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 License at
#... | 49.414634 | 154 | 0.71076 |
1108f48c1409022a25959c69d155bb6d46fde51d | 1,003 | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "digest-murmurhash"
spec.version = "1.1.1"
spec.authors = ["ksss"]
spec.email = ["co000ri@gmail.com"]
spec.description = %q{digest-murmurhash is class collections of use algorithm MurmurHash desiged by Austin Appleby.... | 41.791667 | 120 | 0.684945 |
032360cb8014759f86fcb41d22db1f3f4cd432bb | 1,472 | #
# Author:: Steven Danna (<steve@chef.io>)
# Copyright:: Copyright 2014-2016, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# 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 ... | 33.454545 | 90 | 0.626359 |
1d0faa711319def3c5802e603878f14eb5fe56d6 | 2,362 | # 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::V2019_04_01
module Models
#
# Describes The zonal capabilities of a SKU.
#
class ResourceSkuZoneDetails
include MsRestAz... | 30.282051 | 77 | 0.489416 |
ffb8d7db069dc6a53658204835e17d8948f16eeb | 2,753 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Array#-" do
it "creates an array minus any items from other array" do
([] - [ 1, 2, 4 ]).should == []
([1, 2, 4] - []).should == [1, 2, 4]
([ 1, 2, 3, 4, 5 ] - [ 1, 2, 4 ]).shoul... | 31.284091 | 116 | 0.594987 |
28a831089352467bf324392e95b488cd439b0b58 | 3,497 | require 'net/http'
require 'rubygems'
require 'nokogiri'
require 'cgi'
require 'meme/version'
require 'meme/generators'
##
# Generate memes using http://memegenerator.net
module Meme
class Generator
##
# Sometimes your meme will have an error, fix it!
class Error < RuntimeError; end
... | 24.454545 | 113 | 0.59022 |
bb559389cdf50fe75f06008ef2e67f0464ddb98d | 2,142 | # Copyright 2015 Chris Marchesi
#
# 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 writin... | 34.548387 | 95 | 0.703081 |
f74fe211f10fad4c10d66f7edaa25ff91bf56d1e | 823 | class Addmissingindex < ActiveRecord::Migration[4.2]
def change
add_index :users, :uuid, unique: true
add_index :users, :hruid, unique: true
add_index :users, :is_gadz
add_index :ml_external_emails, :email
add_index :ml_external_emails, :list_id
add_index :alias... | 29.392857 | 57 | 0.718104 |
bfdd5cf707792da265a3fca4045c48c08b4383ec | 2,136 | class VehicleBrandsController < ApplicationController
before_action :set_vehicle_brand, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource
skip_load_resource only: [:create]
# GET /vehicle_brands
# GET /vehicle_brands.json
def index
@vehicle_brands = VehicleBrand.all
end
# GET ... | 27.384615 | 101 | 0.696161 |
bb7e3aacae46b66395bee225439d4f67084c416d | 10,332 | require 'fog/core'
require 'fog/xml'
require 'fog/json'
require 'fog/aws/credential_fetcher'
require 'fog/aws/region_methods'
require 'fog/aws/signaturev4'
module Fog
module AWS
extend Fog::Provider
service(:auto_scaling, 'AutoScaling')
service(:beanstalk, 'ElasticBeanstalk')
service(:cdn, ... | 29.947826 | 251 | 0.565718 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.