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 |
|---|---|---|---|---|---|
abddd645dc1c7d95cbe5496146bf3127b07e7852 | 1,293 | # frozen_string_literal: true
module MotionHTMLPipeline
class Pipeline
# Public: Runs a String of content through an HTML processing pipeline,
# providing easy access to a generated DocumentFragment.
class BodyContent
attr_reader :result
# Public: Initialize a BodyContent.
#
# bo... | 28.733333 | 82 | 0.642691 |
1c33517b8d6661c1ee800219317dd9164a2b5880 | 1,441 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# 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, which is a fork ... | 37.921053 | 91 | 0.758501 |
211727fe1e91e5ef4ebbc637a7b725761567490b | 3,377 | json.type "petition"
json.id petition.id
json.links do
json.self petition_url(petition, format: :json)
end if defined?(is_collection)
json.attributes do
json.action petition.action
json.background petition.background
json.additional_details petition.additional_details
json.committee_note petition.committee_... | 32.786408 | 96 | 0.793308 |
21d274850595bf83515f53cef550e0560dff739f | 430 | require 'messages/base_message'
module VCAP::CloudController
class ServiceCredentialBindingShowMessage < BaseMessage
ARRAY_KEYS = [
:include
].freeze
register_allowed_keys ARRAY_KEYS
validates_with NoAdditionalParamsValidator
validates_with IncludeParamValidator, valid_values: %w(app serv... | 22.631579 | 80 | 0.75814 |
395ef7a2ee8028b5752e161035cc7d6a726eefbf | 674 | module Cryptoexchange::Exchanges
module Deex
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Deex::Market::API_URL}/api/v1/markets"
def fetch
output = super
market_pairs = []
output['result'].each do |pair... | 29.304348 | 88 | 0.508902 |
038b3a955241a53715892c1eeb46ea88d7a6b339 | 318 | namespace :db do
desc 'populate cars'
task :sample_cars => :environment do
Car.delete_all
(1..400).to_a.each_with_index do |i, e|
i.times do
car = Car.new(:name => "car-#{i}")
puts i
car.created_at = i.send(:days).send(:ago)
car.save!
end
end
end
end
| 16.736842 | 49 | 0.550314 |
bfeed6050e91f8ea6b50788044fd3f33102afdde | 779 | require 'jekyll/minibundle/hashes'
module Jekyll::Minibundle
module Environment
class << self
def minifier_command(site, type)
type = type.to_s
ENV["JEKYLL_MINIBUNDLE_CMD_#{type.upcase}"] || Environment.find_site_config(site, ['minibundle', 'minifier_commands', type], String)
end
... | 29.961538 | 140 | 0.639281 |
879b9897fc8cf2543013cf71d25257a481495878 | 2,136 | class Jetty < Formula
desc "Java servlet engine and webserver"
homepage "https://www.eclipse.org/jetty/"
url "https://search.maven.org/remotecontent?filepath=org/eclipse/jetty/jetty-distribution/9.4.47.v20220610/jetty-distribution-9.4.47.v20220610.tar.gz"
version "9.4.47.v20220610"
sha256 "2f67259ce889d0a74cd... | 35.6 | 152 | 0.686798 |
7a6b87041c4a1b3ea063a73b3642de316087e574 | 629 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Configures apt and apt services and LWRPs for managing apt repositories and preferences"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.4.2"
recip... | 44.928571 | 107 | 0.683625 |
877a55193e53cfcad10a2d03c996f11fedd78ce1 | 379 | class ReviewSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :id, :content, :rating, :privacy, :username, :images, :updated_at
has_one :user
has_one :hike
def username
object.user.username
end
def images
images = object.images.map do |image|
imag... | 22.294118 | 78 | 0.728232 |
d52cdb407d788bbb6266d7a64d88c1a724044646 | 2,775 | # frozen_string_literal: true
require 'spec_helper'
SimpleCov.command_name 'test:unit'
RSpec.describe 'unit' do
describe Calculator do
class Example
include Calculator
end
subject(:example) do
Example.new
end
it 'defines functions for each number word in Calculator::NUMBERS' do
... | 33.433735 | 87 | 0.671712 |
e9b545cf4f02358939b57a8ea0381bcc50176dcd | 37 | module MrBot
VERSION = "0.1.0"
end
| 9.25 | 19 | 0.648649 |
1a08791ce5d80ea3b92a8d08116010f3aadf95c4 | 1,149 | module Sidecloq
# Runner encapsulates a locker and a scheduler, running scheduler when
# "elected" leader
class Runner
include Utils
attr_reader :locker, :scheduler
def initialize(options = {})
@locker = extract_locker(options)
@scheduler = extract_scheduler(options)
end
def run... | 24.446809 | 74 | 0.637946 |
7964dbad0dc67f00049bdf1be56ea36059ad447b | 1,273 | # -*- encoding: utf-8 -*-
# stub: jquery-rails 3.1.3 ruby lib
Gem::Specification.new do |s|
s.name = "jquery-rails"
s.version = "3.1.3"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Andr\u{e9} Arko"]
s.da... | 34.405405 | 109 | 0.62608 |
ab5dcd1f4d458e51fc9e0761215d9886815e50dd | 159 | class Category < ActiveRecord::Base
## Relations
belongs_to :user
has_many :subcategories
## Validations
validates :user, :name, presence: true
end
| 17.666667 | 40 | 0.72956 |
ff4fe7d27edae29e836ddc369275edfa604a3769 | 3,318 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 39.975904 | 104 | 0.760398 |
e8b6b74c3fab9947aedb7f8d8ffcb95be22a6e48 | 434 | cask 'vnote' do
version '2.7.1'
sha256 'eee615603a62c7d2474048755c727ebe1daf7871a594f1aae63af6261621d916'
# github.com/tamlok/vnote was verified as official when first introduced to the cask
url "https://github.com/tamlok/vnote/releases/download/v#{version}/VNote-#{version}-x64.dmg"
appcast 'https://github.c... | 33.384615 | 94 | 0.758065 |
879286ef03c894916cb640a0c62541b60e6be45b | 8,136 | ##
# 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::HttpServer::HTML
include Msf::Exploit::Remote::BrowserAutopwn
... | 31.053435 | 152 | 0.553589 |
08576b10eab57bbbfde35b712756fa954c1e9371 | 1,173 | RSpec.describe User do
describe "#can_access?" do
context "when the user has an override permission" do
it "returns true" do
user = build(:user, permissions: [
User::ACCESS_LIMIT_OVERRIDE_PERMISSION,
])
edition = build(:edition)
expect(user).to be_can_access(editio... | 28.609756 | 88 | 0.635976 |
bb0624aec3c3c64ec20b4cab64aede89ce106c37 | 110 | class Payment < ActiveRecord::Base
belongs_to :user
validates :date, presence: true, valid_date: true
end
| 22 | 51 | 0.763636 |
612b17fe2945ee19af5d347b524053dc70b2e7e9 | 781 | #
# Cookbook:: apache2
# Recipe:: mod_ldap
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 28.925926 | 75 | 0.731114 |
bbaf473b0a7ffdc150bc59c50f481774a59d07ac | 9,860 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SurveyorGui::SurveyformsController, :type => :controller do
include Surveyor::Engine.routes.url_helpers
include SurveyorGui::Engine.routes.url_helpers
before do
self.routes = SurveyorGui::Engine.routes
end
let!(:survey) { Fact... | 27.162534 | 140 | 0.638641 |
ffc6e768b9cbab89d7635f573b65089e4191ffaa | 2,323 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Admin::EmailsHelper, :clean_gitlab_redis_shared_state do
include ExclusiveLeaseHelpers
let(:lease_key) { Admin::EmailService::LEASE_KEY }
let(:timeout) { Admin::EmailService::DEFAULT_LEASE_TIMEOUT }
describe '#send_emails_from_admin_area_fea... | 27.011628 | 143 | 0.700818 |
267bc2f662d4e6cea5cb46b4a5e4d914a08f0e99 | 3,120 | #!mruby
#################################
# フードシュータ
# GWS S03N 2BBMG
# オレンジ・・・信号線
# 赤・・・・・・3.3V
# 茶・・・・・・GND
#################################
@SrvPin = 0
Usb = Serial.new(0)
led 1
#ESP8266を一度停止させる(リセットと同じ)
pinMode(5,1)
digitalWrite(5,0) # LOW:Disable
delay 500
digitalWrite(5,1) # LOW:Disable
if( ... | 25.365854 | 137 | 0.544551 |
08ea9014127b08a036b3878cc4a5cfa54ca368c5 | 250 | require 'redis'
require 'awesome_print'
RSpec.describe RedBus do
before :each do
end
context "support functions" do
it "can generate a rpc_token" do
expect(RedBus::rpc_token).to_not be nil
end
end # support functions
end
| 13.157895 | 45 | 0.7 |
91026d019c06e424d31ee9c04ab7f6efa4c43ff0 | 2,821 | require 'spec_helper'
describe PullRequest do
let(:user) { create :user }
it { should belong_to(:user) }
it { should validate_uniqueness_of(:issue_url).scoped_to(:user_id) }
describe '#create_from_github' do
let(:json) { mock_pull_request }
subject { user.pull_requests.create_from_github(json) }
... | 34.402439 | 129 | 0.631336 |
6a9c71f3b5ec9871e88f530ffde044049f526550 | 89 | module WizardsCastle
VERSION = '0.0.5'.freeze
VERSION_DATE = '2016-08-16'.freeze
end
| 17.8 | 36 | 0.719101 |
e265052823a3e8a5cc816b06cdc4ef74a08ba31b | 3,007 | require_relative 'lib/ruby-manta'
# You'll need to provide these four environment variables to run this
# example. E.g.:
# MANTA_USER=john KEY=~/.ssh/john MANTA_URL=https://us-east.manta.joyent.com LOCAL_DIR=. ruby example.rb
host = ENV['MANTA_URL']
user = ENV['MANTA_USER']
priv_key = ENV['MANTA_KEY' ]
u... | 34.965116 | 104 | 0.685068 |
e8f54113a3106d21d0411bee652f38cefc45f0ae | 658 | module Pelusa
# Public: A Report is a wrapper that relates a class name with all its
# analyses for different lint checks.
#
class Report
# Public: Initializes a new Report.
#
# class_name - The Symbol name of the class being analyzed.
# type - the String type of the class being analyzed (... | 27.416667 | 81 | 0.648936 |
e8d027cf7c328bc35a5e12bab03596110cce9d06 | 2,020 | # 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::V2016_03_30
module Models
#
# Contains ServiceProviderProperties in an ExpressRouteCircuit
#
class ExpressRou... | 28.857143 | 77 | 0.560396 |
bfe932a67d1ccf4394238e073d9df75093fb522e | 3,884 | # Copyright 2019-2020 Wingify Software Pvt. Ltd.
#
# 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 agre... | 32.366667 | 93 | 0.695417 |
796ad101c9e9b0a87f075f9a179bff97c31d74a3 | 310 | require 'rails_helper'
RSpec.describe 'tickets/index', type: :view do
before(:each) do
assign :tickets, create_list(:ticket, 2, base_price: 5000, lan: create(:lan), user: create(:user))
end
it 'renders a list of tickets' do
render
assert_select 'tr>td', text: 5000.to_s, count: 2
end
end
| 23.846154 | 102 | 0.683871 |
f81da907b27a3425d3a920acda1be30afa2d7ea9 | 1,790 | # -*- coding: binary -*-
require_relative "lfkey"
require_relative "valuelist"
module Rex
module Registry
class NodeKey
attr_accessor :timestamp, :parent_offset, :subkeys_count, :lf_record_offset
attr_accessor :value_count, :value_list_offset, :security_key_offset
attr_accessor :class_name_offset, :... | 32.545455 | 109 | 0.688827 |
ed1898fc3b6c347f5d8fbd7cf1140ccca069bf9b | 2,228 | # -*- encoding: utf-8 -*-
# stub: web-console 2.3.0 ruby lib
Gem::Specification.new do |s|
s.name = "web-console".freeze
s.version = "2.3.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Charlie S... | 47.404255 | 154 | 0.658887 |
4afded7fbe146ee70c7184bb8aa54a1c74bbfea2 | 2,615 | # encoding: utf-8
require 'cucumber/version'
AUTHOR = 'Aslak Hellesøy' # can also be an array of Authors
EMAIL = "aslak.hellesoy@gmail.com"
DESCRIPTION = "Executable Feature scenarios"
GEM_NAME = 'cucumber' # what ppl will type to install your gem
HOMEPATH = "http://cukes.info"
RUBYFORGE_PROJECT = 'rspec'
@config_fi... | 33.525641 | 152 | 0.652772 |
62233d19516996b80e7395d448b0c9f62a709731 | 560 | # frozen_string_literal: true
module Ci
module ResourceGroups
class AssignResourceFromResourceGroupWorker
include ApplicationWorker
include PipelineQueue
queue_namespace :pipeline_processing
feature_category :continuous_delivery
def perform(resource_group_id)
::Ci::Resourc... | 26.666667 | 101 | 0.7375 |
e8f398cdf4f7bef102a61a27887b438efa1cc7d7 | 5,568 | require 'bigdecimal'
require 'active_support/core_ext/string'
require 'active_support/core_ext/hash/slice'
require_relative 'collection'
module Lightspeed
class ID < Integer; end
class Link; end
class Resource
attr_accessor :id, :attributes, :client, :context, :account
def initialize(client: nil, conte... | 25.309091 | 117 | 0.633441 |
01f0f926c03573cd71402e1e651cce56fadc0731 | 54 | # frozen_string_literal: true
module HasTimeline
end
| 10.8 | 29 | 0.833333 |
383597164bb8039234ae680db05c53e8335792ec | 1,227 | require File.expand_path('lib/rdb/version.rb', File.dirname(__FILE__))
Gem::Specification.new do |s|
s.name = 'rdb'
s.version = Rdb::VERSION
s.bindir = 'bin'
s.executables = ['rdb']
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = 'Browser-based cross-platform Ruby 2.x debugger.'
s.description = 'Brows... | 40.9 | 163 | 0.675632 |
03256ea98102325ef1e699fb84aa753eaec4e5a7 | 532 | require 'rails_helper'
describe BiddingStatusPresenter::Expiring do
describe '#label_class' do
it 'returns the correct label class' do
auction = build(:auction)
presenter = BiddingStatusPresenter::Expiring.new(auction)
expect(presenter.label_class).to eq 'expiring'
end
end
describe '... | 22.166667 | 63 | 0.701128 |
f7d6e270e8ed9e2c31d743d473885cfa335d643e | 1,399 | require "test_helper"
class InterventionStatesControllerTest < ActionDispatch::IntegrationTest
setup do
@intervention_state = intervention_states(:one)
end
test "should get index" do
get intervention_states_url
assert_response :success
end
test "should get new" do
get new_intervention_state... | 28.55102 | 135 | 0.781272 |
ace1fd37462ab08e1a60b207869cce413e4605a9 | 3,468 | require 'spec_helper'
###
Company = Struct.new(:name, :address) do
def creator
User.new('dux', 'dux@.net.hr')
end
def user
User.new('dux', 'dux@.net.hr')
end
end
User = Struct.new(:name, :email) do
def company
Company.new('ACME', 'Nowhere 123')
end
end
JsonExporter.define :company do
prop... | 21.276074 | 71 | 0.644175 |
abe7f847a9b3a0098aabb979eb857da3eedc560f | 4,959 | #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
std_trap = trap("INT") { exit! 130 } # no backtrace thanks
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE']
if ARGV == %w{--prefix}
puts File.dirname(File.dirname(HOMEBREW_BREW_FILE))
exit 0
end
require 'pathname'
HOMEBREW_LIBRARY_PATH ... | 29.694611 | 85 | 0.700746 |
39151da65e75e67a1464ef8b3493ceb11957db09 | 15,147 | require 'fileutils'
require 'digest/md5'
require 'active_support/core_ext/string/strip'
require 'rails/version' unless defined?(Rails::VERSION)
require 'open-uri'
require 'uri'
require 'rails/generators'
require 'active_support/core_ext/array/extract_options'
module Rails
module Generators
class AppBase < Base #... | 35.978622 | 124 | 0.57008 |
bf76cd3cc2e6cbc93a619286cab10b8d60196981 | 1,225 | module Codesake
module Dawn
module Kb
# Automatically created with rake on 2013-05-06
class CVE_2012_6497
include DependencyCheck
def initialize
message = "The Authlogic gem for Ruby on Rails, when used with certain versions before 3.2.10, makes potentially unsafe find_by_id method calls, wh... | 39.516129 | 398 | 0.643265 |
037ebe9a11942f6a00e66dc6e352544a10e4eff0 | 1,717 |
require 'openssl'
module Support
module StringUtility
def format_empty
(self.empty? || self.blank?) ? "Sem informação" : self
end
def percent_string_of(n)
if n == 0
"0 %"
else
"#{(self.to_f / n.to_f * 100.0).round(2)} %"
end
end
def format_cpf
unl... | 21.197531 | 66 | 0.475248 |
7af9de6b810ecaa590d24c727856e1d93a90ac31 | 856 | include KeyPressHandler
def initialize_game_state(args)
puts "init game state..."
args.state.rotation ||= 0
args.state.x ||= 576
args.state.y ||= 100
args.state.player ||= Player.new
args.state.player.x ||= 0
args.state.player.y ||= 0
args.state.player.hp ||= 100
args.state.init... | 24.457143 | 88 | 0.686916 |
611d8be69b39f779a9ab1caafd0a09d14ae5604f | 62 | module OdptCommon::Modules::Decision::Common::RailwayLine
end
| 20.666667 | 57 | 0.822581 |
ab68cf1e3044928590264d79c186cd968ae0d14a | 4,076 | # Copyright:: Copyright 2015 Trimble Navigation Ltd.
# License:: The MIT License (MIT)
# Original Author:: Thomas Thomassen
require "testup/testcase"
# class Sketchup::Entity
class TC_Sketchup_Entity < TestUp::TestCase
def setup
start_with_empty_model
end
def teardown
# ...
end
class TestUpEvi... | 27.355705 | 80 | 0.699215 |
91a788c9868aa4bf336f0e846f3b749c1b63c31d | 1,545 | class DarkskyWeather < Formula
desc "Command-line weather from the darksky.net API"
homepage "https://github.com/genuinetools/weather"
url "https://github.com/genuinetools/weather/archive/v0.15.7.tar.gz"
sha256 "e5efd17d40d4246998293de6191e39954aee59c5a0f917f319b493a8dc335edb"
license "MIT"
bottle do
r... | 45.441176 | 123 | 0.755987 |
abfad9c8ffe5ba5bb089dc6c9d2988f4e8abebc0 | 316 | class AllowNullObjectInLabel < ActiveRecord::Migration[5.2]
def change
change_column_null(:labels, :label_object_type, true)
change_column_null(:labels, :label_object_id, true)
change_column_default(:labels, :label_object_id, nil)
change_column_default(:labels, :label_object_type, nil)
end
end
| 31.6 | 59 | 0.775316 |
bf56934c84a3c9adf2535601f296c661d47c7ceb | 630 | # A Messages object collects messages that may need to be displayed together
# at the end of a multi-step `brew` command run
class Messages
attr_reader :caveats, :formula_count
def initialize
@caveats = []
@formula_count = 0
end
def record_caveats(f, caveats)
@caveats.push(formula: f.name, caveats... | 19.6875 | 76 | 0.685714 |
7a37174928ff83cfe20601c3a7174bffa15021d2 | 11,282 | require 'omniauth'
require 'ruby-saml'
module OmniAuth
module Strategies
class SAML
include OmniAuth::Strategy
def self.inherited(subclass)
OmniAuth::Strategy.included(subclass)
end
RUBYSAML_RESPONSE_OPTIONS = OneLogin::RubySaml::Response::AVAILABLE_OPTIONS
option :name_i... | 35.589905 | 141 | 0.654139 |
e8540a374875c63e24a2796438f1451668a168b6 | 628 | require 'spec_helper'
describe Saml::Elements::IdpEntry do
let(:idp_entry) { FactoryBot.build :idp_entry }
describe 'optional fields' do
[:name, :loc].each do |field|
it "should respond to the '#{field}' field" do
expect(subject).to respond_to(field)
end
end
end
describe 'required... | 22.428571 | 52 | 0.627389 |
622d2404abe51b27f3cca947e1be580579ed8024 | 37 | module StudentapplicationsHelper
end
| 12.333333 | 32 | 0.918919 |
ab7de741322f7053ea91ffd0ea44782f07e84b4a | 769 | module Flumtter
plugin do
class self::Buf < Window::Buf::Buf
Options = {count: 50}
def initialize(twitter)
@twitter = twitter
super(Window::DMBase)
end
def prefetch
adds(
@twitter.rest.direct_messages(
@buf.last.nil? ? Options : Options.merge... | 22.617647 | 107 | 0.595579 |
e9717e8e0458f98ad0f0a7ae6b6bc33051e680c7 | 2,651 | # Encoding: utf-8
#
# Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | 27.05102 | 79 | 0.617126 |
6aa3e729db59cec592f0d21592f89e8f750c1dd3 | 17,183 | # encoding: UTF-8
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
require "java"
require 'securerandom'
require 'test/unit'
require 'thread'
require 'bigdecimal'
require 'jrjackson'
require 'stringio'
require 'time'
require 'date'
class JrJacksonTest < Test::Unit::TestCase
class Test::Unit::CustomObj
end... | 29.677029 | 168 | 0.593261 |
7914d83da1adfffd27ca1d105c0809e9c7aea400 | 1,256 | require 'test_helper'
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "unsuccessful edit" do
log_in_as(@user)
get edit_user_path(@user)
assert_template 'users/edit'
patch user_path(@user), params: { user: { name: "",
... | 33.052632 | 78 | 0.538217 |
5d29bb79f22513289ca1af0b117aff428999b336 | 661 | module Mailkick
module Model
def has_subscriptions
class_eval do
has_many :mailkick_subscriptions, class_name: "Mailkick::Subscription", as: :subscriber
scope :subscribed, -> (list) { joins(:mailkick_subscriptions).where(mailkick_subscriptions: {list: list}) }
def subscribe(list)
... | 26.44 | 115 | 0.641452 |
21250c8c182ac9a45f9f13c5ac8775226b6cc499 | 237 | # typed: false
class CreateSpellBooks < ActiveRecord::Migration[5.0]
def change
create_table :spell_books do |t|
t.string :name
t.references :wizard
t.integer :book_type, null: false, default: 0
end
end
end
| 21.545455 | 53 | 0.675105 |
5d2e42c2a64e676bebdb65cc556162fc72742926 | 565 | require 'rails_helper'
RSpec.describe ImportEntriesController, type: :controller do
let(:import_entry) { fixture_file_upload("files/import_entry_abc_fixture.csv", "text/csv")}
let(:valid_session) { {} }
describe 'POST #create' do
context 'with valid params' do
it "redirects to the entries index" do
... | 25.681818 | 93 | 0.637168 |
0144a5f1a6a8f1d2fe56198fd832d6bec38bc6b7 | 1,410 | module Intrigue
module Ident
module Check
class ParkingCrew < Intrigue::Ident::Check::Base
def generate_checks(url)
[
{
:type => "fingerprint",
:category => "service",
:tags => ["Parked"],
:vendor => "ParkingCrew",
:product => "ParkingCrew",
... | 29.375 | 123 | 0.495035 |
21904a2118cc5ea1d172f149d65bfb158b3064c9 | 456 | Puppet::Type.newtype(:odl_user) do
ensurable
newparam(:username, :namevar => true) do
desc "Username to configure in ODL IDM with admin role"
newvalues(/^\w+$/)
end
newproperty(:password) do
desc "Password for this user"
validate do |value|
if !value.is_a?(String)
raise Argument... | 19 | 59 | 0.64693 |
18c7f7584c0803a9175031cc5c1ab818ff591f03 | 1,241 | # frozen_string_literal: true
module RuboCop
module Cop
module Migration
class UpdatingDataInMigration < RuboCop::Cop::Cop
MSG = "Updating or manipulating data in migration is unsafe!".freeze
def on_send(node)
return if allowed_methods.include?(node.method_name.to_s)
ad... | 22.981481 | 76 | 0.557615 |
b9a3cab1781c590b7b93fa45d0cf36f6ca793215 | 479 | maintainer "Alistair Stead"
maintainer_email "alistair@inviqa.com"
license "Apache 2.0"
description "Installs/Configures chef-varnish"
name "chef-varnish"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.6"
depends "apt"
depends "yum"
%w{re... | 26.611111 | 82 | 0.705637 |
ac91016eb010a83369329a3f6fe7a32bb40e0ec6 | 1,231 | class WhatLivingExpensesForm < Form
set_attributes_for :interview,
:has_rent_mortgage_expense,
:has_space_rent_expense,
:has_property_tax_expense,
:has_child_support_expense,
:has_home_insurance_expense,
... | 34.194444 | 93 | 0.61251 |
01b455a85efe7830db579d8ba7c7f646dc7473f7 | 44 | module BeforeRender
VERSION = "0.1.0"
end
| 11 | 19 | 0.704545 |
4acfadcf03f55b474733a6533c0fd8d54489ffd9 | 103 | class User < ApplicationRecord
include Clearance::User
has_many :messages, dependent: :destroy
end
| 20.6 | 41 | 0.786408 |
e9750b43567c4d1d91ecbb785d0507ef30a9416d | 120 | require 'wink'
Pathname.glob(Rails.root + 'lib' + 'wink' + '*.rb').each do |lib|
require "wink/#{lib.basename}"
end
| 17.142857 | 65 | 0.625 |
f8d66a9100c14f0c6ae0127c0e91669e9103e369 | 1,000 | require 'csv'
class ClassificationsDumpWorker
include Sidekiq::Worker
include DumpWorker
attr_reader :project
def perform(project_id, medium_id=nil, obfuscate_private_details=true)
if @project = Project.find(project_id)
@medium_id = medium_id
begin
csv_formatter = Formatter::Csv::Clas... | 27.027027 | 121 | 0.695 |
87c7598e01d7e182468c3d50a7313d3bdeae3943 | 4,006 | require "base64"
require "spec_helper"
describe CFoundry::AuthToken do
describe ".from_uaa_token_info" do
let(:access_token) { JWT.encode({user_id: "a6", email: "a@b.com"}, nil, 'none') }
let(:info_hash) do
{
:token_type => "bearer",
:access_token => access_token,
:refresh_token... | 26.012987 | 116 | 0.574388 |
6a60217ae3047ce3880e475deb5c06dcac9210df | 5,060 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# 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 ChiliProj... | 29.248555 | 143 | 0.575494 |
33fcdc49c512688f55045055a16a532400228c57 | 18,617 | require 'csv'
require 'fileutils'
require 'set'
require 'net/http'
require 'uri'
require 'json'
def create_crag_page(crags)
# determine unique metros
metros = Set[]
states = Set[]
state_locals = Hash.new
#TODO needs to loop through each metros cell
crags.each do |crag|
crag[:metros].split("|").each do... | 50.452575 | 242 | 0.536499 |
b9625a224ee2ba600fe2c9e40026e9f9d2928d35 | 713 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "units-in-ruby"
s.version = '0.0.1'
s.authors = ["Brandon Fosdick", "Meseker Yohannes"]
s.email = ["bfoz@bfoz.net"]
s.homepage = 'http://github.com/bfoz/units-ruby'
s.summar... | 39.611111 | 83 | 0.612903 |
01bec724a5dbf53c0411e1188bd09ec334e49e4a | 49 | COMMITS = "[%{id}] %{message} - by %{committer}"
| 24.5 | 48 | 0.55102 |
21587ceae681eb815663d4218094d78cdb3fd98b | 3,042 | module MiqServer::WorkerManagement::Heartbeat
extend ActiveSupport::Concern
def worker_add_message(pid, item)
@workers_lock.synchronize(:EX) do
if @workers.key?(pid)
@workers[pid][:message] ||= []
@workers[pid][:message] << item unless @workers[pid][:message].include?(item)
end
... | 34.568182 | 126 | 0.683761 |
4a03a8e48064b5aa5a856f9456b2e0ec405288db | 123 | class AddRecordIdToCreator < ActiveRecord::Migration
def change
add_column :creators, :record_id, :integer
end
end
| 20.5 | 52 | 0.772358 |
28046fbf5b1a2cb338cb4ea64db69f1ade14b984 | 281 | class Xtrafinder < Cask
version :latest
sha256 :no_check
url 'http://www.trankynam.com/xtrafinder/downloads/XtraFinder.dmg'
homepage 'http://www.trankynam.com/xtrafinder/'
license :unknown
pkg 'XtraFinder.pkg'
uninstall :pkgutil => 'com.trankynam.xtrafinder.*'
end
| 23.416667 | 68 | 0.740214 |
28ac6f31d30f772cdc8c37b09160ba5304073c26 | 1,402 | class Taisei < Formula
desc "Clone of Tōhō Project shoot-em-up games"
homepage "https://taisei-project.org/"
url "https://github.com/taisei-project/taisei.git",
:tag => "v1.3",
:revision => "f8ef67224f47e85f4095e32736dc21e0d46ae5b7"
bottle do
sha256 "81286c197a97f979323bcded1b9ed5756b31c35... | 31.155556 | 93 | 0.694722 |
1a5410bef7d6f7bc82daa96812a51431560ba21c | 2,882 | #--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems'
# Mixin methods for local and remote Gem::Command options.
module Gem::LocalRemoteOptions
# Allows OptionParser to handle HTTP URIs.
def accept_uri_http
O... | 26.934579 | 82 | 0.646426 |
e2194710e5c0693705d224b6b496a4d350e497db | 2,004 | # encoding: utf-8
#
control "V-72255" do
title "The SSH public host key files must have mode 0644 or less permissive."
desc "If a public host key file is modified by an unauthorized user, the SSH
service may be compromised."
impact 0.5
tag "gtitle": "SRG-OS-000480-GPOS-00227"
tag "gid": "V-72255"
tag "rid"... | 34.551724 | 88 | 0.673653 |
334732af9c3bad6118da49de90778d3fdd50a687 | 829 |
require "todoly/rest_interface"
require "todoly/project"
require "todoly/filter"
require "todoly/task"
class Todoly
def initialize(opt={})
@rest_if = RestInterface.new(opt)
@projects = nil
@filters = nil
@tasks = nil
end
def projects
@projects ||= Project.list(@rest_if)
end
def find_pr... | 16.918367 | 45 | 0.613993 |
870c69cb15da22f44e10ef5d80c5a29ac00b88f2 | 1,494 | require "rails_helper"
RSpec.describe Api::Courier::ProfilesController,
type: :request do
let(:user) { create :user }
before { login_as user }
describe "doesn't create courier profile for user" do
let(:invalid_attributes) {
attributes_for(:courier_profile).except(:ruc)
}
before... | 21.042254 | 55 | 0.595716 |
26621b82bc2ffae7cb07d7486de7a4272334b35a | 417 | require "rubocop/inspecstyle/version"
module RuboCop
module InSpecStyle
class Error < StandardError; end
# Your code goes here...
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
CONFIG = YAML.safe_l... | 27.8 | 75 | 0.733813 |
e8038dd6ee5de68f5ac4135c43d3e90d7415ac7a | 723 | #
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
require 'puppet'
require 'puppet/type/mongodb_replset'
describe Puppet::Type.type(:mongodb_replset) do
before :each do
@replset = Puppet::Type.type(:mongodb_replset).new(:name => 'test')
end
it 'should accept a replica set name' do
... | 24.931034 | 72 | 0.648686 |
1c7fb65417a52d488f4b030ea7f4937d697196dc | 1,142 | # Copyright 2015 Google 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 writing,... | 32.628571 | 76 | 0.735552 |
08cd91b6c368193df0ad33fb332293803f4d7056 | 449 | # jruby scripting container
jar 'org.jruby:jruby-core', '@project.version@'
jar 'org.jruby:jruby-stdlib', '@project.version@'
# unit tests
jar 'junit:junit', '4.8.2', :scope => :test
properties 'tesla.dump.pom' => 'pom.xml', 'tesla.dump.readOnly' => true
plugin :surefire, '2.15', :reuseForks => false, :additionalCla... | 40.818182 | 190 | 0.648107 |
ff4de659ea2c79e440fbfcc21bf900471884c1fe | 1,987 | # Cookbook Name:: wlp
# Attributes:: default
#
# (C) Copyright IBM Corporation 2013.
#
# 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
#
# Unl... | 34.859649 | 146 | 0.75994 |
18142a12339d6fe8eb103a17c79d9f0e90de955c | 269 | class AddAttributesToProjectDependencies < ActiveRecord::Migration[5.1]
def change
add_column :project_dependencies, :github_url, :string
add_column :project_dependencies, :website, :string
add_column :project_dependencies, :owner_name, :string
end
end
| 33.625 | 71 | 0.788104 |
d5d909752186e9df8416629fd1d8975ec530e39c | 146 | require File.expand_path('../../../spec_helper', __FILE__)
describe "String#rpartition" do
it "needs to be reviewed for spec completeness"
end
| 24.333333 | 58 | 0.739726 |
ac7ccccb44b07eddd04f2428f6c3f427ecc4673c | 638 | require 'benchmark'
require 'pcg_random'
Iterations = 100_000
SeedSize = 16
puts "### PCGRandom.raw_seed(16)"
puts "```bash"
puts "Benchmark of Random.raw_seed(#{SeedSize}) vs PCGRandom.raw_seed(#{SeedSize})"
puts "=================================================="
puts ""
puts "Benchmark created around: #{Time.now}... | 25.52 | 83 | 0.659875 |
3967ca4a1c7507d660cb7c2a4349cd8240734bd7 | 215 |
class HadoopStateChange
# @timestamp
# @previousState
# @newState
def initialize(time, prev_state, new_state)
@timestamp = time
@previous_state = prev_state
@new_state = new_state
end
end | 13.4375 | 45 | 0.693023 |
ab55b8f16107d473ddbb239c5a99065334403408 | 376 | class Module
def trace_attr(sym)
self.module_eval %{def #{sym}
printf "Accessing %s with value %s\n", "#{sym}", #{sym}.inspect
@#{sym}
end}
end
end
class Dog
trace_attr :name
def initialize(string)
@name = string
end
end
Dog... | 18.8 | 88 | 0.523936 |
610e32fc75e4784f9fbfa4769469a573cebab162 | 1,374 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hue_control/version'
Gem::Specification.new do |spec|
spec.name = "hue_control"
spec.version = HueControl::VERSION
spec.authors = ["Karsten Silkenbäumer"]
spec.summa... | 37.135135 | 104 | 0.673945 |
f8106fa5330794a29bbeb69d6782fe53fec8784e | 3,704 | # encoding: UTF-8
module Wice
module GridViewHelper
# View helper to render the list of saved queries and the form to create a new query.
# Parameters:
# * <tt>:extra_parameters</tt> - a hash of additional parameters to use when creating a new query object.
# Read section "Adding Application Specifi... | 45.170732 | 127 | 0.650378 |
acde2e2b57240d41c3dfb30e3ce7d99f5540569c | 939 | # frozen_string_literal: true
require_relative "default_result_renderer"
module Results
module Renderers
class TeamNameRenderer < Results::Renderers::DefaultResultRenderer
def self.render(column, row)
result = row.source
text = row[column.key]
return text unless result.team_id
... | 28.454545 | 112 | 0.642173 |
21d1f298b7db7e17a8cc3ba24aee06d12a02ab04 | 1,606 | # frozen_string_literal: true
module JCW
class Init
class << self
def call
init_jaeger_client
activate_subscribers
init_http_tracer
end
private
def init_jaeger_client
return unless config.enabled?
reporter = config.connection[:protocol].to_sym ==... | 25.903226 | 86 | 0.60523 |
61b57d386e0b3c86071688203b7bff7b6a23a152 | 61 | source 'https://rubygems.org'
gem 'wwtd'
gemspec path: '..'
| 12.2 | 29 | 0.655738 |
086691d5ed8d28b4c2bb5e8ee8a5bdc85051b50d | 958 | # Copyright 2021 The Sigstore Authors
#
# 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... | 36.846154 | 74 | 0.7881 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.