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 |
|---|---|---|---|---|---|
0316afc9bc2fab3aca3ccb67da8916578a12f03b | 326 | class CreateServices < ActiveRecord::Migration
def change
create_table :services do |t|
t.string :service_class
t.string :name
t.string :seo_index
t.text :summary
t.text :description
t.timestamps
end
add_index(:services, [:service_class, :seo_index], :unique=>true)
en... | 23.285714 | 69 | 0.662577 |
4a28d92c311c2b8f9451ebf3ef81e09c96b1a496 | 744 | cask 'extraterm' do
version '0.41.2'
sha256 'da247aaf8ed06fe22ba270a9a2c1eee34f7afde2e822b96c1b9deb10c047a9fd'
# github.com/sedwards2009/extraterm was verified as official when first introduced to the cask
url "https://github.com/sedwards2009/extraterm/releases/download/v#{version}/extraterm-#{version}-darwin-... | 39.157895 | 115 | 0.716398 |
ac549a4a99ec9926f1b2acb35a33a6baed3a7713 | 244 | require 'mkmf'
CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
$CFLAGS << ' -O0 -Wall' if CONFIG['CC'] =~ /gcc|clang/
dir_config("gherkin_lexer_zh_cn")
have_library("c", "main")
create_makefile("gherkin_lexer_zh_cn")
| 34.857143 | 74 | 0.70082 |
627e4f1e8cebfd5f50eab8db11abec995698c095 | 10,892 | # frozen_string_literal: true
require "sequel"
require "sequel/model"
require "set"
require "state_machines/sequel"
module Sequel
module Plugins
module StateMachine
class InvalidConfiguration < RuntimeError; end
def self.apply(_model, _opts={})
nil
end
def self.configure(model,... | 42.88189 | 118 | 0.626882 |
f838536d38aac77889a849b676aec993a06a21ef | 951 | class Docui < Formula
desc "TUI Client for Docker"
homepage "https://github.com/skanehira/docui"
url "https://github.com/skanehira/docui/archive/2.0.4.tar.gz"
sha256 "9af1a720aa7c68bea4469f1d7eea81ccb68e15a47ccfc9c83011a06d696ad30d"
license "MIT"
head "https://github.com/skanehira/docui.git"
bottle do
... | 32.793103 | 117 | 0.740273 |
f77a31546da4f722e86bcc7612d72297bc6e0c9e | 3,169 | # encoding: utf-8
require 'test_helper'
require 'json'
require 'digest/md5'
class IntegrityTest < TestCase
test "images on disk correlate 1-1 with emojis" do
images_on_disk = Dir["#{Emoji.images_path}/**/*.png"].map {|f| f.sub(Emoji.images_path, '') }
expected_images = Emoji.all.map { |emoji| '/emoji/%s' % e... | 35.606742 | 112 | 0.619123 |
4aa323fb006cd267a17f85e17e3b1e12ad36fc2c | 7,256 | module ActiveRecord
# Declare an enum attribute where the values map to integers in the database,
# but can be queried by name. Example:
#
# class Conversation < ActiveRecord::Base
# enum status: [ :active, :archived ]
# end
#
# # conversation.update! status: 0
# conversation.active!
# ... | 37.210256 | 96 | 0.597299 |
62201c22f48f19dbfc3ae25ccecf84416bf50832 | 1,787 | require Rails.root.join("config/smtp")
Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = fa... | 45.820513 | 97 | 0.759373 |
ac8b679b7b5dbac30fb526f529651b057d1a17b8 | 3,552 | #!/usr/bin/ruby -w
# PART 10
# The select! method also modifies the original array
# without modifying the object_id:
fruits = ['Green Apple', 'Strawberry', 'Banana', 'Blueberry', 'Raspberry', 'Cranberry', 'Pineapple', 'Blackberry'] # => ["Green Apple", "Strawberry", "Banana", "Blueberry", "Raspberry", "Cranberry",... | 98.666667 | 228 | 0.456644 |
628c2f01613c2be9133b5f119d6247cba8524e56 | 1,202 | # frozen_string_literal: true
module Script
module Layers
module Domain
class ScriptProject
include SmartProperties
UUID_ENV_KEY = "UUID"
property! :id, accepts: String
property :env, accepts: ShopifyCLI::Resources::EnvFile
property! :extension_point_type, accepts... | 20.372881 | 62 | 0.558236 |
bb64c9997643f34be6cc0be37090f98d800b0da2 | 5,105 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.780702 | 114 | 0.76572 |
e8caf1eb5954d0b1f6dbfa268d7988521ea0b993 | 962 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rfunc/version'
Gem::Specification.new do |spec|
spec.name = "rfunc"
spec.version = RFunc::VERSION
spec.authors = ["Paul De Goes"]
spec.email = ["pauldegoes@ho... | 35.62963 | 89 | 0.668399 |
79163554cae3d23abe4570b19860eb494f46c021 | 16,742 | # frozen_string_literal: true
# File original exported from 18xx-maker/export-rb
# https://github.com/18xx-maker/export-rb
# rubocop:disable Lint/RedundantCopDisableDirective, Layout/LineLength, Layout/HeredocIndentation
module Engine
module Config
module Game
module G1830
JSON = <<-DATA
{
"file... | 19.907253 | 404 | 0.409151 |
260d2c9d0cb4e9f7710dec0bec5aa73ac4c5bc29 | 1,228 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Recipe:: _update_packages
#
# Copyright 2013-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A cop... | 36.117647 | 181 | 0.709283 |
2839b0f4e099fde4302c0ceddd49e92fe7563d2e | 1,695 | #
# Be sure to run `pod lib lint ASRadioGroup.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ASRadi... | 36.06383 | 105 | 0.637168 |
87394629bacf00c4b905cdd0d04bc863fd27a5e3 | 1,271 | module Metarman
class MetarParser
def initialize(wx)
@raw = wx
@result = {}
end
# ToDo::Rainy or Snow condition
# ToDo::After QNH
# ToDo::Refactor This logic is so slowy
def execute
orig = @raw.split(" ")
orig.each do |e|
if /\d{5}[KT]/ === e
@result[... | 27.042553 | 47 | 0.421715 |
62d277dfaf670d80fa1b09043bc7f17d011fb091 | 433 | require File.expand_path('../../base_request.rb', __FILE__)
require 'excon'
class SubnetRequest < BaseRequest
def list_subnets(filters = {})
request(
:expects => 200,
:method => 'GET',
:path => '/subnets',
:query => filters
)
end
def get_subnet(pool_id)
request... | 18.041667 | 59 | 0.528868 |
1d938e802fddebd2bdb74324f8bef7808f610acf | 3,137 | module UbiquoJobs
module Managers
class Base
# Get the most appropiate job to run, depending job priorities, states
# dependencies and planification dates
#
# runner: name of the worker that is asking for a job
#
def self.get(runner)
raise NotImplementedError.new("I... | 33.37234 | 96 | 0.624482 |
ff304681633fb5063db48f2e75f99f49b59e39a5 | 66 | json.plan do
json.partial! 'api/v1/plans/plan', plan: @plan
end | 22 | 48 | 0.69697 |
d54c24bd89084dda84c3cbc88943220d614e3e34 | 2,094 | class DiscountsController < ApplicationController
before_action :check_user_session
before_action :set_discount, only: [:show, :edit, :update, :destroy]
# GET /discounts
# GET /discounts.json
def index
@discounts = Discount.all
end
# GET /discounts/1
# GET /discounts/1.json
def show
end
# G... | 27.194805 | 95 | 0.671442 |
f71a3a3d24d0a08c0e5cb7cbcf909bfcdda3b64f | 46 | class Cloudinary::Engine < Rails::Engine
end
| 15.333333 | 41 | 0.76087 |
21217d6a982ad6e74dfccbd26be437bb0c246342 | 1,452 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# You should have received a copy of the GNU General Public Licen... | 25.928571 | 81 | 0.701791 |
f7941cc7b02b379a1c03a766ed8ec818547fce69 | 3,029 | module Pageflow
# Defines the default abilities for the Pageflow models.
module AbilityMixin
# Call this in the ability initializer.
def pageflow_default_abilities(user)
return if user.nil?
can :read, Folder, :id => user.entries.map(&:folder_id)
can [:read, :use_files], Entry, :id => use... | 32.223404 | 109 | 0.643447 |
5d7e9cd9504c4c913dfd31b1191124a31bf5a723 | 461 | module Zemus
class Vine
def self.valid?(url)
url =~ /vine.co/
end
def initialize(url)
@url = url
end
def to_embed
"<iframe class='vine-embed' src='https://vine.co/v/#{vine_id}/embed/simple' width='100%' height='600px' frameborder='0'></iframe><script async src='//platform.vine... | 21.952381 | 224 | 0.605206 |
793694632af5216c642dd3fd4cd1e11236ca8510 | 12,126 | require 'pathname'
require 'shellwords'
require 'tilt'
require 'yaml'
module Sprockets
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
#
# A directive comment starts with a comment prefix, followed by an "=",
# then the directive name, then any argu... | 29.793612 | 89 | 0.587168 |
ffa6c555bbaa46ccc01d6cf9860c236e1f7aa6c2 | 601 | module Filters
class ValidateEncryptedSubmission
def self.before(controller)
if controller.submission_params[:encrypted_submission].blank?
controller.render json: {
message: ['Encrypted Submission is missing']
}, status: :unprocessable_entity
else
begin
cont... | 28.619048 | 67 | 0.642263 |
9131b15c7ced061b6569e1384e550c9f443f06dc | 1,415 | require 'rails_helper'
describe VotesController do
let!(:debate){ Debate.create(title: "Fat Tax", body: "A fat body.")}
let!(:comment) { Comment.create(content: "content content content content content", debate_id: debate.id) }
let!(:user) { User.create(username: "johnberry", email: "jb@johnberry.com", password:... | 40.428571 | 145 | 0.635336 |
4a83f82f3c5dbfcdd01b73f973b3ebd9ee1f2e22 | 1,395 | #!/usr/bin/env ruby
require 'baseexpressiontest'
# Unit tests for DayIntervalTE class
# Author:: Matthew Lipper
class DayIntervalTETest < BaseExpressionTest
def test_every_8_days
date = @date_20040116
# Match every 8 days
expr = DayIntervalTE.new(date, 8)
assert expr.include?(date + 8), "Expressi... | 36.710526 | 101 | 0.678853 |
d5b505e86c2b63454c68b8c268e992b3fbfa4b87 | 141 | require 'test_helper'
class IncovicesControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 17.625 | 63 | 0.744681 |
bff164cfbb5975d38e5c781c39c8ff6043fd5d65 | 123 | module Kernel
def raise
puts 'override raise!!'
end
end
begin
raise
puts 'Am I dead?'
rescue RuntimeError
end
| 10.25 | 27 | 0.691057 |
03c87772ac36f2fe96938986b01724d8f2f6ee39 | 668 | require "active_support/configurable"
module EA
module AddressLookup
class Configuration
include ActiveSupport::Configurable
config_accessor(:address_facade_server)
config_accessor(:address_facade_port)
config_accessor(:address_facade_url)
config_accessor(:address_facade_client_id)
... | 23.034483 | 59 | 0.714072 |
91806e3f7ebbc8ce04f5df7218da41e9308e8415 | 60,101 | require 'spec_helper'
module VCAP::CloudController
RSpec.describe ProcessModel, type: :model do
let(:org) { Organization.make }
let(:space) { Space.make(organization: org) }
let(:parent_app) { AppModel.make(space: space) }
let(:domain) { PrivateDomain.make(owning_organization: org) }
let(:route)... | 34.620392 | 156 | 0.622253 |
bf5cc82f7ae19f1294704f822a015629c2411912 | 7,695 | # frozen_string_literal: true
require "active_support/core_ext/module/attribute_accessors"
module ActiveRecord
module AttributeMethods
module Dirty
extend ActiveSupport::Concern
include ActiveModel::Dirty
included do
if self < ::ActiveRecord::Timestamp
raise "You cannot inc... | 36.29717 | 80 | 0.671735 |
0316d5d44ee391ecc12bb6679676bfa5a5ddf0ab | 1,302 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 38.294118 | 77 | 0.791091 |
79b9aab7a09af47fe7f7ac2f34448343c7ec5845 | 4,720 | # frozen_string_literal: true
# Methods for Basic Spark Jobs.
class SparkJob < ApplicationJob
queue_as :spark
after_perform do
update_dashboard = Dashboard.find_by(job_id: job_id)
update_dashboard.end_time = DateTime.now.utc
update_dashboard.save
end
def perform(user_id, collection_id)
Dashbo... | 40 | 93 | 0.518644 |
039fe629a61a861848a3baf83b475c2957cf198a | 707 | # frozen_string_literal: true
class AuthorizedKeysWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
PERMITTED_ACTIONS = %w[add_key remove_key].freeze
feature_category :source_code_management
urgency :high
weight 2
idempotent!
loggable_arguments 0
def perform(ac... | 19.108108 | 66 | 0.739745 |
614b97b4aba76569b90fc9250b4dfc0e5be74990 | 1,346 | module Uktt
# A Chapter object for dealing with an API resource
class Chapter
attr_accessor :config, :chapter_id
def initialize(opts = {})
@chapter_id = opts[:chapter_id] || nil
Uktt.configure(opts)
@config = Uktt.config
end
def retrieve
return '@chapter_id cannot be nil' i... | 23.206897 | 63 | 0.610698 |
7979aec217d3718064b65e55bb60551b2eea0488 | 4,246 | # encoding: UTF-8
require 'set'
# Convertible provides methods for converting a pagelike item
# from a certain type of markup into actual content
#
# Requires
# self.site -> Jekyll::Site
# self.content
# self.content=
# self.data=
# self.ext=
# self.output=
# self.name
module Jekyll
module Convertible... | 28.306667 | 110 | 0.597268 |
4a81d1c1288dc8f465ff43ce28ca7448e24c604c | 6,723 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# An instance of a datasource configuration.
class Datasource
... | 29.486842 | 137 | 0.626655 |
1c31af44c15b28e803c9911414415432627e1cac | 1,749 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: '',
... | 34.294118 | 78 | 0.614637 |
1c5032c26fa1ddf9a6c2d4e433aff7794c81ca72 | 5,609 | # 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::PolicyInsights::Mgmt::V2018_07_01_preview
#
# A service client - single point of access to the REST API.
#
class PolicyInsightsClient ... | 38.951389 | 154 | 0.697094 |
28bb8619bfdda9a746773d77dd1615884582edd0 | 2,746 | require File.expand_path(File.dirname(__FILE__) + '/neo')
class AboutControlStatements < Neo::Koan
def test_if_then_else_statements
if true
result = :true_value
else
result = :false_value
end
assert_equal :true_value, result
end
def test_if_then_statements
result = :default_value... | 21.123077 | 71 | 0.658048 |
6196f6322031fd3b3b35cfeb1b9cf15811b981a3 | 717 | class UserPolicy
include PolicyHelper
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def update_supervisor_email?
user.casa_admin? || record == user
end
def update_supervisor_name?
update_supervisor_email?
end
class Scope
attr_reader :... | 17.925 | 61 | 0.630404 |
bbf82d648e040c226e137db4618368038bc495a6 | 1,224 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sad_panda/version'
Gem::Specification.new do |spec|
spec.name = 'sad_panda'
spec.version = SadPanda::VERSION
spec.authors = ['Matt Buckley', 'Edwin Rozario']
spec.em... | 43.714286 | 155 | 0.706699 |
5d70a9d6b9fa723127432376927bb466fa8642d4 | 2,088 | module RiCal
module CoreExtensions #:nodoc:
module Date #:nodoc:
#- ©2009 Rick DeNatale
#- All rights reserved. Refer to the file README.txt for the license
#
module Conversions #:nodoc:
# Return an RiCal::PropertyValue::DateTime representing the receiver
def to_ri_cal_date... | 37.285714 | 101 | 0.619253 |
39648e4fc65f5c9e5553aa7d30ce0526998e2ba6 | 35 | class Slot < ApplicationRecord
end
| 11.666667 | 30 | 0.828571 |
087b00800b60ff0234d27e155b0ab86433c2ba8d | 177 | class RefactorReservedDomains < ActiveRecord::Migration[6.0]
def change
remove_column :reserved_domains, :name
add_column :reserved_domains, :names, :hstore
end
end
| 25.285714 | 60 | 0.768362 |
e22fbbbbd31d40a0cef7b332407c1e885dc2b470 | 1,558 | #
# Be sure to run `pod lib lint ATest.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ATest'
s.ver... | 36.232558 | 97 | 0.612965 |
6a6acdd77c837f3f2f281223acf2001672834a1b | 5,282 | require File.dirname(__FILE__) + '/../spec_helper'
module NotificationSpecHelper
def valid_notification_attributes
Spree::Pagseguro::Config.set({:account => "test@example.com"})
order = mock_model(Order, :null_object => true)
order.stub!(:total).and_return((5.23 * 2) + 10.99)
{
:VendedorEm... | 42.943089 | 212 | 0.701817 |
edd9ce2a1e671961f572174850db50cd986e4412 | 984 |
module EbayTrading # :nodoc:
module Requests # :nodoc:
# == Attributes
# text_node :item_id, 'ItemID', :optional => true
# text_node :status, 'Status', :optional => true
# boolean_node :include_member_messages, 'IncludeMemberMessages', 'true', 'false', :optional => true
# datetime_node :start... | 41 | 105 | 0.699187 |
4a226bafe09195751a3c88b7a4ead015701c5089 | 3,339 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: 'Example User', email: 'user@example.com',
password: "fakeone", password_confirmation: "fakeone")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present"... | 27.825 | 79 | 0.678646 |
6195c46607e2c9b2a64dcccb12e02af7d1331314 | 5,209 | # Require the dependencies file to load the vendor libraries
require File.expand_path(File.join(File.dirname(__FILE__), 'dependencies'))
class SharepointListItemUpdateV1
def initialize(input)
# Set the input document attribute
@input_document = REXML::Document.new(input)
# Store the info valu... | 42.349593 | 150 | 0.652716 |
f79fe6b7441c8498f03038d2bb0296519ab03063 | 2,894 | #!/usr/bin/env ruby
require 'mechanize'
require 'yaml'
unless ARGV[0] =~ /^http/ && ARGV[1] =~ /(now|[\d\/]+)/
puts "Usage: scraper.rb [streeteasy search URL] [date(s)]"
puts " streeteasy search url: just perform a search on streeteasy.com"
puts " and grab the URL from the location bar"
puts ""
puts " ... | 30.463158 | 197 | 0.623704 |
2600edf645f7f60fed8ab7d4f22bc51a9e3bfd0c | 226 | # frozen_string_literal: true
require "support/matchers/be_a_semantic_version"
require "extensible/version"
describe Extensible::VERSION do
it { is_expected.to be_a_semantic_version }
it { is_expected.to be_frozen }
end
| 22.6 | 48 | 0.80531 |
385552e17546a89940b9b15018b0b504cf5364f3 | 147 | require 'tester_xtreme/action_controller'
require 'tester_xtreme/active_record'
require 'tester_xtreme/general'
require 'rubygems'
require 'mocha' | 24.5 | 41 | 0.843537 |
f8e4e7aa9f1213ec8acd8e871e6afc5cb0b00186 | 180 | module Hydra::Derivatives::Processors
module Video
extend ActiveSupport::Autoload
eager_autoload do
autoload :Processor
autoload :Config
end
end
end
| 13.846154 | 37 | 0.7 |
798bd47b3432ce7e9805876eaf3de4be271001fc | 2,243 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Kernel#p" do
before :all do
@rs_f, @rs_b, @rs_c = $/, $\, $,
end
after :each do
suppress_warning {
$/, $\, $, = @rs_f, @rs_b, @rs_c
}
end
it "is a private method" do
Kernel.should have_private_instance_... | 26.702381 | 101 | 0.601427 |
391b7cdab3ffb5ff38424a220727f4bd821e4baa | 1,169 | class Cmus < Formula
desc "Music player with an ncurses based interface"
homepage "https://cmus.github.io/"
url "https://github.com/cmus/cmus/archive/v2.9.1.tar.gz"
sha256 "6fb799cae60db9324f03922bbb2e322107fd386ab429c0271996985294e2ef44"
license "GPL-2.0-or-later"
head "https://github.com/cmus/cmus.git"
... | 31.594595 | 95 | 0.733105 |
62f7953e1a185f4f4488fed1e559fa1d93b552d4 | 907 | # frozen_string_literal: true
# Copyright 2016-2019 New Context, 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 b... | 34.884615 | 77 | 0.768467 |
5da398fc9795b03d86e31ded84162727cd4b4281 | 225 | class CreateImports < ActiveRecord::Migration
def change
create_table :imports do |t|
t.belongs_to :referential
t.string :status
t.timestamps
end
add_index :imports, :referential_id
end
end
| 18.75 | 45 | 0.688889 |
ac52bd523b2382735b5fed823ff16beb065e1d0c | 186 | class RemoveRolesFromAccountUsers < ActiveRecord::Migration
def up
remove_column :account_users, :roles
end
def down
add_column :account_users, :roles, :integer
end
end
| 18.6 | 59 | 0.752688 |
7aa9803432923b1c9fbee49875391b43ca36e643 | 10,762 | # encoding: utf-8
#
# = Integration Session Test Helpers
#
# Methods in this class are available to all the integration tests.
#
# ==== Debugging
# dump_links:: Show list of all the links on the last page rendered.
# save_page:: Save response from last request in a file.
# get:: Call get... | 29.647383 | 97 | 0.570712 |
6267cbdf2be806a6513ea06e1eea9a87b0e94c57 | 2,251 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
end
test "should get new" do
get sign... | 28.858974 | 88 | 0.644158 |
ac9ebd3b5b170109efdb53bc972a32c4b24a1388 | 945 | #
# Cookbook Name:: cron
# Recipe:: default
#
# Copyright 2010-2013, 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
#
# Unles... | 30.483871 | 79 | 0.696296 |
91c19d9c25d078bb0f9e78ce8d4450129ec62249 | 865 | require 'pagy/extras/searchkick'
module MockSearchkick
RESULTS = { 'a' => ('a-1'..'a-1000').to_a,
'b' => ('b-1'..'b-1000').to_a }
class Results
attr_reader :options
def initialize(query, options={}, &block)
@entries = RESULTS[query]
@options = {page: 1, per_page: 10_000}.merge... | 20.116279 | 70 | 0.581503 |
1ca14b5c0a5be6772f3dbe8e478f02b6d6f79c5e | 958 | #
# Cookbook Name:: npm
#
# Author:: Sergey Balbeko <sergey@balbeko.com>
#
# Copyright 2012, Sergey Balbeko
#
# 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/licen... | 31.933333 | 74 | 0.72547 |
1df93d1118b958cd9b347d8fb376113de8d7f625 | 1,616 | # frozen_string_literal: true
module QA
module Page
module Project
module SubMenus
module Issues
extend QA::Page::PageConcern
def self.included(base)
super
base.class_eval do
include QA::Page::Project::SubMenus::Common
end
... | 23.42029 | 79 | 0.522277 |
26e2483ccb469f77da3171dded4440754e5968e2 | 418 | # frozen_string_literal: true
module WebMockHelpers
def stub_custom_request(url:, body:, method: :get, status: 200)
stub_request(method, url).to_return(body: body, status: status)
end
end
RSpec.configure do |config|
config.include WebMockHelpers, type: :job
config.include WebMockHelpers, type: :feature
... | 27.866667 | 67 | 0.767943 |
5d7816b08b9562d680897a249ff2f3e689d5a392 | 15,024 | # coding: utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
version = package['version']
source = { :... | 43.172414 | 196 | 0.575013 |
9128076d2fa86a44c1769637eafb31acb9be600c | 213 | class AddHideReviewLogoToBusinessUnitTypes < ActiveRecord::Migration[6.0]
def change
change_table :business_unit_types do |t|
t.boolean :hide_review_logo, null: false, default: false
end
end
end
| 26.625 | 73 | 0.755869 |
184967a6c9f65f6ed37bb0bdbfa93959baf7304c | 4,084 | $:.unshift File.expand_path('../vendor', __FILE__)
require 'thor'
require 'bundler'
module Bundler
class GemHelper
def self.install_tasks(opts = nil)
dir = File.dirname(Rake.application.rakefile_location)
self.new(dir, opts && opts[:name]).install
end
attr_reader :spec_path, :base, :gemspec
... | 27.972603 | 148 | 0.617042 |
bf57a800e1b3802d1d56cc6412a4349a83f259e9 | 4,309 | # encoding: utf-8
require 'spec_helper'
require 'carrierwave/orm/activerecord'
module Rails; end unless defined?(Rails)
describe CarrierWave::Compatibility::Paperclip do
before do
allow(Rails).to receive(:root).and_return('/rails/root')
allow(Rails).to receive(:env).and_return('test')
@uploader_class... | 30.560284 | 114 | 0.656069 |
d53e496e0b53cb0c14e4e3309b4b307b432b1f4f | 9,730 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking
#
# This module acts as an HTTP server
#
include Msf::Exploit::Remote::HttpSe... | 30.030864 | 135 | 0.586639 |
6a7ca46abdb3880553c114f88b12daa546ff9341 | 2,257 | class Haproxy < Formula
desc "Reliable, high performance TCP/HTTP load balancer"
homepage "https://www.haproxy.org/"
url "https://www.haproxy.org/download/2.3/src/haproxy-2.3.2.tar.gz"
sha256 "99cb73bb791a2cd18898d0595e14fdc820a6cbd622c762f4ed83f2884d038fd5"
livecheck do
url :homepage
regex(/href=.*?... | 30.917808 | 108 | 0.642889 |
1856f61261927b2f60f18ec5e523f4ae6aaf9ada | 419 | cask 'pdfelement-express' do
version '1.2.1,4133'
sha256 'dd60c96c53725e1165a951b5b8c6c82acfbf7d47b91f2ab06ed662326df7eb34'
url "http://download.wondershare.com/cbs_down/mac-pdfelement-express_full#{version.after_comma}.dmg"
name 'Wondershare PDFelement Express for Mac'
homepage 'https://pdf.wondershare.com/... | 32.230769 | 102 | 0.785203 |
2629e297736332ea41859c15a14927172396dfdf | 7,516 | # 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... | 44.738095 | 124 | 0.715141 |
79ce9d835af89bca6c9798efd037c831a6ff1a98 | 2,866 | module Bitcoin
# Ruby port of https://github.com/Blockstream/contracthashtool
module ContractHash
HMAC_DIGEST = OpenSSL::Digest.new('SHA256')
EC_GROUP = OpenSSL::PKey::EC::Group.new('secp256k1')
def self.hmac(pubkey, data)
OpenSSL::HMAC.hexdigest(HMAC_DIGEST, pubkey, data)
end
# generate... | 39.260274 | 100 | 0.660851 |
bbb88517cf77bcd9fcd8aecd969b0b19d63465e2 | 4,290 | require 'test/unit'
require_relative 'ruby/envutil'
# mathn redefines too much. It must be isolated to child processes.
class TestMathn < Test::Unit::TestCase
def test_power
stderr = $VERBOSE ? ["lib/mathn.rb is deprecated"] : []
assert_in_out_err ['-r', 'mathn', '-e', 'a=1**2;!a'], "", [], stderr, '[ruby-co... | 35.454545 | 108 | 0.551282 |
b9e47ed5e8d06c0127ca15e899a0697cc4b6fe0e | 5,336 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.099174 | 114 | 0.765367 |
62b4d30aaf017544b2af730f1e207721d61ecf1f | 1,234 | #
# Copyright David Lakatos
#
# 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, s... | 30.85 | 74 | 0.745543 |
b977e86c25e12bafbf7bce7f43a64ae3236e3e25 | 558 |
module Publishable
extend ActiveSupport::Concern
class_methods do
def subscribe(event = :any)
event_name = event == :any ? /#{collection_name}/ : "#{collection_name}.#{event}"
ActiveSupport::Notifications.subscribe(event_name) do |_event_name, **payload|
yield payload
... | 24.26087 | 89 | 0.62724 |
1dc21e3b8a0585e5710adde49bcc861f7a50b216 | 4,993 | require "resources/azure/azure_backend"
module Inspec::Resources
class AzureResourceGroup < AzureResourceBase
name "azure_resource_group"
desc '
InSpec Resource to get metadata about a specific Resource Group
'
supports platform: "azure"
attr_reader :name, :location, :id, :total, :counts... | 33.066225 | 101 | 0.667535 |
f8a33f7bf57c22b71eb09abd068fe44409dffa8b | 98 | # frozen_string_literal: true
describe "Suite" do
it "spec", allure: "some_label" do
end
end
| 14 | 36 | 0.714286 |
f88eac1a538e6de7893e24275919fa6e60678dc8 | 473 | require 'fastlane/plugin/yalantis_ci/version'
module Fastlane
module YalantisCi
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all availab... | 27.823529 | 79 | 0.748414 |
9112a6764db6fba2cbcdf2b21dfa0ab181f8f87f | 1,359 | class Libmicrohttpd < Formula
desc "Light HTTP/1.1 server library"
homepage "https://www.gnu.org/software/libmicrohttpd/"
url "https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.53.tar.gz"
mirror "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.53.tar.gz"
sha256 "9b15ec2d381f44936323adfd4f989fa... | 34.846154 | 92 | 0.688742 |
339d582f7600ebb25f7ef4b4e7c63c35e466ddf1 | 59,777 | # frozen_string_literal: true
require "date"
require_relative "tag_helper"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/date/conversions"
require "active_support/core_ext/hash/slice"
require "active_support/core_ext/object/acts_like"
require "active_support/core_ext/object/w... | 51.665514 | 175 | 0.607776 |
916fc383eae943b6e71b2cf6366d78176e87ad10 | 16,393 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 32.333333 | 99 | 0.60355 |
5d2d0010ede6b458754eaed2a8cbdb0bf0779d6e | 142 | require 'rake'
namespace :watering_run do
desc 'Waters plants if needed'
task :water => :environment do
User.water_everyday
end
end
| 17.75 | 32 | 0.732394 |
f86a4d59cdf2b1439aceeb6d47e83ea871f2fb6f | 3,632 | # frozen_string_literal: true
require "dry/system/magic_comments_parser"
require "json"
require "pathname"
require "rspec"
module Test
module SuiteHelpers
module_function
def suite
@suite ||= RSpec.configuration.suite
end
end
class Suite
class << self
def instance
@instance... | 20.99422 | 89 | 0.64565 |
2818b7c4e94d27657c8fcab3103dd63416247518 | 4,123 | # Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
SPREE_GEM_VERSION ... | 45.811111 | 108 | 0.732719 |
d5ee7f48afbb02b377cb606562fb25d104c80a91 | 1,126 | Pod::Spec.new do |s|
s.name = 'AWSAuth'
s.version = '2.6.31'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'h... | 30.432432 | 158 | 0.611901 |
e98ab6529a0990539b2a2bfff99dadd634212d9e | 256,449 | #
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.12
# from Racc grammer file "".
#
require 'racc/parser.rb'
class Ruby21Parser < Racc::Parser
require "ruby_lexer"
require "ruby_parser_extras"
# :stopdoc:
# Local Variables: **
# racc-token-length-max:14 **
# End: **
##### State transition ta... | 38.088371 | 121 | 0.514383 |
6222b5c80cea40e9e1b84a2f513d8297bd0423fb | 7,415 | require 'require_relative' if RUBY_VERSION[0,3] == '1.8'
require_relative 'acceptance_helper'
describe "Authorization" do
include AcceptanceHelper
# publish an update and verify that the app responds successfully
def assert_publish_succeeds update_text
VCR.use_cassette('publish_to_hub') do
fill_in "te... | 28.74031 | 106 | 0.621038 |
7af87ef90116600e107a33f9dfa0179d70541ebb | 535 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "Users::Sessions", type: :request do
let(:user) { create(:user) }
before do
sign_in user
end
describe "GET /users/sign_out" do
it "logs out the user and redirects to the signed out page" do
# visit authenticated route
ge... | 21.4 | 66 | 0.691589 |
ff5e2969fb7b839aedc5cd26195c1a3464e05e63 | 445 | class RemoveGamehands < ActiveRecord::Migration
def up
remove_column :white_cards, :user_id
# Remove all of the game hands to make way for submissions.
Hand.where(user_id: nil).each do |h|
h.destroy
end
end
def down
add_column :white_cards, :user_id
# Re-create a game hand for eac... | 22.25 | 63 | 0.665169 |
e87f245091d2172a8f64225810222c5baf032694 | 2,440 | #
# Cookbook Name:: jetty
# Attributes:: default
#
# Copyright 2010, 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
#
# Unles... | 40.666667 | 77 | 0.664344 |
e86e5506878b60ef4cead360fd76a1cb3fbd609a | 1,341 | module API
module V2
class Root < API::Helpers::GrapeApiHelper
version 'v2', using: :accept_version_header, cascade: false
format :json
content_type :json, 'application/json'
group do
before_validation do
authenticate_user_is?('CaseWorker')
end
namespace... | 29.8 | 80 | 0.604027 |
62b8447a96fcda3d37901c66c8ef2db1bf8a9725 | 3,486 | require "spec_helper"
require "teaspoon/exporter"
describe Teaspoon::Exporter do
subject { Teaspoon::Exporter.new(:suite_name, "http://666.420.42.0:31337/url/to/teaspoon", "_output_path_") }
describe "#initialize" do
it "assigns @suite and @url" do
expect(subject.instance_variable_get(:@suite)).to eq(... | 35.938144 | 173 | 0.672691 |
b9944671d7549206dbb5c1a8d90a47611583eb56 | 145 | # Be sure to restart your server when you modify this file.
Prairie0::Application.config.session_store :cookie_store, key: '_prairie_0_session'
| 36.25 | 83 | 0.806897 |
4ac860248586f9a08f86f77aded4534352d668cd | 236 | module Achievements
class HuntingAchievement < BaseAchievement
def check(player, entity)
achievements = @achievements.values.select{ |ach| ach.group == entity.group }
progress player, achievements, 1
end
end
end | 26.222222 | 83 | 0.720339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.