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 |
|---|---|---|---|---|---|
3942291ee4ba93128ce0ce412209fc71af0d1c6d | 5,060 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE
... | 30.481928 | 101 | 0.550988 |
b9ed98dc3dddd3b6931e61fdbc9e96327ecdcc81 | 3,498 | module Zoom
module Constants
module Account
module Settings
PERMITTED_KEYS = {
schedule_meeting: %i[
host_video
participant_video
audio_type
join_before_host
enforce_login
enforce_login_with_domains
enforce... | 28.439024 | 56 | 0.554031 |
7a9a41f383ed15f1250a2e64542ca157ed053e4f | 764 | require 'active_support'
require 'active_support/concern'
# @note 確定
module Nard
module Appi
module ApiExt
module Initializer
extend ActiveSupport::Concern
included do
# puts "#{ self } - Nard::Appi::ApiExt::Initializer.#default (OPTIONS_KEYS: #{ self::OPTIONS_KEYS.to_s })"
... | 20.105263 | 118 | 0.574607 |
e8fab30c2b3bda6d5908ba299ef389a32b0921b8 | 2,787 | require 'json'
class WunderTrello
LISTS_KEY_NAME = "lists".freeze
TASKS_KEY_NAME = "tasks".freeze
NOTES_KEY_NAME = "notes".freeze
def initialize
hashed_json = jsonfile_to_hash
@lists = hashed_json["data"][LISTS_KEY_NAME]
@tasks = hashed_json["data"][TASKS_KEY_NAME]
@notes = hashed_json["data"]... | 28.151515 | 159 | 0.63258 |
ab9a2483d105d05045b9f1795899221c157afb23 | 4,983 | using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
module OpenCL
# Attaches a callback to memobj that will be called on memobj destruction
#
# ==== Attributes
#
# * +memobj+ - the Mem to attach the callback to
# * +options+ - a hash containing named options
# * +block+ - if pr... | 33.668919 | 160 | 0.674493 |
1a7934a83c839a8c8c8f0c89d1d67997fe87b25a | 1,728 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject,... | 35.265306 | 91 | 0.712384 |
7a85461e147212395e67c8024e63a9c3e3925e2c | 1,199 | class AddDetailsToRegionalPartner < ActiveRecord::Migration[5.0]
def change
add_column :regional_partners, :attention, :string
add_column :regional_partners, :street, :string
add_column :regional_partners, :apartment_or_suite, :string
add_column :regional_partners, :city, :string
add_column :regio... | 29.975 | 64 | 0.745621 |
9187f21ab41c755c69f38ac24453c8aaea3d4b5d | 7,432 | module Worker
require 'newrelic_rpm'
class StratumWithdraw
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
def initialize(currency)
@currency = currency
@logger = Logger.new STDOUT
end
# Check withdraw by coin
def process
by_time_batch
by_waiting_ba... | 37.535354 | 117 | 0.601588 |
bb127db5cd84cab336e59d727f197ceab2df79c9 | 739 | Rails.application.routes.draw do
devise_for :users,
path: 'users',
path_names: {
sign_in: 'login',
sign_out: 'logout'
}
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
devise_for :administrato... | 24.633333 | 101 | 0.598106 |
bf1d06aaf9b8b8be4d404eee24ef18d214a8d34b | 11,885 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 42.295374 | 245 | 0.694573 |
87daf7cf5864f9671e8fe4d52f0b748b293393af | 13,854 | require 'jmespath'
require 'seahorse'
Seahorse::Util.irregular_inflections({
'ARNs' => 'arns',
'CNAMEs' => 'cnames',
'Ec2' => 'ec2',
'ElastiCache' => 'elasticache',
'iSCSI' => 'iscsi',
'ACLs' => 'acls',
#'SSEKMS' => 'sse_kms',
})
module Aws
# @api private
API_DIR = File.join(File.dirname(File.dirna... | 36.078125 | 102 | 0.70846 |
6ab83195193969882b99384171ff7489c6198874 | 966 | # frozen_string_literal: true
require_relative "scripts"
RSpec.describe SidekiqUniqueJobs::Scripts do
describe ".execute" do
subject(:execute) { described_class.execute(script_name, script_conn, script_args) }
let(:script_name) { :lock }
let(:script_conn) { Redis.new }
let(:script_args) { { keys: s... | 25.421053 | 88 | 0.63147 |
ffa5aee01a2598eec6bb397dd4ce4a1f1efbc13d | 146 | require 'test_helper'
describe Lotus::Model::VERSION do
it 'returns current version' do
Lotus::Model::VERSION.must_equal '0.1.0'
end
end
| 18.25 | 44 | 0.726027 |
1af06d2f5ee52c1774cc7a9248bb484bcb90dfb3 | 936 | $:.push File.expand_path('../lib', __FILE__)
require 'knife-graph/version'
Gem::Specification.new do |s|
s.name = 'knife-graph'
s.version = Knife::Graph::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Or Cohen']
s.email = ['orc@fewbytes.com']
s.homepage = 'https://github.... | 36 | 101 | 0.647436 |
ff047a570235ea4ab45592b88950e846e6743131 | 112 | class ApplicationController < ActionController::API
def test
render json: { test: "success" }
end
end
| 14 | 51 | 0.705357 |
e2f667550637c25aa8a090741f2c4e80c336f799 | 938 | module ImagesHelper
# !! Rails already provides image_tag, i.e. it is not required here.
def image_link(image)
return nil if image.nil?
link_to(image_tag(image.image_file.url(:thumb)), image)
end
def images_search_form
render('/images/quick_search_form')
end
# @return [True]
# indicates ... | 24.684211 | 87 | 0.653518 |
018eb9c4679d23ea1aefa76b4f2a12754eeb31aa | 550 | require 'formula'
class Bisonphp26 < Formula
homepage 'http://www.gnu.org/software/bison/'
url 'http://ftpmirror.gnu.org/bison/bison-2.6.4.tar.gz'
mirror 'http://ftp.gnu.org/gnu/bison/bison-2.6.4.tar.gz'
sha256 'de2d15dfdcfc24405464cb95acc9d5ef31fb2e5be4aca6a530ec59bb57c30e5d'
version '2.6.4-boxen1'
keg_... | 28.947368 | 78 | 0.696364 |
b982ab9ec2d86b4e22b2536d514f8a3078a0e01c | 2,936 | require 'rails_helper'
require 'rspec_api_documentation/dsl'
resource 'Tasks Bulk' do
include_context :json_headers
doc_helper = DocumentationHelper.new(resource: :tasks)
let!(:account_list) { user.account_lists.order(:created_at).first }
let!(:task_one) { create(:task, account_list: account_list) }
l... | 33.747126 | 126 | 0.675409 |
26bb6b2159e188d4c4ff42969d7368591f813341 | 512 | require File.expand_path('../spec_helper', File.dirname(__FILE__))
describe Tr8n::GlossaryController do
describe "guest user" do
it "should be redirect to homepage" do
get :index
response.should redirect_to('/')
end
end
describe "logged in user" do
it "should redirect the guest user ... | 23.272727 | 66 | 0.664063 |
913776f892205d06eeea6c984fe1434f1f2b1297 | 5,220 | module AocCli
module Commands
class KeyStore
attr_reader :user, :key
def initialize(args)
args = defaults.merge(args).compact
@user, @key = args[:user], args[:key]
end
def exec
Files::Config::Cookie.store(user:user, key:key)
self
end
def respond
puts "Key added successfully"
... | 22.403433 | 63 | 0.61705 |
e9c4c272331ae1a1f4cb1b8e1ea12bfdd0350eca | 755 | require "rails_helper"
RSpec.describe EmailAddressesController, type: :routing do
describe "routing" do
it "routes to #new" do
expect(:get => "/email_addresses/new").to route_to("email_addresses#new")
end
it "routes to #edit" do
expect(:get => "/email_addresses/1/edit").to route_to("email_a... | 26.964286 | 96 | 0.645033 |
1daa135ff82071438b6bde776c448661a6b696c6 | 322 | module Ruboty
module Niftycloud
module Actions
class ComputingImageShow < Base
def call
image = computing.images.find {|image| image['imageId'] == message[:image_id] }
image.each do |k, v|
message.reply "#{k}: #{v}"
end
end
end
end
end
en... | 21.466667 | 89 | 0.546584 |
e2883a62f146aa50788ac3c6c1dc64b46d60161e | 366 | require 'formula'
class RegexOpt < Formula
homepage 'http://bisqwit.iki.fi/source/regexopt.html'
url 'http://bisqwit.iki.fi/src/arch/regex-opt-1.2.2.tar.bz2'
sha1 '18481500e8fed8ecf94f9738104594ef5a658456'
def install
system "make", "CC=#{ENV.cc}", "CXX=#{ENV.cxx}"
bin.install 'regex-opt'
end
def... | 21.529412 | 62 | 0.68306 |
6ab5ca6997894cc5222b0630d8fad47b783b6bc1 | 50 | require './ruby2fmpxml'
run Sinatra::Application
| 12.5 | 24 | 0.78 |
1a6a5d383b05d60e1facd1ff36f0c73fd7659764 | 1,598 | cask 'forklift' do
version '3.0.8'
sha256 '366d58504b4cd9f2eccf5a1e85c146de51c41279b01519592c1e1cf750d67906'
url "http://download.binarynights.com/ForkLift#{version}.zip"
appcast "https://updates.binarynights.com/ForkLift#{version.major}/update.xml",
checkpoint: '8ac4cf3eee7db69bf963f3ca5695b01f7ee82... | 40.974359 | 106 | 0.605757 |
acdfc2acad909f238695ece4c205be704f324b92 | 3,773 | require 'json'
require 'httparty'
require 'chronic'
require 'date'
require 'erb'
def lambda_handler(event:, context:)
{
statusCode: 200,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": "true",
"Content-Type": "text/html"
},
body: render
}
end
de... | 28.156716 | 139 | 0.554996 |
0154851dbe349e02a31ad5ce592eae014c2a49c5 | 546 | shared_examples_for "a REPL provider" do
it "evaluates ruby code in a given context" do
repl.send_input("local_a = 456")
fresh_binding.eval("local_a").should == 456
end
it "returns a tuple of output and the new prompt" do
output, prompt = repl.send_input("1 + 2")
output.should == "=> 3\n"
p... | 28.736842 | 55 | 0.663004 |
6243e2a2f815375f8e4da1eada27be0621467669 | 834 | require 'spec_helper'
module VCAP::CloudController
describe ServicePlanAccess, type: :access do
subject(:access) { ServicePlanAccess.new(double(:context, user: user, roles: roles)) }
let(:user) { VCAP::CloudController::User.make }
let(:roles) { double(:roles, :admin? => false, :none? => false, :present? ... | 33.36 | 90 | 0.664269 |
336e8e83918fa0fbab79ea825515c3e669e003e8 | 3,244 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for developme... | 37.72093 | 87 | 0.766954 |
ed7bd91d6aac7eae257fe03e6e81a08a71ef172c | 3,316 | # typed: strong
# 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 sourc... | 34.905263 | 105 | 0.706876 |
1d2fdbbd57d5ecff8fb36aca0e6e25ca7a12f280 | 2,298 | require 'manageiq-gems-pending'
require 'VMwareWebService/MiqVim'
require 'VMwareWebService/MiqVimBroker'
$vim_log = Logger.new(STDOUT)
$vim_log.level = Logger::WARN
TARGET_VM = raise "please define"
miqVm = nil
begin
vim = MiqVim.new(SERVER, USERNAME, PASSWORD)
# vim.logger = $stdout
puts "vim.class: #{vim.... | 26.113636 | 75 | 0.644038 |
26b70e85c293187daae2faa1eb4d8be9f7455586 | 715 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v2/resources/customer_label.proto
require 'google/protobuf'
require 'google/protobuf/wrappers_pb'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.ads.googleads.... | 37.631579 | 132 | 0.79021 |
79c37903bbc3a7de9cc820657fb7606817aa2c36 | 7,482 | =begin
#Power Cloud API
#IBM Power Cloud API for Power Hardware / Infrastructure
The version of the OpenAPI document: 1.0.0
Contact: kylej@us.ibm.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-beta2
=end
require 'date'
module IbmCloudPower
class VirtualCores
# The minimum D... | 29.456693 | 205 | 0.617482 |
d5812d0c8e73c7c077ee3a10a50c735a7b6b754c | 5,234 | #
# Be sure to run `pod spec lint FBBHttpClient.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://gith... | 37.120567 | 103 | 0.592854 |
61e019a9d5f32b2ba682a3d2a0d97a62515e2d3b | 599 | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyMo... | 23.96 | 81 | 0.699499 |
e27f7be9d53901f2972db204c70bf3e5d3efbc8a | 4,065 | module YMaps
module ActionView
module HtmlHelper
class StaticMapPoint < Struct.new('MapPoint', :style, :color, :size, :number, :lat, :lng)
def to_s
"#{gml_lnglat},#{style}#{color}#{size}#{number}"
end
def gml_lnglat
@gml_lnglat ||= "#{lng},#{lat}"
end
... | 35.043103 | 146 | 0.546371 |
28b4ba655b5188d83ab934f739c5f52b6567fa8c | 2,148 | class Vault::PageController < Admin::BaseController
def index
@homepage = Page.find_by_parent_id(nil)
end
def new
@page = request.get? ? Page.new_with_defaults : Page.new
@page.slug = params[:slug]
@page.breadcrumb = params[:breadcrumb]
@page.parent = Page.find_by_id(params[:parent_id])
... | 24.134831 | 106 | 0.666667 |
180d461ec154b807e06f1919faed612617b534d1 | 181 | class Object
# extending object class with mehtod burrowed from RoR
# abbreviates obj.nil? || obj.empty? test
def blank?
respond_to?(:empty?) ? !!empty? : !self
end
end
| 22.625 | 56 | 0.679558 |
26557db623a3eb500c2e9cf10e7ebb7b58fc097a | 179,483 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 50.16294 | 136 | 0.663311 |
1a63b466682390c64d833b1054881fb66b6f7246 | 161 | require 'spec_helper'
set :os, :family => 'base'
describe group('root') do
it { should exist }
end
describe group('root') do
it { should have_gid 0 }
end
| 13.416667 | 26 | 0.664596 |
790e27eed824f86b325877215e025d0f3f0a5e6e | 1,762 | # frozen_string_literal: true
# The MIT License (MIT)
#
# Copyright <YEAR> <COPYRIGHT HOLDER>
#
# 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 without limitat... | 41.952381 | 79 | 0.784904 |
085765d823aaaa929e66cd7d9c51f23f4552751d | 1,111 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'DevopsAdoptionSegments' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user, :admin) }
let_it_be(:group) { create(:group, name: 'my-group') }
let_it_be(:segment) do
create(:devops_adoption_segment, namespace: group).tap do... | 22.673469 | 106 | 0.612961 |
eddbe1d8ef59ff745ce687912844bf3d5a4d1998 | 4,016 | require 'mail'
class ValidateEmail
class << self
SPECIAL_CHARS = %w(( ) , : ; < > @ [ ])
SPECIAL_ESCAPED_CHARS = %w(\ \\ ")
LOCAL_MAX_LEN = 64
DOMAIN_REGEX = /\A(?:[[:alnum:]](?:[[[:alnum:]]-]{0,61}[[:alnum:]])?)(?:\.(?:[[:alnum:]](?:[[[:alnum:]]-]{0,61}[[:alnum:]])?))+\z/
def valid?(value, use... | 31.873016 | 134 | 0.610807 |
e23eded3142d78b4657565356b7fbb4e405a394e | 2,752 | require 'rails_helper'
RSpec.describe Spree::PermissionSets::OrderDisplay do
let(:ability) { DummyAbility.new }
subject { ability }
context "when activated" do
before do
described_class.new(ability).activate!
end
it { is_expected.to be_able_to(:display, Spree::Order) }
it { is_expected.t... | 50.036364 | 78 | 0.714026 |
bb4f704e0a2fb88cd38b5f50b5c836576ae32447 | 2,390 | require 'simp/cli/config/item'
require 'rspec/its'
require_relative 'spec_helper'
describe Simp::Cli::Config::Item do
before :each do
@ci = Simp::Cli::Config::Item.new
end
describe "#initialize" do
it "has no value when initialized" do
expect( @ci.value ).to eq nil
end
it "has nil values ... | 22.336449 | 64 | 0.603347 |
1afd39129e51531a76b4251933130746e9feabc8 | 2,302 | class LoghouseQueryP < Parslet::Parser
include ParsletExtensions
QUERY_OPERATORS = %w[and or]
EXPRESSION_ALL_OPERATORS = %w[!= =]
EXPRESSION_NUMBER_OPERATORS = %w[>= <= > < ]
EXPRESSION_STRING_OPERATORS = %w[=~ !~]
ANY_RESERVED_KEY = "*"
LABEL_RESERVED_KEY = "~"
rule... | 23.489796 | 101 | 0.589053 |
62df9534b51d3a1f2b66f158208d4c6ec3598b72 | 251 | require 'rufus-lua'
module Testlance
module Script
module LuaHelper
LUA_SCRIPTS_PATH = "#{__dir__}/lua".freeze
def read_lua_script(file)
[File.read("#{LUA_SCRIPTS_PATH}/#{file}.lua"), "\n"].join
end
end
end
end
| 17.928571 | 65 | 0.633466 |
39e539a4111be591fc55736c8f44b6ee94a42580 | 227 | module SpreeWinbankPayment
VERSION = '0.0.1'.freeze
module_function
# Returns the version of the currently loaded SpreeWinbankPayment as a
# <tt>Gem::Version</tt>.
def version
Gem::Version.new VERSION
end
end
| 18.916667 | 72 | 0.726872 |
e2593b8e33c40c29cdf966291540688f7b4cb102 | 823 | require "google/api_client"
class GoogleService
def initialize
name = Rails.application.class.to_s
version = "1"
issuer = Rails.application.secrets.ga_client_email
key_path = Rails.root.join("config", "google_service_key.p12").to_s
passphrase = Rails.application.secrets.ga_passphrase
scope = ... | 32.92 | 76 | 0.716889 |
e86f51e104ba2705a76f61ad7c73e9822d508dbe | 737 | require 'ebay_trading/types/address'
module EbayTrading # :nodoc:
module Responses # :nodoc:
# == Attributes
# text_node :user_id, 'UserID', :optional => true
# object_node :contact_address, 'ContactAddress', :class => Address, :optional => true
# datetime_node :registration_date, 'RegistrationDat... | 35.095238 | 91 | 0.704206 |
2644050e3689571be8d245a097c05412ef268bac | 1,654 | # frozen_string_literal: true
class CollectionItemsController < ApplicationV6Controller
before_action :authenticate_user!, only: %i[edit update destroy]
def edit
set_page_category PageCategory::EDIT_COLLECTION_ITEM
@profile = current_user.profile
@collection_item = current_user.collection_items.only_... | 32.431373 | 96 | 0.772068 |
387503bee540d1f651d2dcfcf95c4f5c04e1fae4 | 4,223 | # frozen_string_literal: true
module Clusters
module Applications
class Knative < ApplicationRecord
VERSION = '0.9.0'
REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'
METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'
FETCH_IP_ADDRESS_D... | 30.381295 | 152 | 0.674639 |
61db788607e6146cbbc789e6ea6181496a1b1f7d | 529 | require 'java'
require 'jruby'
require 'test/unit'
class TestASTInspector < Test::Unit::TestCase
import org.jruby.compiler.ASTInspector
def test_multi_when_optimizes_correctly
# JRUBY-3479: ASTInspector was not walking else node correctly in multi-when cases
code = "case 1; when 2, 3; else; begin; 1; resc... | 27.842105 | 86 | 0.746692 |
1cdafc0715aced9608e3bc620439c07d150580e8 | 962 | rule 'DEPJUL160', 'Existing default recipe, but should be empty' do
tags %w{implementation best_practice}
cookbook do |path|
#avoid printing of parser errors
def capture_stderr(&block)
original_stderr = $stderr
$stderr = fake = StringIO.new
begin
ret = yield
ensure
$s... | 23.463415 | 91 | 0.577963 |
3945445ea9d1c7e759f8903cbc7e05f7a9a255c8 | 71 | module SemiStatic::ContactConcern
extend ActiveSupport::Concern
end
| 14.2 | 33 | 0.830986 |
33c73d6e68c8ec498bcb65af3c76de1a765e70d7 | 247 | module Spree
module ProductsControllerDecorator
def self.prepended(base)
base.include(SpreeMultiDomain::ShowProductSupport)
end
Spree::ProductsController.prepend(self) if SpreeMultiDomain::Engine.frontend_available?
end
end
| 24.7 | 91 | 0.785425 |
d5b266714fd95c2039ecb6d989f650441f8e2b0a | 323 | module HealthSeven::V2_5
class Erq < ::HealthSeven::Segment
# Query Tag
attribute :query_tag, St, position: "ERQ.1"
# Event Identifier
attribute :event_identifier, Ce, position: "ERQ.2", require: true
# Input Parameter List
attribute :input_parameter_lists, Array[Qip], position: "ERQ.3", multiple: true
end
... | 32.3 | 81 | 0.736842 |
ed0ea98df3cc00e55f72547c482061ebc1c54adf | 791 | class << FixtureDependencies
private
def add_associated_object_S(reflection, attr, object, assoc)
object.send("add_#{attr.to_s.singularize}", assoc) unless object.send(attr).include?(assoc)
end
def model_find_S(model, pk)
model[pk] || raise(Sequel::Error)
end
def model_find_by_pk_S(model, p... | 19.292683 | 95 | 0.710493 |
b9d7c5e80ff9318e702c5c827402cfe8f54adb7e | 560 | module MultiTenantController
def subdomain_by_multi_tenant_model(tenant = :account)
self.class_eval do
cattr_accessor :tenant, :tenant_class
attr_accessor :current_subdomain
end
self.tenant_class = tenant.to_s.capitalize.constantize
self.class_eval do
before_filter :find_account_fr... | 26.666667 | 81 | 0.739286 |
280e59c89ad7047c24603f9befa920e8312fd52f | 4,513 | Rakfisk Норвегии: это в мире smelliest рыбы?
Норвегии пять миллионов человек насладиться одним из самых высоких стандартов жизни, не только в Европе, Но и в мире.
Секрет успеха страны может быть связан с местными аппетит на некоторые чрезвы пахнущими рыбы?
Возьмите выбор Over-ripe сыров.
поместить их в разгар кучу гряз... | 90.26 | 237 | 0.80678 |
ab639d09bc0c3789f1ca0dbe37584110a50dc4e3 | 481 | require 'sinatra/base'
class BasicAuth < Sinatra::Base
use Rack::Auth::Basic do |username, password|
[username, password] == ['foo', 'bar']
end
get '/' do
status 200
end
end
class UnchallengedBasicAuth < Sinatra::Base
get '/' do
case env['HTTP_AUTHORIZATION']
when 'Basic ' + %w[foo:bar].pa... | 16.033333 | 64 | 0.659044 |
e201dae2fd1957030309398d7c568d736b08bed4 | 2,021 | require File.dirname(__FILE__) + '/test_helper'
Test::Unit::TestCase.output_fixture_base = File.dirname(__FILE__)
class KernelGeneratorTest < Test::Unit::TestCase
def test_record
script = Eschaton.javascript_generator
script << "// This is before recording"
record = script.record_for_test do
... | 34.254237 | 67 | 0.506185 |
bb95043331528f14be126db65287e07720f4e893 | 5,438 | # frozen_string_literal: true
module Luminati
class Client
module Zone
# Returns the bandwidth stats for a given zone
# @see https://luminati.io/doc/api#stats_api_bw_zone
# @param zone_name [String]
# @param from [String] This should be in the format `2018-07-01T00:00:00`.
# @param ... | 38.567376 | 141 | 0.627253 |
1a77d1408cec209bc49bb34dbb69e83b5354908f | 543 | # frozen_string_literal: true
module ElasticAPM
module Normalizers
module ActionMailer
# @api private
class ProcessActionNormalizer < Normalizer
register 'process.action_mailer'
TYPE = 'app'
SUBTYPE = 'mailer'
ACTION = 'action'
def normalize(_transaction, _na... | 20.111111 | 57 | 0.596685 |
794bc69c4f6bdd8f1bfdf735625a393b6e1781f5 | 447 | class UsersController < ApplicationController
before_action :set_user, only: :show
respond_to :json
def index
@users = User.all
respond_with @users
end
def show
respond_with @user
end
#def create
#@user = User.new(user_params)
#@user.save
#respond_with @user
#end
private... | 15.413793 | 45 | 0.653244 |
386dd034c42aa798dd73d5b023f40ad87343e68b | 929 | require 'lib/handlers/simple/base_index'
"dic = {
'index' => {
subindex_1 => [20,50,300,...],
...
subindex_n => [...]
}
...
}"
def add_to_dic dic, index, subindex, val
if dic[index] and dic[index][subindex]
dic[index][subindex] |= [val]
else
if not dic[index]... | 16.017241 | 44 | 0.466093 |
bf758605a5a8c70244a6bece3f9f0effd2e67388 | 5,716 | require 'pathname'
Puppet::Type.newtype(:dsc_xexchpopsettings) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xExchPopSettings resource type.
Automatically generated f... | 30.084211 | 149 | 0.672148 |
7a127cbd7410af1d13a27a99afa5907d1fa18266 | 2,123 | module M2mhub::LighthouseWatcher
def lighthouse_watcher_create(title, body, assigned_user_id=nil, milestone_id=nil)
log "Creating ticket with project_id = #{self.lighthouse_project_id}, title=#{title}, assigned_user_id=#{assigned_user_id}, and body=#{body}"
self.lighthouse_ticket = Lighthouse::Ticket.new(:pro... | 44.229167 | 145 | 0.738106 |
ab5ffad3c143db7597258a59ce5d6d8abd633a1f | 14,349 | module V1
class Reports < ::BaseAPI
helpers ::ReportsHelpers
version 'v1', using: :path
namespace 'admin' do
desc 'top ten products'
params do
optional :limit, :type => Integer, :default => 25
optional :page, :type => Integer, :default => 1
end
get 'reports/top_te... | 34.65942 | 133 | 0.513973 |
217289446be94f99bcc28614e8d7b2c7a60028e6 | 4,038 | class ProviderOriginAssignment < ActiveRecord::Base
include StateMachine
resourcify
belongs_to :provider
validates :provider, presence: true
validates :provider_id, readonly: true, on: :update
validate :provider_must_be_unique_in_effective_date_range
belongs_to :origin, inverse_of: :provider_origin_ass... | 30.590909 | 141 | 0.74418 |
61b10533213ef6e5045dde4da7046cca53eab34b | 124 | class EventCode
include Virtus.value_object
values do
attribute :id, Integer
attribute :text, String
end
end
| 13.777778 | 29 | 0.725806 |
4a1ed125e71d2c48339dafc69339c375a6b90cb1 | 619 | cask 'cyberduck' do
version '6.2.4.26305'
sha256 '599045f48970d7f2f901157c7386067fe1d6b76025f63523a4664152aec6168d'
url "https://update.cyberduck.io/Cyberduck-#{version}.zip"
appcast 'https://version.cyberduck.io/changelog.rss',
checkpoint: 'f86f616aee2f7f7ac87f1c5c5534e4e430952663fe6de98d221f813e775... | 32.578947 | 88 | 0.684976 |
2105728d097e1547d82fc54fe8aee8ba81a04cca | 6,776 | =begin
#Topological Inventory
#Topological Inventory
The version of the OpenAPI document: 2.0.0
Contact: support@redhat.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.2.1
=end
require 'date'
module TopologicalInventoryApiClient
class CollectionLinks
attr_accessor :first
at... | 28.957265 | 224 | 0.612013 |
623a051bfa9123693ef85a808bcf762f57b11078 | 635 | # frozen_string_literal: true
require File.expand_path '../test_helper.rb', __dir__
class QuestionTest < MiniTest::Unit::TestCase
MiniTest::Unit::TestCase
def test_question_may_has_many_choices
# Arrange
question = Question.create(name: 'Question One', description: 'First Question', number: '001')
# ... | 31.75 | 98 | 0.727559 |
61f88e31060246c68d588b1e1bf97d5d1708f620 | 1,865 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 41.444444 | 90 | 0.730295 |
91521677d9234a3b6b788aa853718444e91c5f1f | 1,930 | # config valid for current version and patch releases of Capistrano
lock "~> 3.16.0"
set :application, "my_rail_app"
set :repo_url, "git@github.com:gautam-vinove/capistrano.git"
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
# ... | 34.464286 | 106 | 0.735751 |
ffcea529d28159759167aedcbd51aad771d49216 | 80 | require 'rails_helper'
RSpec.describe "Admin::Uploads", type: :request do
end
| 13.333333 | 50 | 0.75 |
1a828312976469f465bf6d83b090235250fee0bf | 5,660 | # Copyright 2013 SAP AG.
#
# 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,
# softw... | 31.270718 | 84 | 0.519258 |
03ae1997b48750793947276422bbfb7934662818 | 112 | class EnableCitextExtension < ActiveRecord::Migration[5.0]
def change
enable_extension 'citext'
end
end
| 18.666667 | 58 | 0.767857 |
b994fffa59b0300e667bbc080380f13b009fd517 | 202 | require "spec_helper"
describe Platformer do
it "has a version number" do
expect(Platformer::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 16.833333 | 45 | 0.712871 |
f7b67210b0bf73532ea888f49c573ba68d9832e4 | 2,060 | partition "setup" do
raw <<-RAW
####################
# policy #
####################
iptables --policy INPUT DROP
iptables --policy OUTPUT DROP
iptables --policy FORWARD DROP
iptables --table mangle --policy PREROUTING ACCEPT
iptables --table mangle --policy OUTPUT ACCEPT
####################
# before... | 40.392157 | 115 | 0.689806 |
383d6485339e6c8edaa68e9df4b82daa7c380d3c | 321 | require 'rails/railtie'
module PartialParameters
class Railtie < ::Rails::Railtie
initializer 'partial_parameters.action_view' do
ActiveSupport.on_load :action_view do
require 'partial_parameters/action_view/helpers'
include PartialParameters::ActionView::Helpers
end
end
end
end... | 24.692308 | 56 | 0.738318 |
91109660d5140ce116fbb530def4f2c5644b2d9f | 502 | module AmokTime
module SidekiqMiddleware
# Get the mocked time and store it in the message
# to be sent to Sidekiq.
class Client
def call(worker_class, msg, queue, redis_pool)
msg['amok_time'] ||= Thread.current[:amok_time]
yield
end
end
# Pull the mocked time out and ... | 23.904762 | 68 | 0.631474 |
bb9bb7a2979b1a814aca8402901b83820dc0656f | 24,681 | TOP_LEVEL_VALUE_CONST = 7
class TestClass
M = :m
N = :n
class Nested
class NestedEvenMore
end
end
end
class TestClassThatDefinesSend
C = :c
def self.send
end
end
class TestSubClass < TestClass
P = :p
end
module RSpec
module Mocks
RSpec.describe "Constant Mutating" do
include RS... | 42.189744 | 124 | 0.613022 |
5d5eb3a1b49003196e8e1c3d78bb9f8d022c9dea | 1,066 | # frozen_string_literal: true
module Spree
class PromotionChooser
def initialize(adjustments)
@adjustments = adjustments
end
# Picks the best promotion from this set of adjustments, all others are
# marked as ineligible.
#
# @return [BigDecimal] The amount of the best adjustment
de... | 29.611111 | 120 | 0.690432 |
618074aa4fa413d847e8e91a37343d1b65848dd2 | 1,655 | require 'test_helper'
class MoneybookersHelperTest < Test::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def setup
@helper = Moneybookers::Helper.new('order-500','cody@example.com', :amount => 500, :currency => 'USD')
end
def test_basic_helper_fields
assert_field 'pay_to_email', 'co... | 30.090909 | 106 | 0.636254 |
33110b7aab5ab138e03397f10f57f6a5f6345a18 | 366 | # coding: UTF-8
module MarkdownUI
module Message
class ListMessage < MarkdownUI::Shared::TagKlass
def initialize(_content, _klass = nil)
@_klass = _klass
@content = _content
end
def render
@klass = "ui #{@_klass} message"
MarkdownUI::StandardTag.new(content, k... | 19.263158 | 63 | 0.620219 |
872858d51b3065a18f41579c7e1cf60111f2bd29 | 1,300 | module Jacoat
class Document
class ResourceIdentifier
attr_accessor :id, :type, :relationships
def self.from_jsonapi(body)
if body.is_a?(Array)
resources = []
body.each do |item|
resources << ResourceIdentifier.new(item[:id], item[:type]).process_jsonapi(item)
... | 24.528302 | 93 | 0.565385 |
ab101b2583f6ab5c2627265c6ce2237646679246 | 493 | # frozen_string_literal: true
# == Schema Information
#
# Table name: articles_courses
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# article_id :integer
# course_id :integer
# view_count :integer default(0)
# character_sum :inte... | 23.47619 | 56 | 0.643002 |
117057705559cf70a4891279a7bc18f45f43703c | 1,558 | require 'minitest_helper'
class TestPartialApplication < Logica::Test
def test_with_zero_arguments
partial_application = have_same_prefix_of_length_one.partially_applied_with
assert_equal(2, partial_application.arity)
assert(!partial_application.satisfied_by?('Can', 'you'))
end
def test_with_one_a... | 31.795918 | 94 | 0.793325 |
abc7ee7e9d721b85a402be82439617e33f02244f | 9,478 | require "cases/helper"
require 'models/developer'
require 'models/project'
require 'models/company'
class HasOneAssociationsTest < ActiveRecord::TestCase
fixtures :accounts, :companies, :developers, :projects, :developers_projects
def setup
Account.destroyed_account_ids.clear
end
def test_has_one
ass... | 29.253086 | 109 | 0.722621 |
bbd83c0391556d87b5b464f02161b377f57fae7f | 2,973 | # These are methods that are used at both the view helper and controller layers
# They are only dependent on `blacklight_config` and `@response`
#
module Blacklight
module Facet
def facets_from_request(fields = facet_field_names)
fields.map { |solr_field| facet_by_field_name(solr_field) }.compact
end
... | 37.1625 | 156 | 0.69593 |
bf1df9b5b90847926a1d188ad53f2c824b1a0aec | 1,133 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'centrifuge/version'
Gem::Specification.new do |spec|
spec.name = 'centrifuge'
spec.version = Centrifuge::VERSION
spec.authors = ['Oleg Bovykin']
spec.email = ... | 37.766667 | 77 | 0.686673 |
33b2542e5cf8d6c82db3ac01dd010561dce55486 | 245 | # Common RateSource errors
# Raised when a RateSource encounters an error fetching rates
class Money
module Bank
module DatabaseBank
module RateSource
class FetchError < StandardError ; end
end
end
end
end
| 16.333333 | 61 | 0.693878 |
e832ff02024208b17f39872b80dbd7b6a19e7465 | 986 | class Help2man < Formula
desc "Automatically generate simple man pages"
homepage "https://www.gnu.org/software/help2man/"
url "https://ftp.gnu.org/gnu/help2man/help2man-1.47.13.tar.xz"
mirror "https://ftpmirror.gnu.org/help2man/help2man-1.47.13.tar.xz"
sha256 "b7f8bbad1f2c405db747e3f5a4d5e1eddc63b360221c824bf... | 35.214286 | 93 | 0.760649 |
211d3099cbe5ef27d20dd8c472156b02bd0673c0 | 12,064 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 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 ... | 31.831135 | 96 | 0.620441 |
1a9548fc4ca49aa369ef0d879262481df462dd60 | 2,150 | require 'thor'
require 'active_resource'
require 'active_support/core_ext/object/with_options'
require 'redmine-cli/config'
require 'pp'
module Redmine
module Cli
class BaseResource < ActiveResource::Base
begin
self.site = Redmine::Cli::config.url
self.user = Redmine::Cli::config.username
... | 29.861111 | 117 | 0.607442 |
1d5fb95eae23fd58052f989e8cedab729e74d25f | 11,071 | Pod::Spec.new do |spec|
spec.name = "TTSDK"
spec.version = "1.20.2.1-standard"
spec.summary = "A comprehensive multimedia SDK."
spec.description = <<-DESC
A comprehensive multimedia SDK which provides live streaming, VOD and the other related abilities.
DE... | 32.851632 | 147 | 0.617017 |
08bd55e304e8397bf35ea0df05d5577b1df3a93a | 129 | class AddSurveyGreetingToEvents < ActiveRecord::Migration
def change
add_column :events, :survey_greeting, :text
end
end
| 21.5 | 57 | 0.782946 |
38c87d85803a6a3bdb7ef6ffc0be9dcee3134670 | 3,000 | module UnconfirmedUserConcern
include ActionView::Helpers::DateHelper
def find_user_with_confirmation_token
@confirmation_token = params[:confirmation_token]
@email_address = EmailConfirmationTokenValidator.email_address_from_token(@confirmation_token)
@user = @email_address&.user
end
def confirm_... | 34.090909 | 98 | 0.769 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.