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 |
|---|---|---|---|---|---|
62b554bf5f2e610b6d4fcc70e1dcf885719a125a | 53 | module InvoicePrinter
VERSION = '2.2.0.alpha2'
end
| 13.25 | 26 | 0.735849 |
ac460cc21c919ea94c8f0e609c59881a6d4eed13 | 3,585 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 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, which is a fork of ... | 33.504673 | 100 | 0.728312 |
91e9fc7eaef1f904353f6213ae02600bebf7c84a | 196 | class MealSerializer < ActiveModel::Serializer
attributes :id, :date, :calories, :carbohydrates, :fat, :protein,
:carbohydrates_percentage, :fat_percentage, :protein_percentage
end
| 39.2 | 76 | 0.744898 |
ac2a5674a36064f28fe41be533f555f192c6b382 | 3,618 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'net/ssh'
require 'net/ssh/command_stream'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::SSH
def initialize(in... | 27.409091 | 102 | 0.576562 |
bb706d290302faa61f084d0cde472e7e7d527af1 | 2,225 | module Common
class RegisteredOrganisationResponse
def initialize(ccs_org_id, hidden: true)
super()
@ccs_org_id = ccs_org_id
@results = hidden.blank? ? search_organisation : search_organisation_all
@primary_name = ''
@primary_identifier = {}
@additional_identifier = []
end
... | 28.525641 | 167 | 0.697528 |
62a14f0a18cd90b87cbcca23811850949e4dac07 | 1,799 | require 'rubygems'
# Note that Haml's gem-compilation process requires access to the filesystem.
# This means that it cannot be automatically run by e.g. GitHub's gem system.
# However, a build server automatically packages the master branch
# every time it's pushed to; this is made available as the haml-edge gem.
HAM... | 49.972222 | 121 | 0.685937 |
26f575c12989a45b1277a4091ab9eaf42cfdfc81 | 5,957 | =begin
#rokka.io
#digital image processing done right. [Documentation](https://rokka.io/documentation). [Changelog](https://api.rokka.io/changelog.md).
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.1
=end
require 'date'
module RokkaClient... | 27.451613 | 134 | 0.605842 |
1c1df771995a6ee59a713a4dfb2d2710c678433d | 1,992 | class PlaceTaxonName < ActiveRecord::Base
belongs_to :place, :inverse_of => :place_taxon_names
belongs_to :taxon_name, :inverse_of => :place_taxon_names
validates_uniqueness_of :place_id, :scope => :taxon_name_id
validates_presence_of :place_id, :taxon_name_id
def to_s
"<PlaceTaxonName #{id}, place_id: #... | 40.653061 | 133 | 0.666165 |
4a4ab15205a6dd60f6bf699f99bc6a81aac30bef | 591 | # frozen_string_literal: true
module ElasticAPM
# @api private
module Spies
# @api private
class ActionDispatchSpy
def install
::ActionDispatch::ShowExceptions.class_eval do
alias render_exception_without_apm render_exception
def render_exception(env, exception)
... | 21.888889 | 61 | 0.663283 |
ac12190bea0aee08574e3d552c30d1640671a847 | 1,245 | # typed: false
# frozen_string_literal: true
# :nodoc:
class BbeditCli < Formula
desc "BBEdit Command-Line Tools"
homepage "https://www.barebones.com/products/bbedit/index.html"
url "https://github.com/josh/homebrew-tap/raw/4b9c17f996fd897382ad812a472a551d116f7172/empty.tar"
version "0.1.0"
sha256 "9bfac43f4... | 37.727273 | 99 | 0.759839 |
e2e197a4b5628fc46582edd00ed56b3755cb3b2c | 270 | class Forest::Error < StandardError
attr_reader :object
def initialize(msg= 'Forest::Error', object = nil)
@object = object
super msg
end
end
# begin
# raise MyError.new("my message", "my thing")
# rescue => e
# puts e.thing # "my thing"
# end
# end
| 16.875 | 52 | 0.644444 |
edd41dba7e67be36519837a8b8c413314232890a | 9,565 | #
# Author:: Bryan McLellan <btm@loftninjas.org>
# Copyright:: Copyright 2010-2016, Bryan McLellan
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 39.36214 | 141 | 0.603659 |
875ea6fbbaf134e291c9bbe925f37dbd45c87305 | 133 | class MixTask < Task
def initialize
super('Mix that batter up!')
end
def get_time_required
3.0 # Mix for 3 minutes
end
end | 14.777778 | 30 | 0.706767 |
1c3d3a31b8eac0196995f9b7cb09c19041fce422 | 1,751 | # frozen_string_literal: true
require 'cuprum/collections/basic/commands/update_one'
require 'cuprum/collections/basic/query'
require 'cuprum/collections/basic/rspec/command_contract'
require 'cuprum/collections/rspec/update_one_command_contract'
require 'support/examples/basic_command_examples'
RSpec.describe Cupru... | 25.75 | 76 | 0.717304 |
e264c079c835ad18780b4e4bada1e48d58eac5dc | 5,832 | require 'rubygems'
require 'help/remote_command_handler'
require 'help/state_change_listener'
require 'scripts/ec2/copy_mswindows_ami'
require 'AWS'
module SecludIT
module CloudyScripts
class AwsEc2Helper
#XXX: retrieve a getting-started-with-ebs-boot AMI of Amazon according to Amazon Region
def self.get_star... | 37.625806 | 143 | 0.700274 |
0844616ee1cedd433a30d8ca751fb9cd8f7679dd | 3,203 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Database::DynamicModelHelpers do
let(:including_class) { Class.new.include(described_class) }
let(:table_name) { 'projects' }
describe '#define_batchable_model' do
subject { including_class.new.define_batchable_model(table_name) }
... | 28.855856 | 94 | 0.646269 |
1a7ecd06a4a6bb108fbe6e92c5bd6365e3f1541a | 263 | module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Connecting Grinnellians"
if page_title.empty?
base_title
else
"#{page_title} | #{base_title}"
end
end
end
| 18.785714 | 47 | 0.653992 |
032449465f234d7c062c95bc5aa994cce70957d8 | 5,082 | # frozen_string_literal: true
# Class documentation comment
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
... | 43.435897 | 114 | 0.763676 |
ed91ce519d58bc4d55e4f90cb9b8aeff0df56735 | 6,043 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'value stream analytics events', :aggregate_failures do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let(:from_date) { 10.days.ago }
let!(:context) { create(:issue, project: project, created_at: 2.da... | 33.021858 | 121 | 0.675658 |
18f1842e414a5197db77f4eaab782615801096fb | 137 | FactoryGirl.define do
factory :conversion_host do
sequence(:name) { |n| "conversion_host_#{seq_padded_for_sorting(n)}" }
end
end
| 22.833333 | 74 | 0.737226 |
6a3e27c3728554253d46ee722e107aa2760e8865 | 8,944 | # typed: false
# frozen_string_literal: true
require "formula"
require "erb"
require "ostruct"
require "cli/parser"
module Homebrew
extend T::Sig
module_function
SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze
TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze
TARGET_DOC_PATH = (HOMEBREW_RE... | 33.498127 | 112 | 0.614714 |
d59fa000aed0b927912b833f2ac847c292a60966 | 264 | # frozen_string_literal: true
class StudentsTableReflex < ApplicationReflex
include SortHelper
def sort
sort_records(records: Student.all,
partial: "students_table",
sort_columns: %w[first_name last_name guardian_last_name status])
end
end
| 22 | 71 | 0.765152 |
1d6faf256bde144c2c6c821c37a67d21caf10b35 | 450 | require 'spec_helper'
describe "opendata_app_categories", type: :feature, dbscope: :example do
let(:site) { cms_site }
let(:node) { create_once :opendata_node_app_category, name: "opendata_app_categories" }
let(:index_path) { opendata_app_categories_path site, node }
context "app_categories" do
before { ... | 25 | 89 | 0.726667 |
1cb84d2de8d596cdf3e493e1dbf3bdc080b1cbe1 | 719 | require 'test_helper'
class Liquid::Drops::LineItemDropTest < ActiveSupport::TestCase
include Liquid
def setup
@line_item = FactoryBot.build(:line_item)
@drop = Drops::LineItem.new(@line_item)
end
should "return name" do
@line_item.name = 'foo'
assert_equal(@line_item.name, @drop.name)
end... | 22.46875 | 63 | 0.703755 |
0823bf7952db398bcf052eb015721de346508759 | 1,802 | require_relative 'resource'
module Contentful
module Management
# Resource class for Role.
class Role
include Contentful::Management::Resource
include Contentful::Management::Resource::Refresher
include Contentful::Management::Resource::SystemProperties
property :name, :string
... | 26.5 | 83 | 0.597114 |
61e0597d25450946e924b5cdb9f105119c744f23 | 30 | $: << 'lib'
require 'rubyrdf'
| 10 | 17 | 0.566667 |
3343782d933e45f31e759ad81541f3edc54b59a5 | 3,459 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship",
... | 30.342105 | 96 | 0.696155 |
e20a3b8ed0b9d0adaf0f92a333c6c72933297394 | 2,852 | require 'spec_helper'
require 'phraseapp-in-context-editor-ruby'
require 'phraseapp-in-context-editor-ruby/displayable_key_identifier'
require 'phraseapp-in-context-editor-ruby/fallback_keys_fetcher'
describe PhraseApp::InContextEditor::DisplayableKeyIdentifier do
let(:identifier) { PhraseApp::InContextEditor::Displ... | 29.402062 | 161 | 0.652174 |
91e6f00195d1eb8a6d4e574d9fb8f984665e20d6 | 1,559 | #!/usr/bin/env ruby -rubygems
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |gem|
gem.version = File.read('VERSION').chomp
gem.date = File.mtime('VERSION').strftime('%Y-%m-%d')
gem.... | 36.255814 | 89 | 0.607441 |
abaabad5d65fac35e22907aa9ad536ce222f7491 | 24,903 | # rubocop:disable GitlabSecurity/PublicSend
require_dependency Rails.root.join('lib/gitlab') # Load Gitlab as soon as possible
class Settings < Settingslogic
source ENV.fetch('GITLAB_CONFIG') { "#{Rails.root}/config/gitlab.yml" }
namespace Rails.env
class << self
def gitlab_on_standard_port?
on_stand... | 44.709156 | 245 | 0.717624 |
21cd752f47238cbff973489d917b450bb50bf2a2 | 1,272 | require 'thread'
require 'rack/builder'
require 'lotus/router'
module Lotus
class Container
class Router < ::Lotus::Router
def mount(app, options)
app = app.new(path_prefix: options.fetch(:at)) if lotus_app?(app)
super(app, options)
end
private
def lotus_app?(app)
... | 21.2 | 88 | 0.628145 |
acdd585f80cbad25a17ad33761368b7b0ce7b9a9 | 471 | # frozen_string_literal: true
require_relative '../../support/feature_helper'
describe 'Composer Dependencies' do
let(:php_developer) { LicenseFinder::TestingDSL::User.new }
specify 'are shown in reports' do
LicenseFinder::TestingDSL::ComposerProject.create
php_developer.run_license_finder
expect(php... | 31.4 | 81 | 0.762208 |
87d6f875135e38aabaeabf42f5780e3038296749 | 3,940 | require 'metasploit/framework/login_scanner/http'
module Metasploit
module Framework
module LoginScanner
class DirectAdmin < HTTP
DEFAULT_PORT = 443
PRIVATE_TYPES = [ :password ]
# Checks if the target is Direct Admin Web Control Panel. The login module should call this.
... | 32.833333 | 109 | 0.551269 |
21a1f28abd6e14d3e2623cc4dc161d8150fbcea1 | 1,335 | # Seed repo:
# fa1b1e6c004a68b7d8763b86455da9e6b23e36d6 Merge branch 'add-files' into 'master'
# eb49186cfa5c4338011f5f590fac11bd66c5c631 Add submodules nested deeper than the root
# 18d9c205d0d22fdf62bc2f899443b83aafbf941f Add executables and links files
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gi... | 47.678571 | 85 | 0.865169 |
1d8f6162b84f1fb87d3327d9b7dfa9cdd3230259 | 3,630 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/methods', __FILE__)
describe "Time#localtime" do
it "converts self to local time, modifying the receiver" do
# Testing with America/Regina here because it doesn't have DST.
with_timezone("CST", -6) do
t = T... | 34.903846 | 106 | 0.610193 |
39f8292f398f7a2550c991a429c6dfcef224d6b7 | 2,983 | #-- 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, which is a fork of ... | 31.072917 | 91 | 0.658733 |
1a42786beb9751f44b1a50aede27b7e681557713 | 127 | # frozen_string_literal: true
require 'problem_details/document'
require 'problem_details/version'
module ProblemDetails
end
| 15.875 | 34 | 0.84252 |
381271e60ef8cec8ea6edf0437da522a4afb250c | 856 | # This migration comes from pwb (originally 20170716075456)
class CreatePwbPages < ActiveRecord::Migration[5.0]
def change
create_table :pwb_pages do |t|
t.string :slug
t.string :setup_id
# t.string :link_key
# t.string :link_path
t.boolean :visible, default: false
t.integer :l... | 34.24 | 61 | 0.670561 |
1d348ee7cc5cd45c21113b44bd78b5516feee4b4 | 1,652 | require 'spec_helper'
include Arbre::Html
describe StyleHash do
describe "initializer" do
it "should be able to be initialized without arguments" do
hash = StyleHash.new
expect(hash).to be_empty
end
it "should be able to be initialized with a hash" do
hash = StyleHash.new('one' => 'tw... | 28.482759 | 103 | 0.626513 |
e92fe0705f7803f2e808897f00543e0f301292c2 | 1,512 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "FedEx Error" do
before(:each) do
setup_fedex_responses
end
it "should handle blank response errors" do
use_fedex_response(:blank)
lambda { new_fedex.track(:tracking_number => fedex_tracking_number).size }.should raise_erro... | 48.774194 | 202 | 0.743386 |
e9c6927c852fcb53e05e21c91d3ccb31abcb77de | 687 | cask "font-fira-mono-nerd-font" do
version "2.1.0"
sha256 "f4e966bddbbd85826c72b5d6dfcf3c2857095f2e2819784b5babc2a95a544d38"
url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/FiraMono.zip"
appcast "https://github.com/ryanoasis/nerd-fonts/releases.atom"
name "FiraMono Nerd Font (Fira)... | 40.411765 | 90 | 0.765648 |
08efaaf3ecc5f33ce2e649e928e404115042de19 | 4,688 | module Pod
# Module which provides support for running executables.
#
# In a class it can be used as:
#
# extend Executable
# executable :git
#
# This will create two methods `git` and `git!` both accept a command but
# the later will raise on non successful executions. The methods return the
... | 26.788571 | 85 | 0.555034 |
870addeae32554a4e9df794278a17c003a0251e9 | 1,772 | # encoding: utf-8
require 'spec_helper'
describe Github::Client::Orgs::Members, '#member?' do
let(:org) { 'github' }
let(:member) { 'peter-murach' }
let(:body) { "" }
before {
stub_get(request_path).to_return(:body => body, :status => status,
:headers => {:content_type => "application/json; char... | 26.447761 | 71 | 0.633747 |
1a20db5d08e2eaa32942cbeebec5aa83ac3f2d0a | 599 | require 'helper'
class TestIpsumTime < Minitest::Test
def test_paragraph
assert_match /1\+|[ a-z]+/i, Faker::IpsumTime.paragraph
end
def test_sentence
assert_match /1\+|[ a-z]+\./i, Faker::IpsumTime.sentence
end
def test_paragraphs
assert_match /1\+|[ a-z]+/i, Faker::IpsumTime.paragraphs.join("... | 21.392857 | 70 | 0.657763 |
f7191a14e05c3a01af83ea7ed2289c873952d5bc | 778 | =begin
This file is part of SSID.
SSID is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SSID is distributed in the hope that it will ... | 35.363636 | 75 | 0.789203 |
5d022d7693f00630238ee833b42769b4aa310fe0 | 6,456 | require_relative "../test_helper"
class EventboxSanitizerTest < Minitest::Test
def test_untaggable_object_intern
eb = Class.new(Eventbox) do
sync_call def go(str)
shared_object(str)
end
end.new
err = assert_raises(Eventbox::InvalidAccess) { eb.go(eb.shared_object("mutable")) }
as... | 25.317647 | 87 | 0.656289 |
bf7cbef552c07778de54d7db97673a655b53f73b | 483 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
require 'redis'
require 'opentelemetry/sdk'
require 'minitest/autorun'
require 'fakeredis/minitest'
# global opentelemetry-sdk setup:
EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
sp... | 23 | 85 | 0.801242 |
ff66a09eab932c4c39c48d86edce646a6cf4156f | 3,480 | # frozen_string_literal: true
module MasterfilesApp
class ContractWorkerInteractor < BaseInteractor
def create_contract_worker(params) # rubocop:disable Metrics/AbcSize
res = validate_contract_worker_params(params)
return validation_failed_response(res) if res.failure?
id = nil
repo.tran... | 33.786408 | 166 | 0.724138 |
5dd48ec66f6e49e54827e71aca7c3a999a7299ff | 7,186 | # -*- encoding: utf-8 -*-
# stub: github-pages 168 ruby lib
Gem::Specification.new do |s|
s.name = "github-pages".freeze
s.version = "168"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["GitHub, Inc... | 57.951613 | 112 | 0.659059 |
1a445c8eda435a1e7fb371d35bf5d9008ecd6013 | 747 | require_relative "service"
module Adyen
class Payments < Service
attr_accessor :version
DEFAULT_VERSION = 64
def initialize(client, version = DEFAULT_VERSION)
service = "Payment"
method_names = [
:authorise,
:authorise3d,
:authorise3ds2,
:capture,
:can... | 21.342857 | 74 | 0.606426 |
1aea59cf2fe26b16b9d63c1873796346b949f195 | 289 | ## Adds Star Wars like holograms to site.
Class hologram
:attr_accessor :type, :gender
def initialize(type, gender)
@type = type
@gender = gender
end
def render_image(img)
live_image(img)
end
end | 13.761905 | 41 | 0.519031 |
7a96058789250b51e47bad543ff3cc0b67882bb6 | 6,684 | # Cookbook Name:: cerebro
include_recipe 'java::default' # Note this must exist for elasticsearch
# set vars
install_dir = node['cerebro']['install_dir']
fqdn_hostname = node['cerebro']['fqdn_hostname']
short_hostname = node['cerebro']['short_hostname']
machinename = node['cerebro']['machinename']
app_port = node['cer... | 35.365079 | 175 | 0.681329 |
e27476c2b6a02dcd2501e59e376539a8fb278de8 | 106 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'easy_rss'
require 'minitest/autorun'
| 21.2 | 58 | 0.745283 |
181f7bb1e8681c4b31c43fd4e44dec8d4e9fab4c | 2,428 | require 'java'
java_import 'org.apollo.game.model.Animation'
java_import 'org.apollo.game.model.Graphic'
java_import 'org.apollo.game.model.entity.Skill'
ALCHEMY_SPELLS = {}
ILLEGAL_ALCH_ITEMS = [995, 6529, 6306, 6307, 6308, 6309, 6310]
# A spell that alchemises an item.
class AlchemySpell < Spell
attr_reader :an... | 28.232558 | 97 | 0.700577 |
08fb92fe4228e058363a77602216af0b673896ef | 3,941 | require 'top_secret/version'
require 'rest-client'
require 'nokogiri'
require 'date'
require 'pry'
module TopSecret
class Scrape
def self.positive(url, pages, limit_to_return)
reviews = []
counter = 1
# replaces url and calls extract on correct number of pages starting with the first page.
... | 33.398305 | 140 | 0.676224 |
bb87cb5dd499e5620e04b13b5f8742396e816bd6 | 1,335 | =begin
#Ory APIs
#Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
The version of the OpenAPI document: v0.0.1-alpha.93
Contact: support@ory.sh
Generated by: https://openapi-generator.tech
O... | 30.340909 | 177 | 0.776779 |
7af6d3a977dc11ba163398ad8328b0854dcf162f | 5,561 | #--------------------------------------------------------------------
# @file localexecutormapping.rb
# @author Johnny Willemsen
#
# @brief walker class for local executor mapping support
#
# @copyright Copyright (c) Remedy IT Expertise BV
#--------------------------------------------------------------------
requ... | 27.805 | 117 | 0.598993 |
bfd462099b0bc9f2ee924f527ec42162737d26f5 | 450 | module HolidaysFromGoogleCalendar
class Configuration
DEFAULT_CACHE_SIZE = 1_000
attr_accessor :calendar, :credential, :cache, :preload
def initialize
@calendar = {
nation: "japanese",
language: "en"
}
@cache = {
enable: true,
max_size: DEFAULT_CACHE_SI... | 18 | 58 | 0.582222 |
1ab30f176fec5283c0d946aa280756deaf5af79a | 3,058 | ##
# This module requires Metasploit: http://www.metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex/zip'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::FileDropper
include Msf::Exploit::Remote::HTTP... | 33.23913 | 113 | 0.660889 |
1879b868be1d402d612883e1e4673f1389d6aa96 | 10,029 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/vision/v1/image_annotator.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
require 'google/cloud/vision/v1/geometry_pb'
require 'google/rpc/status_pb'
require 'google/type/color_pb'
require 'google/type/latlng_pb'
Goo... | 51.695876 | 161 | 0.753814 |
f822d38ce353d6880298f5e11734663dbc35f628 | 14,018 | # typed: false
RSpec.describe AttackAction do
let(:session) { Natural20::Session.new }
context do
before do
srand(1000)
@battle_map = Natural20::BattleMap.new(session, 'fixtures/battle_sim')
@battle = Natural20::Battle.new(session, @battle_map)
@character = Natural20::PlayerCharacter.lo... | 40.514451 | 115 | 0.582323 |
d583d72b5f4df4bb305aecb820eda03af8f786db | 3,024 | require "diagnostic"
require "fileutils"
require "hardware"
require "development_tools"
module Homebrew
module Install
module_function
def check_ppc
case Hardware::CPU.type
when :ppc
abort <<~EOS
Sorry, Homebrew does not support your computer's CPU architecture.
For P... | 30.545455 | 115 | 0.647156 |
acb2e67728e363515178d4fb43b198db9a25721a | 1,396 | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class HomogeneousIn < Node
attr_reader :attribute, :values, :type
def initialize(values, attribute, type)
@values = values
@attribute = attribute
@type = type
end
def hash
ivars.hash
... | 19.123288 | 85 | 0.565186 |
919bdc7923f0cccb67fbb7b3f587b11a15b5b7c8 | 206 | class User < ApplicationRecord
validates :email, :username, uniqueness: true, presence: true
validates :username, length: { in: 4..15 }
validates :password, presence: true, length: { minimum: 6 }
end
| 34.333333 | 63 | 0.718447 |
018770f86e0bf24b87df31d8c758ac7b956fd759 | 592 | module Hanuman
class Setting < ActiveRecord::Base
has_paper_trail
validates_uniqueness_of :key
def self.sort(sort_column, sort_direction)
order((sort_column + " " + sort_direction).gsub("asc asc", "asc").gsub("asc desc", "asc"))
end
def self.enable?(key)
k = find_by_key(key)
i... | 19.733333 | 96 | 0.565878 |
184508cb76de68d43cd39f06e0d00ea2b87333d4 | 20,505 | class TestPlansController < ApplicationController
# GET /test_plans
# GET /test_plans.xml
def index
# The index function is now a bit more complicated.
# The initial page lists all available products
# Opening the products should show a lis of test plans for the product
authorize! :read, TestPlan
... | 37.281818 | 172 | 0.640527 |
26f5666dc83ef64af4394f88029dbc0b46dc7c94 | 820 | class RexsterConsole < Formula
homepage "https://github.com/tinkerpop/rexster/wiki"
url "http://tinkerpop.com/downloads/rexster/rexster-console-2.6.0.zip"
sha256 "5f3af7bfc95847e8efa28610b23e2c175c6d92c14e5f3a468b9476cb1f2dfe1e"
bottle do
cellar :any
sha256 "affe578e75691159a7a850c8b144eaaabc58d8375d71... | 34.166667 | 95 | 0.769512 |
1caaff007ff27fcc4cd67dce878195bfb2dbabb0 | 177 | class AddIngredientsAndMethodToRecipe < ActiveRecord::Migration[5.1]
def change
add_column :recipes, :ingredients, :text
add_column :recipes, :method, :text
end
end
| 25.285714 | 68 | 0.751412 |
21bf1a87eb25e649bc29bc882de75111db6cdadf | 121 | require "disjoint_set_forest/version"
require "disjoint_set_forest/disjoint_set_forest"
module DisjointSetForest
end
| 17.285714 | 49 | 0.859504 |
e98ec3de5c715ffa2f5a11424738a5a8a79aaacb | 404 | require 'fastlane_core/ui/ui'
module Fastlane
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
module Helper
class BundletoolHelper
# class methods that you define here become available in your action
# as `Helper::BundletoolHelper.your_method`
#
def self.show_message
... | 23.764706 | 74 | 0.695545 |
91469ae975531a3628129d7582b6934c0a02733e | 609 | cask 'unity-linux-support-for-editor' do
version '2018.2.4f1,cb262d9ddeaf'
sha256 '0e333756d5ac328188f5f0c1e70f4a52c855b95638ac1de2d1b6c8b2d76c2ce8'
url "https://netstorage.unity3d.com/unity/#{version.after_comma}/MacEditorTargetInstaller/UnitySetup-Linux-Support-for-Editor-#{version.before_comma}.pkg"
appcast... | 38.0625 | 156 | 0.791461 |
1cf0b6dc46d9198a0c9764df9fb3ec28933775cb | 302 | class Ey::Core::Client::SslCertificates < Ey::Core::Collection
model Ey::Core::Client::SslCertificate
self.model_root = "ssl_certificate"
self.model_request = :get_ssl_certificate
self.collection_root = "ssl_certificates"
self.collection_request = :get_ssl_certificates
end
| 30.2 | 62 | 0.741722 |
3970b63cff00bc25a1f7d60728ba114f1c5a36c3 | 2,540 | Pod::Spec.new do |s|
s.name = 'IBMWatsonSpeechToTextV1'
s.version = '3.0.0'
s.summary = 'Client framework for the IBM Watson Speech to Text service'
s.description = <<-DESC
The IBM® Speech to Text leverages machine intelligence to transcribe the human voic... | 51.836735 | 121 | 0.551969 |
bf61f9e58c47ee7ab1fadc2676601523c184caa9 | 1,025 | require 'abstract_unit'
class SafeBufferTest < ActiveSupport::TestCase
def setup
@buffer = ActiveSupport::SafeBuffer.new
end
test "Should look like a string" do
assert @buffer.is_a?(String)
assert_equal "", @buffer
end
test "Should escape a raw string which is passed to them" do
@buffer << ... | 24.404762 | 62 | 0.68878 |
d52be119349d266f8b1af199745026d48027c18c | 273 | class TwitterUser < ActiveRecord::Base
has_many :tweets
def tweets_stale?
Time.new - self.tweets.last.updated_at >= 900
end
def fetch_tweets!
CLIENT.user_timeline(self.username).each do |tweet|
self.tweets.create(text: tweet.text)
end
end
end | 19.5 | 55 | 0.70696 |
87299dec1f45432e7d7d91d70e58e5baa1e7a47f | 62 | json.array!(
@posts,
partial: 'posts/post',
as: :post
)
| 10.333333 | 24 | 0.580645 |
ed6af755c052371c763362aaf989499297ba142e | 826 | module Catechism::Matchers
class Change < Struct.new(:operation, :negated, :subject)
attr_reader :expected_difference, :computed_difference
def by(expected_difference)
@expected_difference = expected_difference
raise failure_message unless valid?
end
def valid?
original_v... | 30.592593 | 105 | 0.690073 |
bf734c57058cf24f817be79f4edd3a49e24f54c2 | 1,897 | 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 on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 35.12963 | 85 | 0.762256 |
1c3ae0ccaab9096037b94018794d4f9534a75477 | 1,351 | require 'thor'
require 'csv'
module CtoD
class CLI < Thor
desc "export CSV DATABASE", "Export CSV data to DATABASE"
option :string_size, aliases:"-s", default:100
def export(from, to)
db = create_table(from, to)
db.export
puts "CSV data exported successfully."
end
desc "create_... | 30.704545 | 94 | 0.621762 |
d5b31799dce1836f9380587ebf3b159263c55c29 | 2,398 | # Adapted from https://github.com/Homebrew/homebrew-cask/blob/ef85fb108065ee36e0f8b4d0da9745c9ed5bde6b/Casks/libreoffice.rb
# Copyright © 2013, Paul Hinze & Contributors, released under the BSD 2-Clause License: https://github.com/Homebrew/homebrew-cask/blob/ef85fb108065ee36e0f8b4d0da9745c9ed5bde6b/LICENSE
# All rights... | 42.821429 | 183 | 0.755213 |
e85b97bfb0d0dae01d14a188134b874514939454 | 7,003 | RSpec.describe Organisations::PeoplePresenter do
include SearchApiHelpers
include OrganisationHelpers
describe "ministers" do
let(:people_presenter) { presenter_from_organisation_hash(organisation_with_ministers) }
it "formats data for image card component" do
expected = {
title: "Our mini... | 32.123853 | 115 | 0.593746 |
ac142f58c16a14714d14ba46bffc5f78831c5b7e | 727 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'bundler/setup'
require 'database_cleaner/active_record'
require 'pry'
require 'simplecov'
SimpleCov.start do
enable_coverage :branch
add_filter { |src| src.filename =~ %r,db/(connection|models|schema), }
add_filter 'spec/activerecord'
end
req... | 22.71875 | 75 | 0.76066 |
1860a1718e86de3cd465f8328efc57ee7e823fc5 | 344 | require File.expand_path('../test_helper', __FILE__)
require 'hopper/queue'
require 'hopper/channel'
module Hopper
module Test
class Listener
@channel = Hopper::Channel.new
@queue = Hopper::Queue.new("hopper-perftest-out").listener(@channel)
@queue.listen do |msg|
msg.acknowledge
... | 19.111111 | 74 | 0.668605 |
1d88129264c48ef5e42c3ac9f621d23ef73549b5 | 1,794 | require "spec_helper"
describe Volunteer do
describe '#name' do
it 'returns the name of the volunteer' do
test_volunteer = Volunteer.new({:name => 'Jane', :project_id => 1, :id => nil})
expect(test_volunteer.name).to eq 'Jane'
end
end
describe '#project_id' do
it 'returns the project_id ... | 31.473684 | 85 | 0.618729 |
26b97b1d86998ee378afdd4aae903642b5b91d2f | 87 | # desc "Explaining what the task does"
# task :good_item do
# # Task goes here
# end
| 17.4 | 38 | 0.678161 |
4ab485a417c2c44a4dd4027832186d627c1115e0 | 67 | module Houston
module Exceptions
VERSION = "0.0.1"
end
end
| 11.166667 | 21 | 0.671642 |
03e10639d632d6b79fd5ab0af2a844c27ff46aa2 | 1,468 | #
# Be sure to run `pod lib lint YourPod.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 = 'YourPod'
... | 35.804878 | 98 | 0.632834 |
e86d7de3acdaae9691d7a77985cf6736e0ee36f4 | 2,316 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Mapper definition DSL" do
include_context "container"
before do
configuration.relation(:users)
users = configuration.default.dataset(:users)
users.insert(name: "Joe", roles: ["admin", "user", "user", nil])
users.insert(name: "... | 24.638298 | 76 | 0.528929 |
bfa5f8561e206c074aaf186cfda13eef5c11a789 | 13,718 | require 'user_agent'
shared_examples_for "Firefox browser" do
it "should return 'Firefox' as its browser" do
@useragent.browser.should == "Firefox"
end
it "should return :strong as its security" do
@useragent.security.should == :strong
end
it { @useragent.should_not be_webkit }
end
describe 'Mozi... | 28.519751 | 145 | 0.68093 |
bfcce0441c7296a13b6ef9ce2080c53eef0e370b | 8,604 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop enforces the presence (default) or absence of parentheses in
# method calls containing parameters.
#
# In the default style (require_parentheses), macro methods are ignored.
# Additional methods can be a... | 28.117647 | 78 | 0.565783 |
4aadc4bab6175b2fb8c7bedcd8cc7245f66a9176 | 531 | # a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
module ActiveScaffold::UnsavedRecord
# acts like a dirty? flag, manually thrown during update_record_from_params.
def unsaved=(val)
@unsaved = (val) ? true : false
end
# whether the unsaved? flag has been thrown
... | 27.947368 | 93 | 0.728814 |
03ae1b8a3d0c072554ef46dc75d0236a3dafe00b | 3,503 | # encoding: utf-8
require "logstash/util"
require 'thread'
require 'java'
require 'logstash-output-google_cloud_storage_jars.rb'
java_import 'com.google.api.gax.rpc.FixedHeaderProvider'
java_import 'com.google.api.gax.retrying.RetrySettings'
java_import 'com.google.auth.oauth2.GoogleCredentials'
java_import 'com.goog... | 39.806818 | 179 | 0.568655 |
6a327068e25e8711457d053b44316b3f04de2adc | 11,922 | require 'rubygems/test_case'
require 'rubygems/commands/update_command'
begin
gem "rdoc"
rescue Gem::LoadError
# ignore
end
class TestGemCommandsUpdateCommand < Gem::TestCase
def setup
super
common_installer_setup
@cmd = Gem::Commands::UpdateCommand.new
@cmd.options[:document] = []
@spec... | 21.915441 | 80 | 0.620282 |
390ce96fa2dfe84ddda94dba5da7245ec8fc244f | 983 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 36.407407 | 62 | 0.747711 |
bb49383a704ae16a81d0be8faa78e0251f62073a | 956 | module Metamachine
# Handler of events
# Builds transition and contract
# Runs transition runner in the context of contract
class Dispatch
include DefInitialize.with('machine, event_name, target, params')
def call
build_transition.tap do |transition|
transition.contract!(transition.target... | 23.317073 | 69 | 0.666318 |
181c79fd0a6a8b34578155af360d9785bc73b938 | 236 | require "music-theory/note/name"
require "music-theory/note/value"
module MusicTheory
module Note
class << self
def new(*args)
Note::Name.find(*args)
end
alias_method :find, :new
end
end
end
| 11.8 | 33 | 0.618644 |
4a453d12a9844d683ac8279727b637643c3f2bc9 | 1,093 | # An API backup of user options for Farmbot OS.
class FbosConfig < ApplicationRecord
class MissingSerial < StandardError; end
belongs_to :device
after_save :maybe_sync_nerves, on: [:create, :update]
FIRMWARE_HARDWARE = [
ARDUINO = "arduino",
FARMDUINO = "farmduino",
FARMDUINO_K14 = "farmduino_k14"... | 25.418605 | 65 | 0.719122 |
e268f920ed38fac79c9a624f77b2273ce6e11557 | 4,997 | require_relative 'differ_test_base'
class DiffSummaryTest < DifferTestBase
def self.id58_prefix
'4DE'
end
# - - - - - - - - - - - - - - - - - - - - - - - -
test 'j12',
'created empty file' do
assert_diff_summary('RNCzUr', 2, 3,
:created, nil, 'empty.file', 0,0,0,
:unchanged, 'test_hike... | 33.092715 | 87 | 0.554333 |
01891696fb77a6cf8c03319ed7a65cc69e7e6a02 | 491 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... | 40.916667 | 98 | 0.769857 |
5de6d226cb16193212fe41dcfdd68bdd7abe7116 | 131 | class AddReviewsCountToItems < ActiveRecord::Migration[5.2]
def change
add_column :items, :reviews_count, :integer
end
end
| 21.833333 | 59 | 0.763359 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.