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 |
|---|---|---|---|---|---|
87b077cc9936e45fbbb59f887fd8163f66fc27f5 | 220 | cask :v1 => 'r-name' do
version :latest
sha256 :no_check
url 'http://www.jacek-dom.net/software/R-Name/R-Name.app.zip'
homepage 'http://www.jacek-dom.net/software/R-Name/'
license :gpl
app 'R-Name.app'
end
| 20 | 63 | 0.672727 |
f85000bbb810e26b0d77ba73758fb73304887b4c | 1,198 | # rubocop:disable Style/UnlessElse
class UsersController < ApplicationController
before_action :authenticate_request, except: %i[login register]
def index
render json: User.all
end
def login
authenticate params[:email], params[:password]
end
def test
render json: {
message: 'You have p... | 20.305085 | 82 | 0.657763 |
f7d99e0d099bc05df361e4b929106885765b8418 | 1,149 | require_relative 'test_helper'
# Kernel test class
class KernelTest < Minitest::Test
include FakeFS
def setup
FakeFS.deactivate!
end
def teardown
FakeFS.activate!
end
def test_can_exec_normally
out = open("|echo 'foo'")
assert_equal "foo\n", out.gets
end
def test_fake_kernel_can_crea... | 19.810345 | 68 | 0.635335 |
62093e075a6b01c15d58b3f1199e647143df77e0 | 309 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
private
# Confirms a logged-in user
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in"
redirect_to login_url
end
end
end
| 19.3125 | 52 | 0.728155 |
bf5a097d75bea74469b7cefe83e285c47320af82 | 6,127 | module MesscadaApp
class ForceBinStaging < BaseService
attr_reader :repo, :delivery_repo, :locn_repo, :messcada_repo, :bin_number, :plant_resource_code, :presort_staging_run_id, :presort_staging_run_child_id, :bin, :staging_run
def initialize(bin_number, child_run_id)
@repo = RawMaterialsApp::PresortSt... | 51.923729 | 294 | 0.739187 |
d57c9d31d131ee79228df4b3531097e0fc7bffdd | 1,882 | # frozen_string_literal: true
require 'rake/tasklib'
require 'ansible-ruby'
require 'ansible/ruby/rake/task_util'
require 'ansible/ruby/rake/compile'
require 'ansible/ruby/rake/clean'
module Ansible
module Ruby
module Rake
class Execute < ::Rake::TaskLib
include TaskUtil
# :reek:Attribute... | 28.953846 | 73 | 0.587673 |
6a4ed6ba084d61f6e47d30552d5ceeaa7f86ceac | 1,382 | ActionController::Routing::Routes.draw do |map|
map.namespace :admin do |a|
a.resources :users, :collection => {:search => :post}
end
map.resources :profiles, :member=>{:delete_icon=>:post}, :collection=>{:search=>:get}, :has_many => [:friends, :blogs, :photos, :comments, :feed_items, :messages] do |profile... | 37.351351 | 178 | 0.649059 |
03915be6996ffa215e9af74b4b28c2ceeebf4101 | 110 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "nanoboxifier"
require "minitest/autorun"
| 22 | 58 | 0.754545 |
ab02bfd5c22e237fdbc5ad09d75c6fa2f8fa603a | 157 | class CreateCarts < ActiveRecord::Migration
def change
create_table :carts do |t|
t.integer :store_id
t.integer :user_id
end
end
end
| 17.444444 | 43 | 0.675159 |
f80a6b8b56cb4332d24748c6dbd57d4468b0b0ce | 1,923 | require 'spec_helper'
require 'dea/utils/upload'
describe Upload do
let(:file_to_upload) do
file_to_upload = Tempfile.new("file_to_upload")
file_to_upload << "This is the file contents"
file_to_upload.close
file_to_upload
end
subject { Upload.new(file_to_upload.path, "http://127.0.0.1:12345/") }... | 29.584615 | 137 | 0.618305 |
79ac55c195c42d9782b98e6e498775c6775f60a8 | 1,784 | class Spa < ApplicationRecord
has_many :technicians, :dependent => :delete_all
has_many :treatments
has_many :appointments, :through => :treatments
validates :name, :presence => true
validates :phone_number, :presence => true
scope :by_zipcode, -> (zipcode) { where("zip = ?", zipcode)}
... | 31.857143 | 102 | 0.622758 |
0366eff141b363134c4ebb847fef221e0424c1e6 | 4,306 | require 'time'
require 'rack/utils'
require 'rack/mime'
module Rack
# Rack::Directory serves entries below the +root+ given, according to the
# path info of the Rack request. If a directory is found, the file's contents
# will be presented in an html based index. If a file is found, the env will
# be passed to... | 25.784431 | 140 | 0.574779 |
182c35596445eae0085836795a67eec0982865e6 | 287 | cask 'inc' do
version :latest
sha256 :no_check
# amazonaws.com is the official download host per the vendor homepage
url 'http://inc-static.kippt.com.s3.amazonaws.com/apps/inc-osx.zip'
name 'Inc'
homepage 'https://sendtoinc.com/apps/'
license :gratis
app 'Inc.app'
end
| 22.076923 | 71 | 0.714286 |
ac1f1a620d2552a87d3d20a36770c9b14503999e | 2,573 | require 'fog'
module Muggy
module Fog
include Muggy::Support::Memoisation
extend self
# assumptions: Muggy.use_iam? is defined
# reset service instances.
# Used to reset memoised values if the global region's changed.
def reset_services!
%w{
auto_scaling
cache
... | 19.792308 | 111 | 0.630004 |
acba9cd6f7085ccc70e5173d50aa7c261befa04c | 3,537 | require 'spec_helper'
require 'f5/icontrol'
require_relative '../../../libraries/vip'
require_relative '../../../libraries/credentials'
require_relative '../../../libraries/dns_lookup'
require_relative '../../../libraries/gem_helper'
describe 'f5_test::test_create_vip_name' do
let(:api) { double('F5::Icontrol') }
... | 28.756098 | 96 | 0.60475 |
ac977c7361f0199150789dec21aecf7224fdc879 | 3,860 | class SubmissionRule < ActiveRecord::Base
class InvalidRuleType < Exception
def initialize(rule_name)
super I18n.t('assignment.not_valid_submission_rule', type: rule_name)
end
end
belongs_to :assignment, inverse_of: :submission_rule
has_many :periods, -> { order('id') }, dependent: :destroy
ac... | 33.859649 | 101 | 0.764249 |
d5f97bca6d03d375bfd40e9ee9f5c9ab1763940b | 5,122 | require 'sequel'
require 'benchmark'
DB = Sequel.connect ARGV[0]
DB.create_table! :languages1 do
primary_key :id
varchar :name, :size => 16, :unique => true
varchar :plural, :size => 128
end
DB.create_table! :translations1 do
primary_key [:language_id, :msgid_hash, :msgstr_index]
... | 29.268571 | 79 | 0.588832 |
e9f849b5240d4348db712d520da3f85476889ad1 | 274 | require 'rails_helper'
RSpec.describe Identifier, type: :model do
let(:identifier) { create :identifier }
describe 'the code' do
it 'should be unique' do
iden2 = Identifier.new(code: identifier.code)
expect(iden2.valid?).to be_falsey
end
end
end
| 21.076923 | 51 | 0.689781 |
38227ac2e7193512405779ebca5d4c650702ec3a | 88 | # frozen_string_literal: true
class Task < ApplicationRecord
belongs_to :project
end
| 14.666667 | 30 | 0.806818 |
1dfb6f875cbdb7d642727473bf7903b27db6adb9 | 114 | json.extract! chat, :id, :student_id, :mentor_id, :created_at, :updated_at
json.url chat_url(chat, format: :json)
| 38 | 74 | 0.745614 |
331b5018bae5f80f5aca0c3494ba6141645230cb | 1,580 | # frozen_string_literal: true
# Copyright 2020 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... | 30.384615 | 75 | 0.626582 |
acf81699756e8ab772f15ae1a0b8365d4ae34717 | 484 | AvatarsForRails.setup do |config|
# Filters to run before updating the avatar
# config.controller_filters = [ :authenticate_user! ]
# The method to get the avatarable in the controller
# config.controller_avatarable = :current_user
# The default styles that will be generated
# config.avatarable_styles = {... | 32.266667 | 55 | 0.679752 |
39a0555eea02db61e532fda62fc2293701903bd8 | 2,200 | module EpiCas
class LdapInfo < Struct.new(:username, :user_class)
def attributes
@attributes ||= get_ldap_info
end
def uid
attributes[:uid]
end
def mail
attributes[:mail]
end
def dn
attributes[:dn]
end
def ou
attributes[:ou]
end
d... | 28.947368 | 108 | 0.562727 |
3963b9d35f3e68ab108180074f292f5d00320177 | 1,284 | class MoviesController < ApplicationController
respond_to :html
# this is really heavy. Should probably move to a javascript form
before_action :load_actors, only: [:new, :create, :edit, :update]
def index
@filter = Filter.new({ title: :title, actor: 'actors.name' }, params)
respond_with @movies = @f... | 20.380952 | 73 | 0.674455 |
e21a79fe69e037fd443f1b4d844d5bd41c44aa9b | 5,873 | require 'octokit'
require 'optparse'
module Git
module Pr
module Release
class CLI
include Git::Pr::Release::Util
extend Git::Pr::Release::Util
def self.start
host, repository, scheme = host_and_repository_and_scheme
if host
# GitHub:Enterprise
... | 36.478261 | 124 | 0.570747 |
79e4885ebf0dc04a439abb9898963cdc02225260 | 2,870 | require 'formula'
class Graphviz < Formula
homepage 'http://graphviz.org/'
url 'http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.30.1.tar.gz'
sha1 '96739220c4bbcf1bd3bd52e7111f4e60497185c6'
devel do
url 'http://graphviz.org/pub/graphviz/development/SOURCES/graphviz-2.31.20130608.0446.tar.gz'... | 30.531915 | 117 | 0.661324 |
3913851f15b6a60e493679cf8a6c5851495db6de | 334 | require "simplecov"
SimpleCov.start "rails"
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all test... | 25.692308 | 82 | 0.748503 |
1dc1245a70aed970292bd7584834116e553ba876 | 713 | class Notification < ApplicationRecord
self.inheritance_column = nil
serialize :params, Noticed::Coder
belongs_to :recipient, polymorphic: true
scope :sorted, -> { order(created_at: :desc) }
def self.mark_as_read!
update_all(read_at: Time.current, updated_at: Time.current)
end
# Rehydrate the dat... | 20.371429 | 82 | 0.643759 |
33e4f364dcdf5d18efeb76844f68fd2ef81b01d4 | 3,984 | module MyAcademics
class CollegeAndLevel
include AcademicsModule, ClassLogger
def merge(data)
response = Bearfacts::Profile.new(user_id: @uid).get
feed = response.delete :feed
# The Bear Facts API can return empty profiles if the user is no longer (or not yet) considered an active student.... | 37.233645 | 151 | 0.609438 |
b93fbafdd2539e83afe861ab0fa11e0c5c1dd77c | 180 | #!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.expand_path('..', __dir__), 'app/lib'))
ENV['RAKE'] = nil
require 'tomato_shrieker'
TomatoShrieker::Scheduler.instance.exec
| 22.5 | 73 | 0.733333 |
627851dba25cae2682bce84e60c018a1a71fd8a5 | 1,104 | require 'test_helper'
class NotificationsControllerTest < ActionController::TestCase
def test_should_get_index
get :index
assert_response :success
assert_not_nil assigns(:notifications)
end
def test_should_get_new
get :new
assert_response :success
end
def test_should_create_notification... | 24 | 68 | 0.740036 |
7abd1492681ac5137055c31b56c1000443a39d1b | 312 | cask "shift" do
version "5.0.86"
sha256 "f3ceca819a0bc29f4acb334e80bc9a9f564204dccfd7cdcf5c20d97c4e427d41"
url "https://update.tryshift.com/download/version/#{version}/osx_64"
appcast "https://tryshift.com/download/?platform=mac"
name "Shift"
homepage "https://tryshift.com/"
app "Shift.app"
end
| 26 | 75 | 0.75 |
792f8e9dd955755f81172c2bb1a61f486a9f7ce0 | 3,742 | require 'faye/websocket'
require 'eventmachine'
module RSlack
module Slack
module Live
attr_reader :url, :socket_client
# Public: Method that connects to the WebSocket server using the URL
# of the server which is inside the response of the rtm.start call
#
# url - A WebSocket URL
... | 31.982906 | 85 | 0.581507 |
abfd59eaa21750e38f2a2a8f9bb965b0027e31e8 | 1,158 | require_relative 'treasure_trove'
require_relative 'Playable'
module StudioGame
class Player
include Playable
attr_accessor :name
attr_reader :health
def initialize(name, health=100)
@name = name.capitalize
@health = health
@found_treasures = Hash.new(0)
end
def self.from_csv(string)
name, he... | 19.3 | 85 | 0.67962 |
1de5243db2d5c8a3a014df1ed2449f0b98b45632 | 919 | # frozen_string_literal: true
# See LICENSE.txt at root of repository
# GENERATED FILE - DO NOT EDIT!!
require 'ansible/ruby/modules/base'
module Ansible
module Ruby
module Modules
# This module allows you to copy the running configuration of a switch over its startup configuration. It is recommended to us... | 57.4375 | 672 | 0.781284 |
f8f14e9a34d96ac8056ebcee151a949ce65d265a | 1,235 | require_domain_file
describe ManageIQ::Automate::Cloud::VM::Provisioning::Profile::GetDeployDialog do
let(:cat) { 'environment' }
let(:tag) { 'dev' }
let(:root_hash) { { 'dialog_input_vm_tags' => "#{cat}/#{tag}" } }
let(:root_object) { Spec::Support::MiqAeMockObject.new(root_hash) }
let(:a... | 34.305556 | 88 | 0.693927 |
edd786cce7bdc96e1fd7518d177097debd061749 | 1,387 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe MutatorRails::Statistics do
let(:object) { described_class.call }
let(:statistics_file) { 'log/mutant/statistics.txt' }
before do
File.delete(statistics_file) if File.exist?(statistics_file)
end
describe '#call' do
let(:expectations... | 25.218182 | 64 | 0.720981 |
03a6d2f502cca3c4fb8d2d7eee22f574a49b579d | 548 | require "utils/commands/add_path_command"
require "plugins/plugin_command_spec"
describe AddPath do
let(:test_path) { "test path" }
subject { AddPath.new(test_path) }
it_behaves_like "a plugin command"
describe "#do" do
before do
allow(subject).to receive(:system)
end
... | 23.826087 | 118 | 0.638686 |
26bcc8aba719e14e79672a6cfdcafd7810341c2f | 43 | module CelViewTool
VERSION = "0.1.0"
end
| 10.75 | 19 | 0.697674 |
b9c6b5e70a0f6da321d31241e5d11f569278e3d3 | 1,657 | class Pulumi < Formula
desc "Cloud native development platform"
homepage "https://pulumi.io/"
url "https://github.com/pulumi/pulumi.git",
:tag => "v1.14.0",
:revision => "ee675011512b6f847eeb45685f8873db89e09d10"
bottle do
cellar :any_skip_relocation
sha256 "f8a22bc2dd23579a32359926cb6... | 31.264151 | 93 | 0.648159 |
1d2137814d8e655078651e239367cdc3d7ed841b | 106 | require "httparty"
class BaseService
include HTTParty
base_uri "https://gorest.co.in/public-api"
end
| 15.142857 | 44 | 0.764151 |
bfb2312f498d14e439c5dd2e57da4aeff427dfbb | 314 | # app.rb
require 'rubygems'
require 'sinatra/base'
require 'rack'
require 'yaml'
require 'erb'
class TestApp < Sinatra::Base
set :root, File.dirname(__FILE__)
set :static, true
get '/:view' do |view|
erb view.to_sym
end
end
if __FILE__ == $0
Rack::Handler::Mongrel.run TestApp, :Port => 8070
end
| 14.952381 | 51 | 0.681529 |
6254017615b8bf65177d72aef6a2540154539f89 | 2,168 | class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration[4.2]
include Gitlab::ShellAdapter
class ProjectPath
attr_reader :old_path, :id, :namespace_path
def initialize(old_path, id, namespace_path, namespace_id)
@old_path = old_path
@id = id
@namespace_path = namespace_path
... | 26.765432 | 177 | 0.704797 |
ff068e9b287f58cadf6674cdea585adeed505e28 | 926 | require 'spec_helper'
describe 'postfix::augeas' do
let (:facts) { {
:augeasversion => '1.2.0',
:lsbdistcodename => 'wheezy',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:rubyversion => '1.9.3',
:path => '/foo/bar',
} }
let :pre_condition do
"include :... | 31.931034 | 82 | 0.62635 |
d5a8b690b9e56b6b0f7c8c83e10206bc4fb3c51a | 201 | module ImagesHelper
# called in goals show page to display latest image
def view_latest_image
if @goal.images.any?
image_tag(@goal.images.last.url)
end
end
end | 20.1 | 55 | 0.641791 |
080ea0f21bc386be0c5d5f41178fd374bf017109 | 5,295 | #
# Author:: John Keiser (<jkeiser@opscode.com>)
# Copyright:: Copyright (c) 2013 Opscode, 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 at
#
# ... | 21.790123 | 97 | 0.594145 |
01a51d31084425d0ac745ed5aca376f591c0eab1 | 750 | cask 'terminus' do
version '1.0.82'
sha256 '2e00b814031e1bef2ced9aa49c4ed87c3fee21545a038259553dbd34f48c98af'
# github.com/Eugeny/terminus was verified as official when first introduced to the cask
url "https://github.com/Eugeny/terminus/releases/download/v#{version}/terminus-#{version}-macos.dmg"
appcast 'h... | 37.5 | 102 | 0.693333 |
08daf6d0ff91e1a88c0330f1c2120cd6e7d10052 | 1,839 | # Copyright © 2011-2020 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list... | 51.083333 | 145 | 0.805329 |
e96196b6a25db812f9934761cb7defe2b3d3756d | 4,359 | require "test_helper"
require "support/password_helpers"
class PasswordResetTest < ActionDispatch::IntegrationTest
include PasswordHelpers
include ActiveJob::TestHelper
BLANKET_RESET_MESSAGE = "If your email address is recognised, you’ll receive an email with instructions about how to reset your password.".free... | 32.529851 | 147 | 0.738013 |
395a20ba9e3e40a24df6bc9f8be27360a7b797f8 | 440 | require 'json'
class Rental
attr_accessor :date, :book, :person
def initialize(date, book, person)
@date = date
@book = book
book.rentals << self
@person = person
person.rentals << self
end
def to_s
"Date: #{@date}, Book \"#{book.title}\" by #{book.author}"
end
def to_json(_opti... | 16.296296 | 62 | 0.563636 |
28a817e1d582b8e57039ca94eb90c601a61e744d | 389 | # require FinancialAssistance::Engine.root.join('app', 'domain', 'types.rb')
FinancialAssistanceRegistry = ResourceRegistry::Registry.new
FinancialAssistanceRegistry.configure do |config|
config.name = :enroll
config.created_at = DateTime.now
config.load_path = "#{Rails.root.to_s.gsub('/components/financi... | 43.222222 | 130 | 0.771208 |
334a9aa5ab906f8fbaae859a370e73ad0b1ecc65 | 34,152 | # encoding: utf-8
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
require 'set'
describe "Prawn::Table" do
describe "converting data to Cell objects" do
before(:each) do
@pdf = Prawn::Document.new
@table = @pdf.table([%w[R0C0 R0C1], %w[R1C0 R1C1]])
end
it "shou... | 33.060987 | 92 | 0.572997 |
396f88a742dbdf804fec363ba8e4646ed621243f | 4,260 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'net/ssh'
require 'net/ssh/command_stream'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Auxiliary::Report
include Msf::Exploit:... | 29.583333 | 102 | 0.639671 |
f79cc701e1796bd3702d440c6785f24802faa2e4 | 8,829 | require_relative '../../../../../environments/rspec_env'
RSpec.describe CukeLinter::FeatureWithTooManyDifferentTagsLinter do
let(:model_file_path) { 'some_file_path' }
it_should_behave_like 'a linter at the unit level'
it_should_behave_like 'a configurable linter at the unit level'
it 'has a name' do
... | 29.332226 | 118 | 0.539132 |
26518c953f3c4537c8286674d19d9dc045fd98d8 | 241 | # frozen_string_literal: true
RSpec.describe User do
subject(:user) { build(:user) }
it { is_expected.to have_many :projects }
it { is_expected.to validate_presence_of :email }
it { is_expected.to validate_presence_of :name }
end
| 21.909091 | 51 | 0.738589 |
ed6552fbc4a296451be8ea799bc60e4633778daf | 2,142 | require 'io/console'
require './Game'
player = Player.new
game = Game.new player
player.currentSector = game.sectors[0]
# set name
while player.nameSet == false && game.running == false
printf "What is your name?\n"
player.name = gets.chomp
printf "\nYour name is %s, is this right? [y/n]\n", player.name
if STDIN.... | 19.651376 | 72 | 0.630719 |
33f664cbafccc81837a600e52a113a7007106ba3 | 237 | require_relative '../../../lib/bitfinex.rb'
client = Bitfinex::RESTv2.new({
:url => ENV['REST_URL'],
:proxy => ENV['PROXY'],
:api_key => ENV['API_KEY'],
:api_secret => ENV['API_SECRET']
})
puts client.ticker('tBTCUSD', 'fUSD')
| 21.545455 | 43 | 0.616034 |
3364e31e3403e1741b5131de602c8e37794c215b | 235 | class Survey::ResponseSerializer < ActiveModel::Serializer
attributes :id, :lock_version, :survey_submission_id,
:survey_question_id,
:response, :fuuid
# TODO: test that response comes back ok as JSON
end
| 33.571429 | 58 | 0.702128 |
034ce9167b77ac2aea9fc8db9b8d71a6578a7a5f | 3,630 | # frozen_string_literal: true
require 'yaml'
require 'erb'
# data files
TOKEN_SEQ_FILE_LIST = [
'stdacl_token_seq.yml',
'extacl_token_seq.yml'
# 'extacl_objgrp_token_seq.yml'
].freeze
# return spec conf dir
def _spec_conf_dir(file)
specdir = Dir.new('./spec/conf/')
File.join(specdir.path, file)
end
# retu... | 24.693878 | 68 | 0.654821 |
ed327938c5d2c984523a1a3674abdf91b1398c8e | 90 | json.extract! @survey, :id, :name, :company_id, :section, :text, :created_at, :updated_at
| 45 | 89 | 0.711111 |
18c9082affa1af9e995c6dfa19ad57339878d150 | 7,564 | =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... | 31 | 237 | 0.640534 |
618ea5be1f191ae9f8a5dd0b7a5a5c602765454d | 9,270 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Generator do
subject(:generator) do
described_class.new(cop_identifier, 'your_id', output: stdout)
end
HOME_DIR = Dir.pwd
let(:stdout) { StringIO.new }
let(:cop_identifier) { 'Style/FakeCop' }
before do
allow(File).to receive(:write)
e... | 27.837838 | 99 | 0.558037 |
38a3132b702f5a7463ba0d6f529b48d628a3dc00 | 1,025 | module HealthSeven::V2_3_1
class SurP09 < ::HealthSeven::Message
attribute :msh, Msh, position: "MSH", require: true
class Facility < ::HealthSeven::SegmentGroup
attribute :fac, Fac, position: "FAC", require: true
class Product < ::HealthSeven::SegmentGroup
attribute :psh, Psh, position: "PSH", requir... | 48.809524 | 122 | 0.707317 |
b97552f04d9b8a8eabb8a4f1373d966f4acc7776 | 2,173 | class Cgns < Formula
desc "CFD General Notation System"
homepage "http://cgns.org/"
url "https://github.com/CGNS/CGNS/archive/v4.1.2.tar.gz"
sha256 "951653956f509b8a64040f1440c77f5ee0e6e2bf0a9eef1248d370f60a400050"
license "BSD-3-Clause"
head "https://github.com/CGNS/CGNS.git"
livecheck do
url :head
... | 31.955882 | 109 | 0.64381 |
ed5bce196582810062a2cd397140ea69455136e8 | 50,567 | # 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... | 60.924096 | 477 | 0.582336 |
33c0cb52a8cf001e82c05b75980b9be897119eaa | 139 | <%= boiler_plate %>
card = Balanced::Card.fetch('<%= request['card_href'] %>')
card.debit(
<%= params_to_hash.call(payload).indent(2) %>
)
| 23.166667 | 58 | 0.647482 |
4aaf225f18f17f2b4bf2ad290864b11391eb270a | 1,788 | # frozen_string_literal: true
module UnpackStrategy
class Zip
prepend Module.new {
def extract_to_dir(unpack_dir, basename:, verbose:)
if merge_xattrs && contains_extended_attributes?(path)
# We use ditto directly, because dot_clean has issues if the __MACOSX
# folder has incorr... | 34.384615 | 89 | 0.534116 |
aca43165d765b133a295ec18c7ed84a083bdb6b7 | 1,553 | module URLUtils
module_function
def append_query_param(url_str, param_key, param_val)
uri = URI(url_str)
args = URI.decode_www_form(uri.query || "") << [param_key, param_val]
uri.query = URI.encode_www_form(args)
uri.to_s
end
def remove_query_param(url_str, param_key)
uri = URI(url_str)
... | 28.759259 | 86 | 0.679974 |
01b55a1667f5da239bf7c709a7e2a5492932ea20 | 1,991 | # frozen_string_literal: true
module Gitlab
module Graphql
module QueryAnalyzers
class LoggerAnalyzer
COMPLEXITY_ANALYZER = GraphQL::Analysis::QueryComplexity.new { |query, complexity_value| complexity_value }
DEPTH_ANALYZER = GraphQL::Analysis::QueryDepth.new { |query, depth_value| depth_v... | 27.652778 | 115 | 0.599196 |
33e39261493eee79ff35469802e3f7720c40f663 | 241 | require 'asciidoctor/extensions'
require_relative 'pikchr/extension'
Asciidoctor::Extensions.register do
block Asciidoctor::Diagram::PikchrBlockProcessor, :pikchr
block_macro Asciidoctor::Diagram::PikchrBlockMacroProcessor, :pikchr
end
| 30.125 | 70 | 0.838174 |
084d7bae58b573cd9d99544d3f7632dbd9d39844 | 4,593 | require 'spec_helper'
require 'features/page_objects/notification'
describe 'Bulk update work packages through Rails view', js: true do
let(:dev_role) do
FactoryBot.create :role,
permissions: %i[view_work_packages]
end
let(:mover_role) do
FactoryBot.create :role,
... | 30.417219 | 129 | 0.620509 |
18c1cc0a8a7203d6be4826960c825a66d1b785c4 | 4,833 | #
# Copyright (c) 2015 Mark Heily <mark@heily.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR D... | 23.925743 | 76 | 0.663149 |
7931ceb3b623a967f00eee20fa691543989b16ff | 46 | class AddStatusToTask < ApplicationRecord
end
| 15.333333 | 41 | 0.869565 |
e9d8a62a1ea80cdaec260720eed075716061ac77 | 1,535 | class SpirvCross < Formula
desc "Performing reflection and disassembling SPIR-V"
homepage "https://github.com/KhronosGroup/SPIRV-Cross"
url "https://github.com/KhronosGroup/SPIRV-Cross/archive/2021-01-15.tar.gz"
version "2021-01-15"
sha256 "d700863b548cbc7f27a678cee305f561669a126eb2cc11d36a7023dfc462b9c4"
l... | 39.358974 | 139 | 0.747883 |
ac9982c00e64ea695c0e74beea5f4cdd043a258e | 904 | # frozen_string_literal: true
# Auto-generated file
# DO NOT EDIT
require 'spec_helper'
RSpec.describe Cryptopay::Rates do
include_context :api
describe '#all' do
it 'returns RatesResult', :aggregate_failures, vcr: 'api/rates/all' do
result = client.rates.all
p result # => <RatesResult data=...>... | 25.111111 | 78 | 0.686947 |
abff544f2c2d7ee865ca90a9feecc83e5eb51ffe | 47 | module Valkyrie
# Your code goes here...
end
| 11.75 | 26 | 0.702128 |
6165f5b36982e60681d96b53d3a583bf091d11a9 | 5,047 | require 'test_helper'
# ServiceStore.determine_services
#
# Loads service definitions into a Collection object, based on services configuration
# and current ¨aut.service_group param. Tests.
class DetermineServicesTest < ActiveSupport::TestCase
setup :set_custom_service_store
def set_custom_service_store
... | 30.77439 | 122 | 0.671884 |
7ae3b7d648e758b67f7eeff10044f90012259cf5 | 1,234 | def floyd(matrix_w)
n = matrix_w.size - 1
matrix_d = []
matrix_w.each { |m| matrix_d << m.clone }
(0..n).each do |k|
(0..n).each do |i|
(0..n).each do |j|
matrix_d[i][j] = [matrix_d[i][j], matrix_d[i][k] + matrix_d[k][j]].min
end
end
end
matrix_d
end
def floyd2(matrix_w)
n =... | 23.730769 | 174 | 0.515397 |
bb79f419fef51ee2ec6408aae5c97e0c45d6cbc6 | 10,152 |
require 'parse/doccomment_parser'
class CommentData
def initialize
@blocks = []
end
def add_block(block)
@blocks << block
end
def each_block
@blocks.each do |block|
yield block
end
end
def [](i)
@blocks[i]
end
def each_block_of_type(type)
each_block do |block|
... | 19.046904 | 98 | 0.687352 |
d5d8628bfbf59918eaf1f3976fbcb6ae064793e2 | 1,030 | require 'test_helper'
class TagsControllerTest < ActionController::TestCase
setup do
@tag = tags(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:tags)
end
test "should get new" do
get :new
assert_response :success
end
test "shoul... | 20.6 | 88 | 0.675728 |
acf16155f42943e5c7c747117c40415b34571bfd | 681 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... | 37.833333 | 93 | 0.772394 |
0317f9162ccf3efa8d81cce8cb260f687a9c7dd7 | 5,336 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group empty states' do
let(:group) { create(:group) }
let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user }
before do
sign_in(user)
end
[:issue, :merge_request].each do |issuable|
issuable_name ... | 30.843931 | 114 | 0.589018 |
e28483466d299a9940ce7ef0c9ef1b8e69faab20 | 1,325 | describe :enumeratorized_with_unknown_size, shared: true do
describe "when no block is given" do
describe "returned Enumerator" do
# NATFIXME
xit "size returns nil" do
@object.send(*@method).size.should == nil
end
end
end
end
describe :enumeratorized_with_origin_size, shared: true... | 29.444444 | 94 | 0.642264 |
ff0b74fdd1ad115674a48e94d9957cfe9d9aad7a | 435 | class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :username
t.string :password_digest
t.string :avatar_image
t.string :status
t.string :address
t.string :city
t.string :state
t.... | 21.75 | 48 | 0.627586 |
01aeab6b33ecb52b17cc74b81a09acb5b42fd8b4 | 981 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/flipper/version', __FILE__)
require File.expand_path('../lib/flipper/metadata', __FILE__)
flipper_mongo_files = lambda do |file|
file =~ /mongo/
end
Gem::Specification.new do |gem|
gem.authors = ['John Nunemaker']
gem.email = ['nunemaker@g... | 36.333333 | 106 | 0.648318 |
f8add43b9e8b3063d381188345245085d04c22d7 | 2,259 | # frozen_string_literal: true
class Floor
attr_accessor :tiles
# Grid system:
# x: w-e
# y: sw - ne
MOVES = {
'e' => { x: 1, y: 0 },
'se' => { x: 1, y: -1 },
'sw' => { x: 0, y: -1 },
'w' => { x: -1, y: 0 },
'nw' => { x: -1, y: 1 },
'ne' => { x: 0, y: 1 }
}.freeze
def initialize
... | 21.932039 | 81 | 0.570606 |
b9a397adb6f1c0333fd145477e8729968166330c | 700 | # frozen_string_literal: true
# Manages records which expire using the `expires_at` column.
module WithExpiration
extend ActiveSupport::Concern
included do
scope :expired, -> { where.not('expires_at < ?', Time.now) }
validates :expires_at, presence: true
end
# Set the expiration to occur by a durati... | 22.580645 | 69 | 0.708571 |
21de187e315bb2695a14081cfffe68f6796fbd18 | 1,160 | module Ubiquitously
module MvcForge
class Account < Ubiquitously::Service::Account
# raises Net::HTTPForbidden 403 if already logged in
def login
page = agent.get("http://mvcforge.com/user/login")
form = page.forms.detect { |form| form.form_node["id"] == "user-login" }
form["na... | 30.526316 | 104 | 0.564655 |
1cb18c4efac593a3640cd966af4289c9663c42d5 | 311 | class ConfirmationsController < ApplicationController
def show
user = User.confirm_by_token(params[:confirmation_token])
if user.errors.empty?
redirect_to root_path, notice: t('confirmations.confirmed')
else
redirect_to root_path, danger: t('confirmations.failure')
end
end
end
| 25.916667 | 65 | 0.73955 |
39db1652877a680432b68b8df28027142adbfced | 5,627 | require 'uri'
require 'hmac'
require 'hmac-sha2'
require 'base64'
require 'net/https'
require 'net/http'
module Scalr
class Request
class ScalrError < RuntimeError; end
class InvalidInputError < ScalrError; end
ACTIONS = {
:bundle_task_get_status => {:name => 'BundleTaskGetStatus', :inputs =>... | 46.891667 | 230 | 0.594278 |
d53dc6ce0afd595ee0128cbefc25093d261760f8 | 762 | require 'rails_helper'
RSpec.describe Category, type: :model do
context 'Validations for Category' do
let(:category) { FactoryBot.create :category }
it 'should be valid' do
expect(category).to be_valid
end
it 'should be present' do
expect(category).to be_present
end
it 'should ... | 23.090909 | 61 | 0.671916 |
e8883b1c333c6da9539701089b4c6f1a1a7149d0 | 2,346 | # this generator based on rails_admin's install generator.
# https://www.github.com/sferik/rails_admin/master/lib/generators/rails_admin/install_generator.rb
require 'rails/generators'
# http://guides.rubyonrails.org/generators.html
# http://rdoc.info/github/wycats/thor/master/Thor/Actions.html
module Koudoku
clas... | 31.28 | 183 | 0.712276 |
282443e4a25a9cfe979d3d0ffa45eba33b61679a | 103 | module GrowlGlue
module Util
def with(obj)
yield obj
obj
end
end
end
| 9.363636 | 17 | 0.533981 |
1d558e3fc487ec22973c713e6bd4509af07bba25 | 480 | require 'formula'
class Webfs < Formula
homepage 'http://linux.bytesex.org/misc/webfs.html'
url 'http://dl.bytesex.org/releases/webfs/webfs-1.21.tar.gz'
sha1 'a38880d8cb21e415244d220115ede7b573ac890c'
patch :p0 do
url "https://trac.macports.org/export/21504/trunk/dports/www/webfs/files/patch-ls.c"
sha... | 26.666667 | 88 | 0.74375 |
6125a818c38e6b19cff57ac43aa18e63a2864f26 | 9,509 | #
# This class was auto-generated.
#
require 'onlinepayments/sdk/api_resource'
require 'onlinepayments/sdk/response_exception'
require 'onlinepayments/sdk/domain/error_response'
require 'onlinepayments/sdk/domain/get_payment_products_response'
require 'onlinepayments/sdk/domain/payment_product'
require 'onlinepayments/... | 60.955128 | 142 | 0.688506 |
26748b84614a533ebf1b4842c2a049a088a6dbcd | 1,481 | MetricFu.lib_require { "formatter/syntax" }
MetricFu.lib_require { "templates/template" }
# Creates an HTML document for a given analyzed file,
# with scored metrics annotating the relevant line.
module MetricFu
module Templates
class Report < MetricFu::Template
# @param file [String] the analyzed file to ... | 35.261905 | 207 | 0.649561 |
e92bcdde1e5c0def2743e254027a979de67e8f3a | 1,147 | require 'optparse'
module MPD2HTML
class Options
attr_reader :output_dir, :verbose, :files
def initialize
@output_dir = nil
end
def parse!
parser = OptionParser.new do |op|
op.banner = "Usage: #{$PROGRAM_NAME} -o OUTPUT_DIR [other options] file [...]"
op.on('-o OUTPUT_D... | 22.490196 | 86 | 0.577158 |
5dd7a7cad02df61f1ce0701ef241bfaccd41166e | 468 | cask "mcedit" do
version "1.5.6.0"
sha256 "e2026de3589e3e65086a385ee4e02d607337bc9da11357d1b3ac106e2ee843d7"
url "https://github.com/Podshot/MCEdit-Unified/releases/download/#{version}/MCEdit.v#{version}.OSX.64bit.zip",
verified: "github.com/Podshot/MCEdit-Unified/"
name "MCEdit-Unified"
desc "Minecraf... | 26 | 112 | 0.735043 |
21f8389cc38ef9e8b8394d1a582ab2a09e5edc0b | 154 | attribute :anonymous
extends "api/v1/shopping_cart/partials/items/base"
extends "api/v1/bounties/partials/owner"
extends "api/v1/bounties/partials/issue" | 30.8 | 50 | 0.818182 |
bf8b8ea6c1efcaf48e1dcbd22cb6f1e177e5b871 | 1,974 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.action_mailer.default_url_options = {host: "localhost", port: 3000}
# In the development environment your application's code is reloaded on
# every request. This slows down response time but... | 35.890909 | 85 | 0.762411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.