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 |
|---|---|---|---|---|---|
4a6ba53a2c045f078f6a567ba5eb7a7bce15738c | 659 | # frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'bundler/setup'
require 'smart_parser'
require 'factory_bot'
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.r... | 21.258065 | 67 | 0.738998 |
bbd284b4633069b174d25095048542a29c863004 | 2,992 | class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
include Select2Helper
step 'I visit "Bugfix" issue page' do
visit project_issue_path(@project, @issue)
end
step 'I click the thumbsup award Emoji' do
page.within '.a... | 27.703704 | 113 | 0.660094 |
7943ea1dd76fe09e8bc1f328ad7409370ffb5d53 | 129 | class ApplicationController < ActionController::API
include ActionController::HttpAuthentication::Token::ControllerMethods
end
| 32.25 | 72 | 0.860465 |
f8e758b36cf1e1795ae073392cbef34c0132a271 | 482 | # frozen_string_literal: true
require 'spec_helper'
describe Nocode::StepRegistry do
subject(:registry) { described_class.instance }
context 'when file is in the root steps folder' do
it 'returns class constant' do
expect(registry.constant!('sleep')).to eq(Nocode::Steps::Sleep)
end
end
context... | 24.1 | 74 | 0.701245 |
1cd165ab36d5407b2f605b578dd2c9ceb0e7e3d4 | 10,268 | # ApplicationRecord mixin to configure MarkUs
# All descendants have the following methods available
module MarkusConfigurator
######################################
# Repository configuration
######################################
def markus_config_repository_admin?
if defined? IS_REPOSITORY_ADMIN
... | 23.074157 | 143 | 0.6791 |
9181334f0fca985d5c230dd88409a024dece2431 | 1,870 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "eyowo/version"
Gem::Specification.new do |spec|
spec.name = "eyowo"
spec.version = Eyowo::VERSION
spec.authors = ["Iyanu Adelekan"]
spec.email = ["iyanu@softcom.ng"]
spec... | 41.555556 | 96 | 0.671123 |
795d9f001207ff7bd8d521c8221251a73493c630 | 656 | # frozen_string_literal: true
name 'ama-linux-user-management'
maintainer 'AMA Team'
maintainer_email 'ops@amagroup.ru'
source_url 'https://github.com/ama-team/cookbook-linux-user-management'
issues_url 'https://github.com/ama-team/cookbook-linux-user-management/issues'
license 'MIT'
description 'Installs/Configures a... | 31.238095 | 78 | 0.733232 |
6226985eb9234959bd5a64ab80b347bb49d490c0 | 11,646 | # encoding: utf-8
require File.expand_path('../../spec_helper.rb', __FILE__)
module Backup
describe Database::MySQL do
let(:model) { Model.new(:test_trigger, 'test label') }
let(:db) { Database::MySQL.new(model) }
let(:s) { sequence '' }
before do
Database::MySQL.any_instance.stubs(:utility).
wit... | 32.260388 | 80 | 0.593509 |
4a719ebdbd61d98695f57f591cf71722a2b20bd2 | 4,894 | class OmniauthCallbacksController < Devise::OmniauthCallbacksController
include AuthenticatesWithTwoFactor
protect_from_forgery except: [:kerberos, :saml, :cas3]
Gitlab.config.omniauth.providers.each do |provider|
define_method provider['name'] do
handle_omniauth
end
end
# Extend the standard... | 30.209877 | 108 | 0.706171 |
e83da830935722dc388af3116d889639257359e1 | 1,754 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Toggling the resolve status of a discussion' do
include GraphqlHelpers
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:noteable) { create(:merge_request, source_project: project) }
let(:discussion) do
create(:di... | 35.08 | 131 | 0.7252 |
08b1f31b3c7a64acbcf1747133fdc2a1a1357a37 | 237 | class CreateComments < ActiveRecord::Migration[5.2]
def change
create_table :comments do |t|
t.text :content
t.belongs_to :user, index: true
t.belongs_to :gossip, index: true
t.timestamps
end
end
end
| 19.75 | 51 | 0.658228 |
1c53cee7611e1c92390e39546d3572491244ad34 | 199 | class CreateTags < ActiveRecord::Migration[5.1]
def change
create_table :tags do |t|
t.string :name
t.references :blog_post, foreign_key: true
t.timestamps
end
end
end
| 18.090909 | 48 | 0.663317 |
e99a9bc41fd325c52449db94303ca0e70625d2b1 | 1,165 | require 'ip'
require './lib/configuration/team'
module Themis
module Configuration
def self.network(&block)
network_dsl = NetworkDSL.new
network_dsl.instance_eval &block
@_network = network_dsl.network
end
def self.get_network
@_network
... | 22.403846 | 50 | 0.482403 |
5d347439e63f9d5d53df4845a099cfd5c1615788 | 899 | module Anemone
module Queue
NEW = 0
PROCESSED = 1
def self.included(base)
base.extend Anemone::Queue::ClassMethods
base.send(:include, Anemone::Queue::InstanceMethods)
base.send :field, :state, :Integer, :default => NEW
base.send :field, :fetched_at, :Time
end
mo... | 19.977778 | 72 | 0.575083 |
ab1494300cbc74aafdf21498df8b7474132a7b19 | 1,395 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
module MetasploitModule
CachedSize = 130
include Msf::Payload::Single
include Msf::Sessions::CommandShellOptions
def initialize(info = {})
super(merge_info(info,
... | 25.363636 | 88 | 0.564875 |
79abfa4c196d6ac3e70d520e58b437299b70cd37 | 23,700 | #
# Author:: Richard Lavey (richard.lavey@calastone.com)
#
# Copyright:: 2015-2017, Calastone Ltd.
# Copyright:: Copyright (c) Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | 44.548872 | 396 | 0.639873 |
87572e12171228407dde31d3db9c473427c02b6f | 7,885 | module ActivityNotification
# Manages to add all required configurations to target models of notification.
module ActsAsTarget
extend ActiveSupport::Concern
class_methods do
# Adds required configurations to notifiable models.
#
# == Parameters:
# * :email
# * Email address ... | 51.875 | 197 | 0.659734 |
1a9c39222ab9ec06ef505d1178e2d3dbcb412647 | 197 | json.array!(@tournaments) do |tournament|
json.extract! tournament, :id, :fecha_inicio, :fecha_termino, :puntos_minimo, :jugadores_maximo
json.url tournament_url(tournament, format: :json)
end
| 39.4 | 97 | 0.77665 |
bb50941a504d370950b9e0c1cb620b68c39eaa47 | 1,065 | Pod::Spec.new do |s|
s.name = 'KVKCalendar'
s.version = '0.3.2'
s.summary = 'A most fully customization calendar library for iOS.'
s.description = <<-DESC
KVKCalendar is a most fully customization calendar library.
Library consists of four modules for displaying various... | 48.409091 | 118 | 0.647887 |
626137775a2c131251db07c76c09496fd8353feb | 889 | class Rpg < Formula
desc "Ruby package management for UNIX"
homepage "https://github.com/rtomayko/rpg"
url "https://github.com/downloads/rtomayko/rpg/rpg-0.3.0.tar.gz"
sha256 "c350f64744fb602956a91a57c8920e69058ea42e4e36b0e74368e96954d9d0c7"
head "https://github.com/rtomayko/rpg.git"
bottle do
cellar ... | 32.925926 | 95 | 0.768279 |
f70f3720651343c7167fb5fece969a542a881aae | 1,588 | class Bastet < Formula
desc "Bastard Tetris"
homepage "https://fph.altervista.org/prog/bastet.html"
url "https://github.com/fph/bastet/archive/0.43.2.tar.gz"
sha256 "f219510afc1d83e4651fbffd5921b1e0b926d5311da4f8fa7df103dc7f2c403f"
bottle do
rebuild 1
sha256 "0dfeabb0071431e426ac18b366ff5d065067075e7... | 31.137255 | 94 | 0.752519 |
e81486eeccf882d5c927ca6d8fd88c5c008efbab | 1,654 | require "spec_helper"
describe ActiveModel::Validations::SizeValidator do
context "validates that the attribute has a maximum number of values" do
class TestJsonSize < HarvesterCore::Json::Base
attribute :landing_url, path: "landing_url"
validates :landing_url, size: { maximum: 2 }
end
it... | 33.08 | 121 | 0.673519 |
117f48450e2a78bbcc9b2791836c728f27954b8b | 6,363 | require 'spec_helper'
describe 'projects/jobs/show' do
let(:project) { create(:project, :repository) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:pipeline) do
create(:ci_pipeline, project: project, sha: project.commit.id)
end
before do
assign(:build, build.present)
assign(:proje... | 29.595349 | 95 | 0.636649 |
21d04292246da3115b4e3f78d378fa7528753dd8 | 517 | # 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::EventGrid::Mgmt::V2017_09_15_preview
module Models
#
# Defines values for TopicTypeProvisioningState
#
module TopicTypeProvi... | 24.619048 | 70 | 0.690522 |
bfecbd85f220a67de6d48ea267da7214039c6a28 | 3,103 | # == Schema Information
#
# Table name: research_journal_articles
#
# id :uuid not null, primary key
# abstract :text
# keywords :text
# old_text :text
# position :integer
# published :bool... | 30.421569 | 148 | 0.647438 |
d5e4d3601469c41a8a4b6d57c5182e4ae700ee2c | 2,830 | if ENV['CI']
require 'simplecov'
SimpleCov.start
end
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'spec_helper'
# Prevent database truncation if the environment is production
abort("The ... | 42.238806 | 86 | 0.748057 |
871c765d257b7d2977f14e157c87fbd7ff80d67d | 2,173 | =begin
#Selling Partner API for Catalog Items
#The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog. For more information, see the [Catalog Items API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guid... | 34.492063 | 357 | 0.724344 |
5df7ef0eaefb392adb3961f315cc2e4154ec6d08 | 602 | module JavaPackageModuleTemplate
class << self
def const_missing(const)
JavaUtilities.get_proxy_class(@package_name + const.to_s)
end
private :const_missing
def method_missing(sym, *args)
Kernel.raise ArgumentError, "Java package `#{package_name}' does not have a method `#{sym}'" unless a... | 27.363636 | 117 | 0.719269 |
d59332b4529e8b974230ab27ec25983e88344b6f | 426 | class Student
attr_reader :grade,
:grades
def initialize
@grades = ["A", "B", "C", "D", "F"]
@grade =@grades[2]
end
def study
index = @grades.index(@grade)
if index == 0
index = 0
else
@grade =@grades[index - 1]
end
end
def slack_off
index = @grades.in... | 15.777778 | 39 | 0.516432 |
01d8e93cd6e31b64743318097049f2e7d00f3240 | 1,029 | $:.push File.expand_path('../lib', __FILE__)
require 'screen-object/version'
Gem::Specification.new do |s|
s.name = 'screen-object'
s.version = ScreenObject::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Sreepad Bhagwat','Shailendra Jain']
s.license = 'APACHE 2.0'
s.homepage = 'https://github.com... | 36.75 | 82 | 0.670554 |
ffc2b8f9564967bf11db603e0ce29e1ba9894f6e | 366 | module Neo4j::Driver
module Internal
module Messaging
module Encode
class PullAllMessageEncoder
def encode(message, packer)
Util::Preconditions.check_argument(message, Request::PullAllMessage)
packer.pack_struct_header(0, Request::PullAllMessage::SIGNATURE)
... | 24.4 | 80 | 0.650273 |
e2192dbe94ea4057dfccf676308edae14ec76ca1 | 1,106 | require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'test_helper')
class ApiKeyTest < ActiveSupport::TestCase
test "should create API key" do
assert_difference 'ApiKey.count' do
create_api_key
end
end
test "should generate expiration date" do
t = Time.parse('2015-01-01 09:00:00')... | 27.65 | 80 | 0.717902 |
1c29feb65fbecc0570c5abc25959eab4d07a176a | 1,109 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 35.774194 | 86 | 0.746619 |
d5c77e40a4cc534e6ad61d0907f894d4402fe67f | 13,859 | name 'im'
maintainer 'IBM Corp'
maintainer_email ''
license 'Copyright IBM Corp. 2016, 2017'
provides 'im'
depends 'ibm_cloud_utils'
supports 'rhel', '>= 7.0'
supports 'ubuntu', '>= 14.04'
description <<-EOH
## DESCRIPTION
This cookbook provides a lightweight... | 42.12462 | 185 | 0.699978 |
910dc240e4c100ec91b4a8fc5b842488548f1285 | 3,476 | class Unzip < Formula
desc "Extraction utility for .zip compressed archives"
homepage "https://infozip.sourceforge.io/UnZip.html"
url "https://downloads.sourceforge.net/project/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz"
version "6.0"
sha256 "036d96991646d0449ed0aa952e4fbe21b476ce994abc276e... | 38.197802 | 111 | 0.713176 |
28252df18f7faeddf98c2037b3196f23de338f74 | 213 | module Cucumber #:nodoc:
class VERSION #:nodoc:
MAJOR = 0
MINOR = 3
TINY = 98
PATCH = nil # Set to nil for official release
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
end
end
| 19.363636 | 58 | 0.610329 |
b9fc03922c7dec7f42d704fadb6b68bca16b5495 | 700 | # frozen_string_literal: true
module Screenshots
class CreateMessageThreadsService
prepend BasicService
option :message_threads
def call
prepared_threads = @message_threads.map do |thread|
{
id: thread['threadId'],
date: thread['threadModifiedDate'],
message_... | 25.925926 | 94 | 0.665714 |
e27d579c75bad329d00880233ed09c837f47cb80 | 712 | require_dependency "conference_plugin_constraint"
ConferencePlugin::Engine.routes.draw do
get "/" => "conference_plugin#index", constraints: ConferencePluginConstraint.new
get "/schedule" => "conference_plugin#schedule", constraints: ConferencePluginConstraint.new
get "/show" => "conference_plugin#show", constra... | 59.333333 | 94 | 0.793539 |
f81e53bbee860429b9d913c2a3ce35438e07c197 | 10,452 | class Localstack < Formula
include Language::Python::Virtualenv
desc "Fully functional local AWS cloud stack"
homepage "https://github.com/localstack/localstack"
url "https://files.pythonhosted.org/packages/32/4b/104718327cbfa9362d52c96af98ab32d59ce9be7d1bca42ee913d5ba7cb2/localstack-0.13.3.6.tar.gz"
sha256 ... | 48.165899 | 154 | 0.824244 |
b9c4f9199e5a71f33c4f86f3cb22cf12e6c62905 | 2,553 | # frozen_string_literal: true
require 'test_helper'
# Test that notifications can be viewed and marked as read.
class NotificationsControllerTest < ActionController::TestCase
setup do
@regular_user = users(:valid)
end
test 'should get index' do
login(@regular_user)
get :index
assert_response :s... | 29.686047 | 100 | 0.720721 |
080fab9eb53be95c4a3c60d8665c1578c1ab8386 | 908 | require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "./style/css"
sass_dir = "./style/sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be ... | 34.923077 | 96 | 0.752203 |
3912f3fca6109324cfcc7586ced4dc757fbd0953 | 722 | # frozen_string_literal: true
class RunClaimReviewParser
include Sidekiq::Worker
def perform(service, cursor_back_to_date = nil, overwrite_existing_claims=false, send_notifications=true)
cursor_back_to_date = Time.parse(cursor_back_to_date) unless cursor_back_to_date.nil?
ClaimReviewParser.record_service_h... | 36.1 | 107 | 0.810249 |
018bb98a8166d0e9a1cf0edc156bea85b1707a09 | 4,325 | # frozen_string_literal: true
require "spec_helper"
require "fakeweb"
require "openssl"
require "jwt"
CERTS_URI = "https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com"
RSpec.describe FirebaseIDToken::Validator do
describe "#check" do
before(:all) do
crypto = generate_... | 28.833333 | 102 | 0.587746 |
3869cdcc4823ba67ed9e36f7f511c9f224cc18b6 | 2,870 | # 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::Network::Mgmt::V2020_03_01
module Models
#
# Result of the request to list VirtualWANs. It contains a list of
# VirtualWANs and ... | 28.415842 | 80 | 0.529965 |
03a0a0d345917c5cbee384821ab384aeb30dce83 | 46 | datadog_monitor 'potato' do
action :add
end
| 11.5 | 27 | 0.76087 |
26bc6c265ebf834cfcff6c5f838013eafea9606e | 275 | module Innsights
# Ties up the gem into the Rails boot process
# Explicitly calls the rake tasks located in lib/tasks
class Railtie < Rails::Railtie
rake_tasks do
Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f }
end
end
end | 30.555556 | 82 | 0.683636 |
f7b28c1be2c78cf49c7bbf3a3d24e4260800d09b | 3,174 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRankin... | 27.128205 | 94 | 0.597984 |
1cafee194aa299608396c87b1758031d5c9d2c35 | 2,067 | class Order < ApplicationRecord
belongs_to :organization
belongs_to :organization_unscoped, -> { unscope(:where) }, class_name: "Organization", foreign_key: :organization_id
belongs_to :user
has_many :order_details, autosave: true
has_many :items, through: :order_details
has_many :shipments
include Order... | 26.5 | 118 | 0.708757 |
bbd88e4293514cec6bfd81107b7256825282991d | 1,313 | STDLIB_FILES = %w[
English.rb
abbrev.rb
base64.rb
benchmark.rb
cgi
cgi.rb
cmath.rb
csv.rb
date
date.rb
debug.rb
delegate.rb
drb
drb.rb
e2mmap.rb
erb.rb
fileutils.rb
find.rb
forwardable.rb
getoptlong.rb
ipaddr.rb
irb
irb.rb
logger.rb
mathn.rb
matrix
matrix.rb
monit... | 14.752809 | 52 | 0.651942 |
e23a9dffa758f2a3f9272a7cdfe4f277d1ab2561 | 4,830 | module Sequel
class Model
ID_POSTFIX = '_id'.freeze
# Creates a 1-1 relationship by defining an association method, e.g.:
#
# class Session < Sequel::Model
# end
#
# class Node < Sequel::Model
# one_to_one :producer, :from => Session
# # which is equivalent to
... | 31.363636 | 108 | 0.57619 |
e85004d8e348f4eb29e5310e4a4deb2cfa1bd39d | 5,111 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.833333 | 114 | 0.765995 |
4a26e1df055a0ba629132e4e0661185a97325824 | 745 |
# Ensure this FILE NAME is the name you want for your library
# This is the primary criteria by which your library will be
# found by users of rubygems and sprouts
name = File.basename(__FILE__).split('.').shift
gem_wrap name do |t|
t.version = '2.0.4'
t.summary = "PureMVC is a lightweight framework f... | 37.25 | 167 | 0.714094 |
f70a8d052a3a7705a81930badf1578c482cc661f | 862 | module Authlogic
module Session
# = ActiveRecord Trickery
#
# Authlogic looks like ActiveRecord, sounds like ActiveRecord, but its not ActiveRecord. That's the goal here. This is useful for the various rails helper methods such as form_for, error_messages_for, or any
# method that expects an ActiveRec... | 33.153846 | 211 | 0.674014 |
7ab63e1ba1c5701d23944b11c43cd22de1521209 | 2,458 | require 'augeas'
require 'tempfile'
module AugeasSpec::Fixtures
# Creates a temp file from a given fixture name
# Doesn't explicitly clean up the temp file as we can't evaluate a block with
# "let" or pass the path back via an "around" hook.
def aug_fixture(name)
tmp = Tempfile.new("target")
tmp.write(... | 31.113924 | 129 | 0.648495 |
11240e6b7501aed39ef508cc8c79c151628aefc2 | 218 | Rails.application.routes.draw do
resources :pins
devise_for :users
root 'home#index'
get 'home/about'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 21.8 | 101 | 0.747706 |
031de8af83c91cfa82741f189f78344e0d53f7d3 | 4,128 | ## This is the rakegem gemspec template. Make sure you read and understand
## all of the comments. Some sections require modification, and others can
## be deleted if you don't need them. Once you understand the contents of
## this file, feel free to delete any comments that begin with two hash marks.
## You can find c... | 38.943396 | 105 | 0.712694 |
1a5546236c2d1c7545debf001a207a5381f06233 | 170 | require File.expand_path('../../../../../../spec_helper', __FILE__)
describe "OpenSSL::PKey::EC::Point#invert!" do
it "needs to be reviewed for spec completeness"
end
| 28.333333 | 67 | 0.682353 |
bbd78aacf7a1fa1b36bd492684bb70312af7ec5d | 1,103 | class Fonttools < Formula
include Language::Python::Virtualenv
desc "Library for manipulating fonts"
homepage "https://github.com/fonttools/fonttools"
url "https://github.com/fonttools/fonttools/releases/download/4.13.0/fonttools-4.13.0.zip"
sha256 "63987cd374c39a75146748f8be8637634221e53fef15cdf76f17777676d... | 33.424242 | 94 | 0.777879 |
339ba82e49eb28b2b59725c6d02eaa58afda6949 | 1,790 | class Helmfile < Formula
desc "Deploy Kubernetes Helm Charts"
homepage "https://github.com/roboll/helmfile"
url "https://github.com/roboll/helmfile/archive/v0.111.0.tar.gz"
sha256 "91263ca1b058475f78a30da2965a74c03def503d1d1db350544bd486d954a4c4"
bottle do
cellar :any_skip_relocation
sha256 "da6898c0... | 42.619048 | 136 | 0.682123 |
bfbc11952d475a2b64115269095b1d532f6d714c | 585 | module Api
module V1
class AuthenticationController < ApplicationController
def create
user = User.find_by(email: login_params[:email].downcase)
if user.present? && user.authenticate(login_params[:password])
user.update(token: SecureRandom.hex)
render json: UserSerializer... | 26.590909 | 70 | 0.642735 |
6a71f421eab5c1bd04e076693bbc917b239b7c7b | 1,121 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module TextrisExample
class Application < Rails::Application
# Settings in config/environments/* tak... | 41.518519 | 99 | 0.735058 |
f7d40264e45ca6f344977b9702e9db60c1b23a92 | 7,297 | =begin
#Gomematic OpenAPI
#API definition for Gomematic
The version of the OpenAPI document: 1.0.0-alpha1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.0
=end
require 'date'
module Gomematic
class UserTeamParams
attr_accessor :team
attr_accessor :perm
class EnumAttrib... | 29.188 | 203 | 0.615458 |
39f448fff3956b407616a286c65938b0cc7b1daa | 10 | #My Code!
| 5 | 9 | 0.6 |
4ae98e588f951f5b5f2238bc73fff3a6b70ea215 | 38 | module Refill
VERSION = '0.0.0'
end
| 9.5 | 19 | 0.657895 |
f8b1daf5f0e1013ca014f21250733f8889017ed7 | 1,320 | # frozen_string_literal: true
module Api
module V3
class LikesController < Api::V3::ApplicationController
before_action :doorkeeper_authorize!
before_action do
requires! :obj_type, values: %w[topic reply]
requires! :obj_id
end
# 赞一个信息
#F
# POST /api/v3/likes
... | 23.571429 | 96 | 0.559848 |
e83856b5efe2f1ddf96b648a880a85dc3bb3dfa8 | 27,363 | require "helper"
set :environment, :test
OmniAuth.config.test_mode = true
describe "The Campaign Monitor Subscribe Form app" do
let(:app) { Sinatra::Application }
let(:user_id) { "7654321" }
let(:fb_token) { "xxxx" }
let(:cm_api_key) { "testapikey" }
before do
DataMapper.auto_migrate!
end
describe... | 39.945985 | 298 | 0.595585 |
ed85b7e1a615f7387f3c51ade8289efe17526ae5 | 1,259 | # frozen_string_literal: true
module Hyrax
class PermissionsController < ApplicationController
helper_method :curation_concern
def confirm
# intentional noop to display default view
end
deprecation_deprecate confirm: "Use the #confirm_access action instead."
def copy
authorize! :edit... | 34.027027 | 184 | 0.752979 |
b9cade92151af813a70f332b6052bb3a49c8af4b | 487 | class DropUnusedDatabaseColumns < ActiveRecord::Migration
def self.up
remove_column :ownerships, :approved
remove_column :versions, :downloads_count
drop_table :downloads
end
def self.down
create_table "downloads" do |t|
t.integer "version_id"
t.datetime "created_at"
t.datetime... | 27.055556 | 67 | 0.706366 |
ace84c90f48ad0cf37a83359b40d57624591db1d | 44 | require 'resque'
require 'resque/scheduler'
| 14.666667 | 26 | 0.795455 |
334c49fe4c7977889814ca137a09a663edf882fe | 4,296 | require File.expand_path("../../lib/s3-wrapper", __FILE__)
require 'spec_prepare'
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause thi... | 47.208791 | 129 | 0.744646 |
ac4db34519aa107a25519823a057cb2899a26160 | 849 | Pod::Spec.new do |s|
s.name = "StreamingKit"
s.version = "0.1.21"
s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources."
s.homepage = "https://github.com/tumtumtum/StreamingKit/"
s.license = 'MIT'
s.autho... | 49.941176 | 138 | 0.660777 |
e25a7cc04f87cbf3ab6855d3bdd4a4d4ea2b1d08 | 2,264 | require 'yaml'
require 'oj'
require 'pry'
require_relative 'screen/group'
require_relative 'screen/definition'
module Hippo
module Screen
GROUPS=Hash.new{|h,k| g=Group.new; g.identifier=k; h[k]=g }
DEFINITIONS = Hash.new
EXTENSIONS = Hash.new
mattr_accessor :enabled_group_ids
... | 24.344086 | 84 | 0.487633 |
4ab673cdb06d552afa6483313f58321ea5df7eba | 15,601 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# Copyright (c) 2016, Electric Power Research Institute (EPRI)
# All rights reserved.
#
# OpenADR ("this software") is licensed under BSD 3-Clause license.
#
# Redistribution and use in source and binary forms, with or without m... | 68.726872 | 206 | 0.645536 |
e2e216d24b87afbdd0fd6b1e7e09f7ec97cb6198 | 442 | # frozen_string_literal: true
FactoryBot.define do
factory :incident_management_timeline_event, class: 'IncidentManagement::TimelineEvent' do
association :project
association :author, factory: :user
association :incident
association :promoted_from_note, factory: :note
occurred_at { Time.current }... | 29.466667 | 92 | 0.730769 |
182dad7e9a93429812d45b69fbcba7c45c51363f | 1,741 | Pod::Spec.new do |s|
s.name = "DLIDEKeyboard"
s.version = "1.0.0"
s.summary = "Drop-in component for adding additional keyboard keys to both iPad/iPhone keyboards."
s.homepage = "https://github.com/garnett/DLIDEKeyboard"
s.license = {
:type => 'MIT',
:text => <<-LICENSE
... | 47.054054 | 105 | 0.723148 |
7adb0c5133d2ac3f7c88ecc45be161961861fff3 | 661 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'xq_test_two'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
A new flutter plugin project.
DESC... | 30.045455 | 83 | 0.544629 |
6a90d1499149f47e874ab342f0b8775e472c3912 | 5,423 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 27.668367 | 94 | 0.601696 |
62026b54ec203f09ec93641217eccc832a246796 | 327 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe '{{{grape-starter}}}/v1/oapi' do
subject(:swagger) do
get RSpec.current_example.metadata[:example_group][:full_description]
last_response
end
specify { expect(swagger.status).to eql 200 }
specify { expect(swagger.body).not_to be_empty... | 23.357143 | 73 | 0.743119 |
794f1365c2bd4b805d5c8c3624ad70f23b7ae64b | 2,004 | class DockerMachineDriverXhyve < Formula
desc "Docker Machine driver for xhyve"
homepage "https://github.com/machine-drivers/docker-machine-driver-xhyve"
url "https://github.com/machine-drivers/docker-machine-driver-xhyve.git",
:tag => "v0.4.0",
:revision => "829c0968dac18547636f3ad6aa5ef83677f48... | 35.157895 | 112 | 0.709581 |
08857615e3592419762fea929ee6325b2e257cf8 | 23,958 | #
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may n... | 32.954608 | 163 | 0.613532 |
111ddfc23601f8ab5e709292b955050b5e1eac3b | 719 | require 'pp'
module MeanTest
def self.mean_distances(ps_block)
#ps_block = {
# keys: ["beta", "H"],
# ps: [
# {v: [0.2, -1.0], result: [-0.483285, -0.484342, -0.483428]},
# ...
# ],
# }
mean_distanc... | 23.193548 | 84 | 0.452017 |
3829ba6c8353a94d5f415a6489fd1b7e383b1014 | 21,687 | require_relative "test_helper"
class InterfaceTest < Minitest::Test
include TestHelper
include FactoryHelper
def method_params(source)
parse_method_type(source).type.params
end
def test_method_type_params_plus
with_factory do
assert_equal method_params("(String | Integer) -> untyped"),
... | 46.941558 | 156 | 0.575829 |
f8e9797c3dd33325eb190b7684bbbd5f7ae97346 | 540 | Pod::Spec.new do |s|
s.name = 'UXReader'
s.version = '0.1.1'
s.platform = :ios, '8.0'
s.summary = 'UXReader PDF Framework for iOS'
s.homepage = 'https://github.com/muyexi/UXReader-iOS'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author ... | 41.538462 | 103 | 0.544444 |
f885863fb523d9b5c7e70b6c50429063894f2761 | 105,291 | # 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 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
... | 39.449607 | 427 | 0.638032 |
1d570bd8f78000090960451b86da224870f386be | 1,015 | # -*- encoding: utf-8 -*-
# stub: delegate 0.2.0 ruby lib
Gem::Specification.new do |s|
s.name = "delegate".freeze
s.version = "0.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "homepage_uri" => "https://github.com/ruby/delega... | 44.130435 | 156 | 0.695567 |
33316b92297db5fa47bfe8a5b7cd15e965f38a9e | 119 | require 'pry'
require_relative '../config/environment'
require_relative 'methods.rb'
require 'io/console'
first_prompt | 19.833333 | 40 | 0.806723 |
79f72b820a658eb91b32c9edcbae60ce17bab0bd | 1,050 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v5/errors/time_zone_error.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v5/errors/time_zone_error.proto", :syntax =>... | 33.870968 | 178 | 0.745714 |
5daebbcf6fcdeda8565a1315527f1bd1db2ddde4 | 2,420 | require 'metainspector'
require 'open-uri'
require 'mini_magick'
module Jekyll
class SocialCardTag < Liquid::Tag
def initialize(tag_name, text, options)
super
@card_url = text
end
def render(context)
site = context.registers[:site]
baseurl = site.baseurl
@@properties ||= ... | 32.266667 | 135 | 0.624793 |
f7c831892ee28e89eb51ffcc9c37450c5559640e | 3,261 | namespace :gitlab do
namespace :env do
desc "GitLab | Show information about GitLab and its environment"
task info: :environment do
# check if there is an RVM environment
rvm_version = run_and_match(%W(rvm --version), /[\d\.]+/).try(:to_s)
# check Ruby version
ruby_version = run_and_... | 41.807692 | 99 | 0.644588 |
396dfd50646289d7fa08825f5be07bce0a6832ae | 25,897 | require 'fiddle/import'
require_relative 'fiddle_patch'
module LibUI
module FFI
extend Fiddle::Importer
extend FiddlePatch
begin
dlload LibUI.ffi_lib
rescue LoadError
raise LoadError, 'Could not find libui shared library'
end
class << self
attr_reader :func_map
def ... | 43.161667 | 236 | 0.7185 |
614af909ec26a51c6b773d9804a7b7b9eb00e44f | 266 | require 'rails_admin/config/fields/base'
module RailsAdmin
module Config
module Fields
module Types
class Inet < RailsAdmin::Config::Fields::Base
RailsAdmin::Config::Fields::Types.register(self)
end
end
end
end
end
| 19 | 58 | 0.654135 |
39c71b588af6d83cd3d74c85f0255fe6aa1f978d | 1,134 | module Eye::Process::Controller
# scheduled actions
# :update_config, :start, :stop, :restart, :unmonitor, :monitor, :break_chain, :delete, :signal, :user_command
def start
if load_external_pid_file == :ok
switch :already_running
:ok
else
start_process
end
end
def stop
sto... | 18 | 112 | 0.671076 |
4a7e01b29e6bf98597fe13655b782fd0f5548fb4 | 298 | require 'rails_helper'
RSpec.describe "music_categories/show", type: :view do
before(:each) do
@music_category = assign(:music_category, MusicCategory.create!(
:name => "Name"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Name/)
end
end
| 19.866667 | 68 | 0.667785 |
e89e5fc36cfc60bcb288b9f52d055234f7618529 | 277 | class ContactMessage < NonPersistentRecord
column :id, :integer
column :author, :string
column :author_email, :string
column :author_phone, :string
column :subject, :string
column :body, :string
validates_presence_of :author, :author_email, :subject, :body
end
| 23.083333 | 63 | 0.747292 |
1d6768e563fe8b7840ab8c2d4284989ad0ce16ce | 436 | require 'rails_helper'
RSpec.describe SponsorsController, type: :controller do
context 'GET #show' do
it 'returns a success response' do
sponsor = Sponsor.create!(name: "Sponsor")
get :show, params: {id: sponsor.to_param}
expect(response).to be_success
end
end
#context 'GET #index' do
... | 22.947368 | 55 | 0.662844 |
e8cdecbb564610efc98c7808668054eee9f5ad00 | 166 | class AddBilinguals < ActiveRecord::Migration[5.0]
def change
add_column :leapq_sample_bilinguals, :scene, :string, :limit => 20, :default => 'school'
end
end
| 27.666667 | 91 | 0.722892 |
5dec9a82ab4c75a2c15b50a08e0bbd643fc42c3d | 2,031 | #!/usr/bin/ruby
#this script generates list of popular shop values - more than MIN_COUNT occurences in OpenStreetMap database according to taginfo
#it is useful during creating/updating list of shops displayed with generic dot icon
require 'net/http'
require 'json'
require 'pp'
MIN_COUNT = 100
EXCEPTIONS = [
"no"... | 35.631579 | 130 | 0.71935 |
33037e551eb828e1f518c9a73d893605267ae878 | 1,427 | #!/usr/bin/env rspec
shared_examples_for "Puppet::Indirector::FileServerTerminus" do
# This only works if the shared behaviour is included before
# the 'before' block in the including context.
before do
Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil)
FileTest.stubs(:exists?)... | 33.97619 | 99 | 0.693763 |
f884335ef55dae495d6fe156acbde79e0a89760e | 1,491 | require 'digest'
RSpec.describe HashComparator::Emails::Analyzer do
let(:subject_plaintext_emails) { ['john@gmail.com', 'addy@trailblazers.net', 'tom@hello.inc'] }
let(:target_hashed_emails) { [hashed_email1, hashed_email2] }
let(:options) { { parsing: { remove_usernames: true } } }
let(:hashed_email1) { Diges... | 45.181818 | 188 | 0.760563 |
289df6d14662f98c85245ff952a91872cce47f37 | 466 | class CreateUnitGroupsResources < ActiveRecord::Migration[5.2]
def change
create_table :unit_groups_resources do |t|
t.integer :unit_group_id
t.integer :resource_id
t.index [:unit_group_id, :resource_id], unique: true
t.index [:resource_id, :unit_group_id]
end
reversible do |dir|
... | 27.411765 | 101 | 0.699571 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.