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 |
|---|---|---|---|---|---|
f8e34a9de127be2b5e8dde557715b896526172fc | 554 | # frozen_string_literal: true
$VERBOSE = {'false' => false, 'true' => true}[ENV['VERBOSE']] if ENV['VERBOSE']
if ENV['CODECOV']
require 'codecov' # require also simplecov
# if you want the formatter to upload the results use SimpleCov::Formatter::Codecov instead
SimpleCov.formatter = Codecov::SimpleCov::Forma... | 30.777778 | 93 | 0.750903 |
1a7b57a827246cc72840a396849a95f2ceb43847 | 4,661 | require 'spec_helper'
describe Monga::Cursor do
before do
EM.synchrony do
@client = Monga::Client.new(type: :sync, pool_size: 10)
@db = @client["dbTest"]
@collection = @db["testCollection"]
@collection.safe_remove
docs = []
10.times do |i|
docs << { artist: "Madonna", ... | 22.090047 | 76 | 0.563184 |
edc5bec15a2cbb0f9f5d864ed7e3eb55b876b57c | 1,432 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
module OpenTelemetry
module SDK
module Trace
module Export
# A noop exporter that demonstrates and documents the SpanExporter
# duck type. SpanExporter allows different tracing servi... | 30.468085 | 85 | 0.610335 |
e9155d174a3d7256c23ab01667b6d646bb8496de | 207 | class CreateLots < ActiveRecord::Migration
def change
create_table :lots do |t|
t.string :group
t.integer :number
t.references :kid
t.timestamps null: false
end
end
end
| 17.25 | 42 | 0.642512 |
d56aa7058c781ce14cc2017725e29b7591405bb8 | 360 | require 'rake/clean'
desc 'reinstall plugins'
task :reinstall do
toolchainpath="../../../plugins/"
plugins = ["gcc","clang","diab"]
plugins.each do |p|
plugin = "cxxproject_#{p}toolchain"
sh "gem uninstall #{plugin}"
cd "#{toolchainpath}toolchain#{p}" do
sh "gem build #{p}.gemspec"
sh "g... | 22.5 | 41 | 0.619444 |
7966b180de95615038fe61d20cd8b38756ead053 | 231 | class CreatePhones < ActiveRecord::Migration
def change
create_table :phones do |t|
t.string :number
t.string :phone_type
t.integer :owner_id
t.string :owner_type
t.timestamps
end
end
end
| 17.769231 | 44 | 0.65368 |
91739c5071b772eb3a59b8de78b5281dff2f12f2 | 19,245 | module RSpotify
# @attr [Boolean] collaborative true if the owner allows other users to modify the playlist
# @attr [String] description The playlist description
# @attr [Hash] followers Information about the followers of the playlist
# @attr [Array<Hash>] images Images for... | 47.754342 | 415 | 0.649415 |
e234ab26dcfb1a24266b809b90201cad844821cf | 1,966 | module TaskMapper::Provider
module Teambox
# Ticket class for taskmapper-teambox
API = TeamboxAPI::Task # The class to access the api's tickets
class Ticket < TaskMapper::Provider::Base::Ticket
# declare needed overloaded methods here
def initialize(*object)
if object.first... | 29.343284 | 121 | 0.550865 |
d5760f26f7afcbf34761d2882c447842c9fab77f | 1,140 | class CreateReleaseLogs < ActiveRecord::Migration
def change
create_table :release_logs do |t|
t.string :title, :null => false
t.text :description
t.boolean :send_email_notification
t.boolean :release_upon_publish
t.integer :project_id, :null => false
t.integer :user_id, :nu... | 28.5 | 73 | 0.695614 |
bf7f14c82e6181b8ff8b51554998cfb8f6521ce2 | 1,026 | module Troo
module Commands
class RefreshAll
def self.dispatch
new.refresh_all
end
def refresh_all
return success if refreshed?
failure
end
private
def success
'All local data refreshed.'
end
def failure
'Cannot refresh al... | 18.654545 | 75 | 0.533138 |
accb28eb5be4122633bf9099e6824d9e394523f1 | 3,549 | # encoding: utf-8
begin
require 'rubygems'
require 'bundler'
Bundler.setup
rescue LoadError => e
puts "Error loading bundler (#{e.message}): \"gem install bundler\" for bundler support."
end
require 'geoip'
if ENV['COVERAGE']
COVERAGE_THRESHOLD = 95
require 'simplecov'
require 'simplecov-rcov'
requir... | 25.717391 | 136 | 0.709777 |
f7caa5e79bdf2defa15232211c1c9259a9bdcdf8 | 1,204 | class Defaultbrowser < Formula
desc "Command-line tool for getting & setting the default browser"
homepage "https://github.com/kerma/defaultbrowser"
url "https://github.com/kerma/defaultbrowser/archive/1.1.tar.gz"
sha256 "56249f05da912bbe828153d775dc4f497f5a8b453210c2788d6a439418ac2ea3"
license "MIT"
bottl... | 40.133333 | 93 | 0.79485 |
5dd89b73aa94ef50dddaa9514e990c74d411dd27 | 669 | require 'rails_helper'
RSpec.describe AgreementLetter, type: :model do
it "returns its id as filename" do
@agreement_letter = FactoryGirl.create(:agreement_letter)
user_id = @agreement_letter.user.id
event_id = @agreement_letter.event.id
expect(user_id.to_s).not_to be_empty
expect(event_id.to_s).... | 33.45 | 83 | 0.753363 |
f8fce7d8723c0b6447d87b9be4fadec021b6e106 | 683 | cask 'font-monoid-tight-xtralarge-0-l' do
version :latest
sha256 :no_check
# github.com/larsenwork/monoid was verified as official when first introduced to the cask
url 'https://github.com/larsenwork/monoid/blob/release/Monoid-Tight-XtraLarge-0-l.zip?raw=true'
name 'Monoid-Tight-XtraLarge-0-l'
homepage 'ht... | 34.15 | 97 | 0.743777 |
9168e3b44c92ea4c7ac20a9d18798d96d365d389 | 2,040 |
# frozen_string_literal: true
require File.expand_path('lib/sanitize_email/version', __dir__)
Gem::Specification.new do |s|
s.name = 'sanitize_email'
s.version = SanitizeEmail::VERSION
s.authors = ['Peter Boling', 'John Trupiano', 'George Anderson']
s.summary = 'Email Condom for your Ruby Server'
s.descri... | 40.8 | 203 | 0.696078 |
d5563fd87876292c7e3f870db58bfa9c06c596c7 | 195 | require File.dirname(__FILE__) + '/../test_helper'
class SingleStiParentRelationshipTest < Test::Unit::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end
| 21.666667 | 60 | 0.748718 |
6a150e598b19890c995e479712517de4158b4b4e | 1,072 | class Certstrap < Formula
desc "Tools to bootstrap CAs, certificate requests, and signed certificates"
homepage "https://github.com/square/certstrap"
url "https://github.com/square/certstrap/archive/v1.1.1.tar.gz"
sha256 "412ba90a4a48d535682f3c7529191cd30cd7a731e57065dcf4242155cec49d5e"
bottle do
cellar ... | 38.285714 | 109 | 0.76306 |
01f35e1ec760272ac81308383525d819bf5954a8 | 1,115 | require 'mongoid/token/collisions'
module Mongoid
module Token
class CollisionResolver
attr_accessor :create_new_token
attr_reader :klass
attr_reader :field_name
attr_reader :retry_count
def initialize(klass, field_name, retry_count)
@create_new_token = Proc.new {|doc|}
... | 25.930233 | 74 | 0.647534 |
1d8525466fafcd8caebff5503d97881fb07601f8 | 5,863 | #
# Be sure to run `pod spec lint LoopMeSDK.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.c... | 40.434483 | 251 | 0.62306 |
6aa9ee425f8d9458d072262f0fd856c765079372 | 949 | # encoding: utf-8
$:.push File.expand_path("../lib", __FILE__)
require "vnctools/version"
Gem::Specification.new do |s|
s.name = "vnctools"
s.version = VncTools::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Jari Bakken"]
s.email = ["jari.bakken@gmail.com"]
s.homepage = ... | 35.148148 | 87 | 0.650158 |
111294f201082aaffa5514174deb42a529700ce0 | 927 | Dish::DishType.class_eval do
def self.main
Dish::DishType.find_by(name: "Main")
end
def self.soup
Dish::DishType.find_by(name: "Soup")
end
def self.vegetable
Dish::DishType.find_by(name: "Vegetable")
end
def products_of_date(date)
self.products.select{|p| p.available_ons.any? {|d| d.del... | 20.152174 | 91 | 0.683927 |
913b12f3077711753c1f1c700e5b3be2e0ca3ce9 | 94 | json.extract! @sensor_access, :id, :sensor_id, :module_id, :user_id, :created_at, :updated_at
| 47 | 93 | 0.755319 |
1c3ed1db964364280bd5b15213b97623af7d3d35 | 955 | # Get My Number Game
# Written by: you!
puts "Welome to 'Get My Number!"
# Getting name from the player
print "What's your name? "
input = gets
name = input.chomp.capitalize
puts "Welcome, #{name}"
# Save random digit
puts "I've got a random number between 1 and 100."
puts "Can you gess it?"
target = rand(100) + 1... | 19.489796 | 61 | 0.659686 |
79c94384b1ed60c7e5ce1294b4493e0b860126fd | 1,354 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'gormanic/version'
Gem::Specification.new do |spec|
spec.name = "gormanic"
spec.version = Gormanic::VERSION
spec.authors = ["Andy Henson"]
spec.email = ["andy@... | 39.823529 | 113 | 0.671344 |
4a1591a90a85c34b0cdd077950e5f660eee3d9c0 | 93 | # desc "Explaining what the task does"
# task :flex_attributes do
# # Task goes here
# end
| 18.6 | 38 | 0.698925 |
5dc64cf88219930e95fd390bd06eb96b5ae47b9c | 128 | module ApplicationHelper
def current_user
session[:user_id] ? User.find_by(id: session[:user_id]) : nil
end
end
| 21.333333 | 69 | 0.6875 |
283187eacb1d05eefd4f815dd28a82a3734b9eee | 622 | describe package('filebeat') do
it { should be_installed }
end
describe file('/etc/filebeat/filebeat.yml') do
its('owner') { should cmp 'root' }
its('group') { should cmp 'root' }
its('mode') { should cmp '0640'}
end
describe file('/etc/filebeat/wazuh-template.json') do
its('owner') { should cmp '... | 24.88 | 57 | 0.646302 |
0394bbd8d730517c6d10ffed65495cea15f795ce | 5,710 | require "spec_helper"
RSpec.describe Keisan::AST::Time do
describe "is_constant?" do
it "is true" do
time = Keisan::AST.parse("time(2018)").evaluate
expect(time.is_constant?).to eq true
end
end
describe "evaluate" do
it "reduces to a time when adding numbers" do
ast = Keisan::AST.p... | 34.817073 | 97 | 0.608932 |
5d930fa6686e7572e34e323b1d1edfcb26bbbd8f | 191 | RSpec.describe SazbiViewTool do
it "has a version number" do
expect(SazbiViewTool::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 19.1 | 48 | 0.717277 |
1a8e06590e1f11457b2579a78fd9e778f28d946f | 946 | require 'lims-api/core_action_resource'
require 'lims-api/struct_stream'
require 'lims-laboratory-app/laboratory/tube_rack'
require 'lims-laboratory-app/laboratory/tube_rack/create_tube_rack'
module Lims::LaboratoryApp
module Laboratory
class TubeRack
class CreateTubeRackResource < Lims::Api::CoreAction... | 27.823529 | 88 | 0.61945 |
38ab070ebe057131e5d744b90beda52d0cf6afc4 | 297 | # frozen_string_literal: true
# This class use materialized view strategy
# You can find out more here: lib/generators/metka/strategies/materialized_view/materialized_view_generator.rb
class MaterializedViewPost < ActiveRecord::Base
include Metka::Model(column: 'tags')
belongs_to :user
end
| 29.7 | 110 | 0.811448 |
0185aa88ea6b42588fe361b85fbe0c80e807ef71 | 4,055 | # 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::V2017_11_01
module Models
#
# Effective Route
#
class EffectiveRoute
include MsRestAzure
# @ret... | 31.434109 | 79 | 0.489766 |
ac4e167b385922642d418883057e3f1763889bcf | 415 | RSpec.describe StudentsController do
fixtures :users, :students
let(:valid_session) { sign_in users(:admin) }
let(:valid_attributes) {{first_name: "Susan", last_name: "Noetal"}}
describe "GET #index" do
it "assigns all students as @students" do
student = Student.create! valid_attributes
get :... | 27.666667 | 69 | 0.693976 |
876b3eeb377d33e9488638c5b3c67bcce7edb68a | 9,204 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 35.674419 | 126 | 0.704911 |
e8f3eafd14e76d4eb5976abb3e58114df28f493c | 949 | class SessionsController < ApplicationController
def new
redirect_to '/auth/google_oauth2'
end
def create
auth = request.env["omniauth.auth"]
user = User.where(:provider => auth['provider'],
:uid => auth['uid'].to_s).first || User.create_with_omniauth(auth)
# Reset the session... | 24.973684 | 88 | 0.683878 |
010bff2a4b0a65d11df1aedae167430f58a1cdf0 | 5,780 | ################################################################################
# Before running test, set up the test db & table with:
# rake setup
# or create the database manually if your environment doesn't permit
################################################################################
require_relative... | 28.9 | 111 | 0.640311 |
bfa8c13674019d643f01d1f4d52d359948902ca4 | 638 | module QualtricsAPI
class Panel < BaseModel
values do
attribute :id, String
attribute :library_id, String
attribute :name, String
attribute :category, String
end
def members(options = {})
@members ||= QualtricsAPI::PanelMemberCollection.new(options.merge(id: id)).propagate_c... | 19.333333 | 108 | 0.615987 |
794b8d4933d346758020a5c54b823b6afbc21d61 | 860 | cask "dynobase" do
version "1.4.0"
if Hardware::CPU.intel?
sha256 "9954440dc838fc4459e72ed5d607c3e2c9f388dba07ca9c94b8cad115fb7abfd"
url "https://github.com/Dynobase/dynobase/releases/download/#{version}/Dynobase-#{version}.dmg",
verified: "github.com/Dynobase/dynobase/"
else
sha256 "7cb4e28... | 26.875 | 106 | 0.726744 |
790d927265865ecb29e9ed139d44e4e5b8b87b0e | 1,977 | # Copyright (C) 2010-2011, 2013, 2015 Rocky Bernstein <rockyb@rubyforge.net>
require_relative '../command'
class Trepan::Command::AliasCommand < Trepan::Command
unless defined?(HELP)
NAME = File.basename(__FILE__, '.rb')
HELP = <<-HELP
**#{NAME}** *alias* *command*
Add alias *alias* for a debugger command ... | 27.458333 | 78 | 0.611027 |
186722e064628a74a0a89f4d39e3c4ec443198c5 | 595 | # frozen_string_literal: true
require_relative "vultr/version"
module Vultr
autoload :Client, "vultr/client"
autoload :Collection, "vultr/collection"
autoload :Error, "vultr/error"
autoload :Object, "vultr/object"
autoload :Resource, "vultr/resource"
autoload :Account, "vultr/objects/account"
autoload ... | 28.333333 | 54 | 0.757983 |
b95b9b7be9361056ceec5620caff892d79d073d6 | 1,660 | class Libgr < Formula
desc "GR framework: a graphics library for visualisation applications"
homepage "https://gr-framework.org/"
url "https://github.com/sciapp/gr/archive/v0.64.0.tar.gz"
sha256 "bfefe7e067480584faa2ad1ce296c1aaea1d0da2035224b46024abfaa6931076"
license "MIT"
bottle do
sha256 arm64_mont... | 29.642857 | 93 | 0.641566 |
01144277952b0b8b5c398a6a5d50cbb5460d1462 | 4,922 | class MonthlyDistrictDataService
attr_reader :region, :period, :months, :repo, :dashboard_analytics
def initialize(region, period)
@region = region
@period = period
@months = period.downto(5).reverse
regions = region.facility_regions.to_a << region
@repo = Reports::Repository.new(regions, period... | 35.410072 | 121 | 0.679805 |
ff6f653a367bca61db82ea6777b97166f3147725 | 786 | # frozen_string_literal: true
require 'test_helper'
class EpochsIndexHtmlErbTest < ActionDispatch::IntegrationTest
setup do
@epoch = epochs(:epoch_1)
@user = users(:users_1)
sign_in @user
end
test 'should get index' do
get epochs_url
assert_response 200
@epoches = Epoch.all
asser... | 24.5625 | 124 | 0.695929 |
ffbfd94f01e78c8be26247ad5e18cb099a93073a | 19,957 | require 'i18n'
require 'middleman'
require 'middleman-core/cli'
require 'middleman-core/profiling'
require 'ostruct'
require 'redcarpet'
require 'yaml'
require_relative '../../../lib/bookbinder/middleman_runner'
require_relative '../../helpers/middleman'
require_relative '../../helpers/redirection'
require_relative '..... | 33.428811 | 261 | 0.610412 |
6296ca5fceca406535fee4d1450d7d3ab6120df2 | 373 | # 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::V2017_09_01_preview
module Models
#
# Defines values for FileServerType
#
module FileServerType
Nfs = "... | 21.941176 | 70 | 0.699732 |
ace9c2ac186b85e76ddc100ea92ea784fe99e45a | 639 | require "rizzo/version"
require "rizzo/url_encryptor"
module Rizzo::Assets
def self.precompile
[
'common_core.css',
'common_core_ie.css',
'common_core_no_font.css',
'common_core_no_font_ie.css',
'common_core_overrides.css',
'common_core_overrides_ie.css',
'common_legacy.... | 22.034483 | 37 | 0.605634 |
e8defa62aae2eadd5e89ba1e00a273a582e39cc5 | 610 | module ActiveReporter::Serializer::BaseOverride
extend ActiveSupport::Concern
included do
def human_time_value_label(dimension, value)
case value.bin_edges
when :min_and_max
time_formats.detect { |step, format| return value.min.strftime(format) if value.max == value.min.advance(step => 1) }... | 29.047619 | 159 | 0.677049 |
33b3a1bd8d2d014676e8ee03f662a21a77444ca9 | 3,157 | class Runit < Formula
desc "Collection of tools for managing UNIX services"
homepage "http://smarden.org/runit"
url "http://smarden.org/runit/runit-2.1.2.tar.gz"
sha256 "6fd0160cb0cf1207de4e66754b6d39750cff14bb0aa66ab49490992c0c47ba18"
bottle do
sha256 "e70c75527e992d70255d13631b56e7f1629cb1dc3583881967c... | 33.585106 | 106 | 0.644599 |
d5ae854c1bbfbebdd80cdaa52d14ae16491c1ed4 | 1,904 | # -*- encoding: utf-8 -*-
# stub: listen 3.1.5 ruby lib
Gem::Specification.new do |s|
s.name = "listen".freeze
s.version = "3.1.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Thibaud Guillaume-G... | 42.311111 | 125 | 0.639706 |
61cff0f6e97243214b8eb5b454dc01fb9367b82b | 987 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | 35.25 | 178 | 0.777102 |
39cef79e3b2fdece937c61c7c28557c481f4c07f | 341 | RSpec.describe(Tony::Response) {
it('does not allow writing to body') {
resp = Tony::Response.new
expect { resp.body = 'Hello World' }.to(raise_error(NoMethodError))
}
it('holds an error') {
resp = Tony::Response.new
resp.error = Exception.new('Hello World')
expect(resp.error.message).to(eq('... | 26.230769 | 71 | 0.648094 |
e98b672e75e1f9db9c78a8d9e205fe71ad60e6ff | 1,503 | class Pdnsrec < Formula
desc "Non-authoritative/recursing DNS server"
homepage "https://www.powerdns.com/recursor.html"
url "https://downloads.powerdns.com/releases/pdns-recursor-4.4.1.tar.bz2"
sha256 "f97fa34635d42c68acee5d4da9db0e5ff619fd49e62acace7b4bdb7ee3675698"
license "GPL-2.0-only"
livecheck do
... | 31.3125 | 94 | 0.71191 |
2864a15a1d15a3bf61842e6258bf6090c19aaba5 | 1,455 | Pod::Spec.new do |spec|
spec.name = 'RxStarscream'
spec.version = '0.12'
spec.license = 'Apache License, Version 2.0'
spec.homepage = 'https://github.com/RxSwiftCommunity/RxStarscream'
spec.authors = { 'Guy Kahlon' => 'guykahlon@gmail.com' }
spec.summary ... | 46.935484 | 119 | 0.671478 |
ac9ec96adca71b6ce9a4b3d11b546e14d675661b | 11,579 | require "norn/world/bounty/bounty"
##
## thank you Kragdruk
##
module Norn
class Bounty
module Parser
require 'ostruct'
@@task_assignment_regexs = {
/It appears they have a creature problem they'd like you to solve/ => :cull,
/It appears they need your help in tra... | 56.759804 | 401 | 0.56257 |
e9e08d3c53a91a2b413ff98c9dcf9deef16351f2 | 627 | module Kamiflex
module Actions
def message_action(label, **params)
{
type: "message",
label: label,
text: params[:text] || label
}.merge(params)
end
def uri_action(uri, **params)
action = {
type: "uri",
label: uri[0...40],
uri: uri
}... | 17.416667 | 44 | 0.515152 |
3921510e5d2cba0e45ea79dc430837c9cc25c344 | 2,623 | module Ingenico::Direct::SDK
# Contains the URL, username and password of a proxy.
#
# @attr [String] scheme Proxy scheme (http or https)
# @attr [String] host Proxy hostname
# @attr [Integer] port Proxy port
# @attr [String] username Proxy authentication username
# @attr [String] password Proxy... | 34.973333 | 99 | 0.67175 |
5dfb7d077555e5beab821fab54cac6f6b01cf637 | 4,205 | # frozen-string-literal: true
#
# The server_block extension adds the Database#with_server method, which takes a shard
# argument and a block, and makes it so that access inside the block will use the
# specified shard by default.
#
# First, you need to enable it on the database object:
#
# DB.extension :server_block... | 27.129032 | 93 | 0.662545 |
9102702e232b9acf3a57f25ed016c1c12f31eb7a | 2,481 | module Api
module V2
class SavedSearchesController < ApiController
respond_to :json
before_action :validate_content_type, only: [:create]
before_action :validate_create, only: [:create]
def index
@user = current_user
@saved_searches = @user.saved_searches.order(Arel.sql("... | 28.193182 | 117 | 0.591697 |
e81f35f566e67ef50350ff17f9adc9558f16cfc7 | 1,036 | Gem::Specification.new do |s|
s.name = 'cucumber-rest-bdd'
s.version = if ENV['TRAVIS'] && ENV['TRAVIS_TAG'] == ''
"0.6.1-#{ENV['TAVIS_BUILD_NUMBER']}"
else
'0.6.1'
end
s.platform = Gem::Platform::RUBY
s.date... | 37 | 76 | 0.547297 |
21ffc2374f02828aa664cbc0b4b921e6fe4fd561 | 129 | (1..100).each { |x| str = ''; str += 'Fizz' if (x % 3).zero?; str +=
'Buzz' if (x % 5).zero?; str = x if str.empty?; puts str }
| 43 | 69 | 0.488372 |
bf7b4f8d407ceabaeb04faa94d9662eb3de4655c | 4,707 | # frozen_string_literal: true
require_relative "includes"
require_relative "../../types"
require_relative "../../configuration"
begin
require "smartcard"
require "yubioath"
SMARTCARD_SUPPORT = true
rescue LoadError
SMARTCARD_SUPPORT = false
end
class AwsAssumeRole::Credentials::Providers::MfaSessionCr... | 36.207692 | 122 | 0.690461 |
ffe81cbc97d959791b22c2ff408eb57bfe75b32b | 2,228 | # encoding: utf-8
module Github
module Authorization
attr_accessor :scopes
# Setup OAuth2 instance
def client
@client ||= ::OAuth2::Client.new(client_id, client_secret,
{
:site => current_options.fetch(:site) { Github.site },
:authorize_url => 'login/oauth/aut... | 28.935065 | 112 | 0.628815 |
2111f3813c55754d6203635daefac6d110c569e4 | 2,937 | # Copyright (C) 2009-2019 MongoDB 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 w... | 25.99115 | 83 | 0.640109 |
6a19ad80aa502baa5dd684ccfbb671b71e174f6d | 1,435 | class MalwareScanner
def self.call(**args)
new(**args).call
end
LOCAL_COMMAND = %w[clamdscan --fdpass --no-summary].freeze
CONTAINER_COMMAND = %w[clamdscan -c config/clamd.container.conf --stream --no-summary].freeze
def initialize(file_path:, uploader: nil, file_details: nil, save_result: true)
... | 23.145161 | 97 | 0.675261 |
61e47340d67c13fa1272c3a3cf76cc8071fc4c95 | 303 | # frozen_string_literal: true
require 'rails/railtie'
module YgreneIstioTracing
module Tracing
class Railtie < ::Rails::Railtie
initializer 'ygrene_istio_tracing.insert_middleware' do |app|
app.middleware.use YgreneIstioTracing::Tracing::RackMiddleware
end
end
end
end
| 21.642857 | 70 | 0.742574 |
11036e53e2c4a980f39ffaea758383b8d2de7339 | 2,873 | Kaminari::Helpers::Tag.class_eval do
def page_url_for(page)
if @param_name.is_a?(Array)
@params[@param_name[0]] = (@params[@param_name[0]] || {}).merge(@param_name[1] => (page <= 1 ? 1 : page))
return @template.url_for @params
end
@template.url_for @params.merge(@param_name => (page <= 1 ? 1 ... | 30.242105 | 111 | 0.64149 |
87b8c50657e6f380f27767fefa74fed7c64cb2bd | 274 | class CreateOrganisationMembers < ActiveRecord::Migration
def self.up
create_table :organisation_members do |t|
t.integer :user_id
t.integer :organisation_id
t.timestamps
end
end
def self.down
drop_table :organisation_members
end
end
| 18.266667 | 57 | 0.718978 |
b91281a27457bcbe1e48626990bb252cef802ceb | 586 | require 'pscb_integration/version'
require 'pscb_integration/client'
require 'pscb_integration/config'
require 'pscb_integration/engine'
module PscbIntegration
ConfigurationError = Class.new(StandardError)
class << self
attr_accessor :config
def config
@config ||= begin
if @setup_block
... | 19.533333 | 47 | 0.65529 |
ac7d843ff0deed74baea4fb52c03652289ecbd13 | 1,874 | # frozen-string-literal: true
require 'spec_helper'
RSpec.describe Kitchen::Directions::CompositePageContainer do
before do
stub_locales({
'eoc': {
'top-level': 'Top Level Container',
'some-eoc-section': 'Some Eoc Section'
},
'eob': {
'eob-section': 'EOB SECTION'
... | 28.393939 | 168 | 0.602455 |
184b965b80406df2eff9476b58c08179972147ee | 7,490 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Nuo Yan (<nuo@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 obta... | 28.264151 | 128 | 0.599199 |
6171746814092ca535ac149ba1e5d41b2406ed3e | 60 | class Funder < ActiveRecord::Base
belongs_to :type
end
| 10 | 33 | 0.733333 |
bf9514a2db50ef5e79cbbe70578d9a48ff55e6bc | 85 | # frozen_string_literal: true
module LLHttp
class Error < StandardError
end
end
| 12.142857 | 29 | 0.776471 |
33013f616241a095e4d1c2ca74cafc20c2e6b167 | 54 | module JqueryTableExportRails
VERSION = "0.1.1"
end
| 13.5 | 29 | 0.759259 |
6acfd518465576eff3ecf067ed756895e8a1e35f | 425 | class SwitchCmsVariablesToPolymorphicParent < ActiveRecord::Migration[5.2]
def change
remove_foreign_key :cms_variables, :conventions
change_table :cms_variables do |t|
t.rename :convention_id, :parent_id
t.string :parent_type
end
change_column_null :cms_variables, :parent_id, true
... | 25 | 74 | 0.727059 |
797662d07ce0134914d6714a9fa04dbd56e13b75 | 2,691 | module ActiveRecord
module ConnectionAdapters # :nodoc:
# The goal of this module is to move Adapter specific column
# definitions to the Adapter instead of having it in the schema
# dumper itself. This code represents the normal case.
# We can then redefine how certain data types may be handled in th... | 29.9 | 103 | 0.631364 |
7a42dd97128c5c04f42892ac0d07d655421987c5 | 2,541 | class Gws::Schedule::CommentsController < ApplicationController
include Gws::BaseFilter
include Gws::CrudFilter
include Gws::Memo::NotificationFilter
model Gws::Schedule::Comment
navi_view "gws/schedule/main/navi"
private
def set_cur_schedule
@cur_schedule ||= Gws::Schedule::Plan.find(params[:plan... | 30.987805 | 129 | 0.687131 |
916d035c0c95eb9f36183334e4cc62cb32e7cfb1 | 486 | require 'rails_helper'
describe TagsController, type: :controller do
let(:tag) { FactoryGirl.create(:tag_ruby) }
describe "GET 'show' without login" do
it 'returns http redirect' do
get 'show', name: tag.name
expect(response).to redirect_to('/')
end
end
describe "GET 'show' with login" d... | 20.25 | 45 | 0.660494 |
28c97010ba0febb5caacb7920dedb6cc71e34fb9 | 1,725 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
ruby_version_is "1.8.7" do
describe "Enumerable#minmax_by" do
it "returns an enumerator if no block" do
EnumerableSpecs::Numerous.new(42).minmax_by.should be_an_instance_of(enumerator_class)... | 39.204545 | 110 | 0.646377 |
f8bbfaa6e40518e6821c24e4b278a3a12ca410aa | 1,082 | # Encoding: utf-8
#
# This is auto-generated code, changes will be overwritten.
#
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
# License:: Licensed under the Apache License, Version 2.0.
#
# Code generated by AdsCommon library 0.9.5 on 2014-08-20 16:29:24.
require 'ads_common/savon_service'
require '... | 25.162791 | 69 | 0.702403 |
6140eb2570436b6309d269aa7ee89fccf92e9974 | 776 | # frozen_string_literal: true
module VacancyHelper
def vacancy_available_for_course_site_status?(course, site_status, vacancy_study_mode = nil)
case course.study_mode
when "full_time"
site_status.full_time_vacancies?
when "part_time"
site_status.part_time_vacancies?
when "full_time_or_par... | 24.25 | 94 | 0.761598 |
01b28c09312c5b0890958c0fa60ae21f2dc6d87c | 553 | class MeursingTableCellComponent < Sequel::Model
include ::XmlGeneration::BaseHelper
plugin :oplog, primary_key: %i[meursing_table_plan_id
heading_number
row_column_code
meursing_additional_code_sid]
plugin :confor... | 26.333333 | 66 | 0.638336 |
085d1bc440e3bf55c4ef6e11c21d14554dea38ec | 162 | # Be sure to restart your server when you modify this file.
Rails4MysqlMongo::Application.config.session_store :cookie_store, key: '_rails4_mysql_mongo_session'
| 40.5 | 100 | 0.82716 |
0112125f61ce8d49bfbf18259b20672ce17047f9 | 24,487 | require 'chef_helper'
require 'yaml'
RSpec.describe 'patroni cookbook' do
before do
allow(Gitlab).to receive(:[]).and_call_original
end
let(:chef_run) do
ChefSpec::SoloRunner.new(step_into: %w(database_objects)).converge('gitlab-ee::default')
end
it 'should be disabled by default' do
expect(che... | 33.315646 | 126 | 0.590191 |
d54f2ab8f67cc416c4ac9f01425e4c16cd226cf4 | 1,184 | # 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... | 47.36 | 76 | 0.784628 |
d582f150705e5ff2ca4c7c5fb1493cafea6da390 | 3,645 | class Coreutils < Formula
desc "GNU File, Shell, and Text utilities"
homepage "https://www.gnu.org/software/coreutils"
url "https://ftp.gnu.org/gnu/coreutils/coreutils-8.30.tar.xz"
mirror "https://ftpmirror.gnu.org/coreutils/coreutils-8.30.tar.xz"
sha256 "e831b3a86091496cdba720411f9748de81507798f6130adeaef872... | 35.048077 | 93 | 0.689712 |
1cf5269319e893e52d249a6d880bc6d155581d77 | 78 | require 'test_helper'
class TournamentsHelperTest < ActionView::TestCase
end
| 15.6 | 50 | 0.833333 |
1cbbd0c82c543bf244e7fe1ccd954fbacfca7834 | 824 | Pod::Spec.new do |s|
s.name = "Gloss"
s.version = "3.0.0"
s.summary = "A shiny JSON parsing library in Swift"
s.description = "A shiny JSON parsing library in Swift. Features include mapping JSON to objects, mapping objects to JSON, handling of nested objects and custom trans... | 43.368421 | 185 | 0.578883 |
1115d0ad1756e401a3468f1f332ca67872becb60 | 639 | cask "scratch" do
version "3.26.0"
sha256 "8a25afb528c2de7206ef4f1493ed8ebc78335e7ae9be5659bf7c339c8554bef9"
url "https://downloads.scratch.mit.edu/desktop/Scratch%20#{version}.dmg"
name "Scratch"
desc "Programs interactive stories, games, and animations"
homepage "https://scratch.mit.edu/download"
live... | 26.625 | 75 | 0.732394 |
794be80a586e6c0bcca85fb532e1cf568885a3d5 | 815 | module NewsScraper
module ExtractorsHelpers
# Perform an HTTP request with a standardized response
#
# *Params*
# - <code>url</code>: the url on which to perform a get request
#
def http_request(url)
url = URIParser.new(url).with_scheme
CLI.put_header(url)
CLI.log "Beginning... | 25.46875 | 103 | 0.623313 |
1d0b1972ad710424c7ddd4123a331add1e05f264 | 76 | module Ovirt
module Logging
delegate :logger, :to => :Ovirt
end
end
| 12.666667 | 35 | 0.671053 |
1aa210a63761dad4040061f39ecbf181d9a6773d | 146 | class AddCalendarIdToLocations < ActiveRecord::Migration[5.2]
def change
add_column :locations, :calendar_id, :string, null: true
end
end
| 24.333333 | 61 | 0.760274 |
1a01fb67f0ac95054ee5f91dd2acce0a19e240f6 | 251 | # frozen_string_literal: true
shared_examples_for "a versioned model" do
let(:model) { Fabricate(described_class.to_s.downcase) }
it 'should be versioned' do
expect(model).to respond_to(:version)
expect(model.version).to eq(1)
end
end
| 22.818182 | 58 | 0.737052 |
1855ac47e20645e69f663d62e64f506d5935bce5 | 896 | cask 'fujifilm-x-raw-studio' do
version '1.10.0,yx6qx3w0'
sha256 'eebc03974e47ee4c0c341e085e311a2f45c8b7052635bdb24416d54673082b73'
url "https://dl.fujifilm-x.com/support/software/x-raw-studio-mac#{version.before_comma.no_dots}-#{version.after_comma}/XRawStudio#{version.before_comma.no_dots}.dmg"
appcast 'http... | 40.727273 | 167 | 0.714286 |
61e6020b40f5817fe07285e2e3ebd30c09a9596c | 11,236 | module ActiveRecord
module Associations
class HasManyThroughAssociation < AssociationProxy #:nodoc:
def initialize(owner, reflection)
super
reflection.check_validity!
@finder_sql = construct_conditions
construct_sql
end
def find(*args)
options = Base.send... | 43.550388 | 281 | 0.62718 |
212f989448f858a0b0c16a2b099681c2956b7cd9 | 3,629 | require "rails_helper"
RSpec.describe "API Key Management" do
it "can list api keys" do
user = create(:user)
sign_in(user)
access_token = create(:access_token, resource_owner: user.account)
other_access_token = create(:access_token)
visit(dashboard_access_tokens_path)
expect(page).to have_t... | 28.574803 | 100 | 0.69606 |
01ef95f32ee124ada8b92d7a982e4e30e792a8b4 | 2,845 | module Gws::Memo
class Initializer
Gws::User.include Gws::Memo::NoticeUserSetting
Gws::Role.permission :edit_private_gws_memo_messages, module_name: 'gws/memo'
#Gws::Role.permission :edit_private_gws_memo_notices, module_name: 'gws/memo/notice'
Gws::Role.permission :read_other_gws_memo_lists, module... | 58.061224 | 88 | 0.776801 |
4a4fb57e4b39444e9e366183d6817375e315ba62 | 77 | FactoryGirl.define do
factory :membership do
user
team
end
end
| 8.555556 | 24 | 0.675325 |
18d1a1f98aef3b26934c1f1710d465f4b4084d3e | 2,256 | require 'sqrl/key/unlock_request_signing'
module SQRL
class Cmd
desc 'ident URL', 'Login/create assoction'
long_desc <<-LONGDESC
loops=1: The first request to the server includes the ident command
loops=2: Send a only query, and then prompt the user whether to login using the server friendly nam... | 33.176471 | 107 | 0.625 |
914807eb2f158fbb07017035116bb55e72bb16aa | 102 | class Category < ApplicationRecord
has_many :products
validates :description, presence: true
end
| 17 | 40 | 0.794118 |
79338a9f678929fa94cd3fdc8d2da5fd7e750b65 | 2,556 | module ViewData
module Postgres
module Get
class One
include Get
def self.build(session: nil)
instance = new
instance.configure(session: session)
instance
end
def self.configure(receiver, attr_name: nil, session: nil)
attr_name ||= ... | 30.795181 | 135 | 0.587637 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.