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 |
|---|---|---|---|---|---|
e82c7b55363281a12c6455980af5808e827cfc2b | 373 | # frozen_string_literal: true
require_relative 'jsonable'
module CfnDsl
# Handles property objects for Resources
#
# Usage
# Resource("aaa") {
# Property("propName", "propValue" )
# }
#
class PropertyDefinition < JSONable
include JSONSerialisableObject
attr_reader :value
def init... | 16.217391 | 42 | 0.66756 |
b9624ca6d6675365822b97d8199daa4d2891d00a | 720 | Rails.application.routes.draw do
mount GovukPublishingComponents::Engine, at: "/component-guide"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
get "/service-manual/search",
to: redirect... | 37.894737 | 101 | 0.668056 |
2850f2b720ed2b484edbfef159e81729242f73eb | 2,837 | require 'spec_helper'
describe Scalastic::Config do
let(:config) {subject}
describe '.default' do
let(:config) {described_class.default}
it 'has correct partition_prefix' do
expect(config.partition_prefix).to eq 'scalastic'
end
it 'has correct partition_selector' do
expect(config.par... | 25.790909 | 103 | 0.672894 |
e296415aa1dfd15c3f80d1ff57898706ee0963bc | 943 | # frozen_string_literal: true
require 'spec_helper'
describe NodeFlowSerializer do
subject do
CSV.parse(
described_class.new(graph, 'MJ').as_csv,
headers: true
)
end
let(:scenario) { FactoryBot.create(:scenario) }
context 'with the energy graph' do
let(:graph) { scenario.gql.future.g... | 24.179487 | 81 | 0.673383 |
edfe539f8b1f98657832706e5c8ac3888fccb020 | 342 | class ApplicationController < ActionController::Base
protect_from_forgery
def authenticate_user!
redirect_to user_omniauth_authorize_path(:github, origin: request.fullpath) unless user_signed_in?
end
def after_sign_in_path_for(resource)
request.env['omniauth.origin'] || stored_location_for(resource) |... | 28.5 | 102 | 0.80117 |
ff33e57107dc0d9955d0b81cb59dfee4a5db6877 | 1,092 | # require 'rack-flash'
require 'sinatra/flash'
class ApplicationController < Sinatra::Base
configure do
set :views, './app/views'
set :public_folder, './public'
set :method_override, true
set :session_secret, ENV["session_secret"]
enable :sessions
register Sinatra::Flash
end
get '/' do
... | 21 | 83 | 0.612637 |
e20fc4fc04e3a5a17d90bf1e5a5ab7d28284070d | 1,375 | module Spree
class Calculator::RelatedProductDiscount < Spree::Calculator
def self.description
I18n.t('spree.related_product_discount')
end
def compute(object)
if object.is_a?(Array)
return if object.empty?
order = object.first.order
else
order = object
end... | 26.960784 | 100 | 0.605091 |
ac78859ca4eb56a3f558080cd11979097a5180c8 | 6,736 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 32.541063 | 839 | 0.621734 |
0146870379e582218974f72d1d19b07292e4de05 | 310 | module SpreeFrenet
module_function
# Returns the version of the currently loaded SpreeFrenet as a
# <tt>Gem::Version</tt>.
def version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 0
MINOR = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].compact.join('.')
end
end
| 17.222222 | 64 | 0.654839 |
eda1cfced89cb78b49898b3737d9453fd638f881 | 79 | class String
def to_d
blank? ? 0.0.to_d : BigDecimal.new(self)
end
end
| 13.166667 | 44 | 0.658228 |
87631d24cbaea7b27c68a95e00719c656caadf0f | 388 | class ComicsController < ApplicationController
before_action :set_comic, only:[:show]
def index
@comics = Comic.all
render json: {comics: @comics.as_json(include: :publisher)}
end
def show
if @comic
render json: {comic: @comic }
else
render json: {error: true}
end
end
priv... | 16.869565 | 63 | 0.649485 |
7ad2297ca5af5e9aa0e4e98f77ce4f527a89d235 | 36 | module Rice
VERSION = "2.2.0"
end
| 9 | 19 | 0.638889 |
ab50bd95851e36c0da8ea92f3d3b70ade6567c49 | 499 | if RailsExceptionHandler.configuration.activate? && RailsExceptionHandler.configuration.email?
class RailsExceptionHandler::ErrorMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.error_mailer.send_error_mail_to_admin.subje... | 31.1875 | 94 | 0.729459 |
014c12b66b107ec5346284c65e806e088ce7f50a | 67,417 | module Japanese
module Conjugator
# List with complete list of exceptions for
# consonant verbs that end in -eru -iru at: https://en.wikipedia.org/wiki/Japanese_consonant_and_vowel_verbs#List_of_consonant_stem_verbs_ending_in_iru
POLITE_VERB_ENDINGS = {present: "ます",
past: "ました... | 45.861905 | 155 | 0.500541 |
39b509d04ad16a99f14b3aa2a95816ab5ead5f0e | 146 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV['GOOGLE_OAUTH_KEY'], ENV['GOOGLE_OAUTH_PASSWORD']
end
| 36.5 | 80 | 0.815068 |
115ddcaa77f9b1954039231d799d9c81466bdf03 | 2,377 | # frozen_string_literal: true
require "rails_helper"
require "csv"
RSpec.describe PupilPremiumImporter do
let(:example_csv_file) { "spec/fixtures/files/example_sparse_lads.csv" }
let(:start_year) { 2021 }
let(:sparsity_importer) { SparsityImporter.new(Logger.new($stdout), start_year, example_csv_file) }
befo... | 36.569231 | 117 | 0.752209 |
4ab88f7d6161f93771930cb0dd6ef11696ea8048 | 527 | # == Schema Information
#
# Table name: schemas
#
# id :integer not null, primary key
# name :string(255)
# changelogtable :string(255)
# created_at :datetime
# updated_at :datetime
# environment_id :integer
# host :string(255)
# application_id :integer
# databa... | 21.08 | 57 | 0.618596 |
281e7193bc2f16067aaf49a76207bf41fbe1ad04 | 1,541 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
# require "sprockets/ra... | 33.5 | 82 | 0.752758 |
1a61bd45502b21e9f7a81ca06958cd93c99125f8 | 11,966 | require 'test_helper'
class ExternalAssetTest < ActiveSupport::TestCase
test 'can create' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert asset.save
end
test 'validation fails if service and external id are not unique' do
asset1 = ExternalAsset.new(external_servi... | 29.114355 | 103 | 0.698145 |
0136c22edc03d2cdfb8a78485c39905653c8f8fc | 989 | require 'spec_helper'
describe UserInviteRequestsHelper do
describe "link_to_previous_invite_requests" do
before(:each) do
@user = FactoryGirl.create(:user)
@user2 = FactoryGirl.create(:user)
@invitation_request1 = FactoryGirl.create(:user_invite_requests, user_id: @user.id)
@invitation... | 39.56 | 148 | 0.733064 |
edfd78d310a48cbd760c9581c8db59d774a64f54 | 725 | Gem::Specification.new do |s|
s.name = 'spawn'
s.version = '0.1.3'
s.summary = %{Simple fixtures replacement for Sequel, ActiveRecord, Ohm and probably many other ORMs}
s.description = %{Spawn is a very small library (just 14 lines of code) that can effectively replace fixtures or any other library for the same... | 60.416667 | 197 | 0.711724 |
ac606f932dbd116f21825d3b1af95cc805a6ad7d | 275 | cask 'fman' do
version '1.7.1'
sha256 '6a49f112e37d1aa933f3bec618ecd24b3385c4e47559b483d93ff9944e7ebca7'
url "https://fman.io/updates/mac/#{version}.zip"
appcast 'https://fman.io/updates/Appcast.xml'
name 'fman'
homepage 'https://fman.io/'
app 'fman.app'
end
| 22.916667 | 75 | 0.723636 |
ff51ce859c8ba7afd777d37c9e6c0e77baa3e7b7 | 3,978 | require_relative '../spec_helper'
describe 'register/indirect_index_configurator' do
include_context 'bit field type common'
include_context 'configuration common'
include_context 'ral common'
before(:all) do
enable :global, [:data_width, :address_width]
enable :register_block, [:name, :byte_size]
... | 45.724138 | 163 | 0.487934 |
38dda9383c6453c46300137fd71f6908807a3032 | 9,093 | # frozen_string_literal: true
require_relative 'teammate'
module Gitlab
module Danger
module Helper
RELEASE_TOOLS_BOT = 'gitlab-release-tools-bot'
DRAFT_REGEX = /\A*#{Regexp.union(/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/, /(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/)}+\s*/i.freeze
# Returns a... | 33.186131 | 140 | 0.56648 |
1c91c65d1f35aede62a0ebff3a90c6134b410917 | 332 | class KomodoIde < Cask
version '8.5.4-86985'
sha256 'dde427a79aa17f5404b15bb286c075857fe5407f98395cc97f3e0e9c8b27851c'
url "http://downloads.activestate.com/Komodo/releases/#{version.gsub(/-.*/, '')}/Komodo-IDE-#{version}-macosx-x86_64.dmg"
homepage 'http://komodoide.com/'
license :unknown
app 'Komodo IDE... | 30.181818 | 123 | 0.740964 |
1ad9569c25edd2676a6c9909f2dc95100cde17bc | 3,459 | shared_examples_for :finders do |param_name, param_method|
context "using #{param_name} as parameter" do
describe '.with_role' do
it { should respond_to(:with_role).with(1).arguments }
it { should respond_to(:with_role).with(2).arguments }
context 'with a global role' do
it { subject... | 34.247525 | 120 | 0.648453 |
62ad5f5c2df76e874dd88143e13d2eaf10e67f1c | 72 | module Grape
# The current version of Grape.
VERSION = '0.13.1'
end
| 14.4 | 33 | 0.680556 |
2821c625fd8054e9d82b46ed65b460e922927946 | 4,786 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::AuthBrute
include Msf::Auxiliary::S... | 30.100629 | 125 | 0.579189 |
284b5fd3777f49c983af5342f859de0041753552 | 4,559 | module Spree
module Core
class Engine < ::Rails::Engine
isolate_namespace Spree
engine_name 'spree'
rake_tasks do
load File.join(root, 'lib', 'tasks', 'exchanges.rake')
end
initializer 'spree.environment', before: :load_config_initializers do |app|
app.config.spree ... | 35.617188 | 93 | 0.649704 |
f8cc7626a386dce98e1889dc29e2b4de06688268 | 2,382 | # frozen_string_literal: true
require 'spec_helper'
feature Lodging do
let!(:conference) { create(:conference) }
let!(:organizer) { create(:organizer, resource: conference) }
scenario 'Add a lodging', feature: true, js: true do
path = "#{Rails.root}/app/assets/images/rails.png"
sign_in organizer
v... | 30.151899 | 74 | 0.694374 |
18c6b01766d8d30b8c2844bcbd9d0fd7a499d402 | 2,482 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require "graphql/version"
require "date"
Gem::Specification.new do |s|
s.name = "graphql"
s.version = GraphQL::VERSION
s.date = Date.today.to_s
s.summary = "A GraphQL language and runtime for Ruby"
s.des... | 43.54386 | 91 | 0.710717 |
acf1a4bf15391ef8f61513770b13eb4d630a8d72 | 368 | require 'spec_helper'
require 'eidolon/rgssx/color'
describe Color do
let :color do
object = nil
Dir.glob('**/Color.rdata') do |file|
object = File.open(file, 'rb') { |data| Marshal.load(data) }
end
object
end
describe '._load' do
it 'successfully recreates a Color instance' do
... | 20.444444 | 66 | 0.638587 |
033aca10009e28606b8ad71e7ee78660c1e1ab01 | 2,452 | #
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require 'client_types'
module Hypertable
module ThriftGen
# Result type of HQL queries
#
# <dl>
# <dt>results</dt>
# <dd>String results from metadata queries</dd>
... | 33.135135 | 185 | 0.520392 |
384b1db1f4692ff11dd49c2a80ad43336065f10c | 1,940 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 34.642857 | 86 | 0.762371 |
7ab086ec825d05eeb8729cf964353ca4e83aa116 | 924 | # encoding: utf-8
require 'cassandra'
module CassandraMigrations
module Cassandra
module KeyspaceOperations
def create_keyspace!(env)
config = Config.configurations[env]
begin
execute(
"CREATE KEYSPACE #{config.keyspace} \
WITH replication = { \
... | 24.972973 | 82 | 0.577922 |
089a3ccb3ed27ab6d3660c9ab621133ca4b82026 | 1,449 | class ProgramPresenter < ModelPresenter
delegate :title, :description, to: :object
delegate :number_with_delimiter, :current_customer, :button_to,
to: :view_context
def application_start_time
object.application_start_time.strftime('%Y-%m-%d %H:%M')
end
def application_end_time
object.application... | 29.571429 | 75 | 0.717736 |
f70f4a583517e42f6e3b2f10e4579c8826ab9d46 | 282 | module BeachApiCore::Concerns::NameGenerator
extend ActiveSupport::Concern
included do
before_validation :generate_name
private
def generate_name
return if title.blank? || name.present?
self.name = title.parameterize(separator: '_')
end
end
end
| 18.8 | 52 | 0.712766 |
ac3a571a1f3aa12f1a9209de40e124190354c788 | 452 | class Environment < ActiveRecord::Base
belongs_to :project, required: true, validate: true
has_many :deployments
validates :name,
presence: true,
uniqueness: { scope: :project_id },
length: { within: 0..255 },
format: { with: Gitlab::Regex.environment_name_regex,
... | 26.588235 | 77 | 0.637168 |
28cde92afd8f80240b56624bb0d15cbf8f048004 | 699 | RSpec.describe ":if => true group" do
it(":if => true group :if => true example", :if => true) { puts 1 }
it(":if => true group :if => false example", :if => false) {puts 2 }
it(":if => true group no :if example") {puts 3 }
end
RSpec.describe ":if => false group", :if => false do
it(":if => false group :if => ... | 41.117647 | 71 | 0.579399 |
5d25930cc3b4034ba12935d4af4212feaff8ca3b | 479 | ActiveRecord::Schema.define(version: 2021_05_26_103300) do
create_table "pulse_onboarding_statuses", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "company_id", null: false
t.integer "manager_tutorial_state"
t.integer "member_tutorial_state"
t.string "session_id"
t.boolean "c... | 36.846154 | 66 | 0.724426 |
1a70f73ae68fc37d1ee4e3a7bdb696028f5c7d24 | 3,775 | require "thread"
module Bunni
# Network activity loop that reads and passes incoming AMQP 0.9.1 methods for
# processing. They are dispatched further down the line in Bunni::Session and Bunni::Channel.
# This loop uses a separate thread internally.
#
# This mimics the way RabbitMQ Java is designed quite clos... | 25.856164 | 131 | 0.59894 |
e2dfe7772ebb573cd6d29920ad4d9f7703477545 | 8,591 | =begin
#Selling Partner API for Direct Fulfillment Shipping
#The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.26
=... | 33.822835 | 377 | 0.649401 |
e979dfc5e402421abe7afcefa0d67ae52b35d548 | 1,985 | #本类实现汉字转拼音功能,由perl的Lingua::Han::PinYin包port而来(包括UniHan的数据)。
#
#由于实际需要只实现utf-8版本,需要gbk等转拼音的请使用Iconv自行转换。
#
#感谢Lingua::Han::PinYin原作者(http://www.fayland.org/journal/Han-PinYin.html)的工作.
#
#Author:: H.J.Leochen ( http://www.upulife.com )
#License:: Distributes under the same terms as Ruby
require 'singleto... | 23.630952 | 79 | 0.638791 |
21622c8449c7670d64a886a00389e16fd7eb3aa5 | 588 | module RETerm
module Components
# YouTube viewer, use cmds to render youtube to ascii:
# youtube-dl <url>
# mplayer -vo aa <file> -or-
# CACA_DRIVER=ncurses mplayer -vo caca <file>
class YouTube < CmdOutput
# Initialize the YouTube component
#
# @param [Hash] args youtub... | 28 | 58 | 0.586735 |
9172f18a9ac12cc4f1ed5a15f230d635db51ea42 | 2,089 | require "hotel_beds/parser/room_grouper"
require "hotel_beds/model/available_room"
RSpec.describe HotelBeds::Parser::RoomGrouper do
subject { described_class.new(requested_rooms, response_rooms).groups }
context "when asking for 3 rooms (2 x 2 adults & 1 x 1 adult, 1 child)" do
let(:requested_rooms) do
... | 38.685185 | 126 | 0.674007 |
abd27347fbf9d6b7b018197f523441bd5722f20b | 564 | cask :v1 => 'noun-project' do
version '1.1.1'
sha256 '2c2dde80173af2d739688e47e74562b751bc138fffef68ae765e19597fd0ae0d'
# amazonaws.com is the official download host per the vendor homepage
url "https://s3.amazonaws.com/nounproject/mac/Noun-Project-#{version}.dmg"
name 'Noun Project'
appcast 'https://theno... | 33.176471 | 87 | 0.748227 |
f7da619515f5c1dd6c9e2f1288785a09819b95e7 | 169 | # frozen_string_literal: true
# @api public
# @since 0.3.0
class SmartCore::Types::Protocol < SmartCore::Types::Primitive
require_relative 'protocol/instance_of'
end
| 21.125 | 62 | 0.769231 |
1cbbe3b1661e6949fb0d03d045eb66f0e43df687 | 4,801 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::Udp
def initialize(info = {})
super(update_info(info,
... | 34.539568 | 141 | 0.547803 |
f7d5272cc38684c85d6bbbcd7e4c87e95cb1ef49 | 1,135 | module Fog
module OpenStack
class Baremetal
class Real
def list_chassis(options = {})
request(
:expects => [200, 204],
:method => 'GET',
:path => 'chassis',
:query => options
)
end
end
class Mock
d... | 26.395349 | 104 | 0.387665 |
4a5bfbfa482f30db9f1db428ddf99d2ad4ec9aad | 1,647 | require 'compiler_helper'
module Alf
class Compiler
describe Default, "allbut" do
subject{
compiler.call(expr)
}
shared_examples_for "a compacted compilation result" do
it_should_behave_like "a traceable compiled"
it 'has a Compact cog' do
expect(subject).to... | 24.954545 | 64 | 0.598664 |
ff4e3615dca120c34fdadba40f90150b2a55f24f | 627 | class AllowedBat < ActiveRecord::Base
belongs_to :protocol
belongs_to :species
validates_presence_of :number, :species
validates_numericality_of :number, :only_integer => true, :greater_than_or_equal_to => 0
validates_numericality_of :warning_limit, :only_integer => true, :greater_than_or_equal_to => 0
... | 39.1875 | 104 | 0.759171 |
08100142f80c449955068844154f373074d39219 | 80,235 | # coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require "delegate"
require "rbconfig/sizeof"
class TestArray < Test::Unit::TestCase
def setup
@verbose = $VERBOSE
$VERBOSE = nil
@cls = Array
end
def teardown
$VERBOSE = @verbose
end
def test_percent_i
assert_equal([:... | 28.123028 | 147 | 0.551966 |
e8dd1a19d01b48c2468cba5a2a097a87b2fb87a7 | 5,051 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject... | 35.822695 | 121 | 0.688379 |
ac6ddeaf4985fa208dd63c6cbc1410527a8b6200 | 563 | # frozen_string_literal: true
require 'sequel'
require_relative './persistence/version'
require_relative './persistence/database'
module Blur
module Persistence
class NoSuchScriptSetting < StandardError; end
class NoSuchUserSetting < StandardError; end
end
def self.database
Persistence::Database
... | 23.458333 | 80 | 0.793961 |
f75c9bde94eee52e92a76147a0e56b9c5b216717 | 866 | module Pwfmt
# This patch extends SettingsController.
# This patch enables to load and save user selected format of welcom text.
module SettingsControllerPatch
extend ActiveSupport::Concern
included do
before_render :load_wiki_format, only: %i[edit index]
before_render :reserve_format, only: ... | 29.862069 | 86 | 0.750577 |
6a9e5ddac79e4a94a78d45383266559de7e78f78 | 152 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, 'ab9c1f8903363bae317b', 'bd48e077ac62242f24ecfe411d5b4a46570c950e'
end
| 38 | 86 | 0.848684 |
26a8f64751c5af2e4449afe94eec510f633af656 | 376 | # frozen_string_literal: true
control 'backupninja configuration' do
title 'should match desired lines'
['11-custom.sh', '12-custom-rsync.sh'].each do |file|
describe file("/etc/backup.d/#{file}") do
it { should be_file }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
... | 25.066667 | 55 | 0.619681 |
1ae7f763bf2d93c2d562ca502a9de7784b346be0 | 954 | # frozen_string_literal: true
module Mutations
class Login < Mutations::BaseMutation
null true
argument :login, String, required: true
argument :password, String, required: true
field :token, String, null: true
field :errors, [Types::UserErrorType], null: false
def resolve(login:, password... | 20.297872 | 62 | 0.631027 |
d5a2d57844756c925d8f59dee1b4874e39d01530 | 4,669 | require 'brakeman/checks/check_cross_site_scripting'
#Checks for calls to link_to which pass in potentially hazardous data
#to the second argument. While this argument must be html_safe to not break
#the html, it must also be url safe as determined by calling a
#:url_safe_method. This prevents attacks such as javasc... | 30.717105 | 137 | 0.66224 |
ab6354b9db628083e91265375a06a4c2c525c5a4 | 134 | FactoryBot.define do
factory :mast_arm_frame_type do
name { "MyString" }
code { "MyString" }
active { false }
end
end
| 16.75 | 33 | 0.649254 |
bfac619da3ffbb7d80bd002c15fdf9d7eee3c156 | 85 | # desc "Explaining what the task does"
# task :meccano do
# # Task goes here
# end
| 17 | 38 | 0.670588 |
26f11c8427d0889957a16faea96a75bed62117b3 | 274 | class UserBenefitsController < ApplicationController
before_action :set_benefit
def new
current_user.benefits << @benefit
redirect_to current_user # maybe?
end
private
def set_benefit
@benefit = Benefit.find(params[:id])
end
end
| 16.117647 | 52 | 0.689781 |
ed2282275d47c3759f9309fd9e6aeac3b781d7ad | 1,697 | # frozen_string_literal: true
require_relative '../libraries/algosec_helper'
resource_name :algosec_application_flows
property :algosec_options, Hash, required: true
property :application_name, String, name_property: true
property :application_flows, Hash, required: true
# property :application_flows, Hash, required... | 33.94 | 99 | 0.72363 |
ff97cd3042af59de722ae3600111c5e5d93e0dd5 | 1,184 | require_relative "../puzzle"
class Day3Part1 < Puzzle
def test_cases
{ # {input => expected}
["R8,U5,L5,D3", "U7,R6,D4,L4"] => 30,
["R75,D30,R83,U83,L12,D49,R71,U7,L72", "U62,R66,U55,R34,D71,R55,D58,R83"] => 610,
["R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51", "U98,R91,D20,R16,D67,R40,U7,R15,U6,... | 26.909091 | 100 | 0.525338 |
e99265fe10fee9defd4c639cfc65fc6207977b50 | 37 | module Twins
VERSION = "0.0.4"
end
| 9.25 | 19 | 0.648649 |
2148a6536f84a5cfac7ed87ef798dbd017d7cf07 | 107 | require "safe_op/version"
module SafeOp
class Error < StandardError; end
# Your code goes here...
end
| 15.285714 | 34 | 0.728972 |
03e4b6127d102c6eca8bf8d6b4c3c05d5660b9e6 | 1,967 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Dat... | 30.261538 | 102 | 0.74123 |
e815bbb976ee4fffbfd09ee8df415b9ac1f3c1a0 | 1,602 | require 'crawl_station/version'
require 'pathname'
require 'active_support'
require 'active_record'
require 'active_support/dependencies/autoload'
require 'logger'
require 'thor'
require 'celluloid/debug'
require 'celluloid/current'
module CrawlStation # :nodoc:
extend ActiveSupport::Autoload
autoload :Configurati... | 20.025 | 63 | 0.747815 |
e9f7118d356ec0157bbc63267c80f7b874f30622 | 2,101 | require 'nokogiri'
layout 'layout.html.erb'
ignore /.git/
ignore /.gitignore/
ignore /.ruby-version/
ignore /COPYING/
ignore /Gemfile.*/
ignore /Makefile/
ignore /README/
ignore /package.json/
ignore /package-lock.json/
ignore /requirements.txt/
ignore /screenshot.png/
ignore /node_modules/
ignore /src/
helpers do
... | 26.2625 | 84 | 0.722513 |
2189613423ca45f069c9b2e6a23193e2678c5733 | 5,939 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.13-SNAPSHOT
=e... | 30.613402 | 123 | 0.644553 |
9189a9ce7c22790307d97344439b12181da1fccd | 1,822 | #
# Be sure to run `pod lib lint SAMIM_MapKit_Category.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name =... | 41.409091 | 154 | 0.67124 |
b957eb075f1906c41d9d3997567f27f8c47e75aa | 817 | require "./lib/anchored/version"
Gem::Specification.new do |spec|
spec.name = "anchored"
spec.version = Anchored::VERSION
spec.authors = ["Tee Parham"]
spec.email = ["tee@neighborland.com"]
spec.summary = "Ruby auto linker"
spec.description = "Ruby auto linker based on... | 34.041667 | 68 | 0.629131 |
18020875e1986a63f15232c595942c7ab1736bc4 | 93 | require 'test_helper'
class TemplatesTest < ActiveSupport::TestCase
def setup
end
end
| 10.333333 | 45 | 0.763441 |
912bffce9e2d9372696823fe2171d32e8bb9dcb8 | 1,457 | require 'open-uri'
require 'nokogiri'
$bot.message(start_with: '/yt ') do |yt_event|
$bot.remove_event_handler(Discordrb::Events::MessageEvent, contains: /^\d{1,2}$/i)
query = yt_event.content.gsub('/yt ', '')
page = Nokogiri::HTML(open(URI.escape("https://www.youtube.com/results?search_query=#{query}")), nil, '... | 36.425 | 112 | 0.539465 |
33ef207e7c35a87f3f35c01643659598dca4697c | 10,663 | require 'rails_admin/i18n_support'
module RailsAdmin
module ApplicationHelper
include RailsAdmin::I18nSupport
def get_url(action, model_name, opts = {})
options = {:model_name => model_name}.merge(opts)
options.merge!(current_scope_parameters)
case action
when :dashboard
das... | 34.176282 | 156 | 0.597112 |
03a8a1bdf5f84e9332de165e90d97b1bfcf46754 | 528 | test_cask 'invalid-appcast-multiple' do
version '1.2.3'
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
url TestHelper.local_binary_url('caffeine.zip')
appcast 'http://example.com/appcast1.xml',
sha256: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
app... | 37.714286 | 84 | 0.791667 |
bb2ae137b6eb43f87bdc81aaa8ad96c84af19e23 | 408 | require "natto"
require "yaml"
s = gets.chomp
m = Natto::MeCab.new
dic = Hash.new { |h, k| h[k] = Hash.new(0) }
m.enum_parse(s).map(&:surface).each_cons(4) do |a, b, c|
dic[[a, b]][c] += 1
end
open("rodger.yaml", "w") do |fh|
fh.write YAML.dump(dic)
end
a, b = ans = %w(ロジャー は)
while ans.count("。") < 7
ans << ... | 17.73913 | 56 | 0.580882 |
38ed36577e44546b5a75520d1cda14ced6cdfb33 | 165 | class Instructor < ApplicationRecord
has_many :lessons
has_many :students, through: :lessons
validates :name, uniqueness: true, presence: true
end
| 20.625 | 53 | 0.721212 |
26e0677c165d1ec175bca56936044d3e0dfe4cce | 866 | # encoding: utf-8
require File.expand_path("../lib/decent-pdf/version", __FILE__)
Gem::Specification.new do |s|
#Metadata
s.name = "decent-pdf"
s.version = DecentPdf::VERSION
s.authors = ["Rishab Govind"]
s.email = ["rishab@govind.us"]
s.homepage = ""
s.summary = %q{A decent pdf generator u... | 27.0625 | 83 | 0.615473 |
018d9822d3e11ad3f23d83459824e2829af1aee7 | 3,945 | require 'spec_helper'
describe Clusters::Applications::InstallService do
describe '#execute' do
let(:application) { create(:clusters_applications_helm, :scheduled) }
let!(:install_command) { application.install_command }
let(:service) { described_class.new(application) }
let(:helm_client) { instance_... | 31.062992 | 90 | 0.621293 |
21d2bd2a4b59cc80864b05a7bbef3f2c82afe7d1 | 2,778 | class Go < Formula
desc "Open source programming language to build simple/reliable/efficient software"
homepage "https://golang.org"
revision 1
stable do
url "https://dl.google.com/go/go1.14.2.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.14.2.src.tar.gz"
sha256 "98de84e69726a66da7b4e58eac... | 30.195652 | 93 | 0.675306 |
5da14657202bf0999e67518b3452ecda312c3979 | 115 | json.extract! user, :id, :name, :password, :email, :created_at, :updated_at
json.url user_url(user, format: :json)
| 38.333333 | 75 | 0.721739 |
b97cb3fd394485edfecbb66a64c916b52bfdebdd | 1,975 | class Xapian < Formula
desc "C++ search engine library"
homepage "https://xapian.org/"
url "https://oligarchy.co.uk/xapian/1.4.15/xapian-core-1.4.15.tar.xz"
sha256 "b168e95918a01e014fb6a6cbce26e535f80da4d4791bfa5a0e0051fcb6f950ea"
revision 1
version_scheme 1
bottle do
cellar :any
sha256 "805a00d6... | 31.349206 | 108 | 0.676456 |
bfe14798aa0f101ad79847c07e2c67517d24dbf3 | 1,435 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 32.613636 | 79 | 0.708711 |
2697546fa9978765bd536f05e3d1dfd10dfa058b | 219,535 | # 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
module Aws::S3
# @api private
module ClientApi
include Seahorse::Model
AbortDate = Shapes::Timesta... | 82.843396 | 292 | 0.775667 |
33f41eabc2deb4010a888acbd4fe68ccd5ce4f3c | 3,184 | require "test_helper"
class GemTypoTest < ActiveSupport::TestCase
setup do
@existing = create(:rubygem, name: "delayed_job_active_record")
create(:version, rubygem: @existing, created_at: Time.now.utc)
deleted = create(:rubygem, name: "deleted_active_record_gem")
create(:version, rubygem: deleted, c... | 36.597701 | 140 | 0.730842 |
037a6e1f1625aec5c0f170567dca4c15187233b2 | 4,541 | # frozen_string_literal: true
# MIT License
#
# Copyright (c) 2019 Ivan Bukshev
#
# 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... | 37.528926 | 105 | 0.691698 |
1dfe0565f1bfb5c10a8683a51432b1d217387d1a | 177 | default['starship']['user'] = nil
default['starship']['download_url'] = 'https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz'
| 59 | 142 | 0.762712 |
4a24c3f074273e1336f11878b59ffb7d7de5e4a7 | 148 | module Rudash
module Default
def flow_right(*funs)
flatten_funs = funs.flatten.reverse
self.flow(flatten_funs)
end
end
end
| 14.8 | 41 | 0.682432 |
acb106b7274538d5dfaa1fc2a44390cd5fceacf8 | 2,405 | require 'xeroizer/record/application_helper'
module Xeroizer
class GenericApplication
include Http
extend Record::ApplicationHelper
attr_reader :client, :rate_limit_sleep, :rate_limit_max_attempts, :default_headers, :unitdp, :before_request,
:after_request, :nonce_used_max_attempts
... | 30.0625 | 113 | 0.694802 |
3390619c5cbb4dd90d3d7e9c49ac2749a3626bd7 | 104 | $LOAD_PATH << "./test"
$LOAD_PATH << "./lib"
Dir.glob("./test/test_*.rb").each { |file| require file }
| 20.8 | 57 | 0.596154 |
189591669312fe7148e85cac2fdec018a6fb1f0c | 2,637 | # == Schema Information
#
# Table name: namespaces
#
# id :integer not null, primary key
# name :string(255) not null
# path :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# ... | 28.978022 | 101 | 0.649223 |
bf25d13d68850fc76c03112957b4ca19bbf21932 | 3,334 | #-------------------------------------------------------------------------------
# Copyright (c) 2008 Topher Fangio
#
# 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, i... | 35.094737 | 136 | 0.588482 |
7ad0f5d318e3661610a80b84e5743f80a37f473c | 1,639 | #
# Be sure to run `pod lib lint SemanticImage.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'Seman... | 37.25 | 105 | 0.644905 |
219be7b2d18e0efdb697a6fa8018477b8c7feb63 | 11,377 | describe VmdbIndex do
context "#capture_metrics" do
let(:index) { FactoryGirl.create(:vmdb_index, :name => "accounts_pkey") }
it "creates a vmdb_metrics record" do
# The first capture just gets the raw data
index.capture_metrics
expect(index.vmdb_metrics).to be_empty
expect(index.prio... | 94.808333 | 173 | 0.660895 |
18cdd26b37d3a1e7fd09abd80ccce86ba2a802aa | 153 | class AddReviewToAnswers < ActiveRecord::Migration
def change
change_table :answers do |t|
t.references :review, index: true
end
end
end
| 19.125 | 50 | 0.718954 |
91db0a879b43bf5ed669a9e7dc17b3dd3f6a9dd3 | 42 | module SchemaTest
VERSION = "0.1.0"
end
| 10.5 | 19 | 0.690476 |
6aa0f4f121426d8cae7cd51eda7584fb7233ac62 | 1,528 | require 'command_mapper/gen/option_value'
module CommandMapper
module Gen
#
# Represents a mock `CommandMapper::Option` class.
#
class Option
# The option flag for the option.
#
# @return [String]
attr_reader :flag
# @return [Boolean, :equals, nil]
attr_reader :e... | 22.80597 | 69 | 0.524215 |
e8251b40f33ad3d27ca6f31f3c76ff6062b3b36d | 1,460 | # 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-acmpca/types'
require_relative 'aws-sdk-ac... | 28.076923 | 121 | 0.75411 |
f736bdfb8a23bdab2638320150d80dc550c59897 | 2,123 | if false
require "rollbar/rails"
Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.
config.access_token = "c21921f1085948cfa8332fa4b7c2a81d"
# Disable notifications by now.
config.enabled = false
... | 40.056604 | 93 | 0.739049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.