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 |
|---|---|---|---|---|---|
91de77babdc7b68bf1507df79f2164041eb01a0d | 212 | class AddPhoneOnlyToQuestionType < ActiveRecord::Migration[4.2]
def self.up
add_column :question_types, :phone_only, :boolean
end
def self.down
remove_column :question_types, :phone_only
end
end
| 21.2 | 63 | 0.759434 |
f8faf425f3c3dd180a7faebd87137008ef3369f6 | 10,226 | # Methods and variables for interacting with the gnuplot process. Most of
# these methods are for sending data to a gnuplot process, not for reading from
# it. Most of the methods are implemented as added methods to the built in
# classes.
require 'matrix'
module Gnuplot
# Trivial implementation of the which c... | 26.086735 | 115 | 0.584588 |
1875474ecbfc2f608ccbfa62f8a95c32a001c754 | 119 | # frozen_string_literal: true
FactoryBot.define do
factory :source do
name { "SR Player's Handbook" }
end
end
| 14.875 | 35 | 0.714286 |
2871028335a1d54e49b407f4973e511057770ddc | 1,064 | helper = Nrsysmond::InstallHelper.new(node)
template '/opt/local/etc/nrsysmond.cfg' do
source 'nrsysmond.cfg.erb'
owner 'root'
group helper.process_group
mode 0640
variables(
license: node['nrsysmond']['license'],
logfile: node['nrsysmond']['logfile'],
loglevel: node['nrsysmond']['loglevel'],
... | 26.6 | 56 | 0.693609 |
1a3be8e3c2badf08fc1d2d9229143129173f3928 | 125 | module Twilio
module REST
class ConnectApps < ListResource; end
class ConnectApp < InstanceResource; end
end
end
| 17.857143 | 44 | 0.744 |
d5d5fe62e7f0b32aa4a71a98b284fb2b4d9943e8 | 352 | cask 'cinch' do
version '1.2.3'
sha256 '62589f8f7d08e537dcadea97a4cb35243db2b8a63efc25a21317814f732c5c11'
url "https://www.irradiatedsoftware.com/downloads/Cinch_#{version}.zip"
appcast 'https://www.irradiatedsoftware.com/updates/profiles/cinch.php'
name 'Cinch'
homepage 'https://www.irradiatedsoftware.com... | 29.333333 | 75 | 0.772727 |
081df23f394dd400d8aa8c5ecf69f0f1c1d09909 | 606 | # rubocop:disable RemoveIndex
class RemoveKeysFingerprintIndexIfExists < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
# https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/250
# That MR was added on gitlab-ee so we need to check if the index
# already exists... | 26.347826 | 75 | 0.744224 |
334f2cff9b656100f163c2dc786dbbee74cb43c2 | 1,783 | class Cpprestsdk < Formula
desc "C++ libraries for cloud-based client-server communication"
homepage "https://github.com/Microsoft/cpprestsdk"
url "https://github.com/Microsoft/cpprestsdk/archive/v2.9.1.tar.gz"
sha256 "537358760acd782f4d2ed3a85d92247b4fc423aff9c85347dc31dbb0ab9bab16"
head "https://github.com... | 39.622222 | 103 | 0.661245 |
d58eac224edfd63a71695aa03062cff34f941b35 | 184 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "DriverPool" do
it "should be a hash" do
Sauce.driver_pool.should be_an_instance_of Hash
end
end | 23 | 68 | 0.75 |
3371fe7d5ef0619dcfa8f39f278e65387caa28cf | 1,458 | module Issues
class UpdateService < Issues::BaseService
def execute(issue)
state = params[:state_event]
case state
when 'reopen'
Issues::ReopenService.new(project, current_user, {}).execute(issue)
when 'close'
Issues::CloseService.new(project, current_user, {}).execute(iss... | 30.375 | 79 | 0.620027 |
e22691f4a7b47f0886555d70a3147ec82d08359e | 39,581 | # 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::V2020_08_01
#
# IpGroups
#
class IpGroups
include MsRestAzure
#
# Creates and initializes a new instance o... | 43.210699 | 145 | 0.697178 |
03e66a26c2b0452bcb8e51cd634146aedb349205 | 1,124 | # -*- coding: binary -*-
require 'erb'
module Rex
module Proto
module Http
###
#
# This class is used to wrapper the calling of a procedure when a request
# arrives.
#
###
class Handler::Proc < Handler
#
# Initializes the proc handler with the supplied procedure
#
def initialize(server, procedure, virt_dir = fal... | 18.129032 | 78 | 0.69306 |
4abde4837768e309722fc61e99763640c90659be | 405 | cask "mindforger" do
version "1.52.0"
sha256 "bae855dad678b54a557829877320ee892958be0e20de8661a6d4ee7e3b62bcd0"
url "https://github.com/dvorka/mindforger/releases/download/#{version}/mindforger-macos-#{version}.dmg",
verified: "github.com/dvorka/mindforger/"
name "MindForger"
desc "Thinking notebook an... | 31.153846 | 106 | 0.758025 |
ed44be05a7ffb78c690d46f3ad97bb95f6a71c6a | 11,208 | =begin
The wallee API allows an easy interaction with the wallee 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 required by applicab... | 32.393064 | 184 | 0.632316 |
bfe088534635a834ecf9db1dfda9d117dc0177dd | 842 | require 'rails_helper'
RSpec.describe FeedPostsController, type: :controller do
let(:user) { create :user }
before { sign_in user }
describe '#index' do
subject { get :index }
let!(:post) { create :post, user: user }
it 'assigns @posts' do
subject
expect(assigns(:posts)).to eq([post])... | 22.157895 | 78 | 0.627078 |
269ad63582e46589f097934020bc1ead0745cd2a | 2,848 | # 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::V2019_02_01
module Models
#
# Response for ListVirtualNetworkTap API service call.
#
class VirtualNetworkTapL... | 28.48 | 80 | 0.535112 |
bf823f68b3739b22df65544fb508482552239e7c | 788 | class Iroha < Formula
desc "Hyperledger Iroha — distributed ledger technology platform"
homepage "http://iroha.tech/en"
url "https://github.com/hyperledger/iroha.git", :branch => "master"
head "https://github.com/hyperledger/iroha.git"
version "v1.0_alpha"
depends_on "cmake" => :build
depends_on "auto... | 26.266667 | 69 | 0.678934 |
1daedc11aab36b20344230e0bf47eaf4d353bb9e | 32,303 | # frozen_string_literal: true
# Copyright 2021 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 applicabl... | 32.761663 | 165 | 0.555862 |
62ca297afaa4ff008979b3b64c97f4e366a812c0 | 823 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v6/resources/income_range_view.proto
require 'google/protobuf'
require 'google/api/field_behavior_pb'
require 'google/api/resource_pb'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
... | 29.392857 | 146 | 0.750911 |
ac36fdec0148a4e6163d11f2d61e8b07530a7910 | 1,161 | module HealthDataStandards
module Import
module C32
class ImmunizationImporter < CDA::SectionImporter
def initialize(entry_finder=CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.117']/cda:entry/cda:substanceAdministration"))
super(entry_finder)
... | 40.034483 | 169 | 0.699397 |
ab8504c25bc5d6af3a1280454b058635967a048f | 298 | module Spree
StoreController.class_eval do
# Check if all products in cart are still live.
# Also, delete line item if any of the products from cart is expired.
def check_active_products_in_order
current_order.delete_inactive_items unless current_order.nil?
end
end
end
| 24.833333 | 73 | 0.755034 |
18bde5dd897a3fda180b80f328f82fc286bdaa48 | 17,333 | require 'formula'
# This is a non-functional example formula to showcase all features and
# therefore, its overly complex and dupes stuff just to comment on it.
# You may want to use `brew create` to start your own new formula!
# Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
## Naming -- ... | 42.070388 | 103 | 0.69711 |
7abf87fced6350dbdb1a06cdcebc33199a63fc8f | 25 | module AccueilHelper
end
| 8.333333 | 20 | 0.88 |
e2652733c69b149cd6d43f9b0f2616c0ef170519 | 589 | require 'mysqlcnfparse/lines'
require 'mysqlcnfparse/generator'
module MysqlCnfParse
class Parser < IniParse::Parser
self.parse_types = self.parse_types + [ MysqlCnfParse::Lines::Include, MysqlCnfParse::Lines::IncludeDir ]
# Parses the source string and returns the resulting data structure.
#
# ===... | 24.541667 | 109 | 0.66893 |
286aee65bcaab634c85a05168ef470eff3b3aaf8 | 190 | =begin
Write your code for the 'House' exercise in this file. Make the tests in
`house_test.rb` pass.
To get started with TDD, see the `README.md` file in your
`ruby/house` directory.
=end
| 23.75 | 72 | 0.742105 |
1ca9b2cf92770c6bf7f796cd91ecad8f8682dfd7 | 7,709 | =begin
#OpenLattice API
#OpenLattice API
The version of the OpenAPI document: 0.0.1
Contact: support@openlattice.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'date'
module OpenapiClient
class DataSetColumn
attr_accessor :id
attr_accessor :data_s... | 29.090566 | 206 | 0.60812 |
bf6bc5bf1144631826e245671b5e9bec21e4cec9 | 5,031 | require "byebug"
require_relative "../lib/circuitdata"
require_relative "./support/fixture_helpers"
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` whi... | 47.914286 | 92 | 0.743987 |
1ac89033b13fee1875924d101d36aef6f07223c5 | 906 | #
# Cookbook:: chef-yum-docker
# Recipe:: default
#
# Copyright:: 2016-2017, Chef Software, 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... | 29.225806 | 74 | 0.717439 |
f73871b7e445c96722058adb1d3b97deb45ebf9d | 6,963 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RateLimitedService do
let(:key) { :issues_create }
let(:scope) { [:project, :current_user] }
let(:opts) { { scope: scope, users_allowlist: -> { [User.support_bot.username] } } }
let(:rate_limiter_klass) { ::Gitlab::ApplicationRateLimiter }
l... | 35.345178 | 186 | 0.691369 |
7998dd840a926fa4be4999799c7517a6aaf46f20 | 1,634 | require File.dirname(__FILE__) + '/test_helper.rb'
module Ubiquitously
class DiggTest < ActiveSupport::TestCase
=begin
context "Digg::Account" do
setup do
@user = Ubiquitously::Digg::Account.new
end
context "login" do
should "raise informative error if invalid passwor... | 28.172414 | 157 | 0.574051 |
ace822d4520339dc1bfb32d1b288e4ca777968f4 | 964 | require 'rubygems'
require 'bundler'
Bundler.setup
require 'active_support'
require File.dirname(__FILE__) + '/scalr/response'
require File.dirname(__FILE__) + '/scalr/request'
require File.dirname(__FILE__) + '/scalr/core_extensions/hash'
require File.dirname(__FILE__) + '/scalr/core_extensions/http'
module Scalr
... | 21.422222 | 105 | 0.674274 |
2614b4635bc577abdd9593291e5d4340bab95f69 | 1,341 | require 'experian'
require 'minitest/autorun'
require 'minitest/pride'
require 'webmock/minitest'
require 'mocha/setup'
require 'timecop'
def fixture_path
File.expand_path("../fixtures", __FILE__)
end
def fixture(product, file)
File.read("#{fixture_path}/#{product}/#{file}")
end
def stub_experian_uri_lookup
Ex... | 31.186047 | 155 | 0.740492 |
bbda44afdd317ad2d4bd2873f79bf2314847851f | 1,165 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
# Settings in config/environments/* take precedenc... | 41.607143 | 99 | 0.73133 |
79c8ce550c8d652000041b003c95c13e23a7a927 | 192 | module Byebug
#
# Common parent class for all of Byebug's states
#
class State
attr_reader :interface
def initialize(interface)
@interface = interface
end
end
end
| 14.769231 | 50 | 0.671875 |
ab2be835c0f800e9ca4b2f2bfb1a3a4515b1644a | 137 | # encoding: UTF-8
# frozen_string_literal: true
Date::DATE_FORMATS[:short] = '%m-%d'
Time::DATE_FORMATS[:default] = "%Y-%m-%d %H:%M:%S"
| 22.833333 | 50 | 0.649635 |
ed8f60604cc7cb105c8f085ead51b14c7c063e6d | 1,722 | class Moc < Formula
desc "Terminal-based music player"
homepage "http://moc.daper.net"
url "http://ftp.daper.net/pub/soft/moc/stable/moc-2.5.0.tar.bz2"
sha256 "d29ea52240af76c4aa56fa293553da9d66675823e689249cee5f8a60657a6091"
bottle do
revision 1
sha256 "3188a4355200b250e6a63c909c6ef8a7a458e25377a6a1... | 31.309091 | 95 | 0.708479 |
08e28dd86f3615bd74e3bae0d5aa04653841c99e | 1,421 | class Torchvision < Formula
desc "Datasets, transforms, and models for computer vision"
homepage "https://github.com/pytorch/vision"
url "https://github.com/pytorch/vision/archive/v0.9.1.tar.gz"
sha256 "79964773729880e0eee0e6af13f336041121d4cc8491a3e2c0e5f184cac8a718"
license "BSD-3-Clause"
revision 1
bo... | 34.658537 | 101 | 0.676988 |
18a6d30b6ef19db6d1be77a7e60ac0b0a97ad7fb | 1,447 | module HomeHelper
def render_team
content = ''
@team.each_slice(6) do |row|
content << render_team_members(row)
end
return content.html_safe
end
def render_alumni
content = ''
@alumni.each_slice(6) do |row|
content << render_alumni_rows(row)
end
return content.html_safe
end
private
def ren... | 29.530612 | 118 | 0.664133 |
38e7e249fa73344d1aeaddb7dc1492a8a6fa2627 | 274 | # This migration comes from almanac (originally 20121114043648)
class ChangeDefaultValueForBackgroundTilesInAlmanacBlogs < ActiveRecord::Migration
def self.up
change_column :almanac_blogs, :background_tile, :boolean, :default => true
end
def self.down
end
end
| 24.909091 | 82 | 0.791971 |
ab42573fdc271fbd04d0694ead6093feab7effa1 | 1,357 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 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,... | 38.771429 | 91 | 0.762712 |
e8339003f4323cc0dcbf7c93fc73596ab22fe31e | 38 | module Quetcd
VERSION = "0.1.0"
end
| 9.5 | 19 | 0.657895 |
62cef603999da80ef1f7229ef853f2df9f4ac8c7 | 7,303 | require "test_helper"
class RBS::EnvironmentTest < Minitest::Test
include TestHelper
Environment = RBS::Environment
Namespace = RBS::Namespace
InvalidTypeApplicationError = RBS::InvalidTypeApplicationError
def test_entry_context
decls = RBS::Parser.parse_signature(<<EOF)
class Foo
module Bar
modu... | 18.822165 | 84 | 0.628509 |
e940090d8a02ff2b09cf8d24a1f34b9e01c8f026 | 256 | module Rubybear
module Type
class Hash < Serializer
def initialize(value)
super(:hash, true)
end
def to_bytes
pakHash(@value)
end
def to_s
@value.to_json
end
end
end
end
| 14.222222 | 27 | 0.523438 |
28754e3d7d2e248eba1dc5c7e08ac86ba83e4391 | 469 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the MeditationSessionsHelper. For example:
#
# describe MeditationSessionsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this t... | 29.3125 | 71 | 0.729211 |
6aada6d5a47c4898bb7a8d0ca355d97044080f99 | 250 | module Travis
module Addons
module Campfire
module Instruments
require 'travis/addons/campfire/instruments'
end
require 'travis/addons/campfire/event_handler'
class Task < ::Travis::Task; end
end
end
end
| 17.857143 | 52 | 0.668 |
1dff4ee0b9f0c56e0a8b552987e025a39b3c903b | 945 | # Run `pod lib lint' to ensure this is a valid spec.
Pod::Spec.new do |s|
s.name = 'KeyboardKit'
s.version = '4.8.0'
s.swift_versions = ['5.3']
s.summary = 'KeyboardKit helps you create keyboard extensions for iOS.'
s.description = <<-DESC
KeyboardKit is a Swift library ... | 37.8 | 107 | 0.61164 |
9189a0558f8ad3e3e09518efac221f6fd904cfdf | 1,141 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-datasync'
spec.version = File.read(Fil... | 38.033333 | 117 | 0.659947 |
035eaf88634036e35cdadde4086329498d60ef30 | 385 | When /^I run kumade$/ do
run_simple("bundle exec kumade", must_be_successful = false)
end
When /^I run kumade with "([^"]+)"$/ do |args|
run_simple("bundle exec kumade #{args}", must_be_successful = false)
end
Given /^a directory set up for kumade$/ do
create_dir('the-kumade-directory')
cd('the-kumade-directo... | 24.0625 | 70 | 0.719481 |
61be661c5a9e18e8135d944a5bfb589d901285e3 | 3,404 |
#
# testing ruote
#
# Fri Jul 3 19:46:22 JST 2009
#
require File.expand_path('../base', __FILE__)
class FtConditionalTest < Test::Unit::TestCase
include FunctionalBase
def test_string_equality
pdef = Ruote.process_definition :name => 'test' do
set :f => 'd', :val => '2'
sequence do
... | 20.506024 | 59 | 0.485311 |
01951483f560d3d9bab603f5c1295f1cfcefc23f | 3,044 | # frozen_string_literal: true
RSpec.describe Worklog::Duration do
let(:seconds) { 16_200 }
let(:duration) do
described_class.new(seconds: seconds)
end
describe '.new' do
it 'creates an instance' do
expect(described_class.new(seconds: 30)).not_to be_nil
end
end
describe '.parse' do
... | 22.548148 | 60 | 0.630749 |
6a086ea311e4caef2d377e577bc99538bdff42a8 | 1,307 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :name, presence: true, length: { maximum: 20... | 32.675 | 107 | 0.755164 |
f7cfe3ea278023877582a30f1582145c394d24c0 | 153 | # frozen_string_literal: true
class Deck < ActiveRecord::Base
validates :name, presence: true
belongs_to :user
has_and_belongs_to_many :cards
end
| 19.125 | 33 | 0.784314 |
2851f08c63a51a55b0269c28f208d8dfe6469bc1 | 3,491 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'User interacts with other users', js: true do
context 'As a global super administrator' do
include_context 'login_with_super_admin'
before :each do
Bullet.enable = false
@org = create :organization
@org2 = create :organi... | 34.22549 | 132 | 0.665712 |
e9672a63c9bfb0fd141b35d729336416c4b177a5 | 506 | module ApplicationHelper
# Returns the full title on a per-page basis. # Documentation comment
def full_title(page_title = '') # Method def, optional arg
base_title = "Ruby on Rails Tutorial Sample App" # Variable assignment
if page_title.empty? # Boo... | 38.923077 | 80 | 0.55336 |
bfdd3005ecffd5162c7af480c627ffec193db74c | 6,163 | #encoding :utf-8
module ModeloQytetet
class Jugador
#Modificadores y consultores
attr_accessor :casilla_actual,:encarcelado
#Modificadores
attr_writer :carta_libertad
#Consultores
attr_reader :propiedades, :nombre
#Variables de clase:
@@factor_especulador = 1
... | 22.741697 | 103 | 0.600357 |
012dcf77c4d77a89a3d37793156c79a0e027ab39 | 2,943 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 31.308511 | 79 | 0.673462 |
ffc7b275ab2bcf3f0e66a8ee12fdeab66edf5277 | 262 | # Only works in Ruby 2.6+
RSpec.describe ValueSemantics::RangeOf do
subject { described_class.new(Integer) }
it 'matches beginless ranges' do
is_expected.to be === (1..)
end
it 'matches endless ranges' do
is_expected.to be === (..10)
end
end
| 20.153846 | 42 | 0.675573 |
bb35c0aa14a956e81b07b85900524509174c0804 | 298 | class CreateCourses < ActiveRecord::Migration
def change
create_table :courses do |t|
t.string :name
t.string :course_code
t.string :color
t.string :period
t.text :description
t.date :started_on
t.date :ended_on
t.timestamps
end
end
end
| 18.625 | 45 | 0.630872 |
18d519ff8dc9760be3e6bdbe4b2f754c1185eedc | 1,915 | module Suit # :nodoc:
module Models # :nodoc:
module Matchers
# 'newer_than' named scope which retrieves items newer than given date
# requires that the class have a factory
# Tests:
# scope :newer_than, lambda { |time| {:conditions => ["created_at < ?", time || 1.day.ago] } }
... | 31.916667 | 110 | 0.564491 |
01267a2db72d2fedc5041a0f76ab4bee3b422164 | 542 | require "simplecov"
SimpleCov.start do
add_filter "/spec/"
end
require "bundler/setup"
require "relaton_iev"
require "rspec/matchers"
require "equivalent-xml"
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.exam... | 22.583333 | 66 | 0.736162 |
91d1554e6d06e6e3de270c293fc3731b546d0813 | 44 | module PassCountSim
VERSION = "0.0.1"
end
| 11 | 19 | 0.704545 |
38d19923ab615116febfede659e98265e17eee3a | 1,341 | describe :dir_delete, :shared => true do
before :all do
DirSpecs.rmdir_dirs
end
after :all do
DirSpecs.rmdir_dirs false
end
it "removes empty directories" do
Dir.send(@method, DirSpecs.mock_rmdir("empty")).should == 0
end
ruby_version_is "1.9" do
it "calls #to_path on non-String argumen... | 27.9375 | 92 | 0.686801 |
0850f98455944b7c958fcca0a4ffb32eb89fc97d | 1,226 | #
# Author:: Matt Wrock (<matt@mattwrock.com>)
#
# Copyright:: (C) 2015, Matt Wrock
#
# 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
#
# Unles... | 32.263158 | 79 | 0.717781 |
01b85c9b571d69be0838a860bcf21c58ce373be9 | 1,638 | #
# Be sure to run `pod lib lint FluxCapacitor.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'FluxCa... | 38.093023 | 110 | 0.642857 |
2639a93875e1f55a67f9a42118bb68140e542552 | 5,437 | class Gdal < Formula
desc "Geospatial Data Abstraction Library"
homepage "http://www.gdal.org/"
url "https://download.osgeo.org/gdal/2.3.0/gdal-2.3.0.tar.xz"
sha256 "6f75e49aa30de140525ccb58688667efe3a2d770576feb7fbc91023b7f552aa2"
bottle do
sha256 "00b28455769c3d5d6ea13dc119f213f320c247489cb2ce9d03f7791... | 33.561728 | 112 | 0.650543 |
03c590f89e5439cc4054773e8aa119027d541344 | 338 | #!/usr/bin/ruby
class Foo
def initialize (&block)
puts "inti!! #{ self } #{block}"
obj = {foo: 'bar'}
if block_given?
yield
instance_eval &block
obj.instance_eval &block
1992.instance_eval &block
['bar'].instance_eval &block
end
end
end
Foo.new do
puts "self i... | 15.363636 | 36 | 0.579882 |
4a3da1c560f18fdbfdd2ba651ae15a0965ca423d | 87 | fd = ARGV.shift.to_i
f = File.for_fd fd
f.sync = true
f.write "writing to fd: #{fd}"
| 12.428571 | 30 | 0.643678 |
f752bfc1778449138f08e1646cbe6274d9110852 | 2,213 | class UserCurrentRole < ActiveRecord::Base
include AdmRegionDelegation
belongs_to :current_role
belongs_to :nomination_source
belongs_to :region # a.k.a adm_region_id
belongs_to :uic, :inverse_of => :user_current_roles
belongs_to :user, inverse_of: :user_current_roles
validates :current_role, :nomina... | 29.506667 | 102 | 0.72526 |
39ef72f2049268fa89b65e0e3710844dd147bbf8 | 810 | class Company < ApplicationRecord
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
month3 = row.field('extra').gsub("=>", ":")
data = JSON.parse month3
data3 = {}
data3["phone"] = data['phone']
data3["website"] = data['websit... | 35.217391 | 101 | 0.493827 |
622cb596906229f39f62591a3966c2ae69670e58 | 2,421 | class Textidote < Formula
desc "Spelling, grammar and style checking on LaTeX documents"
homepage "https://sylvainhalle.github.io/textidote"
url "https://github.com/sylvainhalle/textidote/archive/refs/tags/v0.8.3.tar.gz"
sha256 "8c55d6f6f35d51fb5b84e7dcc86a4041e06b3f92d6a919023dc332ba2effd584"
license "GPL-3.... | 37.828125 | 123 | 0.731103 |
33f899168b683f44276f89927940433ea88e1ec1 | 1,026 | class Moe < Formula
desc "Console text editor for ISO-8859 and ASCII"
homepage "https://www.gnu.org/software/moe/moe.html"
url "https://ftp.gnu.org/gnu/moe/moe-1.11.tar.lz"
mirror "https://ftpmirror.gnu.org/moe/moe-1.11.tar.lz"
sha256 "0efbcbcf5a4a8d966541c6cb099ba0ab6416780366dbce82d9ff995a85a5e2f9"
licens... | 36.642857 | 109 | 0.767057 |
185c3063918d7dfdb97b05360fdbc8cc4c3020e4 | 188 | class Moneymoney < Cask
url 'http://moneymoney-app.com/download/MoneyMoney.zip'
homepage 'http://moneymoney-app.com/'
version 'latest'
sha256 :no_check
link 'MoneyMoney.app'
end
| 23.5 | 57 | 0.734043 |
ed6ed16f37469ff60cd35103a0fd7482f39326e4 | 804 | require_relative "board"
require_relative "player"
class Battleship
attr_reader :board, :player
def initialize(board_length)
@player = Player::new
@board = Board::new(board_length)
@remaining_misses = @board.size / 2
end
def start_game
@board.place_random_ships
puts "Number of ships: #{@b... | 16.08 | 49 | 0.633085 |
617b2bf663c49948689f08d6a24be8474d3af93c | 1,864 | module Pallets
class Configuration
# Backend to use for handling workflows
attr_accessor :backend
# Arguments used to initialize the backend
attr_accessor :backend_args
# Number of seconds to block while waiting for jobs
attr_accessor :blocking_timeout
# Number of workers to process job... | 28.676923 | 81 | 0.687768 |
e28524d5f4126981b1fa33d21f052a77d1762d98 | 146 | # @author Donovan Bray <donnoman@donovanbray.com>
Capistrano::Configuration.instance(true).load do
after "deploy:provision", "ssmtp:install"
end | 36.5 | 49 | 0.787671 |
28f990b379274fcdcfa9a973eb92ce5c4e8ac715 | 1,632 | require File.dirname(__FILE__) + '/../../spec_helper.rb'
module Spec
module Mocks
describe "PreciseCounts" do
before(:each) do
@mock = mock("test mock")
end
it "should fail when exactly n times method is called less than n times" do
@mock.should_receive(:random_call).... | 30.792453 | 82 | 0.61826 |
085b9c2d502fa8c8eb6eb916dd3c4dd8e5d7bfc9 | 1,988 | gem 'minitest'
require 'minitest/autorun'
describe "ES2020 support" do
def to_js( string)
_(Ruby2JS.convert(string, eslevel: 2020, filters: []).to_s)
end
def to_js_fn(string)
_(Ruby2JS.convert(string, eslevel: 2020,
filters: [Ruby2JS::Filter::Functions]).to_s)
end
def to_js_nullish( string... | 28.811594 | 77 | 0.577465 |
4acae727995e1de9d0a195886c343db8cbda3caf | 3,279 | require 'spec_helper'
shared_examples 'Card Token Mocking' do
describe 'Direct Token Creation' do
it "generates and reads a card token for create charge" do
card_token = StripeMock.generate_card_token(last4: "2244", exp_month: 33, exp_year: 2255)
charge = Stripe::Charge.create(amount: 500, card: c... | 28.025641 | 95 | 0.627325 |
e2636e4b404a8cf7459b41d375d004d1ac0eeb7f | 1,620 | class Libvpx < Formula
desc "VP8/VP9 video codec"
homepage "https://www.webmproject.org/code/"
url "https://github.com/webmproject/libvpx/archive/v1.11.0.tar.gz"
sha256 "965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83"
license "BSD-3-Clause"
head "https://chromium.googlesource.com/webm/libv... | 33.75 | 122 | 0.685185 |
ab4c0af42b20ce045f980b3bd19b06099a775776 | 264 | Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :users, param: :_username
namespace :auth do
post '/login', to: 'authentication#login'
end
end
end
get '/*a', to: 'application#not_found'
end
| 16.5 | 49 | 0.628788 |
03e5d03feb4b0e63616fcffb430b156b89a51bae | 487 | module Rack
module Cache
class HashAggregator
def initialize(hash, &block)
@hash = hash
@aggregator = block || ->(v) { v }
end
def [](pattern)
aggregate(matches(pattern))
end
def *
aggregate(@hash.values)
end
private
def agg... | 16.793103 | 52 | 0.521561 |
e9867894703741fe767e32373bf6e9a31561a93a | 8,268 | require 'cucumber/cucumber_expressions/ast'
require 'cucumber/cucumber_expressions/errors'
require 'cucumber/cucumber_expressions/cucumber_expression_tokenizer'
module Cucumber
module CucumberExpressions
class CucumberExpressionParser
def parse(expression)
# text := whitespace | ')' | '}' | .
... | 37.581818 | 166 | 0.606918 |
012af3be0e73c67e43cff2e2d56e1f50546996d0 | 3,500 | # frozen_string_literal: true
require 'transaction/version'
require 'securerandom'
require 'redis'
require 'json'
require 'transaction/helper'
module Transaction
STATUSES = %i[queued processing success error].freeze
DEFAULT_ATTRIBUTES = {
status: :queued
}.freeze
def self.configure
yield self
end
... | 22.727273 | 80 | 0.644 |
f878695344f4db3ffd2db262a79b61206ce1e85c | 805 | Pod::Spec.new do |s|
s.name = "CNLiveRequestKitSDK"
s.version = "1.4.2"
s.summary = "LSY-iOS 网络请求基础工具"# 项目简介
s.homepage = "https://github.com/woshiliushiyu/CNLiveRequestKitSDK"
s.source = { :git => "https://github.com/woshiliushiyu/CNLiveRequestKitSDK.git", :tag => "#{s.version}" ... | 36.590909 | 113 | 0.636025 |
f807b5eb5bd5b55283bca07131b46b0b44ac78d2 | 2,815 |
module Musikov
# This class represents a generic markov chain. It holds
# a hash of frequencies of subsequent states, for each state.
class MarkovModel
attr_reader :frequencies
###################
public
###################
# Initialize the hashes used to build the markov chain.
# Passes the init... | 27.871287 | 158 | 0.676021 |
e86f807f9e4cecb012f57da108136c3ea00561f5 | 719 | # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
RSpec.configure do |c|
c.mock_with :mocha
end
# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly set.
ENV['COVERAGE'] ||=... | 29.958333 | 83 | 0.739917 |
01d38b6d4ba474f53d43db8616b124790dd9a772 | 589 | if ENV["COVERAGE"]
require 'simplecov'
SimpleCov.start
end
require 'bundler/setup'
require 'test/unit'
require 'shoulda/context'
require 'turn'
require 'mocha/setup'
require 'webmock'
require 'vcr'
require 'pry'
require 'scrapybara'
VCR.configure do |c|
c.cassette_library_dir = File.expand_path( Pathname( Fil... | 19.633333 | 127 | 0.741935 |
6a2f5fef6bf0da9a42d6cea9c793e60e471ff1f8 | 441 | # frozen_string_literal: true
module Stupidedi
module TransactionSets
module TwoThousandOne
module Standards
SegmentReqs = Versions::TwoThousandOne::SegmentReqs
autoload :FA997, "stupidedi/transaction_sets/002001/standards/FA997"
autoload :PO830, "stupidedi/transaction_sets/002001/s... | 29.4 | 76 | 0.739229 |
113ef54fefbbeaf7867714bca1fe959c383a21e2 | 305 | class Ahoy::Store < Ahoy::DatabaseStore
end
# set to true for JavaScript tracking
Ahoy.api = false
Ahoy.track_bots = true
Ahoy.cookie_domain = :all
Ahoy.visit_duration = 6.hours
IPS = %w[192.168.1.1]
Ahoy.exclude_method = lambda do |_controller, request|
request&.ip ? request.ip.in?(IPS) : true
end
| 20.333333 | 54 | 0.734426 |
b91da11f1956c8f137d4bfaa960c5b0983e867f3 | 2,454 | Biopartsdb::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.act... | 36.088235 | 104 | 0.758761 |
e94cc1a4904567c26802be047d8c882509c0399b | 6,379 | #
# Helper for generating API requests against the files API.
# When you create it, give it the Rack::Test session you want to make requests
# as. If you do a new session, you'll have to create a new helper.
#
# See Also: FilesApiTestBase. If you're changing common test setup or adding
# a utility that doesn't require... | 34.668478 | 128 | 0.706694 |
f81344fdff5431dd1524316f93843f4b5c9ed165 | 211 | class PetSerializer < ActiveModel::Serializer
attributes :id, :name, :gender, :age, :breed, :bio, :rescues, :avatar
#has_many :rescues
def rescues
object.rescues.map{|r| {story: r.story}}
end
end
| 19.181818 | 71 | 0.682464 |
18247924fe03cf2174f20e129e21f0cdc933c14f | 447 | # typed: true
module Family
module Bart
class Character
extend T::Sig
# Ensure that lookup in a parent namespace works correctly. This should
# show up as `Family::Simpsons` in the resulting rbi.
sig {returns(T.class_of(Simpsons))}
def family
Simpsons
end
sig ... | 16.555556 | 77 | 0.610738 |
031b89d04996fab5a498092518949d0f84d57e80 | 1,036 | require 'spec_helper'
feature 'User wants to add a .gitlab-ci.yml file', feature: true do
before do
user = create(:user)
project = create(:project)
project.team << [user, :master]
login_as user
visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: '.gitlab-ci.yml'... | 34.533333 | 115 | 0.699807 |
03ac1d5045772e97244f9a14df0e2e0c01082498 | 584 | class Book < ApplicationRecord
has_many :book_genres
has_many :genres, through: :book_genres
scope :finished, -> { where.not(finished_on: nil)}
scope :recent, -> { where('finished_on > ?', 2.days.ago) }
scope :search, ->(keyword) { where("keywords LIKE ?", "%#{keyword.downcase}%") if keyword.present? }
sco... | 27.809524 | 102 | 0.674658 |
87951d12257462786c86bb5d6837f61fea790f62 | 390 | require 'spec_helper'
RSpec.describe SpreeShopifyImporter::Connections::Base, type: :model do
subject { described_class }
describe '.count', vcr: { cassette_name: 'shopify_import/base/count' } do
it 'raises error ActiveResource::ResourceNotFound' do
authenticate_with_shopify
expect { subject.coun... | 27.857143 | 78 | 0.751282 |
ff2b254abad6492c69e0c2c86cd9833acd561043 | 449 | require_relative '../../../../spec_helper'
describe Web::Views::Google::Lock::Destroy do
let(:exposures) { Hash[format: :html] }
let(:template) do
Hanami::View::Template.new('apps/web/templates/google/lock/destroy.html.slim')
end
let(:view) { Web::Views::Google::Lock::Destroy.new(template, exposures)... | 29.933333 | 82 | 0.674833 |
386b069a0dfef90ce63cb9ccdfd05576645ca6b9 | 1,466 | require 'rspec'
require 'date'
require 'name_matcher/parser'
describe 'Parser' do
def parse_line(line)
send(:parser).parse([line]).to_a[0]
end
let (:date_source) {
# Must match date-code
NameMatcher::DateSource.new(date = Date.new(2018, 1), kingdom = "An Tir")
}
let (:date_string) {
"20180... | 23.269841 | 89 | 0.654843 |
1ac7110731de268233af0d6922e4bba1948ed77c | 65,939 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 43.295469 | 321 | 0.666525 |
1ca8e25d257b1a94b71ba4bc435e115b78ae5e56 | 1,679 | # frozen_string_literal: true
# Copyright 2019 Steven C Hartley
# Copyright 2020 Matthew B. Gray
# Copyright 2020 Victoria Garcia
#
# 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:/... | 33.58 | 97 | 0.744491 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.