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 |
|---|---|---|---|---|---|
28e64a5d4fea51eba8b9fca5bf533970ee9301fa | 211 | # -*- encoding : utf-8 -*-
class RenameStatusIdOnCard < ActiveRecord::Migration
def up
rename_column :cards, :status_id, :deck_id
end
def down
rename_column :cards, :deck_id, :status_id
end
end
| 19.181818 | 52 | 0.696682 |
33755307333162d8fc62b29891f014575e8bded0 | 2,256 | require 'spec_helper'
describe "a built instance" do
include FactoryBot::Syntax::Methods
before do
define_model('User')
define_model('Post', user_id: :integer) do
belongs_to :user
end
FactoryBot.define do
factory :user
factory :post do
user
end
end
end
s... | 21.084112 | 75 | 0.679965 |
ed9e04d1dada8e2ad7fba9f87013ca72d1500f14 | 643 | require 'net/http'
require 'nokogiri'
require 'addressable/uri'
require 'correios/address_search_response'
class Cep
URL = 'http://m.correios.com.br/movel/buscaCepConfirma.do'
def search(term)
response = query({cepEntrada: term.parameterize(' '), metodo: :buscarCep})
Correios::AddressSearchResponse.new(r... | 21.433333 | 78 | 0.679627 |
1cbc7ccd19b5edb128016634d08095807ab7ec38 | 180 | class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
t.timestamps
end
end
def self.down
drop_table :accounts
end
end
| 15 | 46 | 0.688889 |
08c0d2ca5d912cdba3c3af42aae35888e35271ca | 8,347 | # TODO: move paranoid property concerns to a ParanoidModel that is mixed
# into Model when a Paranoid property is used
# TODO: update Model#respond_to? to return true if method_method missing
# would handle the message
module DataMapper
module Model
module Property
Model.append_extensions self
exte... | 31.379699 | 114 | 0.614832 |
262d690c761fac17798899c88a3cc82822fcdc6b | 72 | module ActiveRecord
module Bitemporal
VERSION = "0.1.0"
end
end
| 12 | 21 | 0.694444 |
e836461b0990c97366dbf38b227dd4c2edfcf692 | 3,914 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::AlertManagementHelper do
include Gitlab::Routing.url_helpers
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:current_user) { create(:user) }
let(:project_path) { project.full_path }
let(:project_id) { project.id... | 31.821138 | 127 | 0.64512 |
ff983ed4d800f37ece83132cf0456034bfbedcba | 8,170 | $:.unshift File.join(File.dirname(__FILE__),"..","lib")
require 'minitest/autorun'
require 'rgen/template_language'
require 'rgen/metamodel_builder'
class TemplateContainerTest < MiniTest::Test
TEMPLATES_DIR = File.dirname(__FILE__)+"/template_language_test/templates"
OUTPUT_DIR = File.dirname(__FILE_... | 38 | 132 | 0.664015 |
4a549fd537f33b97e9053043f986c723d1cfc956 | 1,238 | class Profanity < Formula
desc "Console based XMPP client"
homepage "http://www.profanity.im/"
url "http://www.profanity.im/profanity-0.4.7.tar.gz"
sha256 "b02c4e029fe84941050ccab6c8cdf5f15df23de5d1384b4d1ec66da6faee11dd"
revision 3
head "https://github.com/boothj5/profanity.git"
bottle do
sha256 "f... | 30.195122 | 92 | 0.708401 |
1a4f8dc186e36295a23d0d00fef8544e7ae043df | 720 | cask 'ableton-live' do
version '9.2.1'
if Hardware::CPU.is_32_bit?
sha256 'ce37b5ec6c2f717c8db83e39a75398e462bd131d39df5a559b265fa27eba38f6'
url "http://cdn2-downloads.ableton.com/channels/#{version}/ableton_live_trial_#{version}_32.dmg"
else
sha256 '30599a21a857be855e687e3d5a162cefb84ff98491bc2757d0... | 32.727273 | 100 | 0.733333 |
1d8164703d0fcbbdc9b2d94eeff7f8dbb61a752d | 744 | Pod::Spec.new do |s|
s.name = "CategoryPickerLabel"
s.version = "0.0.4"
s.summary = "A label that opens a picker for selection."
s.homepage = "https://github.com/perlguy99/CategoryPickerLabel"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Brent Mi... | 29.76 | 109 | 0.602151 |
2615a1fce9b8c6348a29feabf3dbd4f198917af0 | 396 | cask :v1 => 'vagrant' do
version '1.7.2'
sha256 '78d02afada2f066368bd0ce1883f900f89b6dc20f860463ce125e7cb295e347c'
url "https://dl.bintray.com/mitchellh/vagrant/vagrant_#{version}.dmg"
homepage 'http://www.vagrantup.com'
license :mit
pkg 'Vagrant.pkg'
uninstall :script => { :executable => 'uninstall.to... | 28.285714 | 78 | 0.689394 |
e91067b977fd55d0769f24be8ece1a320d27e13e | 102,150 | # 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/credentials_configuration.rb'
... | 44.587516 | 209 | 0.676104 |
e2d7f6599229dab7b9e03a87fdf8f6e6f58ea578 | 3,534 | require 'active_support/concern'
require 'elasticsearch/model'
require 'track_record/tracker'
module TrackRecord
extend ActiveSupport::Concern
QUERY_AMOUNT = ENV["FEED_EVENTS_QUERY_AMOUNT"].nil? ? 100 : ENV["FEED_EVENTS_QUERY_AMOUNT"].to_i
Client = Elasticsearch::Model.client
included do
after_commit on:... | 40.159091 | 170 | 0.723543 |
18aecdd16200f58793015424bfe4a32f8fc7048b | 1,562 | #--
# Copyright (c) 2010 Michael Berkovich, Geni Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, mer... | 41.105263 | 75 | 0.742638 |
ab9676d96b870f3c1bba8be8f8e00898a6b323a9 | 778 | module God
module Conditions
class DiskUsage < PollCondition
attr_accessor :above, :mount_point
def initialize
super
self.above = nil
self.mount_point = nil
end
def valid?
valid = true
valid &= complain("Attribute 'mount_point' must be specified",... | 23.575758 | 101 | 0.556555 |
6a1abd6f368e876cfa18c5190becdf080816861d | 965 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'alphabetical_paginate/version'
Gem::Specification.new do |spec|
spec.name = "alphabetical_paginate"
spec.version = AlphabeticalPaginate::VERSION
spec.authors = ["lingz"... | 37.115385 | 74 | 0.675648 |
618baf0aa45ec1ecb69f47a1938c52f0838e36b5 | 3,348 | require 'find'
require 'taglib'
require 'pathname'
require 'logger'
require 'json'
module UnitF
module Tag
class File < Pathname
def initialize(file_path)
super(::File.absolute_path(file_path.to_s))
end
def tag
@file.tag
end
def format_json
JSON.pretty_gene... | 21.74026 | 56 | 0.497312 |
bf48af6e90481438d8ffaa9d592369f0d750b0e3 | 680 | Pod::Spec.new do |s|
s.name = 'GoLog'
s.version = '0.0.3'
s.summary = 'GoLog'
s.description = "GoLog"
s.homepage = "https://github.com/junbjnnn/GoLog"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "GoLog" => "info@GoLog.com" }
s.source ... | 35.789474 | 98 | 0.555882 |
8780c7e921851d56d3ea3656945cb21df1a4de11 | 45 | module LogicalFriday
VERSION = "0.1.0"
end
| 11.25 | 20 | 0.711111 |
bba947502e63e7124b812e912ab05cd8d4d89270 | 1,236 | module Tiki
module Torch
class Transcoder
class << self
def inherited(subclass)
unless registry.include? subclass
registry << subclass
end
end
def registry
@registry ||= []
end
def transcoder_for(code)
registry.f... | 22.071429 | 86 | 0.522654 |
030b9b210bbcac146c367b1ed02aa60ae390f6b2 | 4,164 | require 'spec_helper'
require 'r10k/module/git'
describe R10K::Module::Git do
describe "setting the owner and name" do
describe "with a title of 'branan/eight_hundred'" do
subject do
described_class.new(
'branan/eight_hundred',
'/moduledir',
{
:git => 'git... | 32.53125 | 107 | 0.657061 |
28bad31cc8b3f2ef7d7f5b9f96022cb0a1aa144a | 130 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'checkers'
require 'minitest/autorun'
require 'minitest/mock'
| 21.666667 | 58 | 0.753846 |
0386c3e83509f418af9f00111febdfb933c196ab | 9,849 | require 'openssl'
module PuppetSpec
module SSL
PRIVATE_KEY_LENGTH = 2048
FIVE_YEARS = 5 * 365 * 24 * 60 * 60
CA_EXTENSIONS = [
["basicConstraints", "CA:TRUE", true],
["keyUsage", "keyCertSign, cRLSign", true],
["subjectKeyIdentifier", "hash", false],
["authorityKeyIdentifier", "k... | 37.166038 | 99 | 0.554066 |
5db45b283af9eaaafe962f601c5351d625d83fbf | 4,150 | # frozen_string_literal: true
require 'active_support/concern'
module BetterRecord
module ModelConcerns
module HasProtectedPassword
extend ActiveSupport::Concern
module ClassMethods
def has_protected_password(
password_field: :password,
password_validator: nil,
... | 35.169492 | 117 | 0.476145 |
f8ca31470baa08278fb94d9fa7e8595fcb67a46b | 596 | require "sinatra/base"
class FakeSlackApi < Sinatra::Base
cattr_accessor :failure
post "/api/chat.postMessage" do
if failure
json_response 200, "message_post_failure.json"
else
json_response 200, "message_posted.json"
end
end
post "/api/users.list" do
json_response 200, "users_lis... | 19.866667 | 75 | 0.697987 |
87d18305d703ddd2a764df60b57d6c2631f09aca | 1,023 | class MicropostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: [:destroy]
def create
@micropost = current_user.microposts.build(micropost_params)
@micropost.image.attach(params[:micropost][:image])
if @m... | 30.088235 | 93 | 0.653959 |
031176b6c2809b7d9f0df48409c9e4b40737ca0b | 170 | # frozen_string_literal: true
FactoryGirl.define do
factory :book, class: Book do
id { 1 }
title { "神探伽利略" }
author { "東野圭吾" }
genre { "推理" }
end
end
| 17 | 31 | 0.6 |
ab59d8f7a66b53cfa2eaa01563fe34d267185479 | 239 | # frozen_string_literal: true
require "test_helper"
class TestHexletCode < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::HexletCode::VERSION
end
def test_it_does_something_useful
assert false
end
end
| 17.071429 | 39 | 0.790795 |
1a4617dd3ed6ee2c56486fdbe1a2a3d192e9a999 | 1,411 | require 'securerandom'
module SPARQL; module Algebra
class Operator
##
# The SPARQL `uuid` function.
#
# [121] BuiltInCall ::= ... | 'UUID' NIL
#
# @example SPARQL Grammar
# PREFIX : <http://example.org/>
# PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
# ASK {
# B... | 27.134615 | 207 | 0.535082 |
386ef68af97a1034156c85b016ffd9a4ea5a25c7 | 208 | # frozen_string_literal: true
require 'open3'
class RTesseract
module Text
def self.run(source, errors, options)
RTesseract::Command.new(source, 'stdout', errors, options).run
end
end
end
| 17.333333 | 68 | 0.711538 |
5dff7527c87acb9dd7317be2862db13d99356d5f | 1,341 | require_relative 'edgecase'
class AboutNil < EdgeCase::Koan
def test_nil_is_an_object
assert nil.is_a?(Object), "Unlike NULL in other languages"
end
def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil
#
# What is the Exception that is thrown when you call a method that
# doe... | 28.531915 | 94 | 0.66965 |
ffc20ee1074867a9ca4e098fd46e687b39d42fa6 | 678 | require 'pathname'
module Search
def self.files(filter, dir, callback, block)
dir = Pathname.new dir unless dir.instance_of? Pathname
total = 0
dir.each_child do |item|
next if item == '..' or item == '.'
if item.directory?
quantity = files filter, item, callback, block
total... | 18.833333 | 59 | 0.587021 |
1a0e09ac445529a49c3f7ab96fb0c78218be72cb | 972 | Почему веки часто становятся раздраженными и красными?
Офтальмолог, Татьяна Левашова, отвечает:
Наши глаза являются экранами, которые защищают бейсбол от многих маленьких частиц, которые располагаются на них.
Когда забываем регулярно чистить наши глаза, часто мы сами способствуем развитию блефарита.
Решение просто:
не ... | 88.363636 | 288 | 0.837449 |
e97c0c50e5bc043655f7b29dcc37aa2a99c77701 | 798 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "minima"
spec.version = "2.5.0"
spec.authors = ["Joel Glovier"]
spec.email = ["jglovier@github.com"]
spec.summary = "A beautiful, minimal theme for Jekyll."
spec.homepage = "https://github.co... | 31.92 | 95 | 0.637845 |
ab2bd1d3cf6116c24b76a5f201c8adfe31350824 | 704 | require "aws-sdk-s3"
require "brutalismbot/version"
require "brutalismbot/reddit/resource"
module Brutalismbot
module Reddit
class Client
attr_reader :endpoint, :user_agent
def initialize(endpoint:nil, user_agent:nil)
@endpoint = endpoint || ENV["REDDIT_ENDPOINT"] || "https://www.redd... | 28.16 | 104 | 0.647727 |
1ac0e123ff1bd593dee14d7bf24461eccefb8b61 | 416 | class GpgSignature < ActiveRecord::Base
include ShaAttribute
sha_attribute :commit_sha
sha_attribute :gpg_key_primary_keyid
belongs_to :project
belongs_to :gpg_key
validates :commit_sha, presence: true
validates :project_id, presence: true
validates :gpg_key_primary_keyid, presence: true
def gpg_k... | 18.909091 | 50 | 0.776442 |
e9b021bfb2360e89ad118daf3c24de24a560500c | 324 | cask "font-irish-grover" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/master/apache/irishgrover/IrishGrover-Regular.ttf",
verified: "github.com/google/fonts/"
name "Irish Grover"
homepage "https://fonts.google.com/specimen/Irish+Grover"
font "IrishGrover-Regular.ttf"
... | 27 | 94 | 0.740741 |
eddd3c3da16d33210a0e36bafd8ddaf7fe94145e | 1,991 | module ListingIndexViewUtils
ListingItem = Struct.new(
:id,
:url,
:title,
:category_id,
:latitude,
:longitude,
:distance,
:distance_unit,
:author,
:description,
:listing_images,
:price,
:unit_tr_key,
:unit_type,
:quantity,
:shape_name_tr_key,
:listi... | 20.957895 | 90 | 0.523857 |
1c85e9a4ce5935d81c31426749bb0d74655ce62d | 157 | Before("@mediatailor") do
@service = Aws::MediaTailor::Resource.new
@client = @service.client
end
After("@mediatailor") do
# shared cleanup logic
end
| 17.444444 | 43 | 0.713376 |
611b181ebba331be3b47feebfc3c2058f1a3c56e | 1,531 | require 'test_helper'
class TagsControllerTest < ActionController::TestCase
fixtures :all
def test_should_autocomplete_tags
get :auto_complete_for_tag_name, :format => 'json'
assert_response :success
end
def test_should_show_tag
get :show, :id => tags(:general).name
assert_response :success
... | 24.693548 | 98 | 0.707381 |
08839f290cf4fc2e8162732e770f57cbfa6f2a00 | 2,552 | require_dependency 'distributed_mutex'
class EmailLog < ActiveRecord::Base
self.ignored_columns = %w{
topic_id
reply_key
skipped
skipped_reason
}
CRITICAL_EMAIL_TYPES ||= Set.new %w{
account_created
admin_login
confirm_new_email
confirm_old_email
forgot_password
notify_ol... | 24.304762 | 109 | 0.670455 |
b9cfc6057a04c9495685a006d6e0a3980c4d5efe | 12,753 | # 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 invalid all existing
# confirmat... | 49.05 | 154 | 0.750333 |
08139be88c3b211aa4ba03dddabd24b47a4fed5a | 1,635 | require 'rexml/document'
include KNX4R
###################################################################################
# Create Roles, Users, OrgUnits and Accesses in the database #
###################################################################################
connection = ActiveRecord::B... | 36.333333 | 129 | 0.66055 |
bb6e48f1bfd5170c4bb5ecae147931d256635b1e | 291 | class CreateShiftTypes < ActiveRecord::Migration[4.2]
def self.up
create_table :shift_types do |t|
t.string :name
t.integer :primary_requirement
t.integer :secondary_requirement
t.timestamps
end
end
def self.down
drop_table :shift_types
end
end
| 18.1875 | 53 | 0.690722 |
264ba78a85225ada3de7d1a16c574b4069f00ff5 | 359 | #!/usr/bin/ruby
require_relative 'config'
require_relative 'bearing/bear'
require_relative 'bearing/cmd'
require_relative 'bearing/ipc'
action, *args = ARGV
ipc = Bearing::IPC.new
Bearing::Cmd.validate_action_argument!(action)
Bearing::Cmd.start_app
Bearing::Bear.call_api(action: action, args: args, call_id: ipc.cal... | 22.4375 | 72 | 0.793872 |
edc826d13c4296bc2e0ce2c2167f5c2c5dd74eb2 | 479 | # frozen_string_literal: true
RSpec.describe Bigcommerce::Sku do
before(:each) { @sku = Bigcommerce::Sku }
let(:params) { 1 }
describe '.count' do
it 'should hit the correct path' do
expect(@sku).to receive(:get).with('products/1/skus/count', {})
@sku.count params
end
end
describe '.co... | 21.772727 | 69 | 0.636743 |
b9d988cb1d2ab614106b76db630fa3a8c0d863f4 | 4,887 | # 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_06_01
module Models
#
# Properties of an application rule.
#
class AzureFirewallApplicationRule
... | 31.529032 | 89 | 0.448742 |
e8bea52ddfe0b9a084665af35eccba5fe66a3f87 | 3,004 | require 'nokogiri'
module Canvas
module Workflow
module Filters
module InlineColorFilter
CSS = {
vb: {
c: 'color: #008000', # Comment
k: 'color: #0000ff', # Keyword
ch: 'color: #008000', # Comment.Hashbang
... | 46.215385 | 118 | 0.470373 |
4ada1a862de9dbcb0140e0d290de15ba5adfa3e8 | 889 | cask 'now' do
version '4.0.16'
sha256 'cabf8faf7493f8a0711ceee1cf0b528b9893ef57db0d5d25fc38a2b4ca503eaa'
# github.com/zeit/now-desktop was verified as official when first introduced to the cask
url "https://github.com/zeit/now-desktop/releases/download/#{version}/Now-#{version}-mac.zip"
appcast 'https://gith... | 34.192308 | 95 | 0.611924 |
bb7f87b40c5682429f67f1ee4d0066cdd21bc4f9 | 177 | class AddDatapackageResourceToDatasources < ActiveRecord::Migration
def change
add_reference :datasources, :datapackage_resource, index: true, foreign_key: true
end
end
| 29.5 | 85 | 0.813559 |
38a3c0d803897c512707f7ffe2e39c1dbf731b35 | 1,123 | class Classifier
def initialize(company)
@raw_data = company
@company_categories = %w[id name website_url category contact_email mailing_list irc_channel tag_line precis
description tags primary_open_source_license image_url image_bg_color gplus_url
tw... | 34.030303 | 115 | 0.694568 |
acc7c1c26525c3179d42ac02f11a522b37b05365 | 3,443 | # 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.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 34.43 | 86 | 0.713622 |
217a2206bb35740bcaaefb3dd1d68900aea72c20 | 399 | require('spec_helper')
describe Venue do
it do
should have_and_belong_to_many(:bands)
join_table('bands_venues')
end
it ('returns a capitalized name') do
new_venue = Venue.create({name: "brooklyn bowl"})
expect(new_venue.name).to(eq("Brooklyn Bowl"))
end
it ('validates the presence of a... | 22.166667 | 57 | 0.674185 |
08f27676bf4de96fdc1fd3477736dfd0432a17f3 | 1,451 | require "spec_helper"
describe Array do
context "#all_empty?" do
it "returns true if all the elements of the Array are empty" do
expect(["", "", ""].all_empty?).to be true
end
it "returns false if some of the elements of the Array are not empty" do
expect([1, "", Object.new, "", :a].all_... | 27.903846 | 79 | 0.611992 |
0132dcae66763f2c68b50f430ec2c048dc9b741d | 122 | name 'codedeploy-agent'
recipe 'codedeploy-agent::default', 'Fetches, installs, and starts the AWS CodeDeploy host agent'
| 40.666667 | 97 | 0.786885 |
2800df390e9e5017908da8eb4c1c2a6efa41f835 | 1,702 | module Vagrant
# This represents the state of a given machine. This is a very basic
# class that simply stores a short and long description of the state
# of a machine.
#
# The state also stores a state "id" which can be used as a unique
# identifier for a state. This should be a symbol. This allows interna... | 32.730769 | 73 | 0.679788 |
01f6bdbcbf871b5526171a7a1b5cc802a247c6f7 | 109 | 5.times do
Channel.create({
# title: Faker::Book.title,
# body: Faker::Lorem.sentence
})
end
| 15.571429 | 35 | 0.59633 |
6a51b316dd1eda23c589c3290596038f82b3fc16 | 13,194 | require 'spec_helper'
require 'ddtrace'
require 'mongo'
RSpec.describe 'Mongo::Client instrumentation' do
let(:tracer) { get_test_tracer }
let(:client) { Mongo::Client.new(["#{host}:#{port}"], client_options) }
let(:client_options) { { database: database } }
let(:host) { ENV.fetch('TEST_MONGODB_HOST', '127.0... | 34.904762 | 275 | 0.58898 |
280fded9493b862ba456c0d78adfe1d7e7082c51 | 1,314 | # frozen_string_literal: true
# Copyright 2016-2019 New Context, 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 b... | 30.55814 | 117 | 0.687976 |
ff345bf7a368d104a2cc49ff54a413c1db394547 | 71,671 | # frozen_string_literal: true
# -*- coding: utf-8 -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems/deprecate'
require 'rubygems/basic_specification'
require 'rubygems/stub_specification'
require 'rubygems/speci... | 26.802917 | 131 | 0.640845 |
f7915c8523e733a9de7215286aac30b82ea9e6d8 | 928 | require 'nokogiri'
require 'rails/generators/testing/behaviour'
require 'generators/camunda/bpmn_classes/bpmn_classes_generator.rb'
describe Camunda::Generators::BpmnClassesGenerator do
include FileUtils
let(:dummy_app_root) { File.expand_path('../dummy', __dir__) }
describe 'runs sample with success' do
b... | 40.347826 | 126 | 0.760776 |
ac5283e6bb477c154b7a4aa4eefac5daee162ad1 | 1,277 | # frozen_string_literal: true
require_relative "lib/dannugjr_view_tool/version"
Gem::Specification.new do |spec|
spec.name = "dannugjr_view_tool"
spec.version = DannugjrViewTool::VERSION
spec.authors = ["Kerbs"]
spec.email = ["npdannug16@gmail.com"]
spec.summary = "Variou... | 38.69697 | 88 | 0.677369 |
2632826b14ed43e08fc75a99f5c6365b443a05a1 | 3,587 | # frozen_string_literal: true
require 'bootsnap'
require 'optparse'
require 'fileutils'
module Bootsnap
class CLI
unless Regexp.method_defined?(:match?)
module RegexpMatchBackport
refine Regexp do
def match?(string)
!!match(string)
end
end
end
us... | 23.598684 | 108 | 0.571787 |
4a0f56c650a340439f580a9ab8d67e2e485b86c4 | 543 | require_relative '../../test_helper'
class MachineWithOtherStates < StateMachinesTest
def setup
@klass = Class.new
@machine = StateMachines::Machine.new(@klass, initial: :parked)
@parked, @idling = @machine.other_states(:parked, :idling)
end
def test_should_include_other_states_in_known_states
a... | 23.608696 | 67 | 0.74954 |
bb2023bdd33e2a77c08b282b0fd13e970fe6475e | 462 | module TicketNotifier
extend ActiveSupport::Concern
included do
after_create -> { notify_patron_new_ticket }
after_update -> { notify_patron_resolved_status }
end
def notify_patron_new_ticket
TicketMailer.new_ticket(self).deliver_later
end
def notify_patron_resolved_status
if self.saved_... | 22 | 85 | 0.768398 |
79232f86e2be56defe8403a91dfdf18223113a99 | 228 | class User < ActiveRecord::Base
has_many :reviews
has_secure_password
validates :email, presence: true, uniqueness: true
validates :username, presence: true, uniqueness: true
validates :password, presence: true
end | 25.333333 | 55 | 0.763158 |
f8d1529c52964bff95da2bdba5922834609e784d | 758 | # frozen_string_literal: true
module API
module Entities
class PendingMember < Grape::Entity
expose :id
expose :user_name, as: :name, if: -> (_) { user.present? }
expose :user_username, as: :username, if: -> (_) { user.present? }
expose :email
expose :web_url, if: -> (_) { user.pres... | 21.657143 | 72 | 0.58971 |
ac47ae99e0382cd51b490ad6340f2493c255b68f | 4,778 | require 'spec_helper'
describe FbGraph::Connections::Insights do
describe '#insights' do
context 'when included by FbGraph::Page' do
context 'when no access_token given' do
it 'should raise FbGraph::Unauthorized' do
mock_graph :get, 'FbGraph/insights', 'pages/insights/FbGraph_public', :st... | 45.504762 | 222 | 0.570113 |
39fa383d4f470e83ec2c8076aa4bb22f21017776 | 38,046 | # 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::BatchAI::Mgmt::V2018_05_01
#
# The Azure BatchAI Management API.
#
class Experiments
include MsRestAzure
#
# Creates and ... | 53.360449 | 198 | 0.714687 |
1c1aca39b27729a483bb8359269569cf2ef606b5 | 2,044 | ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run ... | 41.714286 | 79 | 0.740705 |
91a33ca18d38b3b0b8f987d6c801829f8f9bb4e5 | 931 | # frozen_string_literal: true
require "rails_helper"
module Renalware
describe "pd regime bag's days assigned are by default set all to true", type: :system do
it "days can be deleselected when creating a new pd regime", js: true do
create(:bag_type, manufacturer: "CompanyA", description: "BagDescription"... | 31.033333 | 91 | 0.654135 |
f77641dbadb3e82098d8c1dedebf84d5fafdd4c2 | 2,613 | require 'spec_helper'
require 'r10k/action/puppetfile/install'
describe R10K::Action::Puppetfile::Install do
let(:default_opts) { {root: "/some/nonexistent/path"} }
let(:puppetfile) { R10K::Puppetfile.new('/some/nonexistent/path', nil, nil) }
def installer(opts = {}, argv = [], settings = {})
opts = default... | 30.741176 | 149 | 0.672407 |
011ca193d8dcdb58e4ec0fcbdca2b146212a1a37 | 382 | maintainer "Logan Lowell - Infochimps, Inc"
maintainer_email "coders@infochimps.com"
license "Apache 2.0"
version "0.0.2"
description "ZeroMQ: The socket library that acts as a concurrency framework."
depends "silverware"
recipe "zeromq::install_from_release", "Install... | 25.466667 | 83 | 0.667539 |
2651d6ff738348b579f63bfd891f1a42dc690ea2 | 28,823 | require "abstract_unit"
require "controller/fake_models"
class TestController < ActionController::Base
end
module RenderTestCases
def setup_view(paths)
@assigns = { secret: "in the sauce" }
@view = Class.new(ActionView::Base) do
def view_cache_dependencies; end
def fragment_cache_key(key)
... | 40.653032 | 198 | 0.750165 |
26660c9415f61cc104d01538e44ccea0373aeb30 | 41,545 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Author:: Tim Hinderliter (<tim@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.... | 35.148054 | 147 | 0.680828 |
ffe0e45937d4e020c87ca9ba77f2d6aa434a2064 | 3,881 | #CLI controller
class RollForInitiative::CLI
attr_accessor :player_name, :klasses
@@site = "https://www.dndbeyond.com/classes"
def call
RollForInitiative::Scraper.new.klasses(@@site)
RollForInitiative::Klass.get_klass_names
welcome_msg
klass_list
end
... | 28.536765 | 107 | 0.472043 |
5d281b6ed992228d8b6595c09d90a54b8bf8431b | 5,109 | # frozen_string_literal: true
require_relative '../../../step/buy_sell_par_shares'
require_relative '../../../step/share_buying'
require_relative '../../../action/buy_shares'
require_relative '../../../action/par'
module Engine
module Game
module G1873
module Step
class BuySellParShares < Engine::... | 33.834437 | 113 | 0.559796 |
08a7a075fed1a9cd379d721f6da961ecc30eca07 | 10,855 | # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 42.568627 | 245 | 0.689083 |
1d166b836b9b4e9926c090e1a766a3035a0c0f44 | 17,567 | # encoding: utf-8
#--
# Copyright 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 law or agree... | 40.291284 | 148 | 0.71418 |
1c48ca173e9e178cf4fd02daca64debc42d8aeed | 2,390 | # frozen_string_literal: true
class ActiveJobs
ALL_LOCK = Mutex.new
class << self
def clusters
Rails.cache.fetch('clusters', expires_in: 12.hours) do
OodCore::Clusters.new(
OodCore::Clusters.load_file(Configuration.clusters_config_dir).reject do |c|
!c.errors.empty? || !c.... | 36.212121 | 154 | 0.608787 |
01a34625578c5b0b235f3a92fa925c3fe94ea164 | 1,200 | class Api::V1::TagsController < Api::V1::BaseController
# before_action :set_tag, only: [:index, :create, :update, :destroy]
before_action :authorize_tag, only: [:show, :update, :destroy]
before_action :set_tag, only: [:show, :update, :destroy]
def index
@tags = Tag.all
end
def show
end
def creat... | 23.529412 | 99 | 0.6625 |
013a2b5f0e3e2dac551df2a36c8ea982e2e6274a | 128 | class UserSerializer < ActiveModel::Serializer
attributes :id, :name
has_many :expenses, serializer: ExpenseSerializer
end
| 25.6 | 52 | 0.796875 |
abef9b70399d83e7a104f43c51139d83396a49b4 | 487 | require 'bundler/setup'
Bundler.require
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "db/project.sqlite"
#might have to do something else to make this my database
)
require_relative "../app/controllers/application_controller.rb"
require_all 'app'
Dir[File.join(File.dirname... | 28.647059 | 94 | 0.706366 |
edd94ead422ffe151435790d6b8559e992b757e1 | 1,140 | # 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 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-pi/types'
require_relative 'aws-sdk-pi/cli... | 23.75 | 92 | 0.735088 |
7a84615bd2b8b8bcd7f2b8a31aa53a61ba26f3ff | 2,835 | # 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
module Models
#
# RouteTable route.
#
class HubRoute
include MsRestAzure
# @return ... | 28.069307 | 72 | 0.470899 |
1c967fe0a3468f038f28bff978fc5e183e80bff6 | 1,723 | require "rails_helper"
module Fieri
RSpec.describe JobsController, type: :controller do
routes { Fieri::Engine.routes }
describe "#create" do
let(:params) do
{
"fieri_key" => ENV["FIERI_KEY"],
"cookbook" =>
{
"name" => "apache2",
"version" ... | 32.509434 | 114 | 0.648868 |
1a8e404a6d1e3ee0b1fa17e065e1739a3031eda1 | 329 | require 'spec/spec_helper'
describe "freezable xml reference", :shared => true do
describe "with :frozen option" do
it "should be frozen" do
@frozen.frozen?.should be_true
end
end
describe "without :frozen option" do
it "should not be frozen" do
@unfrozen.frozen?.should be_false
end
... | 21.933333 | 54 | 0.683891 |
79d30e8414ed1fb8e596c52d4c76b0afb96d2915 | 542 | # This is a traditional example of a callback in Ruby but it is not idiomatic.
def finished_homework(subject)
p "Finished my #{subject} homework."
end
def do_homework(subject, callback)
p "Starting my #{subject} homework."
callback.call(subject)
end
do_homework("Math", method(:finished_homework))
# To perform ... | 24.636364 | 78 | 0.745387 |
3371dd4a49b2fcde2a54c40428a4b8c4f6bea976 | 2,580 | require_relative '../../../lib/bookwatch/html_document_manipulator'
require_relative '../../helpers/use_fixture_repo'
module Bookwatch
describe HtmlDocumentManipulator do
def html_document_manipulator
HtmlDocumentManipulator.new
end
describe 'setting an attribute' do
it 'returns a copy of t... | 37.391304 | 100 | 0.550388 |
ffb40547cb970fb286ead756ab5143b3b8974a36 | 3,422 | # encoding: utf-8
module Rubocop
module Cop
module Style
# Common functionality for modifier cops.
module FavorModifier
# TODO extremely ugly solution that needs lots of polish
def check(sexp, comments)
case sexp.loc.keyword.source
when 'if' then cond, body, _e... | 28.756303 | 79 | 0.556108 |
088131bdfd3332e0a34f74f75af12096654039f6 | 268 | require 'bundler/setup'
require File.join(File.dirname(__FILE__), "..", "lib", "rebay")
Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
end
Rebay::Api.configure do |rebay|
rebay.app_id = 'default'
end
| 20.615385 | 63 | 0.686567 |
7953a04edb55e78dfaaf77a53f9f42b136a4b6ac | 413 | module Pageflow
module RailsVersion
extend self
RAILS_VERSION_FILE = File.expand_path('../../../../.rails_version')
def detect
from_env || from_file || '5.2.0'
end
private
def from_env
ENV['PAGEFLOW_RAILS_VERSION']
end
def from_file
if File.exists?(RAILS_VERSION_... | 17.208333 | 71 | 0.639225 |
21cba877e9b2f9add57900202aea97001a00dcc7 | 1,455 | # frozen_string_literal: true
# Load default formatter gem
require "pathname"
require_relative "default_formatter"
require_relative "profiles/root_filter"
require_relative "profiles/test_frameworks"
require_relative "profiles/bundler_filter"
require_relative "profiles/hidden_filter"
require_relative "profiles/rails"
... | 26.944444 | 87 | 0.770447 |
1d6ee5b3e16774e25980ed6c8847977c44588d74 | 355 | # This provider is in development and not ready for production
Puppet::Type.type(:lmax_network_route).provide(:interfaces) do
defaultfor :operatingsystem => [:ubuntu, :debian]
# There are several ways to implement this
# We can add a post-up/pre-down rules that call ip route
# or we can scripts in /etc/network/... | 35.5 | 68 | 0.749296 |
26954d6261c26d324e0c5740c8ac6b479b2b1664 | 13,982 | # frozen_string_literal: true
require 'rails_helper'
describe CampaignsController do
render_views
describe '#index' do
it 'renders a 200' do
get :index
expect(response.status).to eq(200)
end
end
describe '#create' do
let(:user) { create(:user) }
let(:admin) { create(:admin) }
... | 37.18617 | 100 | 0.658346 |
f8c1a0133f53d13a58c5e59890ca19d5949e0f06 | 504 | # frozen_string_literal: true
require 'vk/api/responses'
module Vk
module API
class Messages < Vk::Schema::Namespace
module Responses
# @see https://github.com/VKCOM/vk-api-schema/blob/master/objects.json
class SearchDialogsResponse < Vk::Schema::Response
# @return [Array] @see ht... | 29.647059 | 96 | 0.676587 |
ffae3b528055b587af1b24386f1d5a4adc4dbef3 | 1,399 | require File.dirname(__FILE__) + '/helper'
describe Mercurial::Node do
before do
@repository = Mercurial::Repository.open(Fixtures.test_repo)
end
it "should be considered directory when ends with a slash" do
node = @repository.nodes.find('new-directory/subdirectory/', 'a8b39838302f')
node.file?... | 33.309524 | 82 | 0.708363 |
f77a889cde253bd92b63f6ea46906060c06ef085 | 69 | # frozen_string_literal: true
module Whatup
VERSION = '0.3.5'
end
| 11.5 | 29 | 0.724638 |
1c15f9e779e6ea329b357e436f804ae5db39395a | 1,021 | ##
# Parse a non-source file. We basically take the whole thing as one big
# comment. If the first character in the file is '#', we strip leading pound
# signs.
class RDoc::Parser::Simple < RDoc::Parser
parse_files_matching(//)
attr_reader :content # :nodoc:
##
# Prepare to parse a plain file
... | 22.688889 | 80 | 0.649363 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.