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 |
|---|---|---|---|---|---|
bb247574a4dcdb32c6873be12a33289f2ace48e1 | 441 | require 'spec_helper'
describe Quota do
it_behaves_like 'a resource'
let(:json) do
{
:uuid => '11111111-2222-3333-4444-555555555555',
:internal_id => 1,
:quota_limit => 2,
:request_type => 'request type',
:project_internal_id => 3,
:pro... | 24.5 | 69 | 0.548753 |
1c311fea0fb654c13e8d3a052bff94fe621a9fb4 | 1,471 | # Copyright (C) 2014-2019 MongoDB, 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 ... | 23.725806 | 74 | 0.603671 |
79853079a798c1532a1004860500ab981cc66d80 | 794 | # frozen_string_literal: true
module Types
module Vulnerability
class ExternalIssueLinkType < BaseObject
graphql_name 'VulnerabilityExternalIssueLink'
description 'Represents an external issue link of a vulnerability'
authorize :read_security_resource
field :id, GlobalIDType[::Vulnerabi... | 34.521739 | 87 | 0.717884 |
610430dfaecec4ddf86cc35e9cc64530447f41d7 | 670 | class DocsController < ApplicationController
before_action :find_doc, only: [:show, :edit, :update, :destroy]
def index
@docs = Doc.where(user_id: current_user)
end
def show
end
def new
@doc = current_user.docs.build
end
def create
@doc = current_user.docs.build(doc_params)
if @doc.save
redirec... | 12.884615 | 65 | 0.69403 |
e92b4f608a96c2e55ce1b940d24696ffc95d9401 | 188 | require 'test_helper'
class DashboardControllerTest < ActionDispatch::IntegrationTest
test "should get welcome" do
get dashboard_welcome_url
assert_response :success
end
end
| 18.8 | 63 | 0.792553 |
9187ff6cc4667ce1374cd2a63fbbc4dd51975e2c | 421 | class Show < ActiveRecord::Base
has_and_belongs_to_many :fans
has_many :memories
belongs_to :year
def date_slug
self[:date].split(" ")[1].split("/").join("-")
end
def self.find_by_slug(slug)
self.all.find {|f| f.date_slug == slug}
end
def self.in_year_of(year)
... | 22.157895 | 87 | 0.584323 |
5d85f1e5c21f21d963f468d04754ac8a907c5ca3 | 1,851 | require 'spec_helper'
describe 'cinder::api' do
let :req_params do
{:keystone_password => 'foo'}
end
let :facts do
{:osfamily => 'Debian'}
end
describe 'with only required params' do
let :params do
req_params
end
it 'should configure cinder api correctly' do
should contain_c... | 28.921875 | 85 | 0.643436 |
7af0f51376ac894d1d4ae4301f4ae583b9868b74 | 2,119 | # frozen_string_literal: true
module ActiveInteractor
module Context
# Find or create {Base context} classes for a given {ActiveInteractor::Base interactor}
#
# @api private
# @author Aaron Allen <hello@aaronmallen>
# @since 1.0.0
module Loader
# ActiveInteractor base classes
# @r... | 41.54902 | 118 | 0.693723 |
1c0bc50a9500cf3b1bc42e1b87cf4d23ab5f8a20 | 597 |
Pod::Spec.new do |s|
s.name = 'RxFSPagerView'
s.version = '0.2.1'
s.summary = 'A short description of RxFSPagerView.'
s.homepage = 'https://github.com/behrad-kzm/RxFSPagerView/'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Pircate... | 39.8 | 108 | 0.574539 |
7a5196eccbb68218f9b2cbddc65fe0ec4bba8471 | 796 | # frozen_string_literal: true
class CreateSpreeWalletPaymentSources < ActiveRecord::Migration[4.2]
def change
return if table_exists?(:spree_wallet_payment_sources)
create_table :spree_wallet_payment_sources do |t|
t.references(
:user,
foreign_key: { to_table: Spree.user_class... | 28.428571 | 69 | 0.668342 |
f871ec174954e913bfe408c755f9f0a5ba9eb2e7 | 666 | require_relative 'boot'
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 ActioncableTest
class Application < Rails::Application
# Initialize configuration defaults for originally generated... | 33.3 | 82 | 0.767267 |
f75961f24df2c73d56e05c466f6d4964272b4012 | 328 | module MoneyS3
module Parsers
class SeznamFirem
include ParserCore::BaseParser
def firma
array_of_at(Firma, ['Firma'])
end
def to_h
hash = {}
hash[:attributes] = attributes
hash[:firma] = firma.map(&:to_h) if has? 'Firma'
hash
end
end
... | 16.4 | 56 | 0.557927 |
b9f64d060d6e87610042a6592b5cc01b663305a8 | 1,538 | Pod::Spec.new do |s|
s.name = "ReactiveObjCBridge"
s.version = "6.0.0"
s.summary = "Bridge between ReactiveObjC and ReactiveSwift"
s.description = <<-DESC
After the announcement of Swift, ReactiveCocoa was rewritten in Swift. This framework creates a bridge between those Sw... | 48.0625 | 234 | 0.680104 |
f7dea616bb3600b6ebf5c35b6eb52f4728807eb0 | 188 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'simplecov'
SimpleCov.start 'test_frameworks'
require 'adam6050'
require 'minitest/autorun'
| 18.8 | 54 | 0.787234 |
f7c0a23e504731828b251bce37068e889c1d1298 | 34,009 | # 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, ... | 37.537528 | 251 | 0.650798 |
9137b64452282845ba42f574763bd1b58e4b1c08 | 8,381 | require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
Sequel.extension :pg_array, :pg_array_ops, :pg_json, :pg_json_ops
describe "Sequel::Postgres::JSONOp" do
before do
@db = Sequel.connect('mock://postgres', :quote_identifiers=>false)
@j = Sequel.pg_json_op(:j)
@jb = Sequel.pg_json... | 36.920705 | 88 | 0.611025 |
1c4a96d5717f21a6dd4706951f714ef43e390225 | 4,814 | # frozen_string_literal: true
# This file was generated by the `rails generate rspec:install` 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
# this file to always be loaded, with... | 48.626263 | 92 | 0.739094 |
1a23706fbfd4b2dc39317678c8afcd55318b59eb | 1,345 | require 'ostruct'
require_relative '../lib/ruby_hid.rb'
class Cursor < OpenStruct
def draw
puts `clear`
out = "+#{'-'*max_x}+\n"
max_y.times do |row|
out << '|'
max_x.times do |column|
if y.to_i == row and x.to_i == column
out << '#'
else
out << ' '
... | 20.692308 | 66 | 0.561338 |
794224b06226caf130e847694ac1742ca2327f40 | 1,053 | json.cache! ['item', p] do
json.(p, :id, :application_id, :parent_id, :sku, :name, :full_name, :permalink, :full_permalink, :description, :short_description, :active, :weight, :price, :cost_price, :tax_rate_id, :created_at, :updated_at, :featured, :in_the_box, :stock_control, :default, :default_image, :final_price)
j... | 47.863636 | 290 | 0.74264 |
7a31536263364be4c9bd6aff75ffa14f1a5accf7 | 2,411 | class Broot < Formula
desc "New way to see and navigate directory trees"
homepage "https://dystroy.org/broot/"
url "https://github.com/Canop/broot/archive/v1.6.1.tar.gz"
sha256 "5f97d876aa554be4c67bfd161ef762425f6083da583775c13cc75bf9882f1085"
license "MIT"
head "https://github.com/Canop/broot.git"
bottl... | 40.183333 | 139 | 0.720033 |
01931c59d99bfe640a5710f287acfefc544c0bc8 | 165 | class AddStackToClaim < ActiveRecord::Migration[4.2]
def change
change_table(:claims) do |t|
t.string :stack, array: true, default: []
end
end
end
| 20.625 | 52 | 0.666667 |
18f7c3c9b17809dfee941e5ea3076193e923c6dd | 6,565 | # frozen_string_literal: true
module Alchemy
# This helpers are useful to render elements from pages.
#
# The most important helper for frontend developers is the {#render_elements} helper.
#
module ElementsHelper
include Alchemy::UrlHelper
include Alchemy::ElementsBlockHelper
# Renders elements... | 31.5625 | 111 | 0.624676 |
6ac4978c6c19e8386a09b337aac2b9df2bcc71d0 | 1,282 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::LtcTransactionAddressKMSFr... | 27.276596 | 102 | 0.75195 |
7a601edd33c57907e8e7bbb043b5d206fdbaefc4 | 1,153 | cask 'v2rayx' do
# note: "2" is not a version number, but an intrinsic part of the product name
version '0.7.8'
sha256 'b7be7a26626bf65c7f5ce2801b52a56f7cd3cbb63c1b9db83cc5bf50cb2dd09c'
url "https://github.com/Cenmrev/V2RayX/releases/download/v#{version}/V2RayX.dmg"
appcast 'https://github.com/Cenmrev/V2RayX... | 36.03125 | 90 | 0.622723 |
61b2d6f6c545bb2f404b0a97991217acad6052dc | 686 | require 'rails/generators/active_record/model/model_generator'
module MobileWorkflow
module Generators
class ModelGenerator < ActiveRecord::Generators::ModelGenerator
source_root File.join(File.dirname(ActiveRecord::Generators::ModelGenerator.instance_method(:create_migration_file).source_location.first),... | 29.826087 | 158 | 0.734694 |
4a6a55e395958bfef866570355afad9612fa582f | 1,572 | require 'spec_helper'
describe Immutable::SortedSet do
describe '#take' do
[
[[], 10, []],
[['A'], 10, ['A']],
[%w[A B C], 0, []],
[%w[A B C], 2, %w[A B]],
].each do |values, number, expected|
context "#{number} from #{values.inspect}" do
let(:sorted_set) { SS[*values] }... | 28.581818 | 66 | 0.568702 |
796f4c0171ff20b1645e9394d3098ac5455f7439 | 5,197 | module ActiveRecordSurvey
class Answer
module Chained
module ClassMethods
def self.extended(base)
end
end
module InstanceMethods
# Gets index relative to other chained answers
def sibling_index
if node_map = self.survey.node_maps.select { |i|
i.node == self
}.first
re... | 32.279503 | 149 | 0.653646 |
edccda38bd400b2ce3d93f1e3de5c6af790dc828 | 1,581 | require 'test_helper'
##
# User Login test
class UserLoginTest < ActionDispatch::IntegrationTest
fixtures :users
test 'login and view default group' do
get '/login'
assert_response :success
post_via_redirect(
'/login',
user: { email: users(:jim).email, password: 'testing123' }
)
a... | 23.954545 | 68 | 0.656546 |
f7cab09bdd2cdae202928ae87cfc3069fba638a2 | 2,769 |
#
# spec'ing slipdf.js
#
# Tue Nov 21 17:26:37 JST 2017
#
require 'pp'
require 'yaml'
require 'io/console'
#require 'execjs'
require 'ferrum'
module Helpers
#def run(s)
# $driver ||=
# begin
# d = Selenium::WebDriver.for :phantomjs
# #d = Selenium::WebDriver.for :chrome
# d.navigate.... | 21.465116 | 73 | 0.464789 |
f8391a88cde38f2210f5ef289afbb7d33281845f | 4,393 | #
# Author:: Derek Groh (<derekgroh@github.io>)
# Copyright:: 2018, Derek Groh
#
# 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 re... | 42.240385 | 210 | 0.665377 |
ed088fd046400625aa9a45318b18cf437df08f77 | 11,816 | require_relative '../template'
require_relative '../scripts'
class Formatron
module CloudFormation
module Resources
# Generates CloudFormation template EC2 resources
# rubocop:disable Metrics/ModuleLength
module EC2
BLOCK_DEVICE_MAPPINGS = :BlockDeviceMappings
def self.vpc(cidr... | 31.259259 | 127 | 0.491029 |
e90602a88e02ab106a13382df366f58ab69216e2 | 1,401 | # frozen_string_literal: true
require_relative 'boot'
require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
# require "active_job/railtie"
require 'active_record/railtie'
# require "active_storage/engine"
require 'action_controller/railtie'
# require "action_mailer/railtie"
# require "action_... | 32.581395 | 79 | 0.756602 |
bb29d0f7719c3d7ec5dc0b39e94f08f87cba9ee6 | 2,832 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ApiManagement::Mgmt::V2018_01_01
module Models
#
# Paged OpenIdProviders list representation.
#
class OpenIdConnectProviderCollection
i... | 28.897959 | 82 | 0.541667 |
ff60aadd88dbbb3349d0798d059f36244a9593d3 | 5,133 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
def custom_domains_list_by_endpoint(*args)
header_params = {}
argstring = args[0].delete('\\')
arg_hash = JSON.parse(argstring)
# Remove task name from arguments - should contain all necessary parameters for URI
arg_hash.delete('_task')
op... | 32.694268 | 221 | 0.66803 |
03a737d66a4236ba72d0a45ea3664ea3668cf290 | 953 | class EMem < Formula
# cite Khiste_2015: "https://doi.org/10.1093/bioinformatics/btu687"
desc "Efficiently compute MEMs between large genomes"
homepage "https://www.csd.uwo.ca/~ilie/E-MEM/"
url "https://github.com/lucian-ilie/E-MEM/archive/v1.0.1.tar.gz"
sha256 "70a5a1e8b4e190d117b8629fff3493a4762708c8c0fe9ea... | 29.78125 | 121 | 0.741868 |
bf8c30b0b1fc35c1e61451b1d981292d700e3b62 | 145 | class AddKindToSettings < ActiveRecord::Migration[5.2]
def change
add_column :settings, :kind, :integer, default: 0, null: false
end
end
| 24.166667 | 66 | 0.731034 |
ff2837d80b33bbef999d4e6121aaae9d745800a0 | 684 | require 'faraday_middleware'
Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}
module LendingClub
# @private
module Connection
private
def connection
options = {
:headers => {
'Accept' => "application/#{format}; charset=utf-8",
'User-Agent' => use... | 22.8 | 73 | 0.615497 |
f8ab97f4de7b42284e9843f9c1f257302632b3a7 | 3,064 | class QwtQt4 < Formula
desc "Qt Widgets for Technical Applications (qt4 version)"
homepage "http://qwt.sourceforge.net/"
url "https://downloads.sourceforge.net/project/qwt/qwt/6.1.3/qwt-6.1.3.tar.bz2"
sha256 "f3ecd34e72a9a2b08422fb6c8e909ca76f4ce5fa77acad7a2883b701f4309733"
revision 1
option "with-qwtmathm... | 31.265306 | 117 | 0.629569 |
380430a13415fad5b69a2423f4bd13bdad471232 | 279 | class Specinfra::Helper::DetectOs::Esxi < Specinfra::Helper::DetectOs
def detect
if run_command('vmware -v').success?
line = run_command('vmware -v').stdout
if line =~ /VMware ESXi (.*)/
{ :family => 'esxi', :release => $1 }
end
end
end
end
| 25.363636 | 69 | 0.591398 |
1aa7c626047c64ac53ff67ffa3511175dca8b9d5 | 206 | PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
require 'middleman-core'
require 'middleman-core/step_definitions'
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-github_api')
| 41.2 | 70 | 0.815534 |
080259579b1ea6a2ed0eee564e7205a4873679cb | 1,368 | class SimpleObfs < Formula
desc "Simple obfusacting plugin of shadowsocks-libev"
homepage "https://github.com/shadowsocks/simple-obfs"
url "https://github.com/shadowsocks/simple-obfs.git",
:tag => "v0.0.5",
:revision => "a9c43588e4cb038e6ac02f050e4cab81f8228dff"
revision 1
bottle do
cell... | 35.076923 | 93 | 0.70614 |
081d1be93190520116064c02e4a870856b0a81f4 | 4,235 | #
# Cookbook Name:: yum
# Provider:: repository
#
# Copyright 2010, Tippr Inc.
# Copyright 2011, Opscode, 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/l... | 33.88 | 159 | 0.670366 |
ab146fc862ad642dc601525e6f5896527b589a90 | 289 | class TeammateReviewQuestionnaire < Questionnaire
after_initialize :post_initialization
def post_initialization
self.display_type = 'Teammate Review'
end
def symbol
"teammate".to_sym
end
def get_assessments_for(participant)
participant.teammate_reviews
end
end
| 19.266667 | 49 | 0.785467 |
3818746a9b7837545a0187e8b14552a963162a54 | 5,303 | require 'spec_helper'
describe GroupsSerializer do
let(:raceteam) { threadable.organizations.find_by_slug!('raceteam') }
let(:electronics) { raceteam.groups.find_by_email_address_tag!('electronics') }
let(:fundraising) { raceteam.groups.find_by_email_address_tag!('fundraising') }
before{ sign_in_as 'alice@uc... | 39.87218 | 81 | 0.583066 |
4a13997e412831019fc175b4d89275201a0dbc8c | 3,640 | # frozen_string_literal: true
class ProductForCart
include TextHelpers::Translation
attr_accessor :error_message
attr_accessor :error_path
def initialize(product)
@product = product
end
def purchasable_by?(acting_user, session_user)
raise NUCore::PermissionDenied unless product.is_accessible_to... | 31.111111 | 126 | 0.744231 |
08681c0341a70e9c0175092ec34f8aabe335972a | 5,385 | # frozen_string_literal: true
require('spec_helper')
describe ProfilesController, :request_store do
let(:user) { create(:user) }
describe 'POST update' do
it 'does not update password' do
sign_in(user)
expect do
post :update,
params: { user: { password: 'hello12345', passwor... | 29.916667 | 141 | 0.653296 |
6a55b6c3fc8bc3bb92cc31da4c40fb1458af9388 | 290 | =begin
author : Jagepard <jagepard@yandex.ru>
license https://mit-license.org/ MIT
=end
class Iterator
def initialize(bucket)
@bucket = bucket
end
def iterate_items
@bucket.each { |item|
puts item.name + ' ' + item.price.to_s + ' ' + item.description
}
end
end
| 17.058824 | 69 | 0.651724 |
ab836934a5172d0885fff2552afd1a861a4e139b | 2,390 | class CfrDecompiler < Formula
desc "Yet Another Java Decompiler"
homepage "https://www.benf.org/other/cfr/"
url "https://github.com/leibnitz27/cfr.git",
:tag => "0.150",
:revision => "1361cd7fa74f25f30a6bbf72c825d83647d2cdaf"
head "https://github.com/leibnitz27/cfr.git"
bottle do
cellar ... | 31.447368 | 100 | 0.633473 |
7ac91c10c377cbb28874f13b7d54c4062d6a4f7f | 3,392 | require 'rails_helper'
describe Address do
subject { build(:address) }
it { is_expected.to be_valid }
it { is_expected.to belong_to(:location).optional.touch(true) }
it { is_expected.to validate_presence_of(:address_1).with_message("can't be blank for Address") }
it { is_expected.to validate_presence_of(:... | 32 | 100 | 0.685436 |
114ed456b7e11fdbf8c0344fff9ce0d7f7dd4361 | 378 | module Textris
module Delay
module Sidekiq
module Missing
def sidekiq_missing(*args)
raise(LoadError, "Sidekiq is required to delay sending messages")
end
alias_method :delay, :sidekiq_missing
alias_method :delay_for, :sidekiq_missing
alias_method :... | 23.625 | 75 | 0.650794 |
6219b9f85d061bf4d4ba88051ffaabb0049f9721 | 1,754 | require 'stringio'
module Aws
module Query
class ParamList
include Enumerable
# @api private
def initialize
@params = {}
end
# @param [String] param_name
# @param [String, nil] param_value
# @return [Param]
def set(param_name, param_value = nil)
... | 19.065217 | 74 | 0.526796 |
03d3f31bfd1ba0dc70abe648019f929ceda8913f | 23,025 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="jpeg_save_options_data.rb">
# Copyright (c) 2021 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | 39.291809 | 686 | 0.676395 |
26db0590f796410cd062ad2dfaeb6c1fdde9fbe2 | 93 | Sequel.migration do
change do
drop_table :service_instance_dashboard_clients
end
end
| 15.5 | 50 | 0.806452 |
872d79c29a474106fbb78ae0cb0699f0d32e9f31 | 4,289 | require 'spec_helper'
require 'actions/transactional_metadata_update'
module VCAP::CloudController
RSpec.describe TransactionalMetadataUpdate do
describe '#update' do
let(:new_metadata) {
{
metadata: {
labels: {
freaky: 'wednesday'
},
anno... | 33.771654 | 131 | 0.583819 |
1a78cbad161e35c302baa6de44064efcbf484f7d | 128 | class AddUserIdToDashboards < ActiveRecord::Migration[5.1]
def change
add_column :dashboards, :user_id, :string
end
end
| 21.333333 | 58 | 0.757813 |
1c0487e83ce8d38857291f588bdcdbf22a0b3e9c | 767 | require 'rails_helper'
RSpec.describe LessonsController, type: :routing do
describe 'routing' do
it 'routes to #index' do
expect(get: '/lessons').to route_to('lessons#index')
end
it 'routes to #show' do
expect(get: '/lessons/1').to route_to('lessons#show', id: '1')
end
it 'routes to... | 25.566667 | 74 | 0.621904 |
ffe98e7247f16a7d9bec0083e63eb69dd9a02790 | 751 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "jekyll-theme-clean-blog"
spec.version = "4.0.9"
spec.authors = ["Start Bootstrap"]
spec.email = ["feedback@startbootstrap.com"]
spec.summary = "A simple blog theme based on Bootstrap 4 by Start Boo... | 37.55 | 132 | 0.65779 |
e839af01d62f0d0f355b1b5a74feebff1397f536 | 304 | cask "font-righteous" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/main/ofl/righteous/Righteous-Regular.ttf",
verified: "github.com/google/fonts/"
name "Righteous"
homepage "https://fonts.google.com/specimen/Righteous"
font "Righteous-Regular.ttf"
end
| 25.333333 | 85 | 0.733553 |
1cb3606126c60fda08066dabcf8b157da3f0c158 | 72 | module ComicVine
# Current gem version number
VERSION = '0.1.4'
end
| 14.4 | 30 | 0.708333 |
280db75168b56a218ae379e3343a8a2deb32addc | 4,002 | # :include: ../rdoc/syslogoutputter
#
# Version:: $Id$
# Author:: Steve Lumos
# Author:: Leon Torres
require 'log4r/formatter/formatter'
require 'log4r/outputter/outputter'
require 'log4r/configurator'
require 'syslog'
module Log4r
SYSLOGNAMES = Hash.new
class SyslogOutputter < Outputter
include Syslog::Con... | 31.511811 | 88 | 0.595952 |
03805a97ffb940bcd47d8b428d4888e814876c36 | 2,223 | require 'uri'
require 'rkelly'
class ContentUrls
# +JavaScriptParser+ finds and rewrites URLs in JavaScript content.
#
# === Implementation note:
# This methods in this class identify URLs by locating strings which match +URI+'s regexp.
class JavaScriptParser
# Returns the URLs found in the JavaScript ... | 31.757143 | 98 | 0.618534 |
39588f85aece208fa0d719889e53e0c9f7617ba8 | 1,763 | class UserMailer < ApplicationMailer
default from: "Feedbin <#{ENV["FROM_ADDRESS"]}>", skip_premailer: true
add_template_helper(ApplicationHelper)
def payment_receipt(billing_event)
@billing_event = BillingEvent.find(billing_event)
@user = @billing_event.billable
mail to: @user.email, subject: "[Feed... | 32.054545 | 91 | 0.718094 |
385c6885a263d95ad2c3811979c04806de991107 | 1,373 | #! /your/favourite/path/to/ruby
# -*- coding: utf-8; mode: ruby; ruby-indent-level: 2 -*-
#
# Copyright (c) 2014 Urabe, Shyouhei
#
# 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 res... | 47.344828 | 79 | 0.749454 |
21d63232bfd1fadcfe14bf13e539213caad993e4 | 178 | class AddUuidToSaveableMultipleChoiceAnswers < ActiveRecord::Migration[5.1]
def change
add_column :saveable_multiple_choice_answers, :uuid, :string, :limit => 36
end
end
| 29.666667 | 78 | 0.786517 |
8777a0a00ba2d5d35bfb863661eed446de60aed5 | 116 | class RealtimeController < ApplicationController
before_action :require_administrator!
def answers
end
end
| 16.571429 | 48 | 0.810345 |
bf81d6c1c1ce1569f478dd1c31bfcd4de5bfb9cd | 16,896 | # frozen_string_literal: true
require 'spec_helper'
require 'yaml'
module Cucumber
module Cli
module ExposesOptions
attr_reader :options
end
describe Configuration do
def given_cucumber_yml_defined_as(hash_or_string)
allow(File).to receive(:exist?) { true }
cucumber_yml = h... | 35.126819 | 173 | 0.613518 |
edc33ffc8dda9e7a746a2ae790f2a7fd61ec0861 | 4,933 | require "spec_helper"
require "nightcrawler_swift/cli"
describe NightcrawlerSwift::CLI::OptParser do
let :runner do
instance_double "Runner", options: OpenStruct.new(config_hash: {}, config_file: nil, default_config_file: true)
end
let :config_dir do
File.expand_path(File.join(File.dirname(__FILE__), "... | 27.558659 | 115 | 0.58585 |
7991f5bd6bf358ae93b25cde73026500473e6621 | 7,601 | HERE = File.dirname(__FILE__)
$LOAD_PATH << "#{HERE}/../../lib/"
UNIX_SOCKET_NAME = File.join('/tmp', 'memcached')
JRUBY = defined?(JRUBY_VERSION)
require 'ffi/times' if JRUBY
require 'memcached'
require 'benchmark'
require 'rubygems'
require 'ruby-debug' if ENV['DEBUG'] && !JRUBY
if ENV['PROFILE']
require 'ruby-pro... | 27.049822 | 126 | 0.600974 |
26b36d42fea4d80ce910f994a23602993e84ddd6 | 2,249 | module Onecloud
# Operations with DNS
module DNS # TODO: Rename to 'Domains'
# Get record by ID
def dns_by_id(record_id)
get("dns/record/#{record_id}")
end
def domain_by_id(domain_id)
get("dns/#{domain_id}")
end
# Update CNAME record
def dns_update_cname(record_id, params)
... | 21.625 | 54 | 0.635394 |
1c2e0079f8d02d388ff77e040974152b32aef815 | 652 | # frozen_string_literal: true
module Api
module Internal
class StatisticsController < Api::Internal::ApplicationController
include TimeZoneHelper
def user_heatmap(username, start_date, end_date)
start_date = Time.parse(start_date)
end_date = Time.parse(end_date)
user = User.p... | 29.636364 | 69 | 0.67638 |
91078a14e1936f049f8dfd515daab652b19fbb43 | 688 | module Hashie
# Hash of great sloth
#
# Hashie::Mash.send(:include, Hashie::Lazy)
#
# local_variable = "I'm fat and lazy"
#
# hash = Hashie::Mash.new
# hash.lazy :lazy_attribute do
# local_variable # this block is evaluated later
# end
# hash.lazy_attribute # "I'm fat and lazy"
module Lazy
... | 20.235294 | 63 | 0.616279 |
f8b051571c8361e4e09317fdb47797957df8716c | 725 | class LessonsController < ApplicationController
def create
@lesson = Lesson.create_with_datetime(lesson_params, current_user)
@invitees = params[:user][:id]
@language_problem = LanguageProblem.find_language_problem(params[:language_id], params[:problem][:id])
@lesson.build_room(:title => @lesson.desc... | 23.387097 | 106 | 0.717241 |
797d5d185bb20faffd746a4a36de6c4eeeb6a51e | 413 | module HoganAssets
class Engine < ::Rails::Engine
initializer 'sprockets.hogan', group: :all do |_app|
HoganAssets::Config.load_yml! if HoganAssets::Config.yml_exists?
Rails.application.config.assets.configure do |env|
HoganAssets::Config.template_extensions.each do |ext|
env.registe... | 31.769231 | 73 | 0.682809 |
ac0db510ff2c80392396e76c6b82563b91169789 | 2,915 | # frozen_string_literal: true
require "forwardable"
module Archimate
module DataModel
# A base string type for multi-language strings.
class LangString
include Comparable
include Comparison
extend Forwardable
def_delegators :@default_text, :strip, :tr, :+, :gsub, :sub, :downcase, :e... | 25.79646 | 111 | 0.5753 |
03efbf96bfae61cc891ba57fea459f3323e3b2dc | 2,349 | class Deno < Formula
desc "Command-line JavaScript / TypeScript engine"
homepage "https://deno.land/"
url "https://github.com/denoland/deno.git",
:tag => "v0.21.0",
:revision => "4e88ba9a114279b3969d5ccca1cca0f74c8fc1fd"
bottle do
cellar :any_skip_relocation
sha256 "756c9df9b5e32392768d7c7... | 33.557143 | 93 | 0.674755 |
382be769a9d86fda97811cb92043a2167c906bcb | 1,414 | class Viewvc < Formula
desc "Browser interface for CVS and Subversion repositories"
homepage "http://www.viewvc.org"
url "https://github.com/viewvc/viewvc/releases/download/1.2.1/viewvc-1.2.1.tar.gz"
sha256 "afbc2d35fc0469df90f5cc2e855a9e99865ae8c22bf21328cbafcb9578a23e49"
license "BSD-2-Clause"
bottle do
... | 31.422222 | 93 | 0.712871 |
616613e450b41265e9ea6cd7109d1b37f79d3cb6 | 933 | require_relative '../../test_helper'
module JPush
module Push
class AudienceTest < JPush::Test
def setup
@audience = Audience.new
end
def test_set_tag
result = @audience.set_tag('jpush').to_hash
assert_equal 1, result.size
assert_true result.has_key?(:tag)
... | 23.923077 | 62 | 0.587353 |
f7c1becb7ca91424b3f3f2d468c8626248a3206e | 1,894 | class Model
def initialize(hash={})
@attributes = hash
end
def read_attribute_for_serialization(name)
if name == :id || name == 'id'
id
else
@attributes[name]
end
end
def id
@attributes[:id] || @attributes['id'] || object_id
end
def method_missing(meth, *args)
if met... | 18.38835 | 76 | 0.708025 |
289cb44f1e8a0014f3848e109abd371a1f5d14f2 | 920 | # frozen_string_literal: true
module BroadcastMessagesHelper
def broadcast_message(message)
return unless message.present?
content_tag :div, class: 'broadcast-message', style: broadcast_message_style(message) do
icon('bullhorn') << ' ' << render_broadcast_message(message)
end
end
def broadcas... | 23 | 92 | 0.711957 |
1cbd95ca4d673a7fdda00ae97af2b0a694fefd54 | 801 | class TastingsController < ApplicationController
# redirect back to events show_quiz method
def create
event_wine = EventWine.find(params[:event_wine_id])
event = event_wine.event
tasting = current_user.tastings.create(tasting_params)
# TO DO: refactor this conditional and test with wine_bringer =... | 36.409091 | 194 | 0.734082 |
1acb7fd733dfe5f7264a78ae0dd6a0369055014f | 198 | component 'rubygem-rubyntlm' do |pkg, settings, platform|
pkg.version '0.6.2'
pkg.md5sum 'e74146db2e08c5254d15d63f0befcc78'
instance_eval File.read('configs/components/_base-rubygem.rb')
end
| 28.285714 | 64 | 0.777778 |
62b002138347bcba80cc5435d69a69d60b69dc06 | 722 | require 'fetchers/log_access_fetcher'
module VCAP::CloudController
class LogAccessController < RestController::BaseController
get '/internal/log_access/:guid', :lookup
def lookup(guid)
check_read_permissions!
if roles.admin?
found = LogAccessFetcher.new.app_exists?(guid)
else
... | 30.083333 | 172 | 0.727147 |
5de041f406d47425ed6fb73ba925837187f056ac | 2,962 | API_HOST = "api.openbeerdatabase.local"
# Request
When /^I send an API GET request to (.*)$/ do |path|
get "http://#{API_HOST}#{path}"
end
When /^I send an API POST request to (.*)$/ do |path, body|
post "http://#{API_HOST}#{path}", body, { "CONTENT_TYPE" => "application/json" }
end
When /^I send an API PUT req... | 31.849462 | 135 | 0.640783 |
392f4dcfa70e5b0a0b2fc9a12fb8dfa88ff1c3c0 | 393 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BreadcrumbItemComponent, type: :component do
pending "add some examples to (or delete) #{__FILE__}"
# it "renders something useful" do
# expect(
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_h... | 24.5625 | 99 | 0.669211 |
abef7c7fa70ef83d13e4bb43380f48c52484cb91 | 368 | name 'windows'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@getchef.com'
license 'Apache 2.0'
description 'Provides a set of useful Windows-specific primitives.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.34.8'
supports ... | 36.8 | 72 | 0.663043 |
5dc725e132ca77c7b4706b04b6fbdfb701aa71c3 | 1,620 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'rex/proto/ntlm/message'
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::WinRM
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanne... | 28.421053 | 107 | 0.635185 |
e880af346cab718d3768ff11b113fcc3cff600d8 | 1,933 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" do
@user.name =... | 26.479452 | 124 | 0.685463 |
266bad5941194f4f4b156b6e1ec8773118f42ca6 | 1,628 | class Ripgrep < Formula
desc "Search tool like grep and The Silver Searcher"
homepage "https://github.com/BurntSushi/ripgrep"
url "https://github.com/BurntSushi/ripgrep/archive/12.1.1.tar.gz"
sha256 "2513338d61a5c12c8fea18a0387b3e0651079ef9b31f306050b1f0aaa926271e"
license "Unlicense"
head "https://github.c... | 36.177778 | 95 | 0.751843 |
9179b9ded461e4b82815ca84f91fb9f453141ff1 | 1,373 | class Chrony < Formula
desc "Versatile implementation of the Network Time Protocol (NTP)"
homepage "https://chrony.tuxfamily.org"
url "https://download.tuxfamily.org/chrony/chrony-4.1.tar.gz"
sha256 "ed76f2d3f9347ac6221a91ad4bd553dd0565ac188cd7490d0801d08f7171164c"
license "GPL-2.0-only"
bottle do
sha2... | 42.90625 | 122 | 0.753095 |
1def33e040449074d6699a2cae1e5968a94af04f | 855 | require 'workers'
# リストの分割数
DIVIDE_NUM = 10
logger = nil
task_pool = Workers::Pool.new(size: DEVIDE_NUM+1, logger: logger, on_exception: nil)
Hoge.where(some_statement).find_in_batches do |list|
# TaskGroup自体がそもそもstate-fullであるため、
# 再利用が出来ない
# ただし、pool自体は再利用が可能
task_group = Workers::TaskGroup.new(... | 23.108108 | 85 | 0.678363 |
1cc0792392e037b9b52be96893f296754aecc395 | 305 | class DataExportJob < ActiveJob::Base
queue_as :high
def perform(options={})
ActiveRecord::Base.connection_pool.with_connection do
data_export = DataExport.find_by_id!(options[:id])
data_export.export!
end
rescue Exception => ex
Notification.create(exception: ex)
end
end
| 23.461538 | 57 | 0.721311 |
ab7f0987a2ba635a969a2d05c867ad0ddaf5a054 | 1,121 | # frozen_string_literal: true
require "forwardable"
require "uri"
module RuboCop
module Cop
module Cask
# This cop checks that a cask's homepage ends with a slash
# if it does not have a path component.
class HomepageUrlTrailingSlash < Cop
include OnHomepageStanza
MSG_NO_SLASH... | 27.341463 | 77 | 0.598573 |
01d094365dd2d2ad4f5b72b45091f0d2cd00ffee | 1,496 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "Backend - Asset (HTML)", type: :feature do
describe "show" do
before { stub_authorization! }
describe "is available" do
let(:resource) { create(:asset, file_name: "amazing.jpg") }
it "finds the Asset file_name" do
vis... | 25.793103 | 79 | 0.61631 |
f79c6014783720f685f266906bd0bd51a9f560ca | 931 | #
# Be sure to run `pod spec lint CommonKit.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 https://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.... | 30.032258 | 103 | 0.648765 |
610df9f64fc77d6f1968c1457c800f271bb1e0ca | 1,920 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module App
class Application < Rails::Application
# Set... | 45.714286 | 99 | 0.726042 |
ed43f857bbbde328602257dbc08742740fcecf75 | 55 | set_unless[:bundler][:apps_path] = "/home/ubuntu/apps"
| 27.5 | 54 | 0.727273 |
1c945916f1e14cf900ea939fe47c93ec3df2a262 | 1,243 | class Ps2eps < Formula
desc "Convert PostScript to EPS files"
homepage "https://www.tm.uka.de/~bless/ps2eps"
url "https://www.tm.uka.de/~bless/ps2eps-1.68.tar.gz"
sha256 "b08f12eed88965d1891261fb70e87c7e3a3f3172ebc31bdb7994a7ce854dd925"
bottle do
cellar :any_skip_relocation
sha256 "55396ec4ff00cfc85c... | 34.527778 | 95 | 0.736927 |
ed615aa9401226984ada3112e888a7c72207ecda | 991 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v0/enums/mime_type.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.ads.googleads.v0.enums.MimeTypeEnum" do
end
add_enum "google.ads.googleads.v0.enums.MimeTypeE... | 31.967742 | 147 | 0.740666 |
3913c2c1f7595deea1cb06186ed316198c6eb58d | 393 | class ApptTimeValidator < ActiveModel::Validator
def validate(appointment)
if appointment.appt_date == DateTime.now.strftime("%Y-%m-%d")
unless appointment.appt_time >= (DateTime.now + 1.hours).strftime("%H:%M")
appointment.errors[:appt_time] << "Time must be at least an ho... | 35.727273 | 110 | 0.62341 |
38710c549edf27be60696a90ec011d694e73cf8c | 244 | module Rubycritic
module SourceControlSystem
class Double < Base
def revisions_count(_)
"N/A"
end
def date_of_last_commit(_)
nil
end
def revision?
false
end
end
end
end
| 12.842105 | 32 | 0.561475 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.