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 |
|---|---|---|---|---|---|
08b2cc97aa5057fa3be972b671874004430f14a7 | 426 | # frozen_string_literal: true
module RailsMiniProfiler
module ProfiledRequestsHelper
include ApplicationHelper
def formatted_duration(duration)
duration = (duration.to_f / 100)
duration < 1 ? duration : duration.round
end
def formatted_allocations(allocations)
number_to_human(allo... | 25.058824 | 113 | 0.699531 |
0132d17f75e9de8043a9fc2608de8669da42e595 | 1,541 | module Baseball
class CalcMostImproved
def self.do_it(to_year)
from_year_data, to_year_data = retrieve_data(to_year)
ensure_common_players(from_year_data, to_year_data)
to_avgs = get_averages(to_year_data).sort_by { |a| a[0][0] }
from_avgs = get_averages(from_year_data).sort_by { |a| ... | 25.683333 | 70 | 0.60026 |
6176b8e58834c964bfa52968199797a3a40e1a7a | 1,164 | #
# Copyright:: Copyright (c) 2017 GitLab 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 agre... | 27.714286 | 106 | 0.707045 |
3966a4d2b5044a561e09af1d832689aa1e2599cf | 2,066 | class TranslateToolkit < Formula
include Language::Python::Virtualenv
desc "Toolkit for localization engineers"
homepage "https://toolkit.translatehouse.org/"
url "https://files.pythonhosted.org/packages/ab/47/d7e0a2fddd457cef11b0f144c4854751e820b2fdaff7671f4b3ef05f5f0e/translate-toolkit-3.3.1.tar.gz"
sha256... | 43.041667 | 149 | 0.821394 |
acedcb5e3c06957c74e45aacd20879069a9d2460 | 2,732 | # -*- encoding : utf-8 -*-
require 'spec_helper'
#require 'marc'
describe Blacklight::Marc::Indexer::Formats do
let(:test_class) do
c = Class.new(Blacklight::Marc::Indexer)
c.send :include, Blacklight::Marc::Indexer::Formats
c
end
subject {test_class.new}
before do
subject.instance_eval do
... | 36.918919 | 110 | 0.625183 |
bf10f74d800b1aa988ef7365ed2ffd3717298c8d | 756 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "minima"
spec.version = "2.5.1"
spec.authors = ["Joel Glovier"]
spec.email = ["jglovier@github.com"]
spec.summary = "A beautiful, minimal theme for Jekyll."
spec.homepage = "https://github.com/jekyll/minima"
spec.license = "MIT... | 32.869565 | 95 | 0.662698 |
1dfd1568bc7d4c85b3ad4b5202b84fd8f950feaf | 347 | FactoryBot.define do
factory :network do
name { Faker::Name.name }
ip { Faker::Internet.ip_v4_cidr }
gateway { Faker::Internet.private_ip_v4_address }
dhcp_start { Faker::Internet.private_ip_v4_address }
dhcp_end { Faker::Internet.private_ip_v4_address }
vlan_id { Faker::Number.number(digits: ... | 28.916667 | 56 | 0.711816 |
91885e5b2bb151c08defef3b09e2b1b8dc8eeadf | 463 | module Mutations
class SortCurriculumResources < GraphQL::Schema::Mutation
argument :resource_ids, [ID], required: true
argument :resource_type, String, required: true
description "Sort targets and target groups"
field :success, Boolean, null: false
def resolve(params)
mutator = SortCurri... | 23.15 | 67 | 0.688985 |
1d22285602b07002d13996b95f4898991444984f | 1,583 | control 'V-14260' do
title 'Downloading print driver packages over HTTP must be prevented.'
desc "Some features may communicate with the vendor, sending system
information or downloading data or components for the feature. Turning off
this capability will prevent potentially sensitive information from bei... | 40.589744 | 102 | 0.71952 |
b92c04ca61f92a6abc92a1ad22f85d760f258804 | 38,578 | # HTTPClient - HTTP client library.
# Copyright (C) 2000-2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
#
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.... | 33.228252 | 149 | 0.661439 |
6a984d0ee2ed5d8440dc8c3968a890126d074bdb | 2,981 | require "etc"
# Bugfixed and interface-patched Nethack.
#
# This formula is based on the Nethack formula, and includes the
# patches from same. The original notes from the Nethack formula
# follow:
# - @jterk
#
# Nethack the way God intended it to be played: from a terminal.
# This build script was created referencing... | 31.378947 | 96 | 0.712848 |
e83742613d4d993063ec6be91dfa7e1b1999bfaa | 35,212 | require 'action_pack'
module Facebooker
module Rails
# Facebook specific helpers for creating FBML
#
# All helpers that take a user as a parameter will get the Facebook UID from the facebook_id attribute if it exists.
# It will use to_s if the facebook_id attribute is not present.
#
module ... | 40.660508 | 150 | 0.615642 |
26818eef661fa3236e879193cf62ecdcfc82f54e | 2,079 | #
# Author:: Stephen Delano (<stephen@chef.io>)
# Author:: Tim Hinderliter (<tim@chef.io>)
# Copyright:: Copyright 2010-2016, Chef Software Inc.
# 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 Li... | 32.484375 | 98 | 0.642136 |
38753ba4137841ef32e2278b57e1cd713bc2cd96 | 571 | cask 'vox' do
version '2730.1,1455479596'
sha256 '73afdc0f72a00b1b3721ace45acff7302ed79f08b593d61eb51f9a8823b4d6f2'
# devmate.com is the official download host per the vendor homepage
url "https://dl.devmate.com/com.coppertino.Vox/#{version.before_comma}/#{version.after_comma}/Vox-#{version.before_comma}.zip"
... | 38.066667 | 128 | 0.774081 |
edd435c4117a798c8c6b932ce3910ab2c8c33129 | 845 | require 'rails/generators'
require 'rails/generators/migration'
module Templateable
module Generators
class InstallGenerator < ::Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
desc "Add the migrations for DoubleDouble"
... | 33.8 | 115 | 0.695858 |
e9bb6f79abf3c1f98f85e8b3fb39513ce317fe26 | 888 | # mundi_api
#
# This file was automatically generated by APIMATIC v2.0 (
# https://apimatic.io ).
module MundiApi
# Request for creating a new Access Token
class CreateAccessTokenRequest < BaseModel
# Minutes to expire the token
# @return [Integer]
attr_accessor :expires_in
# A mapping... | 24.666667 | 65 | 0.647523 |
034273bbe0c2d7736b4ccc80f5e15a65c7b24cfb | 1,069 | describe AnsibleTowerClient::WorkflowJobTemplateNode do
let(:url) { "example.com/api/v1/workflow_job_template_nodes" }
let(:api) { AnsibleTowerClient::Api.new(AnsibleTowerClient::MockApi.new("1.1")) }
let(:raw_instance) { build(:response_instance, :workf... | 46.478261 | 120 | 0.640786 |
1de44dc17740c3f5cca97c28f9ffd9504f602518 | 404 | class UnreadEntryDeleterScheduler
include Sidekiq::Worker
sidekiq_options queue: :worker_slow
def perform
User.select(:id).find_in_batches(batch_size: 10_000) do |users|
Sidekiq::Client.push_bulk(
'args' => users.map{ |user| user.attributes.values },
'class' => 'UnreadEntryDeleter',
... | 23.764706 | 67 | 0.641089 |
1ca1934a63825513d66bf179c2d28b0349ffc0d1 | 4,952 | # rakemswin.rb
# Copyright 2004-2008 by wxRuby development team
# Released under the MIT-style wxruby2 license
# Compiling on Windows with Microsoft compiler - this is currently set
# up to support VS2005 (version 8.0 of the runtime)
# First, common Windows settings (shared with MingW)
require './rake/rakewindows'
#... | 33.234899 | 76 | 0.668215 |
e2f680454af855b736234f4c82d0fc21b254043c | 3,023 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
if Rails.env.production?
abort('The Rails environment is running in pro... | 42.577465 | 83 | 0.751571 |
39ac8368c94e4eee020fb8ddb181abea7a802ebf | 44,044 | # -*- coding: utf-8 -*-
=begin
TECSCDE - TECS Component Diagram Editor
Copyright (C) 2014-2015 by TOPPERS Project
The above copyright holders grant permission gratis to use,
duplicate, modify, or redistribute (hereafter called use) this
software (including the one made by modifying this software),
provided that... | 32.576923 | 117 | 0.588253 |
38dc60ba1d4c93fed935666b6cfd3dd62bc59cb4 | 1,945 | require 'test_helper'
module ActiveModelSerializers
module Test
class SerializerTest < ActionController::TestCase
include ActiveModelSerializers::Test::Serializer
class MyController < ActionController::Base
def render_using_serializer
render json: Profile.new(name: 'Name 1', descri... | 30.873016 | 122 | 0.717224 |
61b63ce059d65e99b889b9bb70ed3d92d9f6bd73 | 6,190 | require_relative 'config_helpers'
module Mock
module Client
class Exotel < Grape::API
helpers ConfigHelpers
desc 'Dumps status to a file. Which can be used later to validate'
post '/status_callback' do
data = params
filename_part = params[:CallSid] || "no-sid-#{Time.now}"
... | 32.925532 | 90 | 0.555897 |
08a8f5d90612e9f0c66414413331c6e6ad803350 | 3,754 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe Api::V1::UserRolesController, type: :controller do
describe "POST #create" do
it_behaves_like "check_auth", :post, :create
context "with auth" do
include_examples "auth"
let(:user) { User.create!(username: "admin") }
let... | 33.517857 | 95 | 0.605487 |
edaee683bc0db8939673e9dcb54b63a96af2f1f4 | 488 | #!/usr/bin/env ruby
require "sinatra"
require "browser_gui"
require "slim"
SLIM =<<EOF
h1 Hello from Slim
form action="/action" method="post"
| Name:
input type="text" name="text" size=30
br
input type="submit"
ul
- (1..3).each do |i|
li
- href = "/link/" + i.to_s
a href=href
= (i ==... | 14.787879 | 50 | 0.590164 |
390ba7e071fe0d387546bed37ed7b9e7be0351ba | 1,432 | =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::BtcTransactionFromUTXOFrom... | 27.018868 | 102 | 0.738827 |
5d43bd89903f706e747c5f6b017d05a1b6d7d8d5 | 5,072 | # Patches for Qt must be at the very least submitted to Qt's Gerrit codereview
# rather than their bug-report Jira. The latter is rarely reviewed by Qt.
class Qt < Formula
desc "Cross-platform application and UI framework"
homepage "https://www.qt.io/"
url "https://download.qt.io/official_releases/qt/5.11/5.11.2/... | 34.97931 | 104 | 0.676065 |
0819ab97997c0260dc539822ece3f56c0674c8ef | 394 | class BaseController < ApplicationController
respond_to :json
around_action :configure_time_machine
expose(:json_list) do
list = []
collection.map do |record|
list << record.json_mapping
end
list
end
def index
render json: json_list, status: :ok
end
private
def ilike?(str, ... | 15.76 | 55 | 0.682741 |
ff502db5713d7df289e632fca0f64740b49c706b | 2,699 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 38.557143 | 95 | 0.722119 |
33f20f4e0c111fb85f8583558a32f5299d91036a | 313 | require "forwardable"
require_relative "singular_resource"
module Clerk
module Resources
class Allowlist
extend Forwardable
def initialize(client)
@resource = SingularResource.new(client, "beta_features/allowlist")
end
def_delegators :@resource, :update
end
end
end
| 18.411765 | 75 | 0.709265 |
5dd74e987e7ae828dcb716834e399af32d9b3699 | 1,165 | class NilClass
def dup
nil
end
def method_missing(method, *args)
Util.trace("NilClass:undefined_method method=#{method} args=#{args}") if ENV["DEBUG"]
nil
end
def split(*val)
Array.new
end
def to_s
""
end
def strip
""
end
def +(val)
val
end
def closed?
true
en... | 16.408451 | 98 | 0.567382 |
28057079ebbc4ea42f4323cd6cbbac548c856b62 | 527 | module Linters
module Remark
class Tokenizer
VIOLATION_REGEX = /\A
\s+
(?<line_number>\d+):(?<start_column>\d+)
(-(?<end_line_number>\d+):(?<end_column>\d+))?
\s{2,}
(?:\e\[\d+m)?
(?<violation_level>\w+)?
(?:\e\[\d+m)?
\s{2,}
(?<message... | 20.269231 | 59 | 0.432638 |
9155eed52d3822695b5f9b601a9d4ffbeff08db8 | 1,355 | require "fit_commit/validators/base"
module FitCommit
module Validators
class LineLength < Base
MERGE_COMMIT = /\AMerge branch '[^']+' into ./
URL = %r{[a-z]+://}
def validate_line(lineno, text)
if lineno == 1
if text.empty?
add_error(lineno, "Subject line cannot ... | 29.456522 | 84 | 0.571218 |
396905a03770b3158369ad4a10a0661d5713ab5a | 694 | # frozen_string_literal: true
module RestoreStrategies
# Generic class to manipulate API resources as Ruby classes
class ApiCollectable < ApiObject
attr_accessor :path
# Add item to collection
def add(item)
RestoreStrategies.client.post_item(@path, item.to_payload)
end
# Remove item fro... | 19.828571 | 64 | 0.685879 |
038c362161b5ccd097f94159e73c378b176942b5 | 14,457 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | 48.19 | 154 | 0.751262 |
5d960482af23cc8f0b850e8f7f3fd9789f885fda | 7,552 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 32.978166 | 97 | 0.590969 |
e91c4f5d375069cfb37cac52f1fc7d2d54b46483 | 194 | require "rspec/core/rake_task"
desc "Run unit tests"
RSpec::Core::RakeTask.new(:test) do |t|
t.pattern = "spec/**/test_*.rb"
t.rspec_opts = ["--color", "--backtrace", "-Ilib", "-Ispec"]
end
| 27.714286 | 62 | 0.639175 |
7ac5cf127a8db0214901c345a2c003a8c578ebeb | 208 | class CreateComments < ActiveRecord::Migration[5.1]
def change
create_table :comments do |t|
t.text :body
t.integer :trader_id
t.integer :trade_id
t.timestamps
end
end
end
| 18.909091 | 51 | 0.653846 |
79466c1d4e77cf63810dc2668dc6df46fe493c3c | 160 | # frozen_string_literal: true
class AddIndexToForumThreads < ActiveRecord::Migration[4.2]
def change
add_index :forum_threads, :last_posted_at
end
end
| 20 | 59 | 0.7875 |
39eafec1b2c9e528a8a0615fdebeb17c763bf15f | 1,550 | require "language/node"
class Fanyi < Formula
desc "Mandarin and english translate tool in your command-line"
homepage "https://github.com/afc163/fanyi"
url "https://registry.npmjs.org/fanyi/-/fanyi-5.0.1.tgz"
sha256 "0f80edeac5e727a299c2a0807f463231143d59b46fd8308ef794390b9d88052c"
license "MIT"
bottle d... | 36.904762 | 122 | 0.765161 |
1d85b3bba46d36e33fa7ef9ba6794f42b4ebca33 | 372 | # frozen_string_literal: true
class CreateAudits < ActiveRecord::Migration[6.0]
def change
create_table :audits do |t|
t.references :planning_application, null: false, foreign_key: true
t.references :user
t.string :activity_type, null: false
t.string :activity_information
t.string :... | 23.25 | 72 | 0.701613 |
399bf1c43439e0ce4b4b50b5297b2ba71d199c24 | 6,027 | #
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright 2012-2016, Chef Software Inc.
# 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
#
# ... | 37.203704 | 151 | 0.641115 |
f8857c4c92e91bf67297ec4edad665b438955abb | 1,603 | require 'nats/io/client'
require 'openssl'
nats = NATS::IO::Client.new
nats.on_error do |e|
puts "Error: #{e}"
puts e.backtrace
end
tls_context = OpenSSL::SSL::SSLContext.new
tls_context.ssl_version = :TLSv1_2
# Deactivating this makes it possible to connect to server
# skipping hostname validation...
tls_conte... | 26.278689 | 95 | 0.718029 |
28365d10e787eaa8348017071f3e47f0a787f495 | 575 | # frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :... | 30.263158 | 96 | 0.782609 |
ab9576ec56046e5671f3ddd980e16c293804db8c | 530 | module FakeS3
class Bucket
attr_reader :name
def initialize(name)
@name = name
clear
end
def clear
@objects = {}
end
def objects(_ = {})
@objects.keep_if(&:exists?)
end
def object(key)
@objects[key] ||= FakeS3::Object.new(self, key, nil)
end
d... | 16.060606 | 58 | 0.566038 |
016f72e67f54bad07c37f6a30bd8b35383576114 | 822 | В Москве задержан мужчина, который зашел в церковь голкипера
Он вел себя спокойно и не совершал никаких противоправных действий; полиция передала его сотрудникам скорой психиатрической помощи.
Столичные полицейские задержали жителя Москвы, который зашел в одну из церквей без одежды.
Об этом сообщает агентство городских... | 74.727273 | 155 | 0.83455 |
5d3891ed76addc755ba343e9e2334764e0bb978a | 1,037 | class Xa < Formula
desc "6502 cross assembler"
homepage "https://www.floodgap.com/retrotech/xa/"
url "https://www.floodgap.com/retrotech/xa/dists/xa-2.3.11.tar.gz"
sha256 "32f2164c99e305218e992970856dd8e2309b5cb6ac4758d7b2afe3bfebc9012d"
bottle do
cellar :any_skip_relocation
sha256 "82ac5a005305bb5fd... | 34.566667 | 94 | 0.696239 |
03a6ea6f051f5d50bd70966c0fe93afc76c02bd1 | 746 |
require 'twitter'
require 'yaml'
config_path = File.expand_path('app_secret.yml', File.dirname(__FILE__))
$app_config = YAML.load_file(config_path)
def update_file(file_name)
data = YAML.load_file(file_name)
data = process_data(data)
file = File.open(file_name, 'w')
file.puts data.to_yaml
file.close
end
... | 19.128205 | 72 | 0.676944 |
79cb53b0b7444e5cc14fb9d94b953a57d08b76fd | 2,855 | module ApplicationHelper
# Link to the finding aid with the passed in label
def link_to_findingaid(doc, label = nil, opts = {})
url = get_url_for_findingaid_from_document(doc)
link_to (label || url), url, opts.merge({ :target => "_blank" })
end
# Abstract actually constructing the url to the finding a... | 35.246914 | 153 | 0.694921 |
3823bec9d1a23ab5513ebbc174e5b5d6c01b0aae | 194 | class Viscosity < Cask
url 'http://www.sparklabs.com/downloads/Viscosity.dmg'
homepage 'http://www.sparklabs.com/viscosity/'
version 'latest'
sha256 :no_check
link 'Viscosity.app'
end
| 24.25 | 56 | 0.737113 |
2104a273470144798767d4ffceb417bdda994c05 | 282 | # frozen_string_literal: true
describe file('/etc/cron.d/a') do
it { should_not exist }
end
describe file('/etc/cron.d/b') do
it { should exist }
end
describe file('/etc/cron.d/c') do
it { should_not exist }
end
describe file('/etc/cron.d/d') do
it { should exist }
end
| 15.666667 | 33 | 0.670213 |
26b6362708c88a8ca792488c4d9820770729c876 | 245 | # Use this hook to configure SellObject settings
SellObject.setup do |config|
# Set up the store name to be used on engines that wrap up their outputs under this single name.
config.store_name = '<%= Rails.application.class.parent_name %>'
end | 49 | 97 | 0.771429 |
bbc50082dbb4fb0249c134536370a0ccce12ca1e | 206 | class AddProjectIdToRequest < ActiveRecord::Migration
def self.up
add_column :requests, :project_id, :integer, :default=>nil
end
def self.down
remove_column :requests, :project_id
end
end
| 18.727273 | 62 | 0.737864 |
0339efdf6d3975bccacde9eb75734e67bd7e8f0f | 469 | require_relative '../spec_helper'
describe Runby do
it 'has a version number' do
expect(Runby::VERSION).not_to be nil
end
# End to end test
it 'tells me my ideal pace for a Long Run is 05:30-06:19, given a 5K time of 20:00' do
long_run = Runby::RunTypes::LongRun.new
five_k_time = Runby::RunbyTime.... | 29.3125 | 88 | 0.701493 |
4a0462b3ad4a723d40b1e637e18e50d1c76747ba | 42 | class Gman
VERSION = '7.0.2'.freeze
end
| 10.5 | 26 | 0.666667 |
ab9a4be404c6f3020bcb12b701218377142f98cf | 4,118 | # encoding: UTF-8
# --
# Copyright (C) 2008-2011 10gen 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 applicab... | 22.02139 | 97 | 0.528169 |
33d55fccb86d72c4f52cc6ea06aa9ca99f645a4a | 1,334 | require 'test_helper'
describe BrNfe::Product::Operation::NfeDownloadNf do
subject { FactoryGirl.build(:product_operation_nfe_download_nf) }
describe '#aliases' do
it { must_have_alias_attribute :chNFe, :chave_nfe }
end
describe 'Validations' do
describe '#chave_nfe' do
before { subject.stubs(:generate_ke... | 31.761905 | 96 | 0.743628 |
7a254b9528f22bec12f6ca4ea118c3b05b36124d | 2,330 | ##
# $Id: spree_searchlogic_exec.rb 12397 2011-04-21 19:38:42Z swtornio $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metaspl... | 29.493671 | 112 | 0.590129 |
e2e72d83d3b4c406715700b4a364ae62571d4b3a | 235 | require 'rspec'
require_relative 'dog'
RSpec.describe Dog do
it 'is hungry' do
dog = Dog.new
expect(dog.hungry?).to be true
end
it 'eats' do
dog = Dog.new
dog.eat
expect(dog.hungry?).to be false
end
end
| 13.055556 | 35 | 0.634043 |
4aabb423f2d08f43213f86c45eaffb5de805eb2a | 935 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dumpsync/version'
Gem::Specification.new do |spec|
spec.name = "dumpsync"
spec.version = Dumpsync::VERSION
spec.authors = ["Resonious"]
spec.email = ["metreck... | 37.4 | 85 | 0.634225 |
2810feb5b5aee4d0cb2b66387c708f7d6cad7aec | 967 | class ShopEmployerNotices::EeMidYearPlanChangeNotice < ShopEmployerNotice
attr_accessor :employer_profile, :hbx_enrollment
def initialize(employer_profile, args = {})
self.hbx_enrollment = HbxEnrollment.by_hbx_id(args[:options][:hbx_enrollment]).first
super(employer_profile, args)
end
def deliver
... | 31.193548 | 88 | 0.777663 |
2664d13cee0bd334e04491aa0dc2c70ad0b9584b | 7,093 | module Fastlane
class ActionsList
def self.run(filter: nil, platform: nil)
require 'terminal-table'
if filter
show_details(filter: filter)
else
print_all(platform: platform)
end
end
def self.print_all(platform: nil)
rows = []
all_actions(platform) do |a... | 33.457547 | 142 | 0.605245 |
f88fa77e9472b19ff5045eec41abd1acd38392c4 | 386 | module Bibliovore
# Parent class for all Collectnik errors
class BibliovoreError < StandardError
end
# Indicates a invalid page has been requested from a result set
class ApiError < BibliovoreError
end
# Indicates that the response couldn't be interpreted as a BiblioCommons API
# object or a proper er... | 27.571429 | 78 | 0.779793 |
1ca8dd7e86094a0a3a606c8dc02e67947d4d5998 | 1,670 | # rubocop:disable Style/Documentation
# rubocop:disable Style/DocumentationMethod
module Feedjira
module FeedEntryUtilities
include Enumerable
include DateTimeUtilities
def published
@published ||= @updated
end
def parse_datetime(string)
DateTime.parse(string).feed_utils_to_gm_time
... | 24.558824 | 80 | 0.633533 |
28dbff09551e0fa1be35a7ebc37b759f25efeb05 | 50 | module PivotalCardChecker
VERSION = "0.0.1"
end
| 12.5 | 25 | 0.74 |
b9445ee072f45d5ec00a0b352a930e6162dbe296 | 21,524 | require "cases/helper"
require 'models/club'
require 'models/company'
require "models/contract"
require 'models/edge'
require 'models/organization'
require 'models/possession'
require 'models/topic'
require 'models/reply'
require 'models/minivan'
require 'models/speedometer'
require 'models/ship_part'
Company.has_many... | 35.055375 | 131 | 0.732067 |
7a0dc441077855395a109f1a306df94ced9d60e5 | 1,238 | require 'spec_helper'
describe 'stackstate_agent::integrations::process' do
let(:facts) {{
operatingsystem: 'Ubuntu',
}}
let(:conf_dir) { '/etc/sts-agent/conf.d' }
let(:dd_user) { 'sts-agent' }
let(:dd_group) { 'root' }
let(:dd_package) { 'stackstate-agent' }
let(:dd_service) { 'stackstate-agent' }
... | 29.47619 | 79 | 0.634087 |
915f6d994a494bedd69f67bf1c41da11ea62d5f9 | 1,937 | describe Travis::Yml::Schema::Def::Jobs do
describe 'jobs_includes' do
subject { Travis::Yml.schema[:definitions][:type][:jobs_includes] }
# it { puts JSON.pretty_generate(subject) }
it do
should eq(
'$id': :jobs_includes,
title: 'Job Matrix Includes',
anyOf: [
{
... | 21.522222 | 94 | 0.410945 |
bf51ebb7fabf299851a00ceda276be075f5b89c1 | 3,392 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort('The Rails environment is running in production mode!') if Rails.env.production?
requ... | 44.631579 | 86 | 0.758255 |
793da793515bea90c16e067d3cc259d57d90ab43 | 371 | # frozen_string_literal: true
class PathLockPolicy < BasePolicy # rubocop:disable Gitlab/NamespacedClass
delegate { @subject.project }
condition(:is_author) { @user && @subject.user == @user }
condition(:is_project_member) { @user && @subject.project && @subject.project.team.member?(user) }
rule { is_author ... | 33.727273 | 100 | 0.74124 |
1ce051f91bb92ada20570d480b3b76a2caa71ffd | 814 | Pod::Spec.new do |s|
s.name = "react-native-waterfall"
s.version = "1.0.0"
s.summary = "基于UICollectionView实现的React Native 瀑布流"
s.description = <<-DESC
这是一个基于原生UICollectionView实现的React Native版本的瀑布流UI控件
s.homepage = "https://github.com/... | 40.7 | 117 | 0.579853 |
87650835b0557f37866ccdb50f9d7a11da8531aa | 10,705 | # frozen_string_literal: true
require 'spec_helper'
describe TodosFinder do
describe '#execute' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge... | 37.170139 | 123 | 0.59262 |
f7c0512d2cb696cd34480360068ed635d04d4d37 | 6,655 | # encoding: utf-8
#--
# Copyright 2013-2014 DataStax, 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 la... | 33.109453 | 132 | 0.675282 |
f8fb64a0ce4ca2423273d5bbaed7bdb555a9a255 | 4,317 | #=== config
# $transcript_file = "Trinity_Mono_130215.fasta"
# $min_len = 50 #aa
# $len_retain_long_orfs = 900 #bp
# $basefreqf = "#{$transcript_file}.base_freqs.dat"
# $cds_for_train = "orfs_for_round2_train.cds"
#===
### Parse command-line options
require 'optparse'
opt = OptionParser.new
opt.on('-t', '--transcript ... | 26.006024 | 121 | 0.702108 |
e2ce5d23411c4e2b5d981798051739c726a2294e | 137 | require File.expand_path('../../../spec_helper', __FILE__)
describe "Dir.home" do
it "needs to be reviewed for spec completeness"
end
| 22.833333 | 58 | 0.722628 |
1169dc9080d508c057028563af61f1441be7abc1 | 1,683 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hyperloop/console/version'
Gem::Specification.new do |spec|
spec.name = "hyper-console"
spec.version = Hyperloop::Console::VERSION
spec.authors = ["catmando"]
spec.em... | 44.289474 | 104 | 0.716578 |
f8b042a08f241e848ed0709eefec53f271b2047d | 841 | # frozen_string_literal: true
# rspec ./spec/lib/statistic_calcs/data_sets/data_set_spec.rb
require 'statistic_calcs/data_sets/data_set'
RSpec.describe StatisticCalcs::DataSets::DataSet do
subject { StatisticCalcs::DataSets::DataSet.new(x_values: x_values) }
before { subject.calc! }
describe '.mean' do
con... | 27.129032 | 71 | 0.596908 |
e2269a7d77b096000009f011914978db771cb08d | 1,882 | ##########################GO-LICENSE-START################################
# Copyright 2018 ThoughtWorks, 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/li... | 44.809524 | 165 | 0.687566 |
9147d1d81596e8757f89f015b994b1466f3626d6 | 3,433 | #!/usr/bin/env ruby
require 'logger'
class Backup
attr_accessor :name, :root, :timestamp_format, :workspace
attr_reader :log, :time
def initialize(config_file)
@log = Logger.new(STDOUT)
log.level = Logger::WARN
# Assume project name is backup config name
self.name = File.basename(config_file).... | 26.612403 | 95 | 0.652782 |
21c8f8ef63a50ea07b9ae4f33caa58ac8ae5f16f | 241 | json.array!(@apps) do |app|
json.extract! app, :id, :name, :updated_at, :url_token, :module_name, :view_count, :bundle_url
json.creator do
json.avatar_url app.creator.avatar.try(:url)
json.username app.creator.username
end
end
| 30.125 | 96 | 0.717842 |
914e9f01cae764edfcad1f3322a09b7172db826a | 354 | When /^I define a Metal endpoint called "([^\"]*)":$/ do |class_name, definition|
FileUtils.mkdir_p(File.join(RAILS_ROOT, 'app', 'metal'))
file_name = File.join(RAILS_ROOT, 'app', 'metal', "#{class_name.underscore}.rb")
File.open(file_name, "w") do |file|
file.puts "class #{class_name}"
file.puts definiti... | 32.181818 | 82 | 0.661017 |
03cff4bc593f82c7687caf7e5e5e129bdfacbc71 | 295 | class CreateSrcSetJoinTable < ActiveRecord::Migration[4.2]
def change
create_table :src_images_src_sets, :id => false do |t|
t.references :src_image
t.references :src_set
end
add_index :src_images_src_sets, [:src_image_id, :src_set_id],
:unique => true
end
end
| 26.818182 | 65 | 0.698305 |
03fd78e08094d5f2878f843b30d29db0915987e1 | 1,315 | RSpec.describe VisualizeRuby::Parser do
subject {
described_class.new(ruby_code).parse
}
let(:graph) {
instance_double(VisualizeRuby::Graph, nodes: nodes, edges: edges, name: "something", options: {})
}
let(:nodes) { subject.first }
let(:edges) { subject.last }
let(:ruby_code) {
<<-RUBY
... | 45.344828 | 432 | 0.652471 |
4a3bcba4cb6924ebc4c47d55debdbd54f51507de | 8,241 | class ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume < ::CloudVolume
supports :create
supports :snapshot_create
supports :update do
unsupported_reason_add(:update, _("The Volume is not connected to an active Provider")) unless ext_management_system
end
CLOUD_VOLUME_TYPES = {
:gp2 ... | 32.317647 | 151 | 0.533188 |
3809325e60167bef5d229ad71363e11d43e8b39c | 1,126 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'acts_as_data_table/version'
Gem::Specification.new do |spec|
spec.name = "acts_as_data_table"
spec.version = ActsAsDataTable::VERSION
spec.authors = ["Stefan Exner"]
... | 43.307692 | 180 | 0.686501 |
b9780691525b01dc42ba7b629e49590223291a2a | 1,216 | # -*- encoding: utf-8 -*-
# stub: jekyll-default-layout 0.1.4 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-default-layout".freeze
s.version = "0.1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.a... | 35.764706 | 112 | 0.684211 |
015d2b59fc58fb71028ca06a500bbc5255ef6d10 | 799 | module Rouge
module Guessers
class Filename < Guesser
attr_reader :fname
def initialize(filename)
@filename = filename
end
# returns a list of lexers that match the given filename with
# equal specificity (i.e. number of wildcards in the pattern).
# This help... | 30.730769 | 75 | 0.607009 |
e2b017d597a5aec93a62d2f58b1e32ef05b29a4a | 1,870 | class NatsServer < Formula
desc "Lightweight cloud messaging system"
homepage "https://nats.io"
url "https://github.com/nats-io/nats-server/archive/v2.1.0.tar.gz"
sha256 "39f0d465b841d116507aa70f8a2c6037f3ee9c0493a8d0d3989391be67946f70"
head "https://github.com/nats-io/nats-server.git"
bottle do
cellar... | 29.21875 | 106 | 0.650802 |
79fd9175e1199b079463c178f93150eacbf9bd2c | 264 |
class SongdownCompiler
class Tokens
VERSE_START = ':'
VERSE_END = /^---/
VERSE_COMMON_HEADER = /\:$/x
VERSE_CHORDS_HEADER = /\+$/x
VERSE_LYRICS_HEADER = /\-$/x
VERSE_ANY_HEADER = /[:+-]$/x
NEWLINE = "\n"
GOTO = /^\-\>/
end
end
| 18.857143 | 32 | 0.556818 |
037c876036e25c025cd4727a65b474e9126855eb | 6,646 | module BWAPI
class Client
module Admin
module Clients
# Subclients module for admin/subclient endpoints
module SubClients
# Get all sub clients
#
# @param id [Integer] Id of the client
# @param opts [Hash] options hash of parameters
# @optio... | 55.383333 | 103 | 0.652874 |
08b54369f4a9bfd2c5b32f2eb3263c705b3225ec | 1,461 | class MPlayerRequirement < Requirement
fatal true
default_formula "mplayer"
satisfy { which("mplayer") || which("mplayer2") }
end
class Mplayershell < Formula
desc "Improved visual experience for MPlayer on macOS"
homepage "https://github.com/donmelton/MPlayerShell"
url "https://github.com/donmelton/MPlay... | 32.466667 | 95 | 0.72553 |
03aa08909112eb1360aa450de20c38ab9b5c6711 | 946 | # 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, ... | 32.62069 | 74 | 0.733615 |
bb162ba0fd3377bf77cf5e2b4449227a7c8c5a4e | 45 | module FeatureSystem
VERSION = "0.0.3"
end
| 11.25 | 20 | 0.711111 |
edab9322dcbe5b030c3cd797c7d4b54ddebbd525 | 822 | class Doodle
module Equality
# two doodles of the same class with the same attribute values are
# considered equal
def eql?(o)
o.kind_of?(Doodle::Core) &&
self.class == o.class &&
doodle.key_values_without_defaults.all? { |k, v| o.respond_to?(k) && v.eql?(o.send(k)) }
# ... | 35.73913 | 118 | 0.635036 |
b997300714fe0c5c1330299b5445a167bf6d8790 | 170 | require File.expand_path('../../../../spec_helper', __FILE__)
describe "FFI::MemoryPointer#write_string_length" do
it "needs to be reviewed for spec completeness"
end
| 28.333333 | 61 | 0.747059 |
bb8321220a1d868375e8d8a419bec34919fba3f2 | 147 | module ZicrouViewTool
class Renderer
def self.copyright name, msg
"© #{Time.now.year} | <b>#{name}</b> #{msg}".html_safe
end
end
end
| 18.375 | 62 | 0.666667 |
79a7345c909b483bf42187793ed074cf631eeff8 | 758 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = users(:jacqlyn)
@non_admin = users(:mookie)
end
test "index as admin" do
log_in_as(@admin)
get users_path
assert_template 'users/index'
first_page_of_users = User.paginate(page: 1)
fi... | 23.6875 | 66 | 0.66095 |
0836b71056c7a7d0e44266b3dbb61ba991e494f0 | 11,829 | require('spec_helper')
describe Projects::IssuesController do
let(:project) { create(:project_empty_repo) }
let(:user) { create(:user) }
let(:issue) { create(:issue, project: project) }
describe "GET #index" do
context 'external issue tracker' do
it 'redirects to the external issue tracker' do
... | 30.17602 | 112 | 0.645025 |
ff531f0d60fe7c89ab7dad4c4eb1c5d5a5a34f23 | 7,724 | # Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 27.784173 | 78 | 0.557742 |
5d54f45eac92470386b38429ddf7b2ba12b84efa | 576 | module Awsborn
class GitBranch
attr_reader :branch
def initialize (branch)
require 'git'
@branch = branch
end
def file (path)
path, file = File.split(path)
repo = Git.open(root)
tree = repo.branches[branch].gcommit.gtree
path.each { |dir| tree = tree.subtree... | 19.2 | 61 | 0.576389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.