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 |
|---|---|---|---|---|---|
1caaa5570852cee0f3bdf6d55520ae8be778cd7a | 1,155 | require 'spec_helper'
RSpec.describe WikiDirectory, models: true do
describe 'validations' do
subject { build(:wiki_directory) }
it { is_expected.to validate_presence_of(:slug) }
end
describe '#initialize' do
context 'when there are pages' do
let(:pages) { [build(:wiki_page)] }
let(:dir... | 25.666667 | 78 | 0.65368 |
ac26f739bc37c942d6b25ce773e8d691709eebd0 | 936 | # frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# avatar :string
# designation :string not null
# dob :date not null
# email :string not null
# employee_code :string ... | 24 | 62 | 0.573718 |
e2bc28eb0b52500cd034a27d734f9f840bc43e14 | 5,138 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require ... | 43.176471 | 92 | 0.743285 |
6a59a5d22d9dc5b4bdbf1968a023dafc1d48dca5 | 2,190 | class EmailAlertSubscriptionsController < ApplicationController
layout "finder_layout"
protect_from_forgery except: :create
before_action :signup_presenter
helper_method :subscriber_list_params
def create
validate_choices!
redirect_to email_alert_signup_api.signup_url
rescue MissingFiltersError
... | 30.84507 | 113 | 0.785388 |
1a3762e34614856f72bc13ac632112b1e59cd29b | 2,300 | class Libphonenumber < Formula
desc "C++ Phone Number library by Google"
homepage "https://github.com/google/libphonenumber"
url "https://github.com/google/libphonenumber/archive/v8.12.39.tar.gz"
sha256 "ff16330f130917e42bc0b1a7efe5e4fba46633bfa62e35268acec855e17e385c"
license "Apache-2.0"
livecheck do
... | 36.507937 | 123 | 0.68 |
f8fd614d4b07aac772d58834bee2d060fc193fbe | 1,567 | # frozen_string_literal: true
require_relative "lib/omniauth-azuread-oauth2/version"
Gem::Specification.new do |spec|
spec.name = "omniauth-azuread-oauth2"
spec.version = OmniAuth::AzureAD::OAuth2::VERSION
spec.authors = ["jinroq"]
spec.email = [""]
spec.summary = %q{TBA}... | 39.175 | 88 | 0.677728 |
e9ff7779e0b242a4a46d77adba33e2ae823bffce | 2,235 | class Setting < ActiveRecord::Base
has_attached_file :cover_image, default_url: ->(attachment) { ActionController::Base.helpers.asset_path('placeholder.png') }
validates_attachment :cover_image, :content_type => {:content_type => /\Aimage\/.*\Z/}
has_attached_file :additional_image, default_url: ->(attachment) { Ac... | 30.202703 | 130 | 0.750783 |
4a9a51e0caed7b2ca449b3d1c1858347f1ebb94f | 875 | #
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
# Author:: Ramesh Sencha (<ramesh.sencha@clogeny.com>)
# Copyright:: Infoblox
# Maintainer:: Infoblox
# License:: Apache License, Version 2.0
#
default['fixedaddress']['ipv4addr'] = '172.26.1.23' # IPv4 address eg. 10.10.70.100
default['fixedaddress']['mac'] = '' # MA... | 58.333333 | 177 | 0.678857 |
1a7ef11b256dde75f7d71794b4b9fe041831821a | 1,124 | require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe :string_eql_value, shared: true do
it "returns true if self <=> string returns 0" do
'hello'.send(@method, 'hello').should be_true
end
it "returns false if self <=> string does... | 33.058824 | 102 | 0.69573 |
91ed6d5716037ec935e949706e9a7c030a618fc6 | 656 | require_relative 'boot'
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 SampleApp
class Application < Rails::Application
# Settings in config/... | 36.444444 | 82 | 0.771341 |
d53234ee72943edbab8e4a07c68d36405fe04251 | 100 | celsius = 100
fahrenheit = (celsius * 9 / 5) + 32
print 'The result is: '
print fahrenheit
puts '.'
| 16.666667 | 35 | 0.66 |
ac819d90f7a51c541b765fc55132a455a851f4e9 | 3,993 | # frozen_string_literal: true
require 'rails_helper'
feature 'Job Seeker can search active jobs ' do
context 'when logged-in' do
let!(:job_seeker) { log_job_seeker_in! }
scenario 'by the contents of title or description successfully' do
Faker::Job.unique.clear
job_a = create :job, title: 'She ... | 40.744898 | 104 | 0.699224 |
03b8ca5539dbf2aafc2fe86ed0c28765f56d87bc | 1,394 | class Duckscript < Formula
desc "Simple, extendable and embeddable scripting language"
homepage "https://sagiegurari.github.io/duckscript"
url "https://github.com/sagiegurari/duckscript/archive/0.8.1.tar.gz"
sha256 "2ff56f80ed1d57a7fffc1f09b9fd7481a79d7815c7947cbff5e746f819f1aa3a"
license "Apache-2.0"
head ... | 34.85 | 122 | 0.751793 |
3895eec7f5216b77f441246f7427e3e6a32a192b | 8,535 | require 'test/unit'
class TestMath < Test::Unit::TestCase
def assert_infinity(a, *rest)
rest = ["not infinity: #{a.inspect}"] if rest.empty?
assert(!a.finite?, *rest)
end
def assert_nan(a, *rest)
rest = ["not nan: #{a.inspect}"] if rest.empty?
assert(a.nan?, *rest)
end
def check(a, b)
e... | 30.265957 | 86 | 0.593087 |
4a5a359c6d4b89f617f8d6068edac3c607c8836a | 6,111 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Spree::Address, type: :model do
# rubocop:disable RSpec/NestedGroups
describe 'validations' do
subject(:address) { build(:address) }
it { is_expected.to validate_presence_of(:lastname) }
it { is_expected.not_to allow_value('NOT A VAT... | 36.592814 | 120 | 0.666339 |
33d6a15216213fe116eb6e13dca6e54c906336dc | 4,592 | require 'spec_helper'
describe CopycopterClient::I18nBackend do
let(:cache) { {} }
def build_backend
backend = CopycopterClient::I18nBackend.new(cache)
I18n.backend = backend
backend
end
before do
@default_backend = I18n.backend
cache.stubs(:wait_for_download)
end
after { I18n.backen... | 29.063291 | 81 | 0.631533 |
bf823d93fb495077522002017613da81048334e0 | 151 | require 'test_helper'
module News::Blog
class EntryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
end
| 15.1 | 43 | 0.662252 |
33771580be24de5622ea2cfabe280d094cfd8636 | 1,984 | # frozen_string_literal: true
module Pages
class LookupPath
include Gitlab::Utils::StrongMemoize
LegacyStorageDisabledError = Class.new(::StandardError)
def initialize(project, trim_prefix: nil, domain: nil)
@project = project
@domain = domain
@trim_prefix = trim_prefix || project.ful... | 23.903614 | 135 | 0.671371 |
62bdcc21489774850bfd2b2c9b6a3b0ca0eb54a3 | 412 | require 'rubygems'
require 'simplecov'
require 'test/unit'
require 'shoulda'
require 'mocha/setup'
require 'rack'
SimpleCov.start do
add_filter 'specs/ruby/1.9.1/gems/'
add_filter '/test/'
add_filter '/config/'
end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirnam... | 21.684211 | 66 | 0.754854 |
2101371ed7ee8a297e6716c4ab635e0868a9b5e3 | 100 | class TransitionsController < ::ApplicationController
def index
@order = Order.last
end
end
| 16.666667 | 53 | 0.75 |
79bcbde75ed916d1e2b3ae29630297d62f7c1cb9 | 3,687 | # Dropzone Action Info
# Name: Print
# Description: Dropped files will be printed. If you have multiple printers, you will be prompted for which printer you wish to use.\n\nNote this action is intended as just a quick and dirty way to quickly print an image, PDF, Pages or MS Office document. It is not intended to let y... | 36.87 | 311 | 0.645782 |
26c170a45fe111a296bce06b14aaf04d2934ffba | 760 | def run
op = FileOperation.new
op.copy_replace_all
end
def verify_source
assert_source_file('file1.txt', /source/)
assert_source_file('file2.txt', /source/)
assert_source_nonexist('file3.txt')
assert_source_nonexist('file4.txt')
assert_source_file('dir1/file1.txt', /source/)
assert_source_file('dir1/di... | 29.230769 | 53 | 0.746053 |
e2479a983a905ed79d56db20f6ff484aeeb0c7b5 | 2,673 | #
# Author:: Seth Chisamore <schisamo@opscode.com>
# Cookbook Name:: php
# Provider:: pear_channel
#
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
#
# 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 ... | 28.43617 | 122 | 0.723158 |
1c25e5722badce272ce513537847612594a0ec37 | 5,166 | require 'rubygems'
require 'bundler/setup'
require 'manticore'
require 'zlib'
require 'json'
require 'rack'
require 'webrick'
require 'webrick/https'
require 'openssl'
require 'rspec/its'
require 'logger'
PORT = 55441
def local_server(path = "/", port = PORT)
URI.join("http://localhost:#{port}", path).to_s
end
Thre... | 35.142857 | 192 | 0.605885 |
1d8d430d35f469510dc7a79352f9515fc77375cb | 5,347 | require 'spec_helper'
require 'support/uses_redis'
require 'materialist/materialized_record'
RSpec.describe Materialist::MaterializedRecord do
uses_redis
let!(:materialized_type) do
Class.new do
include Materialist::MaterializedRecord
attr_accessor :source_url
source_link_reader :city
... | 29.871508 | 106 | 0.638863 |
26f62ba45296041aa3a95ca97b05833244ea1b6c | 4,060 | require 'open3'
require 'tempfile'
require 'securerandom'
describe "CLI" do
before(:each) do
#Laziness
`ps -ax | grep phantomjs | grep -v grep | awk '{print $1}' | xargs kill -9`
end
it "Will not exit in pipe mode" do
@finished = false
Thread.new do
`ruby -I./lib ./bin/boojs`
@finish... | 23.468208 | 99 | 0.580788 |
1ad47ca41aef12aef7f9b557561fb464beddba8e | 161 | class AddNameAndRoleToAdmin < ActiveRecord::Migration[5.2]
def change
add_column :admins, :name, :string
add_column :admins, :role, :integer
end
end
| 23 | 58 | 0.726708 |
5d5225f158df47b245bc53b27f58c2cd87f6ea93 | 12,962 | # frozen_string_literal: true
require "spec_helper"
require "dependabot/dependency"
require "dependabot/dependency_file"
require "dependabot/file_updaters/python/pip/pip_compile_file_updater"
require "dependabot/shared_helpers"
RSpec.describe Dependabot::FileUpdaters::Python::Pip::PipCompileFileUpdater do
let(:upda... | 33.321337 | 80 | 0.596667 |
ff32f92ce3f41165f50443212600167c7087e202 | 1,146 | class PenaltyAmountPage < BasePage
set_url '/steps/appeal/penalty_amount'
section :content, '#main-content' do
element :header, 'h1', text: 'How much is the penalty or surcharge you are disputing?'
element :one_hundred_or_less_option, 'label', text: '£100 or less'
element :one_hundred_to_twenty_thousan... | 36.967742 | 112 | 0.763525 |
f81e035b4de559804413bf3b290148b10d0a061d | 5,002 | require 'recurse'
class Notice < ApplicationRecord
serialize :server_environment, Hash
serialize :request, Hash
serialize :notifier, Hash
serialize :user_attributes, Hash
serialize :current_user, Hash
delegate :lines, to: :backtrace, prefix: true
delegate :app, :problem, to: :err
belongs_to :err
b... | 22.132743 | 128 | 0.687725 |
bbe4d61e86a1562f3c2282a289b505a754d4ea80 | 41 | module Vandamme
VERSION = "0.0.13"
end
| 10.25 | 20 | 0.682927 |
b971dbc20346f3de88a17f941081536dd0fd431e | 1,999 | #!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..','..','..','..','..', 'lib'))
require 'rex/post/meterpreter/extensions/stdapi/railgun/dll'
require 'rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper'
require 'rex/post/meterpreter/extensions/stdapi/railgun/mock_magic'
require '... | 31.234375 | 102 | 0.752376 |
260ef798d1e794aff8c55b0eba71e420c6fa60aa | 3,663 | class TerritoriesController < ApplicationController
load_and_authorize_resource
def territory_params
params.require(:territory).permit(:name, :maps, :description, :notes, :active, :territory_type_id, :congregation_id)
end
helper_method :sort_column, :sort_direction, :territory_types
# List territories
... | 28.84252 | 120 | 0.66148 |
62b880cfff0c00db4f0f5546d83821ec571800c2 | 479 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require "pi_charts"
# create a new pie chart
chart = PiCharts::Pie.new
# add datasets
chart.add_dataset(label: "cats", data: 80)
chart.add_dataset(label: "dogs", data: 20)
# make cats 90
chart.add_dataset(label: "cats", data: 10, add: true)
# make dogs 10, ... | 20.826087 | 58 | 0.724426 |
e83c8443cbfde2ef70615ae7bce16b2e7663063f | 250 | # frozen_string_literal: true
class IndexController < ApplicationController
def index
five = Article.first_five
@top1 = five[0]
@cat1 = five[1]
@cat2 = five[2]
@cat3 = five[3]
@cat4 = five[4]
@cat5 = five[5]
end
end
| 16.666667 | 45 | 0.62 |
bb3ac7ad506274ca1f47e11fc0121b7db694387a | 702 | # frozen_string_literal: true
require 'azurerm_resource'
class AzurermPublicIp < AzurermSingularResource
name 'azurerm_public_ip'
desc 'Verifies settings for public IP address'
example <<-EXAMPLE
describe azurerm_public_ip(resource_group: 'example', name: 'name') do
its(name) { should eq 'name'}
e... | 18 | 74 | 0.682336 |
03448099f43384ac2132268f208b9c838c4a8372 | 1,225 | #
# Copyright 2019 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 31.410256 | 132 | 0.721633 |
08c337a8ac600a5d216b8f249a802a0460b6f964 | 3,002 | #
# Author:: AJ Christensen (<aj@opscode.com>)
# Copyright:: Copyright (c) 2008 OpsCode, 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
#
# ... | 35.317647 | 144 | 0.590939 |
5de3b68a62297c072810997728cc4d28e5f76f6f | 296 | require 'rails_helper'
RSpec.describe Api::V1::TalksController, type: :controller do
describe 'GET #index' do
before do
sign_in FactoryBot.create(:user)
get :index
end
it 'returns http success' do
expect(response).to have_http_status(:success)
end
end
end
| 19.733333 | 61 | 0.682432 |
ac5717eda26acda56cb565999b5fdbefb26a819f | 2,202 | # TODO:
# - scores
# I.e fuzzy {:first_name => 1, :last_name => 2}, last_name gives double score
# Currently everything gets scored with 1
# - weighting of fuzzy_find results
module NoFuzz
def self.included(model)
model.extend ClassMethods
end
module ClassMethods
def self.extended(model)
@@mod... | 31.014085 | 95 | 0.622616 |
918b7a453e4029f19604172a3648311fc01f2aef | 6,788 | # GNU Octave, Qt-enabled, with build customized for Octave.app
#
# This version of Octave is kept at the current version. It is only
# used for grabbing the dependencies of Octave; it is not used for
# building Octave.app itself. The versioned octave formulae are used
# for that. This formula does not have versioned de... | 36.691892 | 136 | 0.683265 |
e2aaf701ce47711c2ca2716f2b25235c737e2b04 | 59,009 | # frozen_string_literal: false
#
# = drb/drb.rb
#
# Distributed Ruby: _dRuby_ version 2.0.4
#
# Copyright (c) 1999-2003 Masatoshi SEKI. You can redistribute it and/or
# modify it under the same terms as Ruby.
#
# Author:: Masatoshi SEKI
#
# Documentation:: William Webber (william@williamwebber.com)
#
# == Overview
#
#... | 30.307653 | 95 | 0.64441 |
1db68fdcc0a10c8a85717a047d895b1cff74959c | 7,814 | =begin
- Author:
Alvaro Martinez Petit
- Description:
This is the main script for the fourth assignment of the Bioinformatics Programming Challenges Course.
Execute the script by doing: $ ruby mainScript.rb proteome_file_1 proteome_file_2 database_proteome_1 database_proteome_2
@proteome_file_1 = File name or fil... | 40.278351 | 149 | 0.664576 |
1d7e884f49ed1ba8ea4bf0c1da68e9ee09059762 | 5,464 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'date'
module VSphereAutomation
... | 29.06383 | 111 | 0.621523 |
e9051681b44e1a731da440dd7765487ab1a4abc9 | 173 | class PositionDecorator < Draper::Decorator
delegate_all
decorates_association :user
decorates_association :role
def starts_at_date
starts_at.to_date
end
end
| 17.3 | 43 | 0.797688 |
793e80f4934836b82a2ca796745b417f0272d569 | 22,741 | # frozen_string_literal: true
require 'forwardable'
module CssParser
class RuleSet
# Patterns for specificity calculations
RE_ELEMENTS_AND_PSEUDO_ELEMENTS = /((^|[\s+>]+)\w+|:(first-line|first-letter|before|after))/i.freeze
RE_NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES = /(\.\w+)|(\[\w+)|(:(link|first-child|l... | 34.825421 | 163 | 0.633833 |
edb8524ae7f68c20730c0da8c06e81fe146ba427 | 587 | describe 'autotags status' do
let(:root) { tmpdir }
after do
clean_dir root
end
context 'with no pidfile' do
it 'should return 1' do
expect(autotags 'status', root).to eq 1
end
end
context 'with pidfile but no process' do
it 'should return 2' do
(root + '.autotags.pid').write ... | 18.935484 | 45 | 0.620102 |
ed6990a679cbab6c24188d5bfa95ec99fe754145 | 294 | cask 'yimello' do
version '0.3.3'
sha256 'e1022910be4363e989b6b0df8430a370589c4839884400be6af50492ba8fbbf4'
url "https://yimello.adriencadet.com/assets/zip/yimello-mac-#{version}.zip"
name 'Yimello'
homepage 'https://yimello.adriencadet.com/'
license :mit
app 'Yimello.app'
end
| 24.5 | 77 | 0.755102 |
284b2d039fa483b139a3439a721879fb95f5857a | 506 | # Improved Fibonacci
# Time Complexity - ?
# Space Complexity - ? O(n)
# Hint, you may want a recursive helper method
def fib_helper(solutions, current, n)
raise ArgumentError.new("negative input") if n < 0
return n if n == 0 || n == 1
if current == n
return solutions[0] + solutions[1]
end
temp = so... | 21.083333 | 52 | 0.662055 |
e9185c0b2ff33378ed695ab51696e4a0abf1137e | 2,405 | # Copyright (c) 2018 Public Library of Science
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | 43.727273 | 100 | 0.736383 |
2686e85ceeb84cd09d046efcd9c03ec15b819cd3 | 4,302 | require "testing_env"
require "cmd/update-report"
require "formula_versions"
require "yaml"
class ReportTests < Homebrew::TestCase
class ReporterMock < ::Reporter
attr_accessor :diff
def initialize(tap)
@tap = tap
ENV["HOMEBREW_UPDATE_BEFORE#{repo_var}"] = "12345678"
ENV["HOMEBREW_UPDATE_A... | 31.866667 | 88 | 0.741748 |
61414d6164ec987c5f696cd726d1841f5b14bc5c | 110 | Rails.application.routes.draw do
get '/chicago_dashboard_data', to: 'dashboards#chicago_dashboard_data'
end
| 27.5 | 72 | 0.818182 |
38b08600768b325bbbde094c79da003ba217a7c4 | 279 | admin_u = User.find_or_create_by(email: 'admin@me.com')
admin_u.password='admin123'
admin_u.admin=true
admin_u.confirmed_at = Time.now.utc
admin_u.save
u = User.find_or_create_by(email: 'just_u@me.com')
u.password='userme123'
u.confirmed_at = Time.now.utc
u.admin=false
u.save
| 21.461538 | 55 | 0.777778 |
f713a103a62c1d2059582a36d576c9c450368760 | 7,466 | # frozen_string_literal: true
# encoding: utf-8
module Unified
module SupportOperations
def run_command(op)
database = entities.get(:database, op.use!('object'))
use_arguments(op) do |args|
args.use!('commandName')
cmd = args.use!('command')
database.command(cmd)
en... | 28.496183 | 110 | 0.579829 |
217438d8ddb7d18a408945b64bfca142aef3633d | 403 | class AttractionsController < ApplicationController
def index
attractions = Attraction.all
render json: attractions
end
def create
attraction = Attraction.create(attraction_params)
render json: attraction
end
private
def attraction_params
params.requir... | 22.388889 | 92 | 0.682382 |
03082262cb319b0824ae384b27aad3e182176f27 | 366 | cask 'font-im-fell-dw-pica-sc' do
version :latest
sha256 :no_check
# github.com/google/fonts was verified as official when first introduced to the cask
url 'https://github.com/google/fonts/raw/master/ofl/imfelldwpicasc/IMFePIsc28P.ttf'
name 'IM Fell DW Pica'
homepage 'http://www.google.com/fonts/specimen/I... | 30.5 | 86 | 0.748634 |
5d9f2fc91fff7b98388d3ccc54967aa351015ab9 | 302 | cask :v1 => 'snowflake' do
version '1.0-148'
sha256 'd9d1f67801bd9ae82e33ca1fcf2bb9463442a62ed3d48f2cc20f73e6d1624b0b'
url "http://assets.vemedio.com/software/snowflake/Snowflake-#{version}.zip"
homepage 'http://vemedio.com/products/snowflake'
license :commercial
app 'Snowflake.app'
end
| 27.454545 | 77 | 0.768212 |
6a4f390423abcaeb36ac707f669d008fe97cc21f | 86 | RSpec.describe "45" do
it do
sleep 45 / 100.0
expect(45).to eq 45
end
end
| 12.285714 | 23 | 0.604651 |
62ae297d1a58f068389d223606c7d3607eb2e10d | 2,591 | require 'filmrolls/exiftool'
module Filmrolls
class Negative
def initialize(path)
@file = Exiftool.new(path)
end
def merge(args)
args.each do |key, value|
method = "#{key}="
public_send(method, value) if respond_to? method
end
end
def to_s
require 'yaml'
... | 21.413223 | 80 | 0.561945 |
6269f46736fc73ed8edf3efbf0e9186d94697003 | 15,846 | #POC project for pulling database tweets and generating various output, such as:
# * time-series CSV files with Twitter metadata... various counts per interval, like hashtags.
# * time-series of JSON/geoJSON objects.
#Currently, this code gets MySQL data directly...
require 'active_record'
require 'yaml'
require '... | 33.0125 | 120 | 0.642307 |
62e2f2786d3d044bf1a686bf0e6c96a543f0ca1a | 1,110 | Pod::Spec.new do |s|
s.name = "Flagger"
s.version = "3.0.3"
s.summary = "An open source Swift SDK for feature flagging (feature gating, feature toggles)"
s.swift_version = "5.1"
s.swift_versions = ["4.2", "5.0", "5.1"]
s.description = <<-DESC
... | 38.275862 | 106 | 0.564865 |
383d302d3276a71230e2bf5d5f26e811f6f9bfd6 | 171 | FactoryBot.define do
factory(:animal) do
name {Faker::JapaneseMedia::Naruto.character}
species {'cat'}
age {Faker::Number.between(from: 1, to: 18)}
end
end | 24.428571 | 49 | 0.678363 |
915bfd72ca513bb4cec1a7702a9ecdde10cc8bb5 | 4,455 | # frozen_string_literal: true
require 'spec_helper'
require 'stringio'
require 'tempfile'
require 'hailstorm/model/target_stat'
require 'hailstorm/model/nmon'
describe Hailstorm::Model::TargetStat do
context '.create_target_stat' do
it 'should calculate averages' do
project = Hailstorm::Model::Project.cre... | 53.674699 | 110 | 0.54321 |
919a7f71f3f551af81fcbf1d43c329ce5c99ce07 | 45,597 | module ApplicationController::MiqRequestMethods
extend ActiveSupport::Concern
included do
helper_method :dialog_partial_for_workflow
end
# AJAX driven routine to check for changes on the provision form
def prov_field_changed
if params[:tab_id]
@edit = session[:edit]
else
return unless... | 42.653882 | 203 | 0.621708 |
1aaf89590acfaef326aef18fa35d48fbe66cc2ef | 1,306 | # frozen_string_literal: true
require 'test_helper'
require 'minibuild/project/repository'
class RepositoryTest < Minitest::Test
include Minibuild::Project
def setup
@repo_url = 'git@github.com:borisaka/repo_4_minibuild.git'
@git_repo = GitRepository.new(@repo_url)
@github_repo = GithubRepository.new do... | 26.653061 | 77 | 0.712098 |
1179303171c7350670aa0b25284fc0c565d8d2c8 | 1,534 | # frozen_string_literal: true
require 'spec_helper'
describe 'Merge request > User sees WIP help message' do
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
before do
project.add_maintainer(user)
sign_in(user)
end
context 'with WIP commits' do
it 'sho... | 24.741935 | 74 | 0.626467 |
ed43a540bb811e64030033703db9ce953e16bd11 | 541 | cask 'colorado' do
version :latest
sha256 :no_check
url 'http://www.moesaid.com/colorado/app/colorado-mac-x64.zip'
name 'Colorado'
homepage 'http://www.moesaid.com/colorado/'
app 'colorado-mac/colorado.app'
zap trash: [
'~/Library/Application Support/colorado',
'~/Library/... | 30.055556 | 84 | 0.64695 |
bb08219ac04719bfd9668bc67d64a9870ff941dd | 1,230 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'standalone_validator/version'
Gem::Specification.new do |spec|
spec.name = "standalone_validator"
spec.version = StandaloneValidator::VERSION
spec.authors = ["Renato Za... | 37.272727 | 82 | 0.686992 |
08ed0054a28863e08245eb3dd02f61fea90d85fe | 1,955 | RSpec.describe NvimConf::ConfigurationBuilder do
describe "#build_configuration" do
context "when only one configuration scope is given" do
before do
NvimConf::Core.define do
configuration do
output_folder "$HOME/.config"
code_output :lua
documented true... | 25.723684 | 95 | 0.534527 |
bb49886ec86cdbfb680c18dd09eb3d6999b846ef | 2,515 | class TopMovies::Movies
attr_accessor :title, :url, :timeurl, :infourl, :reviewurl, :videosurl, :rating, :year, :genre,
:directedby, :company, :desc, :starring
@@all = []
def self.new_from_index_page(movie_row)
self.new(
@title = movie_row.css("div.smallposter.shrink img.lazy").attr("alt").text.stri... | 25.927835 | 112 | 0.629026 |
ff5ed2c6f5f8a59326dafd71e6a103612349d65d | 145 | class AddPreferredThemeToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :preferred_theme, :string, null: true
end
end
| 24.166667 | 60 | 0.758621 |
ab524e75a7d7d1e38a65e6823c614f802f3d981a | 1,563 | Recruiter::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test... | 42.243243 | 85 | 0.774792 |
628c3c3e9b1968770afed7181a1d9a4b419db4d5 | 1,364 | # frozen_string_literal: true
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 37.888889 | 88 | 0.755132 |
33ac41560c70d0fdff2ad1d5cfe56d6b0464207a | 2,221 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/cloud/eventarc/v1/eventarc.proto for package 'Google.Cloud.Eventarc.V1'
# Original file comments:
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 40.381818 | 134 | 0.688429 |
f716982d793d0ecaa9ca63b67d16209ed0213975 | 1,005 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = "RNFBIid"
s.version = package["version"]
s.description = package["description"]
s.summary = <<-DESC
A well tested fea... | 43.695652 | 122 | 0.545274 |
bbee34899ddacbff9c3996d3057179f06b9e2ad7 | 229 | run "yarn add vuex"
insert_into_file "#{PACKS_PATH}/#{name}.js" ,
"import Vuex from 'vuex'\n",
after: "import Vue from 'vue'\n"
insert_into_file "#{PACKS_PATH}/#{name}.js",
"Vue.use(Vuex)\n",
before: "document.addEventListener" | 25.444444 | 45 | 0.69869 |
87f343573aeccf570d76e5b59b50e077cb50dc5a | 5,725 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe ActiveRecord::SaferMigrations::Migration do
let(:migration_base_class) do
if ActiveRecord.version >= Gem::Version.new("5.0")
ActiveRecord::Migration[ActiveRecord::Migration.current_version]
else
ActiveRecord::Migration
end
... | 31.284153 | 86 | 0.670044 |
26d797fbfcc274feb19ab7acc28b70c61083ab02 | 3,843 | # frozen_string_literal: true
module DatabaseConsistency
module Checkers
# This class checks if association's foreign key type is the same as associated model's primary key
class ForeignKeyTypeChecker < AssociationChecker
INCONSISTENT_TYPE = 'associated model key (%a_f) with type (%a_t) mismatches key ... | 29.790698 | 111 | 0.604476 |
ab07af3b49cf77a8de38696c253f4855f15e64e2 | 512 | # frozen_string_literal: true
require 'action_controller/railtie'
module Healthcheck
class HealthchecksController < ActionController::Base
def check
return Healthcheck.custom!(self) if Healthcheck.custom?
checker = Healthcheck.check
response = if checker.errored?
Healthchec... | 25.6 | 68 | 0.644531 |
21de727a794a155984e11a5c9dfc1fa2322ffb09 | 20,116 | require 'tempfile'
module Git
class GitExecuteError < StandardError
end
class Lib
def initialize(base = nil, logger = nil)
@git_dir = nil
@git_index_file = nil
@git_work_dir = nil
@path = nil
if base.is_a?(Git::Base)
@git_dir = base.repo.path
... | 26.714475 | 120 | 0.538825 |
1d747b69ec1bb829ced301575b9dea4646c42947 | 707 | require 'spec_helper'
load 'lib/tasks/digests.rake'
describe Rake::Task['digests:send'] do
it 'queues a job for each digest subscription with events' do
email_subscription = create(:subscription, channel: 'email', email_address: 'a@b.cc')
create(:event, publisher: email_subscription.publisher, geom: email_su... | 41.588235 | 92 | 0.746818 |
e8b9f125ec0a67a25dc8eef7c4f83ba3dcf88d1e | 9,438 | # frozen_string_literal: true
require 'json'
require 'open3'
require 'set'
require 'tempfile'
require 'yaml'
# Make Hash act like OpenStruct for key lookups
class Hash
def respond_to_missing?(symbol, _include_all)
[symbol, symbol.to_s].any? { |key| key? key }
end
def method_missing(symbol, *args)
[symb... | 29.12963 | 121 | 0.686586 |
267451411d5871a2befda21a7f2041d8be023bfd | 953 | # frozen_string_literal: true
require_relative "../../spec_helper"
if defined?(::Redis)
require_relative "../../support/cache_store_helper"
require "timecop"
describe "Plain redis as a cache backend" do
before do
Rack::Attack.cache.store = Redis.new
end
after do
Rack::Attack.cache.stor... | 22.162791 | 98 | 0.632739 |
1ae3399219070760e00f9871802db1ae88b87684 | 2,358 | class NodeAT10 < Formula
desc "Platform built on V8 to build network applications"
homepage "https://nodejs.org/"
url "https://nodejs.org/dist/v10.23.1/node-v10.23.1.tar.xz"
sha256 "88aa16f5af79615b183ca55ed81393763169e75d1fb96013cf1831895c6cedfa"
license "MIT"
livecheck do
url "https://nodejs.org/dist... | 36.84375 | 113 | 0.691688 |
18952e19bd5d4f3e5ea10933ac92d57dbb5a8d16 | 12,346 | # -*- coding: utf-8 -*- #
# stdlib
require 'strscan'
require 'cgi'
require 'set'
module Rouge
# @abstract
# A lexer transforms text into a stream of `[token, chunk]` pairs.
class Lexer
include Token::Tokens
@option_docs = {}
class << self
# Lexes `stream` with the given optio... | 26.722944 | 103 | 0.552163 |
d56b1d26538d2de244ec4cf088c3699fcbfd7f22 | 1,040 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = users(:michael)
@non_admin = users(:archer)
@non_activator = users(:newcomer)
end
test "index as admin including pagination and delete links" do
log_in_as(@admin)
get users_path
assert_templa... | 25.365854 | 66 | 0.689423 |
1a29f9ee18bcff304d36d20cbec6fd2f1da2692e | 35 | class MoviePolicy < CorePolicy
end
| 11.666667 | 30 | 0.828571 |
aca14d79b1c0895de8b482d343f73bf981bd1b5f | 367 | name 'nginx'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures nginx'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends "rightscale"
recipe "nginx::default"... | 30.583333 | 72 | 0.702997 |
2837e2e960975ae542e9c3a3eb9e90221186b97a | 1,419 | RSpec.shared_examples 'plutto client test' do |method|
let(:resource_client) {}
it 'calls method on respective client' do
allow(resource_client).to receive(method.to_sym)
client.send(method)
expect(resource_client).to have_received(method.to_sym).once
end
end
RSpec.shared_examples 'plutto client tes... | 31.533333 | 85 | 0.728682 |
d5de2d692bb968e9b5c4bd6f331885f309efba23 | 669 | # Copyright 2019 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, ... | 29.086957 | 74 | 0.741405 |
8757bc793a6df68dbb269ead70398e2410f3edea | 853 | class MLKmeansDistance
# Membership rate is the greater the closer
def cosine_similarity(x1, x2)
sumA = 0.0
sumB = 0.0
sumAB = 0.0
x1.each.with_index{ |aValue, i|
bValue = x2[i]
sumA += (aValue * aValue)
sumB += (bValue * bValue)
sumAB += (aValue * bValue)
}
(su... | 22.447368 | 62 | 0.556858 |
283f4d54f2689886405c3a3df3521303df0d02d1 | 3,512 | require File.expand_path('../spec_helper', __FILE__)
load_extension("bignum")
def ensure_bignum(n)
0xffff_ffff_ffff_ffff_ffff.coerce(n)[0]
end
describe "CApiBignumSpecs" do
before :each do
@s = CApiBignumSpecs.new
@max_long = ensure_bignum(2**(0.size * 8 - 1) - 1)
@min_long = ensure_bignum(-@max_long... | 33.769231 | 102 | 0.673405 |
28612447058977d45be3c4a977d0207de273f5e8 | 87 | FactoryBot.define do
factory :viewer do
topic { nil }
user { nil }
end
end
| 12.428571 | 20 | 0.62069 |
7ac7d12b607c5afdeac6255e4beb910a76c46faf | 205 | require 'rails_helper'
RSpec.describe "presents/show", type: :view do
before(:each) do
@present = assign(:present, Present.create!())
end
it "renders attributes in <p>" do
render
end
end
| 17.083333 | 50 | 0.673171 |
7984e396991b4762914be70d2679d668293f7c6a | 1,221 | class Admin::CategoriesController < Admin::ApplicationController
before_filter :verify_logged_in
def new
@page_title = 'Add Category'
@category = Category.new
end
def create
@category = Category.new(category_params)
if @category.save
flash[:notice] = 'Category Created'
redirect_to ... | 20.016393 | 128 | 0.6724 |
214a7e578963059d8730f53d87780ce7f75d82dc | 353 | # frozen_string_literal: true
require "rspec/expectations"
RSpec::Matchers.define :have_content do |expected|
match do |actual|
File.read(actual) == expected
end
failure_message do |actual|
"expected that `#{actual}' would be have content '#{expected}', but it has '#{File.read(actual)}'" # rubocop:disa... | 25.214286 | 139 | 0.719547 |
624bfde7359823bd7b106b5368aeab32caed6d04 | 14,040 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin::Users::User' do
include Spec::Support::Helpers::Features::AdminUsersHelpers
let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') }
let_it_be(:current_user) { create(:admin) }
before do
sign_in(curr... | 31.836735 | 456 | 0.663462 |
d5805fcca08c47715d8c2c5a852e8451598d133f | 2,364 |
#.......................................................
# Do not move this 'evaluate' function inside a module
# Otherwise, the eval_uated class will be prefixed
# with the module itself
# ......................................................
def evaluate simfile
rcode=IO.read(simfile)
eval(rcode)
end
module R... | 24.371134 | 71 | 0.60533 |
62bdab4f368f2a167fdb39cbbbd62af69bbc1d61 | 447 |
class DressesPage < ExampleStorefrontBasePage
add_id_element(:h1, /DRESSES \nThere are 5 products./, class: ['page-heading', 'product-listing'])
add_route(:CasualDressesPage, :casual_dresses_button)
def create_elements
add_button(:casual_dresses, element_type: :link, xpath: "//div[@id='categories_block_l... | 26.294118 | 112 | 0.731544 |
7a5ec970ab85c45d0e00a592140c3e523d247fdd | 1,447 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Web::Mgmt::V2016_08_01
module Models
#
# An app cloneability criterion.
#
class SiteCloneabilityCriterion
include MsRestAzure
# ... | 25.385965 | 70 | 0.526607 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.