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 |
|---|---|---|---|---|---|
18dbe921b2cd8cdcebbbe7d19bd3e8fbdbb84a89 | 56 | def self.foo
7.77
end
def self.bar
8.88
end
| 7 | 13 | 0.571429 |
79e3dd6fc5e87a4f16980b5efac8307f7d7256f4 | 909 | # frozen_string_literal: true
module NumbersAndWords
module Strategies
module FiguresConverter
module Decorators
module PtBr
class Fractional < Base
def run
"#{super} #{fraction_significance}"
end
private
def fraction_signifi... | 22.725 | 98 | 0.546755 |
335eb175b2d5409bc970463801e62ca48f6880df | 2,025 | # encoding: UTF-8
module Cantor
# @private
NullSet = Class.new(RelativeSet) do
def initialize
end
# @return [NullSet]
def build
self
end
# Yields each element in the set to the implicit block argument. Since
# there are no elements, the block is never executed
#
# @ret... | 16.330645 | 77 | 0.454321 |
33e5f4b29cfb83d5bcfd597e9f8bd010a28f7a36 | 2,037 | class Libgit2 < Formula
desc "C library of Git core methods that is re-entrant and linkable"
homepage "https://libgit2.github.com/"
url "https://github.com/libgit2/libgit2/archive/v0.27.5.tar.gz"
sha256 "15f2775f4f325951d9139ed906502b6c71fee6787cada9b045f5994072ccbd33"
head "https://github.com/libgit2/libgit2... | 32.333333 | 93 | 0.600393 |
d5750390f81ad9f701f83a2fb96893be38272437 | 872 | name 'aws-parallelcluster'
maintainer 'Amazon Web Services'
maintainer_email ''
license 'Apache-2.0'
description 'Installs/Configures AWS ParallelCluster'
long_description 'Installs/Configures AWS ParallelCluster'
issues_url 'https://github.com/aws/aws-parallelcluster-cookbook/issues'
source_url 'https://github.com/aws... | 29.066667 | 71 | 0.680046 |
e9820011e9041988eccedeec8172981a04d79d83 | 1,612 | module MinispadeRails
class DirectiveProcessor < Sprockets::DirectiveProcessor
def process_source
super
if @spades
output = @spades.map do |spade|
# Create a custom context for the spade require
attributes = context.environment.attributes_for(spade)
spade_contex... | 28.280702 | 116 | 0.633375 |
613ccff90e06495a11aa61df5e7dabac8b3bc8f2 | 520 | cask "pdfsam-basic" do
version "4.1.4"
sha256 "e75c82b5b1ace85aa9f81ee49e2e5ac4631f88ea79c46dfeb4718ec8018e7596"
# github.com/torakiki/pdfsam/ was verified as official when first introduced to the cask
url "https://github.com/torakiki/pdfsam/releases/download/v#{version}/PDFsam-#{version}.dmg"
appcast "https... | 37.142857 | 94 | 0.763462 |
e2a961fb993bb1170dfd0480fd94a9b99ab423e5 | 12,995 | # frozen_string_literal: true
require 'thredded/base_migration'
# rubocop:disable Metrics/ClassLength
# rubocop:disable Metrics/MethodLength
class CreateThredded < Thredded::BaseMigration
def change
unless table_exists?(:friendly_id_slugs)
# The user might have installed FriendlyId separately already.
... | 46.913357 | 117 | 0.697961 |
1dfa309a6f8110a973c7d56cbc6d317d0b9d2c5c | 8,744 | require 'util/miq-xml'
module MiqLinux
class OSInfo
attr_reader :os, :networks
ETC = "/etc"
IFCFGFILE = "/etc/sysconfig/network-scripts"
DHCLIENTFILE = "/var/lib/dhclient/"
DEBIANDHCLIENTFILE = "/var/lib/dhcp3/"
DEBIANIFCFGILE = "/etc/network"
DISTRIBUTIONS = ["mandriva", "mandrake", "ma... | 36.739496 | 148 | 0.547347 |
e80b8f2e718612c382ea69cb6b6f6416e8e2cb0a | 218 | class Calculator
attr_reader :name
def initialize(name)
@name = name
end
def add(one, two)
one + two
end
def subtract(one, two)
one - two
end
def divide(one, two)
one / two
end
end
| 9.478261 | 24 | 0.605505 |
7a89c1dba9417e4afcc7f20fa11e32127f8ace57 | 1,502 | require_relative 'boot'
require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_view/railtie'
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Ra... | 39.526316 | 99 | 0.746338 |
7a54dc5755389fe851be5b0174b2c48437fde91a | 3,099 | # frozen_string_literal: true
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
#
# 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 l... | 37.792683 | 120 | 0.727654 |
210556cac08967210692b2ce4bd1116c1410fff0 | 293 | Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.sleep_delay = 10
Delayed::Worker.max_attempts = 2
Delayed::Worker.max_run_time = 45.minutes
Delayed::Worker.default_queue_name = 'default'
Delayed::Worker.delay_jobs = !Rails.env.test?
Delayed::Worker.raise_signal_exceptions = :term
| 36.625 | 47 | 0.805461 |
617f9dca6ec0428c128cc0ef5ecf462ecff2373c | 16,391 | require 'mono_logger'
require 'redis/namespace'
require 'forwardable'
require 'resque/version'
require 'resque/errors'
require 'resque/failure'
require 'resque/failure/base'
require 'resque/helpers'
require 'resque/stat'
require 'resque/logging'
require 'resque/log_formatters/quiet_formatter'
require 'resque/log_fo... | 28.260345 | 127 | 0.679275 |
62d72dead178cb2975e32ac739347c125e39fdff | 1,298 | class Libmp3splt < Formula
desc "Utility library to split mp3, ogg, and FLAC files"
homepage "https://mp3splt.sourceforge.io"
url "https://downloads.sourceforge.net/project/mp3splt/libmp3splt/0.9.2/libmp3splt-0.9.2.tar.gz"
sha256 "30eed64fce58cb379b7cc6a0d8e545579cb99d0f0f31eb00b9acc8aaa1b035dc"
bottle do
... | 39.333333 | 98 | 0.756549 |
bba48a7be086f092c32e717b9a3a1974890d62a8 | 1,905 | # frozen_string_literal: true
require "cli/parser"
module Homebrew
module_function
def mirror_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`mirror` <formula>
Reupload the stable URL of a formula to Bintray for use as a mirror.
EOS
switch :verbose
switch :debu... | 29.765625 | 115 | 0.64357 |
28bc6a1afc102812b313cc466fe7acfe33780e17 | 814 | # Use Action Cable channels (remember to import "@rails/actionable" in your application.js)
# pin "@rails/actioncable", to: "actioncable.esm.js"
# pin_all_from "app/javascript/channels", under: "channels"
# Use direct uploads for Active Storage (remember to import "@rails/activestorage" in your application.js)
# pin "... | 47.882353 | 106 | 0.749386 |
08c00bbf37a029abdd3a5665458561a2fcb440f4 | 1,252 | # 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,... | 33.837838 | 84 | 0.731629 |
b9952c2a860dfb3919c053b5eaf66240d294f444 | 6,952 | require 'spec_helper'
if defined?(ActionController::Request)
describe ApiAuth::RequestDrivers::ActionControllerRequest do
let(:timestamp) { Time.now.utc.httpdate }
let(:request) do
ActionController::Request.new(
'AUTHORIZATION' => 'APIAuth 1044:12345',
'PATH_INFO' => '/resource.xml',
... | 28.846473 | 94 | 0.584436 |
6a4f0268478cca3faf250d1c8fc17015f72ef920 | 6,309 | # frozen_string_literal: true
require 'test_helper'
class UserTest < ActiveSupport::TestCase
setup do
@mati = users(:mati)
@fede = users(:fede)
@juan = users(:juan)
@public = travels(:public)
@private = travels(:private)
@atlantis = travels(:atlantis)
@params = {
username: 'lione... | 24.453488 | 93 | 0.68331 |
38477aa11c51659e9d98ef5b2d3fa17d096298ef | 2,023 | # 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::Authorization::Mgmt::V2015_07_01_preview
module Models
#
# Role definition permissions.
#
class Permission
include Ms... | 27.337838 | 70 | 0.45823 |
fff878810e88ae91bd49a6c49c1f0fd22d4d6064 | 8,729 | require 'ansible_tower_client'
shared_examples_for "ansible configuration_script_source" do
let(:finished_task) { FactoryGirl.create(:miq_task, :state => "Finished") }
let(:manager) { FactoryGirl.create(:provider_ansible_tower, :with_authentication).managers.first }
let(:atc) { double("AnsibleTow... | 45.701571 | 152 | 0.671784 |
e8087411df5a45420f1ab1a0fe770effa4320214 | 805 | require 'open-uri'
require 'base64'
class Prawn::Svg::UrlLoader
attr_accessor :enable_cache, :enable_web
attr_reader :url_cache
DATAURL_REGEXP = /(data:image\/(png|jpg);base64(;[a-z0-9]+)*,)/
URL_REGEXP = /^https?:\/\/|#{DATAURL_REGEXP}/
def initialize(opts = {})
@url_cache = {}
@enable_cache = opt... | 23 | 65 | 0.627329 |
abdb207a9f9b712e59c19e8bff61c5aa1618d849 | 1,829 | # frozen_string_literal: true
require 'cancan'
module Spree
module TestingSupport
module AuthorizationHelpers
module CustomAbility
def build_ability(&block)
block ||= proc{ |_u| can :manage, :all }
Class.new do
include CanCan::Ability
define_method(:init... | 26.507246 | 93 | 0.59158 |
1d0aaab6399c6117ffc7889e80c5d578d4d1bb36 | 5,325 | # Copyright (c) 2020-2021 Andy Maleh
#
# 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 limitation the rights to use, copy, modify, merge, publish,
# d... | 44.375 | 83 | 0.497465 |
ff8cf17b24ff5afb61b16d6bb18c69345b507c1a | 562 | # frozen_string_literal: true
require "bundler/setup"
Bundler.setup
require "simplecov"
SimpleCov.start
require "maremma"
require "rspec"
require "rack/test"
require "webmock/rspec"
require "vcr"
RSpec.configure do |config|
config.include WebMock::API
config.include Rack::Test::Methods
config.expect_with :rsp... | 18.733333 | 56 | 0.759786 |
38691dcb26fe2997044713495df0d1e816a6f572 | 1,573 | # Use a sha1 instead of a tag, as the author has not provided a tag for
# this release. In fact, the author no longer uses this software, so it
# is a candidate for removal if no new maintainer is found.
class Contacts < Formula
desc "Command-line tool to access macOS's Contacts (formerly 'Address Book')"
homepage ... | 43.694444 | 97 | 0.783853 |
395031df23319f23b6d8627a0de9639fd65432d1 | 197 | module ActivityStreams
class Object::Collection < Object
attr_optional :object_types
def validate_attributes!
super
validate_attribute! :object_types, Array
end
end
end | 19.7 | 46 | 0.730964 |
ac7d47f9ad110611f7e0008605c3ee7623e319b0 | 5,042 | # NOTE: These tests require RubyCocoa and should be run on a Mac.
# Because this provider is OS X-specific, the tests (and,
# subsequently, the provider itself, will only run on OS X).
require 'puppet'
require 'puppet/type/property_list_key'
require 'fileutils'
require 'tempfile'
RSpec.configure do |confi... | 28.811429 | 93 | 0.659461 |
1c71c8c22a4125c3d92a2206792d202548151b9c | 712 | Pod::Spec.new do |s|
s.name = "MCSCommerceWeb"
s.version = "1.1.4"
s.summary = "Objective-C iOS wrapper for Mastercard's web SRC Initiator"
s.homepage = "https://github.com/Mastercard/MCSCommerceWeb"
s.license = "Apache License, Version 2.0"
s.author = { "Bret Deasy" =... | 47.466667 | 98 | 0.622191 |
33719b7e24bd6a20b5a011dbf5b877fe281ff7ad | 337 | class GemCollector::UpdateRepository
def run(repository_id:, full_name:, html_url:, ssh_url:)
host = Addressable::URI.parse(html_url).host
repo = GemCollector::Repository.find_or_initialize_by(site: host, repository_id: repository_id)
repo.full_name = full_name
repo.ssh_url = ssh_url
repo.save!
... | 30.636364 | 99 | 0.74184 |
ab0bd85d8d59c4e68c41014cafe36e0d78a20322 | 321 | class PaymentMethod::Ebsin < PaymentMethod
preference :account_id, :string
preference :url, :string, :default => "https://secure.ebs.in/pg/ma/sale/pay/"
preference :secret_key, :string
preference :mode, :string
preference :currency_code, :string
def payment_profiles_supported?
false
end
end... | 22.928571 | 87 | 0.716511 |
035205f12d79c836dfeae487dbc748d93ecb7c56 | 86 | include Java
class A < java.AbstractClass2
def foo
#caret#
end
end
#result#
1 | 9.555556 | 29 | 0.686047 |
e89f9d61b08835865276a83b638a94cc3d612052 | 1,194 | require 'MustardClient/client'
module MustardClient
class EnvironmentsClient < Client
def find environment_id
command = {}
command[:method] = :get
command[:route] = @mustard_url + "/environments/#{environment_id}"
command[:headers] = {'User-Token' => @user_token}
execute(command)
... | 22.528302 | 72 | 0.628978 |
d52349dabe32c4dc3c91c9ffce27f4d0e00f2ff0 | 849 | class GitSvnAbandon < Formula
desc "History-preserving svn-to-git migration"
homepage "https://github.com/nothingmuch/git-svn-abandon"
url "https://github.com/nothingmuch/git-svn-abandon/archive/0.0.1.tar.gz"
sha256 "65c11b5e575e6af4d21ef7624941c4581a5570748d50e38714bd33fee56e4485"
license "MIT"
head "https... | 33.96 | 112 | 0.722026 |
1d8dd4e9c4b884d5e8617be19188633d7d689a14 | 603 | Pod::Spec.new do |s|
s.name = 'TOPropertyAccessor'
s.version = '1.1.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'An abstract class that enables hooking the properties of subclasses.'
s.homepage = 'https://github.com/TimOliver/TOPropertyAccessor'
s.author = 'Tim Oliver'
s.so... | 35.470588 | 99 | 0.6534 |
087719d248086d3514362b7bcc812a589295dd53 | 1,541 | namespace :associated_user do
desc "Testing populate change requests associated users into the database"
task :populate_users_dryrun => :environment do
populate(true)
end
desc "Populate change requests associated users into the database"
task :populate_users => :environment do
populate(false)
end
... | 38.525 | 102 | 0.691759 |
abd795485581bbe5370608072177feddc26d4a11 | 1,944 | class Sngrep < Formula
desc "Command-line tool for displaying SIP calls message flows"
homepage "https://github.com/irontec/sngrep"
url "https://github.com/irontec/sngrep/archive/v1.4.9.tar.gz"
sha256 "3c6f28b5c795a5b1844a8997aa430aba72e083c8bd52939990900450c5f4c85a"
license "GPL-3.0-or-later"
bottle do
... | 46.285714 | 123 | 0.667181 |
335679e9ff5fbb9372ce038e17a66c2e6f758047 | 2,185 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Security::StoreScansWorker do
let_it_be(:sast_scan) { create(:security_scan, scan_type: :sast) }
let_it_be(:pipeline) { sast_scan.pipeline }
let_it_be(:sast_build) { pipeline.security_scans.sast.last&.build }
describe '#perform' do
subjec... | 33.615385 | 101 | 0.691991 |
391b88a2ee7950dad06ac30947683be0cad011d9 | 581 | describe Eshop::ProductDetector do
describe '#find_product_class' do
it { expect(Eshop::ProductDetector.new('book','20').find_product_class).to be_an_instance_of(Eshop::Product::Book)}
it { expect(Eshop::ProductDetector.new('pill','19').find_product_class).to be_an_instance_of(Eshop::Product::Medicine)}
i... | 64.555556 | 130 | 0.7642 |
4a5a940de40d17b907ac4e2f346d489e96b54e1c | 609 | # frozen_string_literal: true
RSpec.shared_examples 'a resource with orderable creators' do
before(:all) do
raise 'resource must be set with `let(:resource)`' unless defined? resource
end
it 'orders them by #position asc' do
creator_a, creator_b = resource.creators
creator_a.update!(display_name: '... | 26.478261 | 79 | 0.70936 |
e2758aceecfd1556239bf07cfec3157cc1a5277f | 260 | class AddChoreSessionFieldsToTarget < ActiveRecord::Migration[6.0][5.0]
def change
add_column :targets, :video_embed, :text
add_column :targets, :last_session_at, :datetime
add_index :targets, :chore
add_index :targets, :session_at
end
end
| 28.888889 | 71 | 0.742308 |
186e556d6afd9c317f4047bed2d981656193949d | 1,680 | #
# Be sure to run `pod lib lint qrframework_part_5.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = '... | 39.069767 | 114 | 0.651786 |
62670f011e36a2412fd6ff934c0ce6ea1bae30f4 | 10,477 | class HostAggregateController < ApplicationController
before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data
include Mixins::GenericFormMixin
include Mixins::GenericListMixin
include Mixins::GenericSessionMixin
include Mixins::Generic... | 31.748485 | 125 | 0.656008 |
ab2197e9689a9fa07d24bcf578986b72a1a8c1c9 | 531 | require 'fog'
bucket_name = ARGV[0]
host = ARGV[1]
admin_access_key = ARGV[2]
admin_secret_key = ARGV[3]
client = Fog::Storage.new(
provider: 'AWS',
path_style: true,
host: host,
port: 8080,
scheme: 'http',
aws_access_key_id: admin_access_key,
aws_secret_access_key: admin_secret_key)
puts "Fog client: #... | 18.964286 | 45 | 0.713748 |
1d47171cb310b9e03f61823d12d000986b7a4295 | 5,376 | =begin
#DocuSign Admin API
#An API for an organization administrator to manage organizations, accounts and users
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_Admin
class PermissionProfileResponse
... | 27.854922 | 107 | 0.610491 |
1da89883fe240bea6d855156785ef40ab5a902ce | 315 | module Api
module V2
class GeographicalAreasController < ApiController
def index
render json: CachedGeographicalAreaService.new(actual_date).call
end
def countries
render json: CachedGeographicalAreaService.new(actual_date, countries: true).call
end
end
end
end
| 22.5 | 89 | 0.711111 |
87c9eb9504be28a92264a4a247ee33c350b42ad5 | 3,682 | #
# Copyright 2017, Schuberg Philis B.V.
#
# 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 ... | 37.958763 | 418 | 0.719446 |
4abeedcca51c17b50c8fc62c9a6559e05a57aa75 | 915 | require 'rails_helper'
require 'helpers/login_helper'
describe "the delete a project process" do
it "allows admins to delete projects" do
category = FactoryGirl.create(:category)
login_admin
visit category_path(category)
click_on 'Add a project'
fill_in 'Name', :with => 'Basic Website'
fill_i... | 33.888889 | 114 | 0.700546 |
113fc2153f1668345fdffbbb6377550f9c6dde8a | 239 | class CreateEmployees < ActiveRecord::Migration[5.2]
def change
create_table :employees do |t|
t.string :name
t.string :position
t.string :address
t.integer :phone_number
t.timestamps
end
end
end
| 18.384615 | 52 | 0.65272 |
08706821e0fd37b4719d35973b92fdf8434f3469 | 1,328 | # -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
require 'rubygems'; require 'require_relative'
require_relative 'up'
# Debugger "down" command. Is the same as the "up" command with the
# direction (set by DIRECTION) reversed.
class Trepan::Command::DownCommand < Trepan::Comma... | 24.145455 | 90 | 0.613705 |
013fcd74246928a477b540529c303c26cb6e1747 | 3,616 | module CliTasks
class Viewer
attr_accessor :files
attr_accessor :notes
def initialize(*args)
@files = args
if args.any?
Runner.run! args
else
Runner.run! world.task_path
end
end
def self.tag_groups(*args)
new(*args).tag_groups
end
def self.s... | 23.031847 | 108 | 0.562777 |
0136d1a4a7fdbb83f2fd705b49d39f26d1fca34a | 600 | cask 'mattr-slate' do
version '1.2.0'
sha256 'd409ccda9ed09f5647175f8834650e141a7375ced9665bf6af237525665d4966'
url "https://github.com/mattr-/slate/releases/download/v#{version}/Slate.zip"
appcast 'https://github.com/mattr-/slate/releases.atom',
checkpoint: '12a305e83d56fb2eab4c1341df73ea1faf5591838... | 30 | 88 | 0.66 |
61191a4115fbf2cfc1508a2d1709d968488fcf49 | 110 | class Capybara::Node::Base
def find_custom(finder, locator)
base.find_custom(finder, locator)
end
end
| 18.333333 | 37 | 0.745455 |
ff75e87d3d9e46e646a5e9642024d42219dca9eb | 4,171 | require 'delayed/server'
Rails.application.routes.draw do
# api
# service
# rails/active_storage
# assets
root 'application#index'
get 'oauth/admin', to: 'oauth#admin_token' if Rails.env.development?
scope '/rails' do
devise_for :users
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
... | 33.637097 | 92 | 0.626708 |
7957db8fd790974de325110e88d563aa690e7604 | 809 | # frozen_string_literal: true
xml.instruct! :xml, version: '1.0'
xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/') {
xml.ShortName application_name
xml.Description "#{application_name} Search"
xml.Image "#{asset_url('favicon.ico')}", height: 16, width: 16, type: 'image/x-icon'
xml.Contac... | 62.230769 | 180 | 0.71199 |
280584041fd64763ab503840bbcd43af72f002f5 | 6,228 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-beta3
=end
... | 29.516588 | 196 | 0.620745 |
6ac2dfd88a6242dc302b8923ef01227051029061 | 1,720 | # Windows console color support
# Copyright 2011 Michael 'mihi' Schierl
# Licensed under MSF license
class WindowsConsoleColorSupport
STD_OUTPUT_HANDLE = -11
COLORS = [0, 4, 2, 6, 1, 5, 3, 7]
def initialize(origstream)
@origstream = origstream
# initialize API
@GetStdHandle = Wi... | 28.196721 | 102 | 0.580814 |
62986af4cd65f74a9f4ba92e4ae72d82b6da472a | 18,624 | require 'spec_helper'
describe TranslationIO::FlatHash do
describe '#to_flat_hash' do
it 'returns a flat hash' do
hash = {
'en' => {
'hello' => 'Hello world',
'main' => {
'menu' => {
'stuff' => 'This is stuff'
}
},
'bye... | 27.388235 | 126 | 0.452695 |
e83cf5f4e8e81bdc20e175e19679fd91168c3c1f | 389 | Given /^I am logged in$/ do
@current_user = FactoryBot.create(:user)
login_as @current_user
end
Given /^a user named "(.*?)"$/ do |name|
FactoryBot.create(:user, name: name)
end
Given /^I am logged in as "(.*?)"$/ do |name|
login_as User.find_by(name: name)
end
Given /^I am logged in as approver$/ do
@curr... | 21.611111 | 46 | 0.683805 |
18a6609b271f13c751d7e3b7c4b52fafa41c2308 | 573 | require "/home/pi/.gem/ruby/2.5.1/gems/redis-4.0.2/lib/redis"
def blink
[1,0,1,0,1,0,1,0,1,0].each do |n|
`echo #{n} | tee /sys/class/leds/led0/brightness`
sleep 0.5
end
end
Redis.new.subscribe("system") do |on|
on.subscribe do |channel, subscriptions|
puts "Subscribed to #{channel}"
end
on.mes... | 20.464286 | 61 | 0.645724 |
bbb191a09b1fd2b2f78a7ac432c3b2bdc2c8564b | 62,322 | # 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,... | 64.515528 | 166 | 0.692436 |
3336c66ac02e8dc08cf9da4d71e3622824116310 | 765 | cask "go-agent" do
version "21.4.0,13469"
sha256 "c1cfc71c5389cbb9d7d290448995515d93a01b7f1c4c236be9f0b39c4f8b89b0"
url "https://download.gocd.io/binaries/#{version.csv.first}-#{version.csv.second}/osx/go-agent-#{version.csv.first}-#{version.csv.second}-osx.zip",
verified: "download.gocd.io/binaries/"
na... | 34.772727 | 149 | 0.670588 |
38f23865a3e46a435a1bb3b2ab794fb2ac6b7abb | 74 | require 'alchemy/ferret/engine'
module Alchemy
module Ferret
end
end
| 10.571429 | 31 | 0.77027 |
bb313b9f974a534592f36dd0bcbd2feb67eec9c6 | 263 | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
# Cleaner (and less shout-y) reading from the environment variables:
def env(name, default)
ENV["EOL_#{name.upcase}"] || default
end
| 23.909091 | 68 | 0.771863 |
7a970d2b361e3e7fd0161811b1b82b65205468df | 2,814 | class AdvisingStudentController < ApplicationController
include CampusSolutions::StudentLookupFeatureFlagged
include AdvisorAuthorization
before_action :api_authenticate
before_action :authorize_for_student
rescue_from StandardError, with: :handle_api_exception
rescue_from Errors::ClientError, with: :hand... | 29.93617 | 119 | 0.79602 |
87afa0b67e844f2416c79e84199f4ceb6c4c8401 | 484 | # frozen_string_literal: true
module Blacklight
class DocumentMetadataComponent < ::ViewComponent::Base
with_collection_parameter :fields
# @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters
def initialize(fields:, show: false)
@fields = fields
@show = show
... | 22 | 86 | 0.702479 |
5d4082a4686fb304e67046354a948f4c91ff4ab8 | 392 | require 'spec_helper'
require 'rdf/spec/repository'
describe RDF::Blazegraph::Repository do
let(:endpoint) { 'http://localhost:9999/bigdata/sparql' }
before { RDF::Blazegraph::Repository.new('http://localhost:9999/bigdata/sparql').clear! }
# @see lib/rdf/spec/repository.rb
let(:repository) { RDF::Blazegraph:... | 28 | 91 | 0.734694 |
5d0b69aa7ce541e48f88b240d4485729155f1ec0 | 1,339 | require 'faraday'
module Dtime
module Connection
# A module for methods that will be available on the faraday body
module Response
module Helpers
RATELIMIT = 'X-RateLimit-Remaining'.freeze
CONTENT_TYPE = 'Content-Type'.freeze
CONTENT_LENGTH = 'content-length'.freeze
at... | 23.086207 | 69 | 0.570575 |
2123f710efcd7822eda7a1cdb9b11bf5364a0d40 | 1,482 | require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "login with invalid information" do
get login_path
assert_template 'sessions/new'
post login_path, params: { session: { email: "", password: "" } }
assert_template 'sessi... | 27.962264 | 85 | 0.690283 |
abfa0aa8e683c2a907a82f9f4c15ae3d2b14f695 | 222 | object false
node (:success) { true }
node (:info) { 'ok' }
child :data do
node (:students_count) { @students.size }
child @students do
attributes :id, :username, :first_name, :last_name, :status, :avatar
end
end | 24.666667 | 72 | 0.671171 |
aba48a83cdb48e64f60a31d10b15b9d186681820 | 521 | module Harness
class Gauge < Measurement
def initialize(attributes = {})
super
self.units ||= :ms
end
def self.from_event(event)
if event.payload[:gauge].is_a? Hash
gauge = new event.payload[:gauge]
elsif event.payload[:gauge].is_a?(Symbol) || event.payload[:gauge].is_a?(S... | 21.708333 | 86 | 0.591171 |
611fa0a539af14f3ffc781874d8eb719260ada2a | 760 | require 'resque_scheduler'
Resque.redis = 'localhost:6379'
Resque.redis.namespace = "resque:SchedulerExample"
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is... | 40 | 82 | 0.751316 |
28fa7ced281bb566824096326e2928201434ea02 | 30,636 | # 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::V2017_09_01
#
# Network Client
#
class VirtualNetworkPeerings
include MsRestAzure
#
# Creates and initiali... | 48.245669 | 217 | 0.72343 |
2800bb0a1c7749717cc14f64070caf4a6e3d1720 | 971 | require 'switches'
namespace :s do
desc "List current"
task :c do
Switches.dump :current
end
desc "Diff current vs. default switches"
task :d do
Switches.dump :diff
end
desc "Turn on switch"
task :on, :name do |t, args|
Switches.turn_on args.name
Switches.dump :current
end
desc "... | 17.654545 | 42 | 0.675592 |
5d172163febb9e698a9cb7a3ed5f98bac73d2e03 | 880 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint omnisaude_chatbot.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'omnisaude_chatbot'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s... | 36.666667 | 105 | 0.592045 |
6183e592e9a59746fd96c9053da9fed0b2b5213e | 15,917 | # frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/commands/query_command'
module TestGemCommandsQueryCommandSetup
def setup
super
@cmd = Gem::Commands::QueryCommand.new
@specs = add_gems_to_fetcher
@stub_ui = Gem::MockGemUi.new
@stub_fetcher = Gem::FakeFetcher.new
... | 18.551282 | 109 | 0.631526 |
e98f5844d009db7556f3d64af91563d5ab4fca33 | 3,710 | # vFabric Administration Server Ruby API
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0... | 33.727273 | 109 | 0.712938 |
7aa9ae49d74b5c944f6e90ab954e3e2660435366 | 893 | # frozen_string_literal: true
ENV["RACK_ENV"] = "test"
require File.expand_path("../config/environment", __dir__)
abort("DATABASE_URL environment variable is set") if ENV["DATABASE_URL"]
require "rspec/rails"
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
module SystemTestHelper
#... | 30.793103 | 78 | 0.786114 |
acf2b8ae70c33b8456f462987c618a087f2913e5 | 7,257 | require_relative '../../version1_0'
require_relative '../../function'
require_relative '../../signature'
require_relative '../../semantics'
module BELParser
module Language
module Version1_0
module Functions
# ProteinAbundance: Denotes the abundance of a protein
class ProteinAbundance
... | 30.880851 | 112 | 0.481604 |
bf5a31f9ce7d6ba3938234f2d583b3fbf3800dcc | 188 | class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :username
t.string :password_digest
t.timestamps
end
end
end
| 17.090909 | 48 | 0.664894 |
bf025476b70562fbf2ef1be2b54e02f9f96eca06 | 685 | Gem::Specification.new do |s|
# Release Specific Information
s.version = "0.1.alpha.3"
# Gem Details
s.name = "animation"
s.authors = ["Eric Meyer"]
s.summary = %q{css3 animations plugin for compass}
s.description = %q{css3 animations plugin for compass, with core animation mixins, and optional defaul an... | 29.782609 | 134 | 0.662774 |
1829f8d81fb1516d37400ba48e813455116ceed5 | 854 | # frozen_string_literal: true
require 'helper'
require 'minitest/autorun'
require 'wrapture'
class VersionTest < Minitest::Test
def test_gemspec_date
spec = Gem::Specification.load('wrapture.gemspec')
date_regex = /^## \[(\d+\.\d+\.\d+)\] - (\d{4}-\d{2}-\d{2})/
File.open('ChangeLog.md').each do |line|... | 25.878788 | 70 | 0.641686 |
28270f769f5112a4623f15ef7770418b33cd8c94 | 250 | # frozen_string_literal: true
FactoryGirl.define do
factory :notification_from_admin, class: 'Notification::FromAdmin' do
notification
body { FFaker::Lorem.paragraph }
expiration_date { Time.zone.today + rand(20) }
end
end
| 27.777778 | 71 | 0.712 |
bb4cf25cd8d989c52cc04247280de78a471d89f8 | 4,695 | RSpec.shared_examples :semaphore do
let(:semaphore) { described_class.new(3) }
describe '#initialize' do
it 'raises an exception if the initial count is not an integer' do
expect {
described_class.new('foo')
}.to raise_error(ArgumentError)
end
context 'when initializing with 0' do
... | 25.516304 | 78 | 0.652822 |
1807e107eb9f8e3a880189a6fa42b3f67cd5ff81 | 1,865 | # -*- encoding: utf-8 -*-
# stub: grape-entity 0.5.2 ruby lib
Gem::Specification.new do |s|
s.name = "grape-entity".freeze
s.version = "0.5.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Michael... | 41.444444 | 115 | 0.653619 |
384e2141f6c9b5709f7ce5698a62008043242214 | 2,964 | # encoding: UTF-8
# frozen_string_literal: true
module Serializers
module EventAPI
class OrderEvent
def call(order)
{
id: order.id,
market: order.market_id,
type: type(order),
trader_uid: Membe... | 30.875 | 91 | 0.551282 |
5df9f1df26bf8fc7e29ca79da5e8adb9a02108b4 | 6,134 | module TextRank
##
# Primary class for keyword extraction and hub for filters, tokenizers, and
# graph strategies # that customize how the text is processed and how the
# TextRank algorithm is applied.
#
# @see README
##
class KeywordExtractor
# Creates a "basic" keyword extractor with default opti... | 34.852273 | 147 | 0.661396 |
91689563c8ebd75053bfa67b47cdc4642b15c6cc | 10,202 | require File.dirname(__FILE__) + '/test_helper'
require 'satellite'
def return_to; search_body("//input[@name='return_to'").first['value']; end
def cancel_to; search_body("//a[text()='Cancel']").first['href']; end
describe 'The add page' do
setup_and_teardown(:populated)
it 'should not encode the referrer when n... | 30.728916 | 110 | 0.645168 |
1cc8a65a20455709ec0370fb465097ab9ae902aa | 8,786 | module Formtastic
module Helpers
# FormHelper provides a handful of wrappers around Rails' built-in form helpers methods to set
# the `:builder` option to `Formtastic::FormBuilder` and apply some class names to the `<form>`
# tag.
#
# The following methods are wrapped:
#
# * `semantic_for... | 44.150754 | 167 | 0.615866 |
bb8bcadd3352c3bc46e1fe26e0e9d797be103bf1 | 896 | # frozen_string_literal: true
class SessionsController < ApplicationController
# ensures the authorized function in the applicationController
# does not run when trying to create an account or sign in
skip_before_action :authorized, only: %i[new create welcome]
# creates a new session then sets the current us... | 22.974359 | 64 | 0.691964 |
87aad78d010175ed07a13b7c6fcbcafe095b2883 | 2,096 | class Event::Agents::Nodes::PageController < ApplicationController
include Cms::NodeFilter::View
include Event::EventHelper
helper Event::EventHelper
public
def index
@year = Time.zone.today.year.to_i
@month = Time.zone.today.month.to_i
monthly
end
def monthly
@year = pa... | 24.952381 | 92 | 0.56584 |
4a430b92abefaf96ff6223fa09c5e6a797e09fa2 | 460 | class RemoveJurisdictionFromAgencies < ActiveRecord::Migration
def up
remove_column :agencies, :jurisdiction
ActiveRecord::Base.connection.execute <<-SQL
DROP TYPE jurisdiction;
SQL
end
def down
ActiveRecord::Base.connection.execute <<-SQL
CREATE TYPE jurisdiction as ENUM ('none', 'l... | 25.555556 | 102 | 0.706522 |
4a61ca9c852b4eaf0915e7bbb52bf9b0fd18dd19 | 1,366 | require 'http'
require 'sponsored/search'
module Sponsored
class GoogleSearch < Search
GOOGLE_SEARCH_URL = 'https://www.googleapis.com/customsearch/v1'
SEARCH_RESULT_LIMIT = 3
def results
@results ||= response.parse['items'].map { |attributes| Result.new(attributes) }
end
private
def... | 21.34375 | 89 | 0.601757 |
e22e96ef332d5ffd302a4752be97f586a1430d2d | 1,553 | class RedditProcessor < AtomProcessor
POINTS_THRESHOLD = 2000
CACHE_HISTORY_DEPTH = 4.hours
protected
def entities
super.select { |entity| enough_points?(entity.uid) }
end
private
def enough_points?(link)
reddit_points(link) >= POINTS_THRESHOLD
end
def reddit_points(link)
data_point(l... | 22.838235 | 77 | 0.674823 |
fff1300b80f0794a090bfbc8bb1885976f90a1dc | 5,437 | require_relative '/usr/src/app/sinatra_template/utils.rb'
module LoginService
module SparqlQueries
include SinatraTemplate::Utils
def remove_old_sessions(session)
query = " DELETE WHERE {"
query += " GRAPH <http://mu.semte.ch/graphs/sessions> {"
query += " <#{session}> <#{MU_SESSION.ac... | 42.147287 | 130 | 0.488873 |
62befae5bb27fcd0dcb7d040920211a91419563e | 2,164 | # This queue service is based on aws sqs.
# To make this queue service work, one would need the aws sqs gem to be installed.
module DispatchRider
module QueueServices
class AwsSqs < Base
require "dispatch-rider/queue_services/aws_sqs/message_body_extractor"
require "dispatch-rider/queue_services/aws_s... | 29.243243 | 177 | 0.63817 |
616b62ab8b6121e20aff2655d6f94ee25b4197f0 | 2,554 | require "premailer"
module ActionMailer
module InStyle
class Processor
def self.inline!(message)
new(message).inline!
end
attr_reader :message, :premailer
# Initialize
# Accepts one argument:
# - ActionMailer message object
def initialize(message)
@mes... | 28.065934 | 130 | 0.630775 |
4aa4400cda0165c558620d09b26c6503f06a8dfa | 1,454 | class Kubevela < Formula
desc "Application Platform based on Kubernetes and Open Application Model"
homepage "https://kubevela.io"
url "https://github.com/oam-dev/kubevela.git",
tag: "v1.0.1",
revision: "1444376b0cf17add8c818078fb9496c23c45ed32"
license "Apache-2.0"
bottle do
sha256 cell... | 39.297297 | 122 | 0.740715 |
bf1bf8a2d152bfb68c126ad8b7461eced29349fa | 1,324 | =begin
The Trust Payments API allows an easy interaction with the Trust Payments web service.
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 requ... | 33.1 | 120 | 0.750755 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.