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 |
|---|---|---|---|---|---|
e9aefe9e3b59c529c8936236ea94e7b078802d86 | 6,437 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 37.424419 | 245 | 0.689762 |
bf17941eb84e995664d6079087df9b4dd20f0a9b | 987 | # encoding: utf-8
require 'sequel'
module Resque
class BaseJob
MAX_RETRIES = 3
@@queue = ''
@@retries = 0
def self.perform(options = {})
raise NotImplementedError("This class shouldn't be directly instantiated")
end
def self.run_action(options, queue_name, action)
@@queue = qu... | 24.073171 | 118 | 0.5846 |
6aefa7d38b6526a94a223b3c181f0ac5392ff60e | 264 | module SocialStream
module Events
module Models
module Actor
extend ActiveSupport::Concern
included do
has_many :rooms
end
def events
Event.authored_by(self)
end
end
end
end
end
| 14.666667 | 37 | 0.564394 |
e9e178ffdbe4326965fcb06bb96a8fa6a88d25cb | 278 | #!/usr/bin/env ruby
# by Andronik Ordian
def optimal_weight(w, weights)
result = 0
weights.each { |weight| result += weight if result + weight <= w }
result
end
if __FILE__ == $0
w, _, *weights = STDIN.read.split().map(&:to_i)
puts optimal_weight(w, weights)
end
| 18.533333 | 68 | 0.661871 |
3841f54222b2ca7defd6d67c28277724f62d6b9d | 2,561 | # rubocop:disable all
require 'flows'
require 'dry/transaction'
require 'trailblazer/operation'
#
# Task: a + b = ?
#
class FlowsSummator
include Flows::Operation
step :sum
ok_shape :sum
def sum(a:, b:, **)
ok(sum: a + b)
end
end
class POROSummator
def self.call(a:, b:)
a + b
end
end
class ... | 16.00625 | 43 | 0.574385 |
ff13942d5527ee0e3cd51ef4b8028e04d661ee57 | 99 | module Reviewit
autoload :App, 'reviewit/app.rb'
autoload :GitUtil, 'reviewit/git_util.rb'
end
| 19.8 | 43 | 0.747475 |
1171f32bb104b933ff139b70c7f5905f9d0364b9 | 14,272 | # frozen_string_literal: true
require "spec_helper"
require "dependabot/dependency"
require "dependabot/dependency_file"
require "dependabot/maven/file_updater/declaration_finder"
RSpec.describe Dependabot::Maven::FileUpdater::DeclarationFinder do
let(:finder) do
described_class.new(
dependency: dependenc... | 35.859296 | 79 | 0.6353 |
f7b25e7a87156669d3265efcb4482a6cd85f6b5b | 1,785 | require 'test_helper'
class AgentsIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = agents(:michael)
@agent = agents(:archer)
end
test "index as admin including pagination with edit and delete links and a button to add a new agent" do
log_in_as(@admin)
get agents_path
assert_tem... | 33.055556 | 106 | 0.673389 |
218c11552175a0bcb10ec01411c487433fc70a56 | 973 | module MoneyS3
module Parsers
class VyrobniCislo
include ParserCore::BaseParser
def vyrobni_cis
at 'VyrobniCis'
end
def vyrobni_cis_attributes
attributes_at 'VyrobniCis'
end
def dat_vyr
at 'DatVyr'
end
def dat_vyr_attributes
attri... | 21.622222 | 83 | 0.609455 |
03c107141c507c18cc5c42ab02e35f960354e2be | 401 | # encoding: UTF-8
# frozen_string_literal: true
module BlockchainClient
class Xano < Bitcoin
def get_block(block_hash)
json_rpc(:getblock, [block_hash, true]).fetch('result')
end
def get_raw_transaction(txid)
json_rpc(:getrawtransaction, [txid, 1]).fetch('result')
end
def get_u... | 20.05 | 61 | 0.685786 |
bb822ab91b491c40776ff4c822a0dff2696908c6 | 1,329 | require 'terjira/utils/file_cache'
module Terjira
VERSION = '0.4.1'.freeze
class VersionChecker
VERSION_CHECK_DURATION = (60 * 60 * 24 * 5).freeze
class << self
def check_version
version_alert_cache.fetch :alert do
if new_version_exists?
puts "* New version of terjira ... | 27.122449 | 104 | 0.586907 |
39b681175c83b338886f7a758d3d4538128d87b4 | 2,071 | class Libscrypt < Formula
desc "Library for scrypt"
homepage "https://lolware.net/libscrypt.html"
url "https://github.com/technion/libscrypt/archive/v1.21.tar.gz"
sha256 "68e377e79745c10d489b759b970e52d819dbb80dd8ca61f8c975185df3f457d3"
license "BSD-2-Clause"
bottle do
sha256 cellar: :any, arm64_big_su... | 45.021739 | 106 | 0.733462 |
87c4d264c2f9af078eafbd6e83558745ee3ae309 | 877 | require 'test_helper'
module Rubybear
class StreamTest < Rubybear::Test
def setup
@api = Rubybear::Stream.new
end
def test_method_missing
assert_raises NoMethodError do
@api.bogus
end
end
def test_all_respond_to
@api.method_names.each do |key|
assert @api... | 21.390244 | 68 | 0.63512 |
285c2b03cfae5afccdafcf7d506934d683fb917e | 1,348 | $LOAD_PATH.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'care_bert/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'care_bert'
s.version = CareBert::VERSION
s.authors = ['Daniel Loy']
s.email = ['loybert... | 51.846154 | 568 | 0.719585 |
e23dbcae753b2c754315f82d340c25a30f858035 | 754 | # frozen_string_literal: true
class Zendesk2::Search
include Zendesk2::Request
request_method :get
request_body { |r| { query: r.query } }
request_path { |_| '/search.json' }
page_params!
attr_reader :query
def call(query, params)
@query = query
super(params)
end
def mock
terms = Hash... | 22.848485 | 110 | 0.588859 |
187d3de20e33e33991ab85551c44901b514d9349 | 157 | class AddPasswordSaltToUsers < ActiveRecord::Migration
def change
add_column :users, :password_salt, :string, :null => false, :default => ''
end
end
| 26.166667 | 78 | 0.719745 |
e9e9a21b90dc742feed28c3e86d868514fa18b32 | 852 | cask 'detectx' do
version '2.73'
sha256 '9422a1cffd1c3ea7786c80cd767a373983ad788fc4aa5138e69c15163a79df7a'
# amazonaws.com/sqwarq.com was verified as official when first introduced to the cask
url 'https://s3.amazonaws.com/sqwarq.com/PublicZips/DetectX.app.zip'
appcast 'https://s3.amazonaws.com/sqwarq.com/Ap... | 38.727273 | 150 | 0.728873 |
79c762f230069547a2417e068fcc856882e2ef27 | 6,068 | # http://linux.die.net/man/5/rackspace_yum.conf
case node['platform_version'].to_i
when 5
default['rackspace_yum']['main']['cachedir'] = '/var/cache/yum'
else
default['rackspace_yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever'
end
default['rackspace_yum']['main']['cookbook_template_globalconfig']... | 67.422222 | 104 | 0.671885 |
1804e5babc7dbf801c14ede76b9afbd885184330 | 147 | class UserAddPwDigest < ActiveRecord::Migration[6.1]
def change
change_table :users do |t|
t.string :password_digest
end
end
end
| 18.375 | 52 | 0.70068 |
086602f482da0eb24fa60baf0e4d0295ec8808da | 744 | require 'spec_helper'
describe Amazon::Associates do
describe ".item_search" do
context "when omitting required parameters" do
it "should fail" do
proc { Amazon::Associates.item_search(nil) }.should raise_error(Amazon::Associates::RequiredParameterMissing)
end
end
context "when the c... | 28.615385 | 131 | 0.682796 |
39a7061968bc33163934a8a5a681e8135c518775 | 1,305 | module Scripto
module PrintCommands
RESET = "\e[0m".freeze
GREEN = "\e[1;37;42m".freeze
YELLOW = "\e[1;37;43m".freeze
RED = "\e[1;37;41m".freeze
attr_accessor :verbose
# Is verbose mode turned on?
def verbose?
!!@verbose
end
# Turn on verbose mode. #vbanner, #vput... | 23.727273 | 77 | 0.584674 |
ab155be0c44b4253ec0f1d242278f7ed53209068 | 377 | FactoryGirl.define do
factory :resource_pool do
sequence(:name) { |n| "rp_#{seq_padded_for_sorting(n)}" }
end
factory :default_resource_pool, :parent => :resource_pool do
is_default true
end
factory :default_resource_pool_with_vms, :parent => :resource_pool do
after(:create) do |rp|
rp.add... | 23.5625 | 71 | 0.710875 |
08cde0f7b7e51662a8ea1143431e913488e46eee | 460 | require_relative '../message_init'
context "Proceed from Previous Message to a Class" do
source = EventStore::Messaging::Controls::Message.example
msg = EventStore::Messaging::Message::Proceed.(source, source.class)
source_metadata = source.metadata
metadata = msg.metadata
test "Constructs the class" do
... | 25.555556 | 70 | 0.747826 |
62d9d2680869b5cf4e80a9a2be90479335fb4563 | 140 | class AddTimezoneToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :time_zone, :string, :default => "UTC"
end
end
| 23.333333 | 61 | 0.714286 |
87552e80be6819f9c197e4c9c1ab8ee351fcf5f8 | 442 | # Copyright (c) 2015 Vault12, Inc.
# MIT License https://opensource.org/licenses/MIT
require 'errors/zax_error'
# There are no saved HPK client/session keys
# Client should prove HPK ownership to establish these keys
module Errors
class HPK_keys < ZAXError
def http_fail
@response_code = :unauthorized
... | 26 | 95 | 0.714932 |
38b9e90332e31b4cef0a27b8729854e12afcfe36 | 7,716 | # frozen_string_literal: true
# Assessment: assessment model
class Assessment < ApplicationRecord
columns.each do |column|
case column.type
when :text
validates column.name.to_sym, length: { maximum: 2000 }
when :string
validates column.name.to_sym, length: { maximum: 200 }
end
end
ha... | 47.925466 | 137 | 0.684033 |
21ea5463c97e33d94176f41727fc0dd65eb540e6 | 3,270 | require "spec_helper"
describe Emites::Resources::Taker do
let(:http) { Emites::Http.new("2C58AFD8E960A7BFE0BC912EBF47A960") }
let(:entity_klass) { Emites::Entities::Taker }
let(:params) do
{
email: "wanderson.policarpo@myfreecomm.com.br",
social_reason: "My Fake, Inc",
... | 27.711864 | 78 | 0.599388 |
ff867538bc19aad578077b291bb9653e8c862339 | 529 | class NYTInterface
def self.fetch_stories_for_category(category)
response = HTTParty.get("https://api.nytimes.com/svc/topstories/v2/#{category}.json?api-key=rVFIgSZh3fGk0wXTzOl48y89ozhV54uh").body #abracted away category allowing this code to be used more flexible.
if response.include?("Se... | 44.083333 | 208 | 0.697543 |
ac30f56379ed371ba860d978c4adbde16a12b9b9 | 3,960 | require 'spec_helper'
require 'tempfile'
# Time to add your specs!
# http://rspec.info/
TMDB_API_KEY = '7a2f6eb9b6aa01651000f0a9324db835'
describe "TmdbProfile" do
before(:all) do
File.mkdirs(TMPDIR)
end
before(:each) do
# tt0465234 => National Treasure: Book of Secrets
@profile = TmdbProfile.fir... | 28.695652 | 108 | 0.658333 |
6163e162a5076fe24a68e7abf8600db5861e25f4 | 619 | class TokyoMetro::App::Renderer::TravelTimeInfo::MetaClass::MultipleRailwayLines < TokyoMetro::Factory::Decorate::MetaClass
def initialize( request , railway_line_infos )
super( request )
set_railway_line_infos( railway_line_infos )
common_procedures_when_initialize
end
include ::TokyoMetro::App::Re... | 26.913043 | 123 | 0.785137 |
03e02f3947483c4a11122f75ebd796cff3e61237 | 55 | #!/usr/bin/env ruby
require __dir__ + '/browserid.rb'
| 13.75 | 33 | 0.690909 |
bf18e74adfaa353ed68f0ad3e1f0ba26aa2f1b6a | 2,210 | require 'zip'
require_relative '../lib/presentation_merger'
class ResourcePackager
attr_accessor :download
def initialize(download)
@download = download
@lesson_parts = download.lesson_parts
end
def lesson_bundle
build_lesson_bundle.tap(&:rewind)
end
def filename
download.lesson.name... | 24.285714 | 98 | 0.703167 |
115713763d889516b65b0286c1058fd35464c0d5 | 707 | module TranslationsManager
class TransifexConfigFileUpdater
def self.read_lang_map(file)
file.each_line do |line|
if line =~ /lang_map = (.*)/i
return Hash[$1.split(',').sort.map { |x| x.split(':').map(&:strip) }]
end
end
end
def self.update_lang_map(file, languages)... | 22.09375 | 79 | 0.526167 |
39eb8c42cb11afdb3085187005727e5778c88885 | 1,900 | require 'selenium-webdriver'
require_relative 'treatment/processor'
def run_botascript
# 1 Find orders to execute
# => Alive, exec triggered, not processing
taff = Order.exec_scope()
# 2 Les marquer IN_PROCESS:
taff.each do |order|
order.update(processing: true)
# Marquer les ordres IN_PROCESS
... | 29.230769 | 142 | 0.671579 |
e8fb0ee29e587ca5a5860a30932cab2eb803e3ac | 547 | # -*- ruby -*-
namespace :mspec do
desc "Synchronize mspec with another checkout"
task :sync do
unless dir = ENV['DIR']
raise "Use DIR= to specify a checkout of mspec"
end
unless File.directory?(dir)
raise "#{dir} isn't an mspec checkout. Use 'cd ~/git; git clone git://github.com/brixen/ms... | 26.047619 | 105 | 0.61426 |
9151d1fad6da1ce94b7ee88dc0c2dd6d446c0580 | 91 | require 'test_helper'
class ClientProjectAssignmentsHelperTest < ActionView::TestCase
end
| 18.2 | 63 | 0.857143 |
79ca5553f99935aec057976090b551c13405a318 | 1,481 | module Sage300Kit
class Client
module OE
module Invoices
# Get all records:
# client.get_invoices('COMPANY')
# Get records using a range:
# client.get_invoices('COMPANY', '$skip':5, '$top':2)
# Get records using filter:
# client.get_invoices('COMPANY', ... | 33.659091 | 108 | 0.56921 |
79784bad67ecd23a19b7e61d4f655f2b97c98e47 | 14,362 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::ServicesController do
include JiraServiceHelper
include AfterNextHelpers
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:jira_integration) { create(:jira_integration, project:... | 33.322506 | 133 | 0.628464 |
e2993733ce1dd6e539b05ab3ba906585a49f78f8 | 1,079 | # frozen_string_literal: true
require 'application_system_test_case'
module Spina
module Admin
module Journal
class JournalsTest < ApplicationSystemTestCase
setup do
@journal = spina_admin_journal_journals :journal
authenticate
end
test 'updating the journal' d... | 28.394737 | 87 | 0.618165 |
183c5e45a41a7d8d6c4be8c7ac4ab49d4b1c0434 | 567 | require 'spec_helper'
describe Array do
describe '#indent' do
subject { ["root:", " indented:"] }
it "prepends each element with spaces" do
expect(subject.indent 2).to eq [" root:", " indented:"]
end
context "when offset is 0" do
it "returns the array as is" do
expect(subjec... | 23.625 | 65 | 0.622575 |
e8e186cc37a7c1bf00780b04e4aba8650307ea6c | 178 | # frozen_string_literal: true
class AddSpecialToDomainTags < ActiveRecord::Migration[5.2]
def change
add_column :domain_tags, :special, :boolean, default: false
end
end
| 22.25 | 63 | 0.769663 |
e9acdc1d0824a6fb746ed1c397425f032e0e8f37 | 1,520 | # encoding: utf-8
$:.unshift File.expand_path('../lib', __FILE__)
require 'comfortable_mexican_sofa/version'
Gem::Specification.new do |s|
s.name = "comfortable_mexican_sofa"
s.version = ComfortableMexicanSofa::VERSION
s.authors = ["Oleg Khabarov"]
s.email = ["oleg@khabarov.ca"]
... | 38.974359 | 77 | 0.597368 |
f8da1d67f2f839a83915272820d2092064dadccf | 12,472 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/dataplex/v1/metadata.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
require 'google/api/client_pb'
require 'google/api/field_behavior_pb'
require 'google/api/resource_pb'
require 'google/protobuf/empty_pb'
require '... | 51.53719 | 187 | 0.723942 |
08d0a73ec7eb055a0c1863d51d7bde9e8f7f3045 | 3,375 | module Stubby
mattr_accessor :base_definitions, :instance_definitions
@@base_definitions = {}
@@instance_definitions = {}
class << self
def included(base)
base.after :each do Stubby::Instances.clear! end
end
def base_definition(name)
name = name.name.demodulize if name... | 27 | 86 | 0.578667 |
912398725863ae843282fa115335662c473f6b0a | 2,830 | require 'readline'
require 'optparse'
require 'gitsh/completer'
require 'gitsh/environment'
require 'gitsh/history'
require 'gitsh/interpreter'
require 'gitsh/prompter'
require 'gitsh/version'
module Gitsh
class CLI
EX_OK = 0
EX_USAGE = 64
def initialize(opts={})
interpreter_factory = opts.fetch(:... | 23.196721 | 84 | 0.636042 |
4a8db82cf33732624cf9e38320675fd588f3486b | 576 | require 'digest/sha1'
# @summary
# Hash a string as mysql's "PASSWORD()" function would do it
#
Puppet::Functions.create_function(:'mysql::password') do
# @param password
# Plain text password.
#
# @return hash
# The mysql password hash from the clear text password.
#
dispatch :password do
requi... | 25.043478 | 70 | 0.675347 |
1c1e9a26ab02decf7d0b80646cbfde80e6023af8 | 2,939 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction PUNPCKHWD
forms = []
operands = []
encodings = []
# punpckhwd: mm, mm
operands << OPERAND_TYPES[54]
operands << OPERAND_TYPES[36]
encodings << Class.new(Fisk::Encoding) {
def encode buffer, operands
... | 27.212963 | 51 | 0.541681 |
e277f67b6272ad91bf3c0dc1c952556ba9efcf93 | 1,389 | # Called within a class definition, establishes a containment
# relationship with another class
Puppet::Parser::Functions::newfunction(
:contain,
:arity => -2,
:doc => "Contain one or more classes inside the current class. If any of
these classes are undeclared, they will be declared as if called with the
`inclu... | 44.806452 | 149 | 0.781857 |
f86a1b8a0a4de59f3a1b5deb292c283c633a0f84 | 733 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User activates JetBrains TeamCity CI' do
include_context 'project integration activation'
before do
stub_request(:post, /.*teamcity.example.com.*/)
end
it 'activates integration', :js do
visit_project_integration('JetBrains TeamCity... | 28.192308 | 81 | 0.729877 |
e9bf13ae762bc9f0bdbfe55a90c568d0ca917316 | 1,458 | module TicTacToe
class Game
attr_reader :players, :board, :current_player, :other_player
def initialize(players, board=Board.new)
@players = players
@board = board
@current_player, @other_player = players.shuffle
end
def switch_players
@current_player, @other_player = @other_p... | 23.142857 | 80 | 0.581619 |
38baa81995767ac947238e82f1fbe6ee8877b657 | 3,067 | require 'spec_helper'
describe Banzai::Filter::GollumTagsFilter, lib: true do
include FilterSpecHelper
let(:project) { create(:project) }
let(:user) { double }
let(:project_wiki) { ProjectWiki.new(project, user) }
describe 'validation' do
it 'ensure that a :project_wiki key exists in context' do
... | 34.077778 | 160 | 0.6433 |
61c201a82fabb68877aac96e95a1ff1ff20bb37a | 4,014 | 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.742574 | 102 | 0.758844 |
793c76480e58731ba084e98c2d2486680eff5479 | 1,027 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "xspec/version"
Gem::Specification.new do |spec|
spec.name = "simple-xspec-wrapper"
spec.version = XSpec::VERSION
spec.authors = ["Matt Patterson"]
spec.email = ["matt@reproc... | 35.413793 | 87 | 0.640701 |
4a300dd28888dc79c39d88a0e5df89b3ebf9f8eb | 632 | class Role < ApplicationRecord
has_and_belongs_to_many :users, :join_table => :users_roles
belongs_to :resource,
:polymorphic => true,
:optional => true
validates :resource_type,
:inclusion => { :in => Rolify.resource_types },
:allow_nil => true
scopify
has_and_belongs_to_... | 19.75 | 59 | 0.648734 |
f884cf1689ededa22052ed4ab5d55eee438361d1 | 1,304 | require "language/node"
class Babel < Formula
desc "Compiler for writing next generation JavaScript"
homepage "https://babeljs.io/"
url "https://registry.npmjs.org/babel-cli/-/babel-cli-6.24.1.tgz"
sha256 "d69a00bdb4f35184cda1f5bfe8075cd4d569600b8e61d864d1f08e360367933b"
bottle do
rebuild 1
sha256 "... | 34.315789 | 99 | 0.751534 |
f7e306b0032b9a59d0d1962200d4aae84de0d5c4 | 859 | require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "react-native-svg-viewer"
s.version = package["version"]
s.summary = package["description"]
s.description = <<-DESC
react-native-svg-viewer
D... | 31.814815 | 113 | 0.57858 |
6afffef640de3fc62fb3d731c3c9ea84e644b674 | 1,317 | require 'bundler/setup'
require 'yaml'
require 'rspec'
require 'rspec/its'
require 'rspec/collection_matchers'
require 'yaml'
require 'active_support'
require 'active-orient'
read_yml = -> (key) do
YAML::load_file( File.expand_path('../spec.yml',__FILE__))[key]
end
OPT ||= {}
[:oetl,:orientdb, :admin].each{|kw| OPT[... | 20.904762 | 72 | 0.688686 |
b9b58700ee425c1bf64973ba9c631544ec756c5b | 1,046 | 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/rail... | 32.6875 | 82 | 0.771511 |
217f7175d16f34259f87ca558dc242bd4146a31d | 270 | use Rack::Static,
:urls => ["/images", "/js", "/css"],
:root => "public"
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/index.html', File::RDONLY)
]
}
| 16.875 | 49 | 0.496296 |
4ab700d97b1c12b7851ae39cdf09e490be91e383 | 988 | # frozen_string_literal: true
# == Schema Information
#
# Table name: microposts
#
# id :bigint not null, primary key
# content :text
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint
#
# Indexes
#
# index_microposts_on_user_id ... | 27.444444 | 111 | 0.676113 |
e298fc0cdbf507fb83dd04ddd7c0ea8ae009a4b9 | 645 | class UserMailer < ActionMailer::Base
helper :days
default from: Rails.configuration.noreply_email
def introduction(user, token)
@user = user
@token = token
mail to: @user.email
end
def closure_notification(user, token)
@user = user
@token = token
mail to: @user.email
end
def fe... | 18.428571 | 49 | 0.657364 |
6af335c747c380096a0c31ccb9d7588754741771 | 333 | class APIStats < APIMain
def bounces
data(URLS_STATS[:bounces])
end
def cycle
data(URLS_STATS[:cycle])
end
def history
data(URLS_STATS[:history])
end
def spam
data(URLS_STATS[:spam])
end
def summary
data(URLS_STATS[:summary])
end
def unsubscribe
data(URLS_STATS[:unsubs... | 12.807692 | 30 | 0.660661 |
62ed52ccb1bd8c7162eb1f325763a0c190ca3764 | 1,270 | module Mazes
# Internal: Standard interface for all Space-manipulating Algorithms that create
# mazes. Algorithm subclasses need only define a single method which, when
# called, will execute the algorithm on a Space.
class Algorithm
# Internal: Executes an algorithm on a Space of Cells.
#
# space - A Space of Cells ... | 34.324324 | 80 | 0.752756 |
18964eda9ccd8fa3eb7a24f81c6ad11e24f48671 | 1,069 | class RubyBuild < Formula
desc "Install various Ruby versions and implementations"
homepage "https://github.com/rbenv/ruby-build"
url "https://github.com/rbenv/ruby-build/archive/v20210119.tar.gz"
sha256 "5c49a0b46a471f8f6a176a56637ded1a09c7a583fa02451ae8a93ad5ced772c1"
license "MIT"
head "https://github.co... | 28.891892 | 110 | 0.710945 |
ab4665317c83e23b4d3999de3b139f270f6f5818 | 4,039 | module Sinatra
module Sprockets
class AssetPaths
attr_reader :config
class AssetNotPrecompiledError < StandardError; end
def initialize(config)
@config = config
end
def asset_for(source, ext)
source = source.to_s
return nil if is_uri?(sour... | 30.832061 | 126 | 0.562763 |
ac58666e85da1722115e75a415f883240a611f56 | 319 | Given(/^the following YouTube channels exist for the site "(.*?)":$/) do |site_name, table|
site = Affiliate.find_by_name(site_name)
table.hashes.each do |hash|
profile = YoutubeProfile.where(hash).first_or_initialize
profile.save!
site.youtube_profiles << profile
end
site.enable_video_govbox!
end
| 31.9 | 91 | 0.733542 |
e84af04dbc8bbaaee84d824d91c0723453dc000c | 6,375 | require "rails_helper"
describe "Event", type: :feature do
describe "index page" do
it "should link to the show page when an event title is clicked" do
event = FactoryGirl.create :event
visit events_path
click_link event.name
expect(page).to have_current_path(event_path(event))
end
... | 38.636364 | 94 | 0.693804 |
6a7fb3dcbdec7eacb065bda67a5f390d27f01d72 | 654 | class MobilityStringTranslation < ApplicationRecord
belongs_to :translatable, polymorphic: true
belongs_to :created_by, class_name: "User", optional: true
validates :locale, presence: true
validates :key, presence: true
validates :value, presence: true
validates :translatable_id, uniqueness: { scope: [... | 38.470588 | 115 | 0.70948 |
b952e1db109ec627be9ec02d97e60ed5e716aca1 | 1,090 | require "rack"
require "spec_helper"
require "raptor"
describe Raptor::Route do
let(:injector) { Raptor::Injector.new }
it "errors if redirect target doesn't exist"
it "can render text" do
app = Raptor::App.new(Object) {}
route = Raptor::BuildsRoutes.new(app).root(:text => "the text")
req = request... | 25.348837 | 88 | 0.685321 |
019cce88c6ce3973271b8ee71527d2f61d3cb018 | 2,369 | ##
# $Id: trendmicro_serverprotect_earthagent.rb 9179 2010-04-30 08:40:19Z jduck $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http:... | 28.202381 | 121 | 0.604897 |
ffd52dc857f47ccffaffbb69aed2f1295e734b07 | 1,156 | require 'spec_helper'
module Atlas
module Parser
module TextToHash
describe MultiLineBlock do
context 'with a correctly formatted block' do
let(:block) do
MultiLineBlock.new([
Line.new("~ demand ="),
Line.new(" SUM("),
Line.new(" 1... | 24.083333 | 70 | 0.446367 |
e21b8c80b738e403f4c0af7c82aca74d057ad20a | 542 | class CreateItemsQuestions < ActiveRecord::Migration
def self.up
create_table :items_questions do |t|
t.integer :item_id, :null => false
t.integer :question_id, :null => false
t.integer :position, :default => 1400, :null => false
t.integer :wins, :default => 0, :null => false
t.integ... | 27.1 | 59 | 0.662362 |
bb6daae872f1111610e73acf6d6e094a0eeec56e | 856 | require 'spec_helper'
describe 'rundeck::config::securityroles', type: :define do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
os_facts.merge(
serialnumber: 0,
rundeck_version: ''
)
end
describe 'with array parameters' do
... | 25.939394 | 141 | 0.556075 |
ab8df64abebc20da43e9231ad5a4e4b32aaef5aa | 15,870 | class PhpAT72 < Formula
desc "General-purpose scripting language"
homepage "https://www.php.net/"
# Should only be updated if the new version is announced on the homepage, https://www.php.net/
url "https://www.php.net/distributions/php-7.2.31.tar.xz"
mirror "https://fossies.org/linux/www/php-7.2.31.tar.xz"
... | 32.520492 | 113 | 0.624575 |
26fc7da8d9d8ff0269ab4cc09584a5fff2115560 | 4,979 | # encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require_relative '../rest/resource'
require_relative '../mixins/data_property_reader'
require_relat... | 27.815642 | 142 | 0.615385 |
f73eb9a1a2b3f842ef1a037ba665698c97aad5ef | 692 | FactoryGirl.define do
factory :restaurant_partial, class: "Restaurant" do
active true
status :new_account #AccountStatus::NewAccount.new.text # AccountStatuses::NewAccount
brief "is a newly signed up account. They say it gets busy. Let us know how it goes!"
unedited true
after(:build) do |f|
... | 43.25 | 100 | 0.725434 |
79b53e27ae3c4e0768efd9f3f2e5ec1562fab02b | 1,581 | # -*- ruby -*-
# encoding: utf-8
require File.expand_path("lib/google/cloud/os_login/v1/version", __dir__)
Gem::Specification.new do |gem|
gem.name = "google-cloud-os_login-v1"
gem.version = Google::Cloud::OsLogin::V1::VERSION
gem.authors = ["Google LLC"]
gem.email = "googleapis-... | 43.916667 | 301 | 0.664137 |
f8aeca8a7231cf7d10f767a39a36d7bfa3b8ff7e | 3,461 | ##
# 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 = GreatRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::Seh
def initialize(info = {... | 27.039063 | 102 | 0.56631 |
1dd6dd5d3f4dd8911c623499421992b8ce04d7ab | 241 | class AddActivateionToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :activation_digest, :string
add_column :users, :activated, :boolean, default: false
add_column :users, :activated_at, :datetime
end
end
| 30.125 | 59 | 0.746888 |
014a5d30df4fdcf034492bd99092b4ed580a16bb | 68 | class DealershipVehiclesController < ApplicationController
end
| 17 | 58 | 0.838235 |
ffd67bbc64023dbf6f33f485b74d1b3fc551fa16 | 315 | # Needed to import datamapper and other gems
require 'rubygems'
require 'pathname'
# Add all external dependencies for the plugin here
gem 'dm-core', '0.10.0'
require 'dm-core'
dir = Pathname(__FILE__).dirname.expand_path / 'dm-querizer'
require dir / 'querizer'
require dir / 'model'
require dir / 'collection'
| 22.5 | 60 | 0.742857 |
21f10bb5bdeea3da28091a929f098808bb41baf8 | 1,566 | # ActsAsSlugged
#
# This module automatically generates slugs based on the :to_s field using a before_validation filter
#
# Mark your model with 'acts_as_sluggable' make sure you have a string field :slug
module ActsAsSlugged
extend ActiveSupport::Concern
module ActiveRecord
def acts_as_slugged(options = nil)... | 23.727273 | 157 | 0.671775 |
335fb757c2039b4a66e29cdfd161175f18cb639d | 1,514 | # frozen_string_literal: true
# Allows reviewers to specify agreement variables for resubmission.
class Reviewer::AgreementVariablesController < ApplicationController
before_action :authenticate_user!
before_action :find_editable_data_request_or_redirect
before_action :find_agreement_variable_or_redirect, only: ... | 36.047619 | 117 | 0.742404 |
91ca08a9ceb6926fd992617d82f1e38d92f7990f | 259 | class CreatePicture < ActiveRecord::Migration
def change
create_table :pictures do |t|
t.timestamps
t.string :name, null: false
t.text :description
t.datetime :date
t.integer :monument_id, null: false
end
end
end
| 21.583333 | 45 | 0.648649 |
33eb747d7f8da7e3767bd3ac03ef3c3ca5d25039 | 2,783 | # 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.53211 | 77 | 0.727273 |
01dfc4ea893bb8a83108bf73f6e291e3293d6b80 | 19,980 | module ModelClass
require 'stringio'
include OrientSupport::Support
########### CLASS FUNCTIONS ######### SELF ####
######## INITIALIZE A RECORD FROM A CLASS ########
=begin
NamingConvention provides a translation from database-names to class-names.
It can be overwritten to provide different conventions for ... | 30.364742 | 147 | 0.670871 |
bb50ce58658ccf310fdc73192d16db73a362ca64 | 1,294 | # -*- encoding: utf-8 -*-
# stub: jekyll-theme-leap-day 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-theme-leap-day".freeze
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.a... | 36.971429 | 112 | 0.661515 |
e989283cc3dc76d650c360e2f65f63d219e45fd1 | 565 | require 'spec_helper'
describe 'Private zone' do
let(:private_domain_name) { vars.private_domain_name }
subject { route53_hosted_zone("#{private_domain_name}.") }
it { should exist }
it 'outputs the zone id' do
expect(subject.id).to(include(output_for(:harness, 'private_zone_id')))
end
it 'outputs ... | 24.565217 | 75 | 0.679646 |
91bb64b75fa0522623c0b97a10bdb55fddc915bc | 3,844 | And(/^I wait to see Droplet text mode$/) do
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until {@browser.execute_script("return parseInt($('.droplet-ace').css('left')) > 0;")}
end
And(/^I wait to see Droplet block mode$/) do
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until {@browser.execu... | 33.719298 | 120 | 0.668054 |
014c556c2b1391bee28ae84e9b16163cd6557bcd | 751 | Rails.application.routes.draw do
mount Rswag::Ui::Engine => '/api-docs'
mount Rswag::Api::Engine => '/api-docs'
devise_for :users
root "users#index"
resources :users, only: [:index, :show] do
resources :posts, only: [:index, :show, :destroy] do
resources :comments, only: [:create, :destroy]
re... | 30.04 | 56 | 0.617843 |
39b1a8b274499c32ca02afd2e503d73ce01bb0c4 | 2,139 | class Libsvm < Formula
desc "Library for support vector machines"
homepage "https://www.csie.ntu.edu.tw/~cjlin/libsvm/"
# Upstream deletes old downloads, so we need to mirror it ourselves
url "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.24.tar.gz"
mirror "https://dl.bintray.com/homebrew/mirror/libsvm-... | 36.254237 | 94 | 0.684432 |
2822914265d760360b50121e591d990d557920f3 | 1,134 | module Intrigue
module Issue
class VulnerableWebminInstall < BaseIssue
def self.generate(instance_details={})
{
name: "vulnerability_webmin_cve_2019_15107",
pretty_name: "Vulnerable Webmin Password Reset (CVE-2019-15107)",
identifiers: [
{ type: "CVE", name: "CVE-2019-... | 35.4375 | 301 | 0.641975 |
e25f7f8d02645fe547d826540933ba91029fe6d7 | 395 | cask :v1 => 'the-unarchiver' do
version '3.9.1'
sha256 '4911c332df7f4bb23877652700e845fe097b793ae37450948319398009e923a3'
# googlecode.com is the official download host per the vendor homepage
url "https://theunarchiver.googlecode.com/files/TheUnarchiver#{version}_legacy.zip"
name 'The Unarchiver'
homepage... | 30.384615 | 85 | 0.767089 |
082b77772f7368d86c356c91299aef46a6ff6aae | 363 | require "bundler/setup"
require "top/ico"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rsp... | 24.2 | 66 | 0.749311 |
edc00f7bde5498705a2d5ec5668fbb77c70cfab9 | 3,972 | require 'base64'
require 'bcrypt'
require 'cgi'
require 'digest/sha1'
require 'json'
require 'logger'
require 'rack'
begin
require 'securerandom'
rescue LoadError
end
module Songkick
module OAuth2
ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
TOKEN_SIZE = 160
autoload :Model, ROOT + '/oaut... | 28.992701 | 72 | 0.611531 |
016f263c75f5e64f4fe4ed40708759c5cc360d3e | 205 | require File.dirname(__FILE__) + '/../test_helper'
class UserTest < ActiveSupport::TestCase
def test_create
User.create(:username => 'tuxedo', :name => 'Mr. Tuxedo', :password =>'cat')
end
end
| 22.777778 | 80 | 0.673171 |
1c73081e7abe1473c60b7454a8e4c85dafb72e32 | 4,336 | RSpec.shared_examples 'a bucket' do |features|
features ||= {}
before do
subject.write '/a/b.txt', 'TESTDATA-b'
subject.write 'a/b/c.txt', 'TESTDATA-c',
content_type: 'text/plain',
metadata: { 'meta-KEY' => 'VaLuE' }
subject.write 'a/b/c/d.txt', 'TESTDATA-d'
subj... | 28.526316 | 90 | 0.604935 |
38f3f65767501491592b4acbd5265a20d7833193 | 7,464 | #!/usr/bin/env ruby
# Copyright (c) 2004-2020 Microchip Technology Inc. and its subsidiaries.
# SPDX-License-Identifier: MIT
require_relative 'libeasy/et'
require_relative 'libeasy/utils'
$ts = get_test_setup("mesa_pc_b2b_4x")
#---------- Capabilities -----------------------------------------------------
cap_check_... | 27.240876 | 91 | 0.456994 |
79e5c3b1fae948ff440283c50c552afc52029b33 | 918 | require 'rails_helper'
describe "When I visit the measurement_type New page" do
let(:user) { create(:user, role: "admin") }
before do
sign_in user
end
it "Then I see the measurement_type form" do
visit new_measurement_type_path
expect(page).to have_content("New Measurement Type")
expect(page... | 23.538462 | 78 | 0.691721 |
5d4410e4c0f411c6c83b689999697bf7d29e7d41 | 1,107 | ##########################################################################
# Copyright 2016 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | 38.172414 | 112 | 0.65673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.