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 |
|---|---|---|---|---|---|
ac81330b1e1f50f046a780b52cfb94dbe4d9b9fd | 154 | class PagesController < ApplicationController
skip_before_action :authenticate_user!
def home
redirect_to posts_path if user_signed_in?
end
end
| 22 | 45 | 0.818182 |
792ced39056079fd033028a32bb64ef01b536c34 | 2,218 | require File.expand_path('../fixtures/classes', __FILE__)
require 'matrix'
ruby_version_is "1.9" do
describe "Matrix.build" do
it "returns a Matrix object of the given size" do
m = Matrix.build(3, 4){1}
m.should be_an_instance_of(Matrix)
m.row_size.should == 3
m.column_size.should == 4
... | 29.184211 | 73 | 0.609107 |
111662fa4fe9055df30bf32509e1e4be214cb850 | 340 | require 'rails_helper'
RSpec.describe "contributions/show", type: :view do
before(:each) do
@contribution = assign(:contribution, Contribution.create!(
:user => nil,
:package => nil
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
expect(rendered).to ... | 20 | 63 | 0.638235 |
91e2c8aac84cd17d2d55c309ec1935fe5768bc4c | 32,058 | # frozen_string_literal: true
describe Appeal, :all_dbs do
include IntakeHelpers
before do
Timecop.freeze(Time.utc(2019, 1, 1, 12, 0, 0))
end
let!(:appeal) { create(:appeal) } # must be *after* Timecop.freeze
context "#create_stream" do
let(:stream_type) { "vacate" }
let!(:appeal) { create(:ap... | 33.083591 | 115 | 0.66205 |
ac3ca7a571dca871c8ff23ab16c0bfa7e7346403 | 7,789 | # frozen_string_literal: true
require 'spec_helper'
module Spree
describe Api::TaxonsController, type: :request do
let!(:taxonomy) { create(:taxonomy) }
let!(:taxon) { create(:taxon, name: "Ruby", parent: taxonomy.root, taxonomy: taxonomy) }
let!(:taxon2) { create(:taxon, name: "Rails", parent: taxon, t... | 37.267943 | 128 | 0.633457 |
bf9361d4b5bb7e9d44e3aeb4665f8e19cd6aaca7 | 452 | require('spec_helper')
describe(Venue) do
it { should have_and_belong_to_many(:bands)}
it("validates the presence of a venue") do
venue = Venue.new({:name => ''})
expect(venue.save()).to(eq(false))
end
describe("upcase") do
it("should capitalize the first letter of each word") do
venue_test... | 25.111111 | 66 | 0.665929 |
7a9e7d8afba4b8566f7ce59b9d90d69978456bcc | 4,905 | # frozen_string_literal: true
require 'spec_helper'
# We want to test Import on "complete" data set,
# which means that every relation (as in our Import/Export definition) is covered.
# Fixture JSONs we use for testing Import such as
# `spec/fixtures/lib/gitlab/import_export/complex/project.json`
# should include the... | 37.730769 | 87 | 0.738634 |
28a9d838e63ef008915e78535fa1ac7f4048b781 | 3,004 | require 'spec_helper'
module VCAP::CloudController
module Repositories
RSpec.describe OrganizationEventRepository do
let(:request_attrs) { { 'name' => 'new-space' } }
let(:user) { User.make }
let(:organization) { Organization.make }
let(:user_email) { 'email address' }
let(:user_nam... | 42.309859 | 128 | 0.665113 |
1850ae5277e4d774ccffa465422e511a33387729 | 8,874 | # frozen_string_literal: true
module Parser
module Source
##
# A range of characters in a particular source buffer.
#
# The range is always exclusive, i.e. a range with `begin_pos` of 3 and
# `end_pos` of 5 will contain the following characters:
#
# example
# ^^
#
... | 27.137615 | 97 | 0.569078 |
5d94700cdd013d362ab7658e06f75372c47d1098 | 1,570 | # Please don't update this formula until the release is official via
# mailing list or blog post. There's a history of GitHub tags moving around.
# https://github.com/hashicorp/vault/issues/1051
class Vault < Formula
desc "Secures, stores, and tightly controls access to secrets"
homepage "https://vaultproject.io/"
... | 32.708333 | 93 | 0.708917 |
117ae5b8d3e1b67f298beba3d6285d66c2760bb6 | 884 | cask 'mongoclient' do
version '2.1.0'
sha256 '4ae7a761f82d315c43f238f98ff5dabc0a78b8445fe392a1bf521b7a30c977d3'
# github.com/mongoclient/mongoclient was verified as official when first introduced to the cask
url "https://github.com/mongoclient/mongoclient/releases/download/#{version}/osx-portable.zip"
appcas... | 42.095238 | 97 | 0.720588 |
1df9caa5ffb4a99d920830130fb2ffd3b63fd210 | 359 | require "bundler/setup"
require "rql"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec d... | 23.933333 | 66 | 0.749304 |
1d1697598bd978ec6d74dfecde8ddc33245db3c7 | 1,861 | Pod::Spec.new do |s|
s.name = 'GiniCapture'
s.version = '1.0.0'
s.summary = 'Computer Vision Library for scanning documents.'
s.description = <<-DESC
Gini provides an information extraction system for analyzing documents (e. g. invoices or
contracts), specifically information... | 38.770833 | 123 | 0.671145 |
388e5264fe58c36757aac23718018b905cc4ca69 | 73 | # frozen_string_literal: true
Stripe.api_key = ENV["STRIPE_SECRET_KEY"]
| 18.25 | 41 | 0.794521 |
ed8574ce779b94951a8ffb226ce0ea6b97c4187f | 202 | # frozen_string_literal: true
module ErrorHandler
def self.included(klass)
klass.class_eval do
rescue_from StandardError do |e|
render_error_msg(e.to_s)
end
end
end
end
| 16.833333 | 38 | 0.693069 |
e2ec36356b153815c799baff24a507944162b399 | 4,284 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 35.7 | 117 | 0.623016 |
623fdd8945647f72c38237af643c3e770f3cc2d6 | 3,173 | # frozen_string_literal: true
module Gitlab
# The SidekiqStatus module and its child classes can be used for checking if a
# Sidekiq job has been processed or not.
#
# To check if a job has been completed, simply pass the job ID to the
# `completed?` method:
#
# job_id = SomeWorker.perform_async(...)... | 27.119658 | 80 | 0.64387 |
5d6df20bdd6d6c158712330f5c8f775899e7075d | 3,318 | # frozen_string_literal: true
Rails.application.routes.draw do
devise_for :all_casa_admins, path: "all_casa_admins", controllers: {sessions: "all_casa_admins/sessions"}
devise_for :users, controllers: {sessions: "users/sessions"}
concern :with_datatable do
post "datatable", on: :collection
end
authenti... | 24.761194 | 107 | 0.679024 |
918c08c213c8d9d748dbe9fe5fe0851e937f986d | 605 | require 'test_helper'
require 'securitytxt/parser'
module SecurityTxt
class TestParser < ActiveSupport::TestCase
test 'Genereator class' do
assert_kind_of(Class, SecurityTxt::Parser)
end
test 'empty' do
assert_equal({}, Parser.new.parse(''))
end
test 'data simple' do
a = { 'fo... | 23.269231 | 60 | 0.573554 |
61f84a13e363595471dfbb629cc97aa2953df28e | 1,063 | #
# is_ip_address.rb
#
module Puppet::Parser::Functions
newfunction(:is_ip_address, :type => :rvalue, :doc => <<-DOC
@summary
**Deprecated:** Returns true if the string passed to this function is a valid IP address.
@return [Boolean]
Returns `true` or `false`
> **Note:* **Deprecated** Will b... | 27.973684 | 137 | 0.655691 |
219f74122d72de5ba86825b3d5a548e4cb263839 | 873 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "tddium_status_github"
s.version = "0.1.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Steven Davidovitz"]
s.email = ["support@zendesk.com"]
s.homepage = "https://github.com/steved555/tddium-status-github"
s.su... | 36.375 | 116 | 0.635739 |
bb2eb8c35c7b5399d9faf95612a86cc315219c85 | 632 | # Preview all emails at http://localhost:3000/rails/mailers/customer_mailer
class CustomerMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/customer_mailer/account_activation
def account_activation
customer = Customer.first
customer.activation_token = Custome... | 33.263158 | 96 | 0.799051 |
013daff34f1bdac4ce674ef407d98e28ff6d31f3 | 2,201 | class User < ApplicationRecord
attr_accessor :remember_token, :activation_token, :reset_token
before_save :downcase_email
before_create :create_activation_digest
validates :name, presence: true, length: {maximum:50}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, pre... | 26.841463 | 87 | 0.719219 |
e2f2c9b7a12d955937ba56a0d40327c2d675416b | 1,295 | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
Rails.application.config.content_security_policy do |policy|
... | 44.655172 | 114 | 0.765251 |
5d0c852d04a6896b3766d226bc229cf336de5d22 | 1,162 | require "active_support/all"
require "reserved_word/version"
require "reserved_word/word"
module ReservedWord
@words = ActiveSupport::OrderedOptions.new
@words.default_words = ReservedWord::Word::SITE_SLUG
def self.include?(word)
@words.default_words.include?(word)
end
def self.list
@words.default_... | 19.04918 | 56 | 0.663511 |
610afd0d8e1a8a1b7b7885c46df592f9a4603044 | 44 | # helper for heroes
module HeroesHelper
end
| 11 | 19 | 0.818182 |
08fe4d16d261114f5b77c144b61f5bb78b770716 | 1,564 | Gem::Specification.new do |spec|
spec.name = "embulk-output-bigquery"
spec.version = "0.6.4"
spec.authors = ["Satoshi Akama", "Naotoshi Seo"]
spec.summary = "Google BigQuery output plugin for Embulk"
spec.description = "Embulk plugin that insert records to Google BigQuery."
spec... | 47.393939 | 94 | 0.662404 |
012eae87a2125edab9dd1f2cf3eff0496bb448ea | 4,784 | require 'spec_helper'
describe ActAsTimeAsBoolean do
it 'defines time_as_boolean class method' do
Article.singleton_methods.should include(:time_as_boolean)
end
describe 'calling time_as_boolean' do
describe 'without param' do
it 'raises an ArgumentError' do
expect do
class Artic... | 24.284264 | 80 | 0.590301 |
ab4f75d7736120bfb179ce62075801dd6f9d8c6a | 1,048 | require 'rubygems' # you need this when xbrlware is installed as gem
require 'edgar'
require 'xbrlware'
dl=Edgar::HTMLFeedDownloader.new()
url="http://www.sec.gov/Archives/edgar/data/843006/000135448809002030/0001354488-09-002030-index.htm"
download_dir=url.split("/")[-2] # download dir is : 000135448809002030
dl.dow... | 38.814815 | 112 | 0.775763 |
f739fe781be9872f9db861fc4f7799b5698e147f | 541 | cask 'lytro-desktop' do
version '4.3.3,151118.98'
sha256 '500b28ed7d67aaf18a59a8770e3fb83a4b96e692728ddbd522a52879af758966'
# amazonaws.com/lytro-distro was verified as official when first introduced to the cask
url "https://s3.amazonaws.com/lytro-distro/lytro-#{version.after_comma}.dmg"
appcast 'https://pic... | 38.642857 | 89 | 0.780037 |
abdf044b0def463bb306169dfc63c76dfde4fa79 | 3,108 | require 'yaml'
spells_lines_names = { 0 => :name, 1 => :level, 2 => :casting_time, 3 => :range, 4 => :components, 5 => :duration }
spells = []
COMPONENTS = %w( V S M )
File.open( 'Spells - cleaned.txt', 'r' ) do |file|
spells_lines_start_lines = []
current_line = 0
file.each_line do |line|
current_line +... | 31.714286 | 136 | 0.644144 |
e9d7677f87dcc2a6526dd70edf7ce718ed5e0ab8 | 4,107 | # frozen_string_literal: true
module GraphQL::Models
module MutationHelpers
def self.validate_changes(inputs, field_map, root_model, context, all_changes)
invalid_fields = {}
unknown_errors = []
changed_models = all_changes.group_by { |c| c[:model_instance] }
changed_models.reject { |m,... | 39.114286 | 130 | 0.648405 |
1d2dcabe55c49714d982920a0ce032faec5c0da6 | 1,986 | require 'rod/rest/exception'
module Rod
module Rest
# Cache used to store proxy objects.
class ProxyCache
# Initializes empty cache.
def initialize(cache_implementation={})
@cache_implementation = cache_implementation
end
# Returns true if the described object is in the cache... | 31.52381 | 112 | 0.672709 |
915b93eb01daf3831e0a40ff5cc2012c9f1f7a4d | 2,122 | # 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.225806 | 88 | 0.66918 |
edf4ea87e95b563c84c88bf4b2cccbce8ec71297 | 3,344 | require 'spec_helper'
describe Maestrano::Connector::Rails::Synchronization do
# Attributes
it { should validate_presence_of(:status) }
# Indexes
it { should have_db_index(:organization_id) }
#Associations
it { should belong_to(:organization) }
describe 'class methods' do
subject { Maestrano::Con... | 31.252336 | 130 | 0.650718 |
5d7174f24fa86987a8c0edae09d0177dec13ea4d | 2,345 | # frozen_string_literal: true
module Asciidoctor
class SyntaxHighlighter::CodeRayAdapter < SyntaxHighlighter::Base
register_for 'coderay'
def initialize *args
super
@pre_class = 'CodeRay'
@requires_stylesheet = nil
end
def highlight?
library_available?
end
def highlight node, source, lan... | 26.055556 | 152 | 0.689979 |
e827221394236906b74e0210519d70ad3b22ee50 | 564 | require_relative 'bench_helper'
module BenchGetuid
iter = ITER
module Posix
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :getuid, [], :uint
end
puts "uid=#{Process.pid} Posix.getuid=#{Posix.getuid}"
puts "Benchmark FFI getuid performance, #{iter}x calls"
10.times {
puts... | 20.142857 | 58 | 0.664894 |
abcc709acbf0d8c3204ec0e6dc6cc905d1c421c7 | 632 | module EventInventory::Catalog
class Performer < Base
class Parser
include ParseHelper
class Performer
include ParseHelper
element :row, :value => :event_id, :as => :id
element :row, :value => :event_name, :as => :name
element :row, :value => :event_type_id, :as => :e... | 23.407407 | 69 | 0.593354 |
ffee86a3190a064284b628162f1e52698021a9a6 | 585 | cask 'max' do
if MacOS.version <= :mojave
version '0.9.1'
sha256 '722bf714696d3d39329ba98ffddc9f117f8cc6863f71670507cd12f62a5e5f14'
appcast 'https://sbooth.org/Max/appcast.xml'
url "https://files.sbooth.org/Max-#{version}.tar.bz2"
app "Max-#{version}/Max.app"
else
version '0.9.2b2'
sha... | 24.375 | 77 | 0.702564 |
e87c60df788117cf5b18c88af6835aba5d1ef889 | 602 | Pod::Spec.new do |s|
s.name = 'KLAddressSelector'
s.version = '0.1.2'
s.license = 'MIT'
s.summary = '地址选择器'
s.homepage = 'https://github.com/liuxiaolu/KLAddressSelector'
s.authors = { 'liuxiaolu' => '1185327278@qq.com' }
s.ios.deployment_target = '9.0'
# s.osx.deployment_target = '10.11'
# s.tvos.deployment_target =... | 24.08 | 94 | 0.710963 |
1ab6c0b7b1e42fbe6b210cb78e56f28d153657df | 22,137 | #!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
# Use this script to install and provision contrail nodes.
# sudo ruby $PWD/contrail-kubernetes/scripts/opencontrail-install/contrail_install.rb
@opt = OpenStruct.new
def parse_options
@opt.fix_docker_issue = false
@opt.intf = "eth0"
@opt.role = "... | 42.165714 | 340 | 0.644261 |
086b44e8fa55a6f5d291e8391bdc155cd7545722 | 81,425 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 52.736399 | 245 | 0.713872 |
87749479d2cfc0dd60eca3d62b44c6fd5f83c59e | 2,407 | require 'spec_helper'
require "#{File.dirname(__FILE__)}/../support/tables_spec_helper"
require "#{File.dirname(__FILE__)}/../support/shared_example_spec_helper_for_integer_key"
module Partitioned
describe ById do
include TablesSpecHelper
module Id
class Employee < ById
belongs_to :company, ... | 24.814433 | 115 | 0.664728 |
7907aff409261c9ee756a40e8426ada400f4fb81 | 950 | require 'bulk_insert/worker'
module BulkInsert
extend ActiveSupport::Concern
module ClassMethods
def bulk_insert(*columns, values: nil, set_size:500, ignore: false, update_duplicates: false, return_primary_keys: false)
columns = default_bulk_columns if columns.empty?
worker = BulkInsert::Worker.ne... | 24.358974 | 141 | 0.672632 |
d5807c94258ab5baa13cae3d1f509be67c288d49 | 313 | cask 'elyse' do
version '4.0.1'
sha256 '4741a9d1ebf8d707489b2282a3ac0be3d5ea3c60042db2f3443b6b04412b1465'
url "https://silkwoodsoftware.com/Elyse-#{version.no_dots}.dmg"
appcast 'https://silkwoodsoftware.com/download.html'
name 'Elyse'
homepage 'https://silkwoodsoftware.com/'
app 'Elyse.app'
end
| 26.083333 | 75 | 0.760383 |
accc3904a9b5fddb82328767348ae383e487b797 | 411 | require 'rails_helper'
RSpec.describe Course, type: :model do
it 'should be able to search a specific course' do
Course.search 'ee569'
Course.search 'csci580'
Course.search 'csci574'
Course.search 'ee450'
end
it 'should be able to list courses in a department' do
Course.search 'ee*'
end
... | 21.631579 | 56 | 0.695864 |
7ae51797c2c20dd26f3adbe520b41581aae3e9b4 | 4,523 | #!/usr/bin/ruby
#
# Copyright 2017 Istio Authors
#
# 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... | 29.562092 | 101 | 0.620606 |
088cd7e782492e133a5a193fa00a87f100121e56 | 309 | FactoryBot.define do
factory :category do
name { Faker::Company.name }
icon { Faker::Company.logo }
user
factory :category_with_deals do
transient do
deals_count { 5 }
end
deals do
Array.new(deals_count) { association(:deal) }
end
end
end
end
| 17.166667 | 53 | 0.601942 |
acc85f32ecc9f31b8b8337c440132e20c87e3b2e | 1,226 | # frozen_string_literal: true
require 'spec_helper'
describe Projects::RestoreService do
let(:user) { create(:user) }
let(:pending_delete) { nil }
let(:project) do
create(:project,
:repository,
namespace: user.namespace,
marked_for_deletion_at: 1.day.ago,
deleting_user: user,
a... | 25.541667 | 83 | 0.682708 |
ede55f4a4669740722d04b3c252e86e7a4acfbd5 | 8,370 | require 'spec_helper'
require 'pact_broker/pacticipants/service'
require 'pact_broker/domain/tag'
require 'pact_broker/domain/pact'
module PactBroker
module Pacticipants
describe Service do
let(:td) { TestDataBuilder.new }
subject{ Service }
describe ".update" do
before do
... | 35.168067 | 142 | 0.608124 |
7a54c112e686a6583ce40a0724765ea7847e7f7e | 1,491 | require 'spec_helper'
require 'json'
describe 'web_configure' do
chef_run = ChefSpec::SoloRunner.new
before(:all) do
chef_run.node.normal_attrs = property[:chef_attributes]
chef_run.converge('role[web_configure]')
end
it 'is apache service is running ' do
expect(service(chef_run.node['apache']['s... | 36.365854 | 113 | 0.67941 |
edc3bb11f0267f547a0e6ca54f4d07fab9e1613a | 6,164 | require File.dirname(__FILE__) + '/beanstream/beanstream_core'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# This class implements the Canadian {Beanstream}[http://www.beanstream.com] payment gateway.
# It is also named TD Canada Trust Online Mart payment gateway.
# To learn more about the spe... | 36.258824 | 182 | 0.624432 |
7afa350131825b64d2df108aeab0c989f3afa16f | 32 | # encoding: utf-8
puts '135°C'
| 8 | 17 | 0.625 |
11115788e6672e3875210b887e8b90a81454a6c2 | 2,055 | class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4.tar.gz"
sha256 "7d0232b9f1c57e8de81f38071ef8203e6820fe7eec8ae46a1df125d88dbcc2e1"
license "BSD-3-Clause"
head "https://gitlab.kitware.com/cmake/cmak... | 31.136364 | 122 | 0.689051 |
03561d1caea860afebef4f738122b5566613e419 | 591 | class LRUCache
def initialize(size)
@size = size
@cache = []
end
def count
# returns number of elements currently in cache
self.cache.length
end
def add(el)
# adds element to cache according to LRU principle
if self.cache.include?(el)
self.cache.delete(el)
self.cache << e... | 16.416667 | 59 | 0.619289 |
6a3f57d9e2bbaef0a385f005817c6325885b9032 | 133 | class GroupEquipmentship < ActiveRecord::Base
belongs_to :user
belongs_to :group
belongs_to :equipment, class_name: 'Item'
end | 22.166667 | 45 | 0.781955 |
38419f8e98d21a71a729c8a5919c91d8f5718125 | 4,996 | #!/usr/bin/env ruby
# encoding: utf-8
require_relative '../../environment.rb'
include Sinatra::Mimsy::Helpers
file = "/Users/dshorthouse/Desktop/Objects MXG Upload RTM Dec 2018 - Toronto BB.txt"
log = "/Users/dshorthouse/Desktop/Objects MXG Upload RTM Dec 2018 - Toronto BB.csv"
log_entries = []
CSV.foreach(file, :he... | 30.650307 | 97 | 0.707166 |
e83e4ec17766f464ae008777e577e80978e63086 | 491 | module Mulukhiya
class GitHubWebhookContractTest < TestCase
def setup
@contract = GitHubWebhookContract.new
end
def test_call
errors = @contract.call(digest: 'fuga').errors
assert(errors.empty?)
errors = @contract.call(digest: 11).errors
assert_false(errors.empty?)
e... | 22.318182 | 52 | 0.663951 |
ed97b6cb577e95c33ac3f25c434507dc8180bf27 | 3,340 | require 'spec_helper'
feature 'Project', feature: true do
describe 'description' do
let(:project) { create(:project) }
let(:path) { namespace_project_path(project.namespace, project) }
before do
login_as(:admin)
end
it 'parses Markdown' do
project.update_attribute(:description, '... | 29.298246 | 101 | 0.673353 |
7adf7874d230cf8fa9c0dc11ba60110af01347aa | 863 | class OrganizationsController < ApplicationController
def show
authorize Organization
end
# alert: no authlevel!
def new
@organization = Organization.new
authorize @organization
end
# alert: no authlevel!
def create
@organization = Organization.new(organization_params)
authorize @org... | 22.128205 | 91 | 0.695249 |
11067a3c8ea0cf8356dbb749d992bc38cb387150 | 6,963 | # frozen_string_literal: true
require 'test_helper'
class Admin::Api::ApplicationPlanMetricLimitsTest < ActionDispatch::IntegrationTest
def setup
@provider = FactoryBot.create(:provider_account, domain: 'provider.example.com')
@service = FactoryBot.create(:service, account: @provider)
@app_plan = Factor... | 39.788571 | 152 | 0.736895 |
1ad12b9e047d114a92736ece7ab95c9f8eb6f7c5 | 34,451 | # NOTE: file contains code adapted from **oracle-enhanced** adapter, license follows
=begin
Copyright (c) 2008-2011 Graham Jenkins, Michael Schoen, Raimonds Simanovskis
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to ... | 36.150052 | 165 | 0.653827 |
01a8ee8632fa3d572763431b19a811930f817cc6 | 458 | require 'rails_helper'
RSpec.describe Question, type: :model do
subject { described_class.new(title: 'Question?', description: 'Description') }
it 'is valid with valid attributes' do
expect(subject).to be_valid
end
it 'is not valid without a title' do
subject.title = nil
expect(subject).to_not b... | 19.913043 | 81 | 0.71179 |
0852dfb1eaf34ea29b0a908560549db4b4a917bb | 126 | # http://www.codewars.com/kata/56fa3c5ce4d45d2a52001b3c
# --- iteration 1 ---
def xor(a,b)
[!!a, !!b].count(true) == 1
end
| 18 | 55 | 0.626984 |
03df65edf1b104d2a8daecdd6231d812f3e277bb | 553 | Дэвид Бекхэм попал в ДТП, пытаясь скрыться от кроме
Дэвид Бекхэм попал в аварию на мотоцикле, пытаясь спасти себя от кроме.
Это случилось в Лос-Анджелесе на бульваре Сансет.
Британский футболист легко отделалась лишь сотрясением и ресторан, правую руку.
Бэкхем покинул комнату татуировки, где находились кроме лагерем, ж... | 69.125 | 147 | 0.815552 |
334414bcf41880b9e60e0bdf5060c3245641b7ce | 878 | Hanami::Model.migration do
change do
create_table :songs do
column :title, String
column :useless, String
foreign_key :artist_id, :artists
index :artist_id
add_constraint(:useless_min_length) { char_length(useless) > 2 }
end
alter_table :songs do
add_primary_key :id
... | 23.72973 | 70 | 0.676538 |
b9c20b2199e227ad31a783e82457b3ec9bbbf675 | 6,834 | WORKSPACE_DIR = File.expand_path(File.dirname(__FILE__) + '/..')
def in_dir(dir)
current = Dir.pwd
begin
Dir.chdir(dir)
yield
ensure
Dir.chdir(current)
end
end
ENV['PREVIOUS_PRODUCT_VERSION'] = nil if ENV['PREVIOUS_PRODUCT_VERSION'].to_s == ''
ENV['PRODUCT_VERSION'] = nil if ENV['PRODUCT_VERSION']... | 39.275862 | 274 | 0.649985 |
e9363b69a6076c78d47c06eeb16f7aeb0063e490 | 1,846 | # frozen_string_literal: true
require_relative '../helpers'
module Adventofcode
module Year2020
class Day4 < Adventofcode::Day
REQUIRED_FIELDS = {
"byr" => ->(field) { (1920..2002).cover?(field.to_i) },
"iyr" => ->(field) { (2010..2020).cover?(field.to_i) },
"eyr" => ->(field) { (... | 28.84375 | 89 | 0.490791 |
6152d560046e0cc1cf58bfa6593b4135fa3dac79 | 1,368 | # typed: true
module Kuby
module Redis
module DSL
module Databases
module V1
class RedisFailoverSpecSentinelAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelector < ::KubeDSL::DSLObject
key_value_field(:match_labels, format: :string)... | 45.6 | 251 | 0.726608 |
913feeb92a6fd723283ea74d2cd17b015cea2653 | 637 | Pod::Spec.new do |s|
s.name = "OEXRemoteConfig"
s.version = "0.0.1"
s.summary = "This contains custom configuration details for edX on iOS."
s.homepage = "https://github.com/appsembler/edx-app-ios-config"
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE.txt' ... | 45.5 | 120 | 0.590267 |
ffb80ecb4b8b11a2796668ac097df46bf43c29e5 | 49,807 | # encoding: UTF-8
unless defined? ASCIIDOCTOR_PROJECT_DIR
$: << File.dirname(__FILE__); $:.uniq!
require 'test_helper'
end
context 'Tables' do
context 'PSV' do
test 'renders simple psv table' do
input = <<-EOS
|=======
|A |B |C
|a |b |c
|1 |2 |3
|=======
EOS
cells = [%w(A B C), %w(a b c), ... | 29.95009 | 175 | 0.620756 |
87ca62785b769290c16c1aa26fde287fe945c653 | 1,311 | # frozen_string_literal: true
require 'chefspec'
require 'chefspec/berkshelf'
require 'pathname'
def dummy_context(node)
OpenStruct.new(node: node)
end
def fixture_path(*path)
Pathname.new(File.expand_path('fixtures', __dir__)).join(*path)
end
# Stolen from https://github.com/rails/rails/pull/30275 and put
# in... | 23 | 75 | 0.697941 |
7a0f6b4a4f0489d785b667eedb50056fe60343d1 | 493 | class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
flash[:success] = "Welcome to the Sample App!"
redirect_to @user
else
render'new'
end... | 15.40625 | 60 | 0.58215 |
e2e61b08a68a81173a6bd97ac5165a12501e3286 | 691 | #
# Cookbook Name:: masala_cassandra
# Recipe:: agent
#
# Copyright 2016, Paytm Labs
#
# 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
#
# Unl... | 31.409091 | 74 | 0.762663 |
d5f027fa3e44a680602a2870054f5bf3d1c95abe | 5,766 | class MysqlAT56 < Formula
desc "Open source relational database management system"
homepage "https://dev.mysql.com/doc/refman/5.6/en/"
url "https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.51.tar.gz"
sha256 "262ccaf2930fca1f33787505dd125a7a04844f40d3421289a51974b5935d9abc"
license "GPL-2.0-only"
bot... | 31.681319 | 108 | 0.673084 |
26167172c7e3368af0017f4661d49341bab87a20 | 1,226 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-organizations/types'
require_relative 'aws... | 25.541667 | 85 | 0.755302 |
bb4ab4ac495ec8e6068f29e778ee3011f75b251a | 1,511 | require 'spec_helper'
module CMIS
describe CMIS::Query do
before :all do
@folder = create_folder
21.times { create_document }
end
after :all do
@folder.delete_tree
end
context 'when querying with a limit' do
it 'should execute only one query if limit is under 10' do
... | 27.472727 | 89 | 0.663799 |
26bb9502405625450da6fe73e04ae7dcdded334e | 4,193 | # Adds conversion methods to the Collins::Asset class for obtaining Jetpants equivalents
module Collins
class Asset
# Convert a Collins::Asset to a Jetpants::DB. Requires asset TYPE to be SERVER_NODE.
def to_db
raise "Can only call to_db on SERVER_NODE assets, but #{self} has type #{type}" unless type... | 46.076923 | 149 | 0.674457 |
6277e320ea887356f5418ab63f9acb9228fd9f55 | 148 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def hello
render html: "Hello,World!"
end
end
| 18.5 | 52 | 0.763514 |
39d302c385375baf77d847706248751cf617adae | 2,583 | class CustomersController < ApplicationController
before_filter :signed_in_user, only: [:create, :show, :index]
before_filter :correct_user, only: [ :destroy , :show ,:edit ]
autocomplete :customer, :name
def index
@customers = current_user.customers.paginate(page: params[:page])
end
def cr... | 25.83 | 82 | 0.619048 |
620b782c2e683a38b28596e396ea93ceed875ce9 | 1,760 | # frozen_string_literal: true
require 'zoho_hub/records/base_record'
module ZohoHub
class Potential < BaseRecord
attributes :id, :code, :deal_name, :amount, :description, :stage
attributes :company_age_years, :company_age_months, :term, :use_proceeds, :proceeds_detail
attributes :currency, :territory, :... | 33.207547 | 98 | 0.684091 |
332759704319a3c065b335cea13dee26c52aa6dd | 623 | require 'test_helper'
class UsersProfileTest < ActionDispatch::IntegrationTest
include ApplicationHelper
def setup
@user = users(:michael)
end
# test "profile display" do
# get user_path(@user)
# assert_template 'users/show'
# assert_select 'title', full_title(@user.name)
# assert_selec... | 28.318182 | 62 | 0.693419 |
4aa066a468d78518f8e9da6f85deec85671780ad | 11,240 | # -*- coding: binary -*-
require 'msf/core'
require 'pathname'
#
# Define used for a place-holder module that is used to indicate that the
# module has not yet been demand-loaded. Soon to go away.
#
Msf::SymbolicModule = '__SYMBOLIC__'
###
#
# A module set contains zero or more named module classes of an arbitrary
# ... | 33.452381 | 118 | 0.69137 |
1c2999f362d69ac635725eb1a6abee60b3069858 | 1,347 | describe "migration order" do
let(:current_release_migrations) do
File.read(File.join(__dir__, 'data/released_migrations')).split.map(&:to_i).sort
end
let(:migrations_now) do
Dir.glob(File.join(Rails.root, "db/migrate/*.rb")).map do |f|
File.basename(f, ".rb").split("_").first.to_i
end.sort
e... | 29.282609 | 90 | 0.76095 |
5dce9ed248c99d1d9cdc2833088ca23e53c0ecc7 | 636 | require 'spec_helper_acceptance'
describe 'secure_apache class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'should work idempotently with no errors' do
pp = <<-EOS
class { 'secure_apache': }
EOS
# Run it twice and test for idempotency
apply_manifest(... | 24.461538 | 51 | 0.665094 |
edb186344ef503c4699fe7ffbd9927bdfbf1d1df | 714 | # frozen_string_literal: true
require "spec_helper"
describe Montrose do
it { assert ::Montrose::VERSION }
describe ".r" do
it { Montrose.r.must_be_kind_of(Montrose::Recurrence) }
it { Montrose.r.default_options.to_h.must_equal({}) }
it { Montrose.r(every: :day).must_be_kind_of(Montrose::Recurrence)... | 32.454545 | 84 | 0.718487 |
1dc3231cedf3d6696f5201ac8627adddf0c8c892 | 592 | require 'test_helper'
module Landlord
class Accounts::MembershipsControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
include Devise::Test::IntegrationHelpers
test "should only allow owner access" do
owner_mem = landlord_memberships(:owner_1)
admin_mem = landlor... | 25.73913 | 77 | 0.753378 |
26e5514a04cd1b86938f54d95ed4eb19c4cea86d | 406 | # name: user-themes
# about: Make Discourse have users be able to switch from available forum themes on the fly.
# version: 0.0.1
# authors: lunarmuffins
enabled_site_setting :DiscourseThemes_enabled
add_admin_route 'DiscourseThemes.title', 'DiscourseThemes'
Discourse::Application.routes.append do
get '/admin/p... | 33.833333 | 99 | 0.793103 |
030c899badc3263ca45c39656414d27113838b22 | 11,459 | require "spec_helper"
describe Mongoid::Relations::Embedded::In do
describe "#===" do
let(:base) do
Name.new
end
let(:target) do
Person.new
end
let(:metadata) do
Name.relations["namable"]
end
let(:relation) do
described_class.new(base, target, metadata)
en... | 19.963415 | 80 | 0.58033 |
b94309db45eb7d479d78fe9613d509c28c0fed06 | 1,206 | # frozen_string_literal: true
module Jekyll
module TableOfContents
# jekyll-toc configuration class
class Configuration
attr_accessor :toc_levels, :no_toc_class, :no_toc_section_class,
:list_class, :sublist_class, :item_class, :item_prefix
DEFAULT_CONFIG = {
... | 28.714286 | 75 | 0.601161 |
1c8e88f3230836d5f87679ae6b36a9dbe60c5da2 | 82 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'lita/weather'
| 27.333333 | 58 | 0.731707 |
26fac381aaffd612c0920058462f3ec5979b7f74 | 6,658 | class VidgameScraper::Scraper
def self.scrape_all_items(url)
#open the url and scrape all the items ps4,ps5 etc.ur
# url =" https://austin.craigslist.org/#{type}"
webpage = Nokogiri::HTML(open(url))
section = webpage.css(".rows").css(".result-row").css(".result-info").css(".result-h... | 44.986486 | 170 | 0.56158 |
bfe356725ca55fd42246901c786e57286b2d2809 | 687 | # This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
RSpec.configure do |c|
c.mock_with :rspec
end
# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly se... | 29.869565 | 80 | 0.73508 |
7a0aeac57bc3792fbbcf0305eb5fc25fac234b1a | 2,536 | require 'one_gadget/gadget'
# https://gitlab.com/libcdb/libcdb/blob/master/libc/libc0.1-2.24-7/lib/i386-kfreebsd-gnu/libc-2.24.so
#
# Intel 80386
#
# GNU C Library (Debian GLIBC 2.24-7) stable release version 2.24, by Roland McGrath et al.
# Copyright (C) 2016 Free Software Foundation, Inc.
# This is free software; s... | 53.957447 | 150 | 0.586356 |
79a0cd3005b4db30bb933f89476ca00a806ba33c | 2,650 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'inspec/version'
Gem::Specification.new do |spec|
spec.name = 'inspec'
spec.version = Inspec::VERSION
spec.authors = ['Dominik Richter']
spec.email = ['dominik... | 44.915254 | 354 | 0.676226 |
d5b9903ea36b427289d2ad90d8b70678649a7eed | 493 | class TransactionsController < ApplicationController
def new
@transaction = Transaction.new
end
def create
@transaction = Transaction.new(transaction_params)
@transaction.user = current_user
if txid = @transaction.create_with_eth
redirect_to user_path(current_user), notice: "Transaction is... | 20.541667 | 92 | 0.720081 |
6216f189c20823ef45e88a6f6237654c044f00cf | 284 | Допустим(/^есть строк[иа] ссылки:$/) do |string|
@parser = Bukovina::Parsers::Link.new
@res = @parser.parse( YAML.load( string ) ) ; end
То(/^обработанные данные ссылки будут выглядеть как:$/) do |string|
expect( @res[ :link ].to_yaml.strip ).to be_eql( string.to_s ) ; end
| 40.571429 | 71 | 0.665493 |
ff9731993b7b5fc436089cac286ce53f1f3006fc | 717 | module Spree
class Calculator::FlatPercentTaxonTotal < Calculator
preference :flat_percent, :decimal, :default => 0
preference :taxon, :string, :default => ''
attr_accessible :preferred_flat_percent, :preferred_taxon
def self.description
I18n.t(:flat_percent_taxon)
end
def compute... | 29.875 | 107 | 0.695955 |
bb3466b46107ef03d765a2f547ba3e563377bb98 | 367 | class AddAlertMarkedThroughToVendors < ActiveRecord::Migration
def change
add_column :vendors, :alert_marked_through_text, :boolean, default: false
add_column :vendors, :alert_marked_through_app, :boolean, default: false
add_column :vendors, :alert_marked_through_flag, :boolean, default: true
remove_... | 40.777778 | 77 | 0.790191 |
395d6c07bd6771d3dcb97371357e92655bb88ca5 | 951 | cask 'remote-desktop-manager' do
version '5.4.0.0'
sha256 '04a460944353df93e1b75080e3f0fc6baa1a56780f0244cc22d520831d20ee74'
# devolutions.net was verified as official when first introduced to the cask
url "http://cdn.devolutions.net/download/Mac/Devolutions.RemoteDesktopManager.Mac.#{version}.dmg"
appcast '... | 45.285714 | 99 | 0.726604 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.