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 |
|---|---|---|---|---|---|
ac398d23b9a339730fc96b080f971ac907c7182e | 6,146 | =begin
#DockGenius API
#No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 0.1.0
Contact: hi@dockgenius.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may ... | 29.548077 | 120 | 0.664823 |
792d1cd33a0dea4912d3674d097465277e635490 | 28 | module MatriculasHelper
end
| 9.333333 | 23 | 0.892857 |
33ad98aa6b8e5bc70017cd173c6fe642bfa8fe42 | 1,623 | class AreaItemsController < ApplicationController
before_action :set_area_item, only: [:show, :edit, :update, :destroy, :full, :half, :empty]
def index
@area_items = AreaItem.all
end
def show
end
def new
@area_item = AreaItem.new
end
def edit
end
def create
@area_item = AreaItem.new... | 21.932432 | 93 | 0.661738 |
bf006b76885029a38ae8180eea2445c6a79d8e6d | 513 | cask 'framer' do
version '63'
sha256 '52e8086787d292cdb2089d9aa6a49cacc2c8d4705c4719ef9173e8b0ecb11e1d'
# devmate.com/com.motif.framer was verified as official when first introduced to the cask
url 'https://dl.devmate.com/com.motif.framer/FramerStudio.zip'
appcast 'https://updates.devmate.com/com.motif.frame... | 34.2 | 91 | 0.775828 |
bbe45face05515f8cda2920d5357d37027031912 | 1,443 | # encoding: utf-8
# Wizport: A gem for creating reports by specifying columns, groups, styles, etc.
# Copyright 2012 by sgzhe@163.com
require "stringio"
module Wizport
module Pdf
class PdfBuilder
include Wizport::Visitor
def initialize
@pdf = StringIO.new
end
visit Document do ... | 22.546875 | 81 | 0.462231 |
2877dfef6ba719153b63425d164e96cdbb8dcee6 | 128 | FactoryGirl.define do
factory :origin do
market
contact_attributes { FactoryGirl.attributes_for(:contact) }
end
end
| 18.285714 | 63 | 0.75 |
ff661b0bc1c75dd10abff4b3924bcbdf062fd694 | 10,439 | # SearchLink 2.0 by Brett Terpstra 2014 (http://brettterpstra.com)
# Free to use and modify, please maintain attribution
require 'net/https'
require 'rubygems'
require 'json'
require 'cgi'
if RUBY_VERSION.to_f > 1.9
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
# You ... | 30.34593 | 190 | 0.624294 |
1d89d6e9d7d6c11737a41607e9b8f6e5e9005f1b | 856 | require "cask/artifact/app"
require "cask/artifact/artifact" # generic 'artifact' stanza
require "cask/artifact/binary"
require "cask/artifact/colorpicker"
require "cask/artifact/dictionary"
require "cask/artifact/font"
require "cask/artifact/input_method"
require "cask/artifact/installer"
require "cask/artifact/intern... | 29.517241 | 60 | 0.817757 |
3989142fa59e9dc63ee9bb61f3913042b66bf44a | 910 | # frozen_string_literal: true
require "digest"
module Integral
module Yandex
module Money
module Helpers
module_function
def encode_sha string
Digest::SHA1.hexdigest string
end
def find_missing_hash_values required_keys:, hash:
required_keys.select {... | 25.277778 | 106 | 0.620879 |
ff1e3936ffe8c281ec3370b1c12d54d480f05582 | 125 | # frozen_string_literal: true
RSpec.describe AutomationHelpers::Patches::SeleniumManager do
it_behaves_like 'a patch'
end
| 20.833333 | 61 | 0.824 |
abb2f4faa51b0dec27ece5b6107c0711cd5f7be8 | 317 | class AddEndDateToBudgetItems < ActiveRecord::Migration[5.0]
def change
add_column :programs, :end_date, :date, index: true
add_column :spending_agencies, :end_date, :date, index: true
add_column :priorities, :end_date, :date, index: true
add_column :totals, :end_date, :date, index: true
end
end
| 35.222222 | 64 | 0.728707 |
335bb029b410779d4b04a534f64dff4a8ece68f1 | 28,447 | # Copyright 2019 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 applicable law or agreed to in writing, ... | 40.122708 | 156 | 0.701374 |
e9e2c89fb809214fc3ae5003ab4d26a28729d2fc | 1,484 | $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
require "yaml"
require "minitest/autorun"
require "iostreams"
require "amazing_print"
require "symmetric-encryption"
# Since PGP libraries use UTC for Dates
ENV["TZ"] = "UTC"
# Test cipher
SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(
cipher_nam... | 36.195122 | 134 | 0.742588 |
87c0a645686e864f45c6829eb3acbd9c2946ea05 | 1,946 | module ApplicationHelper
def default_meta_tags
if Setting.url.protocol == 'http'
canonical_url = request.url
else
canonical_url = request.url.sub(/^http:\/\//, "#{Setting.url.protocol}://")
end
{
separator: "—".html_safe,
site: '財團法人民間司法改革基金會',
reverse: true,
... | 29.484848 | 114 | 0.590956 |
26cd6e3980a14fd642720862cc47594e9bed161e | 22,376 | require "helper"
module Nokogiri
module HTML
class TestDocument < Nokogiri::TestCase
def setup
super
@html = Nokogiri::HTML.parse(File.read(HTML_FILE))
end
def test_nil_css
# Behavior is undefined but shouldn't break
assert @html.css(nil)
assert @html.xp... | 29.249673 | 177 | 0.581158 |
1acdd2089ba9bc7351bd95f0ca63827497dad6c8 | 1,967 | # 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::DevTestLabs::Mgmt::V2018_09_15
module Models
#
# Properties to attach new disk to the Virtual Machine.
#
class AttachNewData... | 28.1 | 75 | 0.531266 |
ff3beb9e8ed6300680b82dafcf90c5170935a3aa | 611 | module Genius
module Search
class Tracks
class Track < Genius::Search::Tracks
include Genius::Utils::Track
def call
data
end
private
def data
muffon_data
.merge(track_data)
end
def track_data
{
... | 16.972222 | 42 | 0.476268 |
f8f44ed550ee5482af26c74a452f13dc9c3970b4 | 1,537 | class Groonga < Formula
desc "Fulltext search engine and column store"
homepage "http://groonga.org/"
url "http://packages.groonga.org/source/groonga/groonga-5.0.5.tar.gz"
sha256 "ca62d15374117f4007a7b406ac2072683edda7ed7607d1b1fbcf3a30920f5b56"
bottle do
sha256 "0e4834e388e1e485527c0fd89cde6a61de679fc58... | 30.74 | 95 | 0.715029 |
3995bc94c5ed7c93a92253898b410e43fb851588 | 3,571 | # Geography Controller
class GeographyController < ApplicationController
before_action :authenticate_user!
# Build a hash of options for geographical forms based on the parameters
# given. For example, if we only receive a state name, we will return the
# list of all possible states as well as all counties in ... | 39.677778 | 169 | 0.706805 |
ed63c868caf1c7007ccb436af00bc4c1487545b6 | 1,337 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'portfolio/version'
Gem::Specification.new do |spec|
spec.name = "portfolio"
spec.version = Portfolio::VERSION
spec.authors = ["Carl Tablante"]
spec.email = ["... | 38.2 | 95 | 0.682872 |
4a2ea985c5993232a8a573499bbd75f1b60f2f4f | 699 | module Apidoco
# Parse a folder and find all the sub folders and files
class FileParser
attr_accessor :file, :parents
def initialize(file, parents:)
self.file = file
self.parents = parents
end
def as_json
content.merge(parents: parents, id: id)
end
def content
@con... | 20.558824 | 66 | 0.62804 |
bf32223fa63463bbc339e04d416b9362c4960034 | 10,756 | # -*- encoding: utf-8 -*-
require 'rest-client'
require 'resolv'
require 'fiber'
module Aliyun
module OSS
##
# HTTP wraps the HTTP functionalities for accessing OSS RESTful
# API. It handles the OSS-specific protocol elements, and
# rest-client details for the user, which includes:
# * automati... | 31.358601 | 81 | 0.549554 |
617956f56f37660e4425b97060c871f241d6158f | 3,922 | # frozen_string_literal: true
module ActiveModel
module Validations
class AcceptanceValidator < EachValidator # :nodoc:
def initialize(options)
super({ allow_nil: true, accept: ["1", true] }.merge!(options))
setup!(options[:class])
end
def validate_each(record, attribute, value... | 34.403509 | 100 | 0.600459 |
6aef5501f6c4a34b28cd866fff139b1c4f023431 | 795 | RSpec.describe BeeiqAPI::Contact do
describe '.new' do
subject{ described_class.new(data) }
context 'when name empty' do
let(:data) { { name: '' } }
it 'raise an error' do
expect { subject }.to raise_error(ArgumentError, 'name is required')
end
end
context 'when name is giv... | 27.413793 | 77 | 0.605031 |
1d6fa772abba386c7aec44564d4008bd1a1454b8 | 999 | #! /usr/bin/env ruby
require 'spec_helper'
require 'oregano/util/splayer'
describe Oregano::Util::Splayer do
include Oregano::Util::Splayer
let (:subject) { self }
before do
Oregano[:splay] = true
Oregano[:splaylimit] = "10"
end
it "should do nothing if splay is disabled" do
Oregano[:splay] = ... | 21.717391 | 68 | 0.685686 |
61f7e0517d1e0207c3feb72ecb0e9f3091595cc7 | 2,379 | # These examples hold for both BasicObject#__id__ and Object#object_id.
describe :basic_object_id, :shared => true do
it "returns an integer" do
o1 = @object.new
o1.__send__(@method).should be_kind_of(Integer)
end
it "returns the same value on all calls to id for a given object" do
o1 = @object.new
... | 25.858696 | 80 | 0.651114 |
4a6deeee881a1dea8f56ed2e6226f496303722d7 | 2,343 | class Test < ActiveRecord::Base
after_initialize :default_values
after_create :create_key
after_save :update_baseline
after_destroy :delete_thumbnails
belongs_to :run
default_scope { order(:created_at) }
dragonfly_accessor :screenshot
dragonfly_accessor :screenshot_baseline
dragonfly_accessor :screens... | 24.40625 | 100 | 0.718737 |
e80b39e8d9c590bbac0f7657fe2f2cf5fd15c3d1 | 624 | module Berkshelf::API
class RemoteCookbook
attr_accessor :name
attr_accessor :version
attr_accessor :location_type
attr_accessor :location_path
attr_accessor :priority
attr_accessor :info
def initialize(name, version, location_type, location_path, priority, info = {})
@name ... | 22.285714 | 84 | 0.623397 |
38a113caec7d712f0fc04721c6baaa57a08adc6d | 1,206 | class DeleteBranchService < BaseService
def execute(branch_name)
repository = project.repository
branch = repository.find_branch(branch_name)
unless branch
return error('No such branch', 404)
end
if branch_name == repository.root_ref
return error('Cannot remove HEAD branch', 405)
... | 24.612245 | 60 | 0.686567 |
62b15b7b2f586c2afa0217590ab1320396493493 | 602 | module OmniAuthTestHelper
def valid_facebook_login_setup
if Rails.env.test?
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({
provider: 'facebook',
uid: '123545',
info: {
first_name: "Jared",
last_name: "Rader"... | 23.153846 | 69 | 0.584718 |
6ac82d6b03d94ce3001ff580d88bf12e91e3514a | 14,641 | # frozen_string_literal: true
require 'json'
require 'open3'
require 'shellwords'
require 'kubernetes-deploy/remote_logs'
module KubernetesDeploy
class KubernetesResource
attr_reader :name, :namespace, :context
attr_writer :type, :deploy_started_at
GLOBAL = false
TIMEOUT = 5.minutes
LOG_LINE_CO... | 31.828261 | 147 | 0.644696 |
e87515fe4b1961ed5fd4c443b90ebec052e87b27 | 484 | # Competitor must jump at the same distance as their previous fault
# Once a Competitor faults 3 attempts at the same distance, they are done, and their previous successful distance stands.
# After a fault, the next attempt must be at the same distance (no further), until they succeed, or are finished.
class DistanceAt... | 53.777778 | 121 | 0.803719 |
e2a288fdb5a9ad1caa4c74aa82db820c4277944f | 42,487 | #: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`<method>|`--except=`<method>] [`--only-cops=`[COP1,COP2..]|`--except-cops=`[COP1,COP2..]] [<formulae>]:
#: Check <formulae> for Homebrew coding style violations. This should be
#: run befor... | 34.458232 | 228 | 0.638125 |
d5a1fb6ffc2a657a884238333adafeca42afbac5 | 169 | # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run MuhimbiPDFConverter::Application
| 33.8 | 67 | 0.786982 |
61d091dc48a4d5ab2d19187f61e04f360d1c2822 | 260 | class Oasis::DashboardController < Common::DashboardController
prepend_before_action -> { @namespace = self.class.name.split('::').first.constantize }
def index
super
@subscriptions = @chain.alert_subscriptions.where(user: current_user)
end
end
| 28.888889 | 89 | 0.75 |
08146add2c5a2f4092295c5490bb948a2b1d2d71 | 2,213 | module CC
module Analyzer
# TODO: replace each use of this with CC::Yaml and remove it
class Config
def initialize(config_body)
@config = YAML.safe_load(config_body) || { "engines" => {} }
@config["engines"] ||= {}
expand_shorthand
end
def to_hash
@config
... | 25.436782 | 85 | 0.600994 |
39cc49b5f7ddb6424b88a50b3f6bb6b9f7778f07 | 2,810 | class Presto < Formula
desc "Distributed SQL query engine for big data"
homepage "https://prestodb.io"
url "https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-server/0.214/presto-server-0.214.tar.gz"
sha256 "223eea5c5df9f404c4418e1af044f7b42f7c5213ddfeca0b9bf06aa85a7ca973"
bottle :unn... | 27.821782 | 126 | 0.652313 |
f707f70a81d9fcceb4feeb270a00676e772629e5 | 200 | class AddLatitudeAndLongitudeToTradeRequests < ActiveRecord::Migration[5.0]
def change
add_column :trade_requests, :latitude, :float
add_column :trade_requests, :longitude, :float
end
end
| 28.571429 | 75 | 0.78 |
ab54b0e77d7221f29578028c552e240375250700 | 4,039 | require "rails_helper"
RSpec.describe "Admin claims", type: :request do
before { sign_in_as_service_operator }
describe "claims#index" do
let!(:claims) { create_list(:claim, 3, :submitted) }
let!(:approved_claim) { create :claim, :approved }
it "lists all claims awaiting a decision" do
get admi... | 32.837398 | 152 | 0.664521 |
87ddfd5c46cfc8c5779538d218a58f06e1141096 | 3,770 | # frozen_string_literal: true
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | 35.233645 | 397 | 0.701061 |
eda576777b69077e85981f9b4a7f133fc2c9e567 | 5,666 | # frozen_string_literal: true
module Onebox
module Engine
def self.included(object)
object.extend(ClassMethods)
end
def self.engines
constants.select do |constant|
constant.to_s =~ /Onebox$/
end.map(&method(:const_get))
end
attr_reader :url, :uri
attr_reader :cache... | 29.978836 | 108 | 0.747088 |
ac6c68749eda6a2c26ae63a3975d7ceec9e0f3ca | 1,114 | require_relative '../test_helper'
require 'cdo/profanity_filter'
class ProfanityFilterTest < Minitest::Test
def test_find_potential_profanities
# webpurify returns an array
WebPurify.stubs(:find_potential_profanities).returns(['shit', 'sh1t'])
assert_equal 'shit', ProfanityFilter.find_potential_profanity... | 38.413793 | 109 | 0.754039 |
abcd1c8d8a0198ae834d82cc212833ac601a034b | 69 | module Capcoauth
class AuthorizationError < StandardError; end
end
| 17.25 | 47 | 0.826087 |
26f867accf51bb3c2e5958e83c320cb04897f151 | 1,283 | # frozen_string_literal: true
require_relative 'peg'
require_relative 'players/player'
require_relative 'players/maker'
require_relative 'players/breaker'
# It's an aggregator for all the information about the game, doesn't do much
# alone but it creates everything the game needs and nests the other important
# class... | 32.075 | 97 | 0.694466 |
ff8edcce4f742497f74acc55a2fe95f22d44fb74 | 610 | # frozen_string_literal: true
class PasswordsController < Devise::PasswordsController
before_action :find_user
respond_to :json
def create
if @user.blank?
render json: {}, status: :not_found
else
code = @user.generate_code
@user.update(reset_password_token: code, reset_password_sent_at... | 21.785714 | 84 | 0.706557 |
21fca704e56be1827e461c41a959063875578aae | 7,087 | describe Berkeley::Terms do
let(:options) {{fake_now: fake_now}}
before { allow(Settings.hub_term_proxy).to receive(:fake).and_return true }
subject {Berkeley::Terms.fetch(options)}
shared_examples 'a list of campus terms' do
its(:campus) {should be_is_a Hash}
it 'is in reverse chronological order' do
... | 39.592179 | 101 | 0.658671 |
87d6aa3f42a21f1ce8022695788eaf7f6d93f366 | 1,620 | # frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Friending users', type: :feature do
before do
@user = create(:user)
@friend = create(:user)
@sender = create(:user)
@receiver = create(:user)
@request = create(:request, sender: @sender, receiver: @user)
end
scenario 'shoul... | 30.566038 | 74 | 0.700617 |
ab4ff613ce9b1c49539b4e22a2d56258c7f2bd2f | 214 | class Ability
include CanCan::Ability
def initialize(user)
# TODO: reimplement the ability
user ||= User.new
if user.admin?
can :manage, :all
else
can :read, :all
end
end
end
| 15.285714 | 35 | 0.61215 |
211b54c47cd2334a5489e713d0ad283b0f1e68de | 8,547 | module Octokit
# Custom error class for rescuing from all GitHub errors
class Error < StandardError
# Returns the appropriate Octokit::Error subclass based
# on status and response message
#
# @param [Hash] response HTTP response
# @return [Octokit::Error]
def self.from_response(response)
... | 29.780488 | 92 | 0.654148 |
acfab0e75c5155a77cd4b1db1140456b49ca9983 | 2,552 | require 'spec_helper_acceptance'
# Enable Cron Daemon - Section 5.1.1
describe service('crond') do
it { is_expected.to be_running }
end
# Ensure permissions on /etc/crontab are configured - Section 5.1.2
describe file('/etc/crontab') do
it { is_expected.to be_file }
it { is_expected.to be_owned_... | 28.674157 | 74 | 0.681426 |
33bc4635e4a801a69664e40ccc8a2e23de6186f7 | 322 | require "helper"
require "fluent/plugin/out_dockerlogs.rb"
class DockerlogsOutputTest < Test::Unit::TestCase
setup do
Fluent::Test.setup
end
test "failure" do
flunk
end
private
def create_driver(conf)
Fluent::Test::Driver::Output.new(Fluent::Plugin::DockerlogsOutput).configure(conf)
end
en... | 16.947368 | 86 | 0.726708 |
03dc86a45fce3603117e3cd6e98f76a0b7ebdebf | 249 | class Kylo < Cask
version '1.0.1.76141'
sha256 '5c5f1c3aedba9aa2807cffbc3aec448f0f51e16e1039c0314cf6394ddbe391b1'
url 'https://kylo.s3.amazonaws.com/update/public/kylo-setup-1_0_1_76141.dmg'
homepage 'http://kylo.tv'
link 'Kylo.app'
end
| 24.9 | 78 | 0.767068 |
edd8294ee9607b8910120acd6ed147fa84d06ea0 | 1,632 | class Ent < Formula
desc "Pseudorandom number sequence test program"
homepage "https://www.fourmilab.ch/random/"
# This tarball is versioned and smaller, though non-official
url "https://github.com/psm14/ent/archive/1.0.tar.gz"
sha256 "6316b9956f2e0cc39f2b934f3c53019eafe2715316c260fd5c1e5ef4523ae520"
bottl... | 41.846154 | 92 | 0.694853 |
e2a6c5cd532ed780acc77b9310a48d2279d9522b | 5,120 | # -------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 36.056338 | 83 | 0.436133 |
2810593cb2615ad3cedc244a1d6cac1b6cb2d005 | 186 | class Army < ActiveRecord::Base
has_many :units
belongs_to :user
validates :name, presence: true
validates :description, presence: true
validates :is_current, default: false
end
| 16.909091 | 39 | 0.768817 |
e2a915a2b00052485f2dabffa0dd3815491b55b3 | 5,068 | #
# Be sure to run `pod spec lint TSImagePods.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github... | 36.460432 | 97 | 0.592147 |
916881d2e9e2c26463b5f3b6518f48bdf6547226 | 373 | require './config/environment'
if ActiveRecord::Migrator.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
use Rack::MethodOverride #any time you need to use PATCH / DELETE requests
use SessionsController
use StudentsController
use KlassesController
use ReviewsControl... | 24.866667 | 77 | 0.825737 |
bb8eb5f63bdd365cc9c00ba94e61e7147581a1f0 | 954 |
# 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, software
# distributed under the Lic... | 31.8 | 77 | 0.746331 |
62ccb0948906598d1f96197591660281c1aeb443 | 1,770 | # frozen_string_literal: true
module Listen
# @private api
class Record
# Represents a directory entry (dir or file)
class Entry
# file: "/home/me/watched_dir", "app/models", "foo.rb"
# dir, "/home/me/watched_dir", "."
def initialize(root, relative, name = nil)
@root = root
... | 26.41791 | 74 | 0.577401 |
b92f48c0104344db8c60e73a59e76dc485eb763d | 744 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | 37.2 | 69 | 0.740591 |
8736a5ce72e2d0c627bf574dd122041f9bde7419 | 1,684 | # frozen_string_literal: true
RSpec.shared_examples 'IncidentManagement::PendingEscalation model' do
let_it_be(:escalatable_type) { described_class.name.demodulize.downcase.to_sym }
let_it_be(:pending_escalation) { create_escalation }
subject { pending_escalation }
it { is_expected.to be_valid }
describe ... | 35.083333 | 103 | 0.739905 |
e25fad52afa320949fb47eed263d69b10e5f0aab | 385 | class Admin::BaseController < ApplicationController
inherit_resources
before_filter do
authorize! :access, :admin
end
def update
update! do |format|
if resource.errors.empty?
format.json { respond_with_bip(resource) }
else
format.html { render action: "edit" }
format... | 21.388889 | 51 | 0.65974 |
4ad27b9cf02a2157e2a7922b6c3619e973a9c11f | 1,249 | # frozen_string_literal: true
module Algorithms
module Sorts
module QuickSelect
class << self
def select(i, a)
return if a.empty? || !(0...a.size).cover?(i)
result = r_select(i, a, 0, a.size.pred)
result && a[result]
end
private
def r_select(... | 24.019231 | 79 | 0.516413 |
218a15c1b5f88d849dc5b3d0573d631024a3bc0a | 1,316 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 33.74359 | 118 | 0.75228 |
6142998f013c4ed789a23f9e0c210518ccec4a4d | 5,350 | ##
# $Id$
##
module Msf
###
#
# This module exposes methods that may be useful to exploits that deal with
# servers that require authentication via /bin/login
#
###
module Auxiliary::Login
NULL = "\000"
CR = "\r"
LF = "\n"
EOL = CR + LF
#
# Creates an instance of a login negoation module.
#
def initial... | 21.747967 | 94 | 0.631402 |
915e3ff0e5167219787780ca4b7f994fb1e2cb59 | 3,938 | require 'spec_helper'
describe 'Gitlab::Satellite::MergeAction' do
include RepoHelpers
let(:project) { create(:project, namespace: create(:group)) }
let(:fork_project) { create(:project, namespace: create(:group), forked_from_project: project) }
let(:merge_request) { create(:merge_request, source_project: pro... | 37.504762 | 128 | 0.714068 |
7afc66d473ad4a59a17c579add4f4bc6c0a58161 | 1,049 | # 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
# Manage the state of a virtual host in RabbitMQ
class Rabbitmq_vhost < Base
# @return [String] The name of the ... | 34.966667 | 143 | 0.650143 |
61523b355cbacadc2037f8ad70b0169acf4d0fbb | 643 | puts 'begin' <=> 'end'
puts 'same' <=> 'same'
a = [5, 3, 4, 1]
puts a.sort
puts a.any? {|i| i > 6}
puts a.any? {|i| i > 4}
puts a.all? {|i| i > 4}
puts a.all? {|i| i > 0}
# map
puts a.collect {|i| i * 2}
# filter
puts a.select {|i| i % 2 == 0 } # even => [4]
puts a.select {|i| i % 2 == 1 } # odd => [5, 3, 1]
puts a.m... | 19.484848 | 50 | 0.514774 |
f83aad515f5beb526319057c002e2637ce0f63f0 | 1,610 | # frozen_string_literal: true
# Copyright 2022 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... | 40.25 | 80 | 0.790683 |
fffccfefc4cd5d1d53ba327c79d91bea2014eb96 | 179 | require "test_helper"
class DetailsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get details_index_url
assert_response :success
end
end
| 19.888889 | 61 | 0.787709 |
edb465afeb5aa40423feab1326e137b3f9c1fa5c | 7,634 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class UpgradeCheckListResult
# Link to this resource
attr_accessor :_self
# The s... | 28.807547 | 107 | 0.606628 |
28c7fd6e604138649bc9f083e0e0faf9493fa1f1 | 2,174 | require 'skype'
require 'pstore'
require "active_support/all"
Skype.config :app_name => "SkypeGuard"
@store = PStore.new("data.pstore")
@whitelist = [] # names of people you trust
def block_unauthorized_video
active_call = Skype.exec("SEARCH ACTIVECALLS").split(" ").last
puts active_call
partner_handle = S... | 22.412371 | 99 | 0.690892 |
edf5cc29ddc331f0bf7230b47142dc217aa68a5c | 1,764 | # -*- encoding: utf-8 -*-
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
#
# Copyright (C) 2012, Fletcher Nichol
#
# 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.o... | 31.5 | 77 | 0.696145 |
5d4029d71536f4523592171dc712ae185f92a5a1 | 1,388 | class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
## Database authenticatable
t.integer :current_cart_id
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string ... | 31.545455 | 104 | 0.654179 |
38784606cedf4646cbfe122764290b9f19ebe877 | 5,548 | # -*- coding: utf-8 -*-
#==============================================================================
# ** Window_NumberInput
#------------------------------------------------------------------------------
# This window is used for the event command [Input Number].
#==================================================... | 36.986667 | 79 | 0.363735 |
e95d179fdee3dbf02b6fc5943fe8e38ea99bf5bd | 5,525 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'date'
module VSphereAutomation
... | 28.776042 | 111 | 0.616109 |
39bd1bc5c9503049254ddbbf0c3956e5ee3938a3 | 388 | # frozen_string_literal: true
Sequel.migration do
up do
create_table :games do
primary_key :id
String :trophy_service_id
String :title
String :platform
String :icon_url
DateTime :created_at
DateTime :updated_at
end
add_index :games, :trophy_service_id
add_in... | 16.869565 | 40 | 0.667526 |
f8c8664adc5d87f17d9881e1e047cde2373f6646 | 427 | cask 'minishift' do
version '1.20.0'
sha256 '8877897d06d134a00bcd7801e8239ab323519d84fca15d07d4ea0a83ffbf6072'
url "https://github.com/minishift/minishift/releases/download/v#{version}/minishift-#{version}-darwin-amd64.tgz"
appcast 'https://github.com/minishift/minishift/releases.atom'
name 'Minishift'
hom... | 35.583333 | 114 | 0.782201 |
33d1ae6892f3e73e082577df7ff0667d028c6e69 | 1,102 | # The player!
module Entities
class Player < Mobile
attr_reader :took_action
def initialize(opts = {})
super
@path = 'sprites/pc/elf/elf_f_idle_anim_f0.png'
end
def tick(args)
@took_action = false
target_x = if args.inputs.keyboard.key_down.right || args.inputs.keyboard.key_d... | 32.411765 | 92 | 0.57441 |
1a60a3d4808e9834cbba16591c989df05561f39b | 4,634 | #
# Author:: Stuart Preston (<stuart@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | 43.716981 | 79 | 0.732844 |
abd7ddf37e9ab8e71b45f235ab28925d33c0ffcf | 5,556 | # frozen_string_literal: true
module ActiveRecord
# = Active Record Signed Id
module SignedId
extend ActiveSupport::Concern
included do
##
# :singleton-method:
# Set the secret used for the signed id verifier instance when using Active Record outside of Rails.
# Within Rails, this ... | 48.736842 | 128 | 0.697624 |
33fdbaa128f2fc4226c36a1bf9e5cbe92d413e73 | 404 | Encryptor.default_options.merge!(
algorithm: 'aes-256-cbc',
insecure_mode: true
#key: Base64.decode64('Is995f6zy+tKE4/tnCG73I7XzNAiFNWQBdBDmzEb6OI='),
#iv: Base64.decode64('FOIbqxLbDwh4P+d9'),
#salt: Base64.decode64('0zUIh/CiVIE3ERfl8Z4F1YjWYlvvUIf21B0tL0QrBxMKKEK9R1Hs992hLp7AMOqy0USY99TndZekUv+vAcy+rKakMio0K... | 50.5 | 200 | 0.831683 |
bf26a6e213daaa9800a40bf773e79e5a653d4b6a | 2,377 | require 'test_helper'
class PasswordResetsTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
@user = users(:nookie)
end
test "password resets" do
get new_password_reset_path
assert_template 'password_resets/new'
assert_select 'input[name=?]', 'password_reset[... | 38.33871 | 72 | 0.666807 |
01876c1acb68d3d9e5ceae10a19b2dbb75646dca | 1,145 | class UpdateMailer < ActionMailer::Base
default from: 'Dealbook Admin <admin@dealbook.co>'
def update_email(object, user, action)
@object = object
@user = user
@action = action
@model = @object.class.to_s
@subject = subject
@header = header
@object_title = title
@object_url = url
... | 20.818182 | 78 | 0.609607 |
7a8632f7a672849c1b8471748d6786799bb5786f | 867 | include BenchHelpers
bench_log "Runs admin source methods in batch"
Bench.config do |config|
config.concurrency ||= 10
config.iterations ||= 100
config.main_marker = 'get_adapter'
config.user_name = "benchuser"
config.password = "password"
config.get_test_server
config.reset_app
@token = config.get... | 30.964286 | 95 | 0.716263 |
38b26b500f0bd4984e917a37614d88c1ab7ac988 | 3,771 | shared_examples 'sp requesting attributes' do |sp|
include SamlAuthHelper
include IdvHelper
let(:user) { user_with_2fa }
let(:good_ssn) { '666-66-1234' }
let(:profile) { create(:profile, :active, :verified, user: user, pii: saved_pii) }
let(:saved_pii) { DocAuthHelper::ACUANT_RESULTS_TO_PII.merge(ssn: good... | 38.479592 | 95 | 0.720233 |
e9db326443e0868108474ff593aa1e6982dc1a42 | 21,030 | ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::ORACLE
def initialize(info = {})
super(update_info(info,
... | 30.478261 | 141 | 0.527913 |
21a37b99dd86d0a768ea56cfb1ca765789920046 | 91 | module PlayerSeasonInfosHelper
def player_value(value)
"#{value / 10.0}"
end
end
| 11.375 | 30 | 0.692308 |
620b0a0bc53fb9053143714671bf59db4d8a8223 | 919 | module Servicetools
module Plugins
class Apache < Resource
include Systemd
def initialize params = {}
@pid_file = "#{@segment}/#{@customer}/#{@project}/logs/apache.pid"
@conf_file = "#{@segment}/#{@customer}/#{@project}/conf/httpd.conf"
@apache_bin = "/usr/bin/apachectl"
... | 27.029412 | 75 | 0.515778 |
e8e2653b0e0ae292f697b1014d3af5e35c93e0c4 | 1,312 | class LeanCli < Formula
desc "Command-line tool to develop and manage LeanCloud apps"
homepage "https://github.com/leancloud/lean-cli"
url "https://github.com/leancloud/lean-cli/archive/v0.18.3.tar.gz"
sha256 "ef8212965d303bd053cb56ff0f4a751e3c184a690e4187a569ba7f990bbe5986"
head "https://github.com/leancloud... | 39.757576 | 93 | 0.726372 |
62404ea9254a386406c6e3a83748c964eb1ea1ec | 267 | # Play nice with Ruby 3 (and rubocop)
# frozen_string_literal: true
PafsCore::ProjectsController.class_eval do
helper ::ApplicationHelper
layout ->(_) { "pafs" }
# adding this here as pafs_core doesn't know about Devise
before_action :authenticate_user!
end
| 26.7 | 59 | 0.7603 |
e29b2935610d5c7899b84647ddfd05ea077699f8 | 166 | class Article < ApplicationRecord
has_many :comments, dependent: :destroy
validates :title, presence: true,
length: { minimum: 5 }
end | 33.2 | 44 | 0.626506 |
33d0a7709a4391efc5944035dcb1b7e9600028f0 | 1,027 | ##
# Extracts just the RDoc::Markup::Heading elements from a
# RDoc::Markup::Document to help build a table of contents
class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
@to_toc = nil
##
# Singleton for ToC generation
def self.to_toc
@to_toc ||= new
end
##
# Output accumulator
at... | 18.017544 | 63 | 0.679649 |
acf1db10089bdbabf486c19890a3dffdb4ebe35e | 4,068 | # Groups controller
class GroupsController < ApplicationController
before_action :set_group, only: %i[show edit update destroy landing]
before_action :verify_login, except: %i[index show]
before_action :verify_group_owner, only: %i[edit update destroy landing]
# GET /groups
def index
@groups = Group.read... | 25.111111 | 95 | 0.638151 |
62d16e0c07542f2f1ae4dbd251af5895e7d8b231 | 373 | # frozen_string_literal: true
AjaxDatatablesRails.configure do |config|
# available options for db_adapter are: :pg, :mysql, :mysql2, :sqlite, :sqlite3
config.db_adapter = :pg
# Or you can use your rails environment adapter if you want a generic dev and production
# config.db_adapter = Rails.configuration.dat... | 37.3 | 95 | 0.772118 |
037ecaf8c3d4378cd95e73d47b213f37dc6476bf | 593 | # frozen_string_literal: true
require 'vcr'
require 'simplecov'
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.report_with_single_file = true
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov.start
API_EMAIL = ENV['API_EMAIL'] ||= 'mock@example.com'
API_KEY = ENV['API_KEY'] ||= '12345... | 28.238095 | 66 | 0.767285 |
bbd71068a6a14c51156c162240ba3ec2302fba41 | 2,474 | require_relative 'test_helper'
describe "FastExcel::WorksheetExt append_row" do
before do
@workbook = FastExcel.open(constant_memory: false)
@worksheet = @workbook.add_worksheet
end
it "should have last_row_number = -1" do
assert_equal(-1, @worksheet.last_row_number)
end
it "should write_value... | 28.436782 | 123 | 0.630962 |
bfc41185d44a7cfd43116ea2d9e0df7ad2860706 | 1,481 | class LDAPConnection < Net::LDAP
attr_accessor :filter, :entry
TREEBASE = "dc=makerspace,dc=org"
def self.connect(auth = nil) #initialize LDAP connection to server anonymously
credentials = { :host => "10.0.0.168",
:port => "389",
:auth => auth
}
self.new(cr... | 29.62 | 103 | 0.567184 |
334f06397e7c180dbe41affadead9e87b78e6ec0 | 170 | require 'open-uri'
require 'nokogiri'
require 'pry'
require_relative "pod_scraper/version"
require_relative './pod_scraper/cli'
require_relative './pod_scraper/episode'
| 21.25 | 40 | 0.805882 |
6adde8724878e785e039d09babd0fc37c9435808 | 427 | class TokyoMetro::Factory::Convert::Patch::Api::StationTimetable::NambokuLineToMusashiKosugi::Info < TokyoMetro::Factory::Convert::Common::Api::StationTimetable::ConvertTerminalStations::Info
def initialize( object )
super( object , ::TokyoMetro::Factory::Convert::Patch::Api::StationTimetable::NambokuLineToMusas... | 30.5 | 191 | 0.765808 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.