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 |
|---|---|---|---|---|---|
18f9ba4bdb05be0c35e435235383ee825e36f00b | 63 | module Railcart
module Rails
VERSION = "0.1.0"
end
end
| 10.5 | 21 | 0.650794 |
e862e74fed792e13dd425a334427a3fc0ba15cc4 | 186 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'ruby_minitest_analyzer'
require 'minitest/autorun'
require 'pry'
require 'mocha/minitest'
| 20.666667 | 54 | 0.790323 |
39f1d5967dcbb74e4840db2990573414feb23e19 | 227 | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
# Initialize default meta tags.
DEFAULT_META = YAML.load_file(Rails.root.join('config/meta.yml'))
| 25.222222 | 65 | 0.797357 |
6a25f2c63cb77da9a3f076a3ff5e78b7c14a149a | 6,501 | # frozen_string_literal: true
begin
require "datadog/statsd"
rescue LoadError
$stderr.puts "In order to report Kafka client metrics to Datadog you need to install the `dogstatsd-ruby` gem."
raise
end
require "active_support/subscriber"
module Racecar
module Datadog
STATSD_NAMESPACE = "racecar"
class... | 26.21371 | 113 | 0.602061 |
1179b2ad0756b096d0c3217414e4a5deb18959ed | 113 | # encoding: UTF-8
require 'spec_helper'
describe CloudModel::Monitoring::Services::NginxChecks do
pending
end | 16.142857 | 57 | 0.787611 |
7a92c98b94e21266b2e27faa5aa8fdb23eb8f489 | 304 | # frozen_string_literal: true
require 'test_helper'
class VerificationsControllerTest < ActionController::TestCase
def test_show
subscription = subscriptions(:avery)
get :show, params: { subscription_id: subscription.id }
subscription.reload
assert subscription.validated?
end
end
| 21.714286 | 62 | 0.769737 |
03fa7cc9404c9c26d60b688e2a1ae4e676e28022 | 948 | Pod::Spec.new do |s|
s.name = "DataEyeGameAnalysis"
s.version = "2.7.5"
s.summary = "DataEye game analysis SDK of iOS platform. Please use the new version as far as possible, the new version is at https://github.com/DataEye/DataEyeGameAnalysis."
s.description = <<-DESC
This pr... | 41.217391 | 184 | 0.622363 |
210ea0e467fab88b2a37d78798afdbdb41942186 | 310 | cask 'supersync' do
version '7.0.5'
sha256 '188a60ae85f0dc2d8df633dfb95241a65f163dd3b370c883f7f3366ad748d4f7'
url "https://supersync.com/downloads/SuperSync_#{version}.dmg"
appcast 'https://supersync.com/downloads.php'
name 'SuperSync'
homepage 'https://supersync.com/'
app 'SuperSync.app'
end
| 25.833333 | 75 | 0.76129 |
f8ce80927394cbde64c56aeb64f309364cc16889 | 8,304 | require 'rails_helper'
describe Post do
let(:post) { FactoryGirl.create(:post) }
let(:valid_title) { 'today-i-learned-about-clojure' }
it 'should have a valid factory' do
expect(post).to be_valid
end
it 'should require a body' do
post.body = ''
expect(post).to_not be_valid
end
it 'should h... | 28.634483 | 121 | 0.647881 |
f71ac22dfee4ec66657a52f30a5fa4b4bbb5895c | 3,561 | require 'factory_girl'
FactoryGirl.define do
factory :alchemy_dummy_user, class: 'DummyUser' do
sequence(:email) { |n| "john.#{n}@doe.com" }
password 's3cr3t'
alchemy_roles ['member']
trait :as_admin do
alchemy_roles ['admin']
end
trait :as_author do
alchemy_roles ['author']
... | 24.060811 | 108 | 0.651502 |
e802626a0ac244b385b6362c4783cbc1b8e96ee5 | 2,063 | # NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
require 'annotate'
task :set_annotation_options do
# You can overrid... | 34.383333 | 79 | 0.594765 |
bb211c12ac0fbee72223d5e6968b5fbcc8859a9f | 1,892 | test_name 'C3448 - checkout a tag (http protocol)'
# Globals
repo_name = 'testrepo_tag_checkout'
tag = '0.0.2'
hosts.each do |host|
ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby'
tmpdir = host.tmpdir('vcsrepo')
step 'setup - create repo' do
install_package(host, 'git')
my_root = File.expand_pa... | 29.5625 | 120 | 0.616808 |
08505ae8be54802710212f59abdb34098a90e0b0 | 2,219 | class TicTacToe
autoload :Printer, "tic_tac_toe/printer"
autoload :Game, "tic_tac_toe/game"
autoload :RandomPlayer, "tic_tac_toe/random_player"
autoload :ConsolePlayer, "tic_tac_toe/console_player"
autoload :MonteCarloPlayer, "tic_tac_toe/monte_carlo_player"
autoload :GrpcPlayer, "tic_tac_toe/grpc_player"
... | 18.491667 | 65 | 0.588103 |
1d7e698c49a37eac90af7510ac7a1a6aa0526637 | 377 | #! /usr/local/bin/ruby
require 'deduction.rb'
ded = CDeduction.new
buf = $mysql.query("select id from relation_node order by id desc limit 1;")
id = -1
id = ARGV[0].to_i if( ARGV[0] != nil )
if( id > 0 )
ded.read(id)
ded.printRel( 2 )
else
(buf.fetch_hash['id'].to_i - 1).times do |i|
ded.read(i + 1)
... | 15.708333 | 76 | 0.612732 |
e82b94a378989795e344029ecc282276bef488a4 | 1,505 | module Monitr
module Configurable
# Override this method in your Configurable (optional)
#
# Called once after the Configurable has been sent to the block and attributes have been
# set. Do any post-processing on attributes here
def prepare
end
def reset
end
... | 26.403509 | 112 | 0.613289 |
87e8abaf8507a2cb675309f40104acbcdaeb84b2 | 1,328 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 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, which is a fork of ... | 39.058824 | 91 | 0.765813 |
116f003777d99098c99f530198d89c83ee740c84 | 1,911 | class UsersController < ApplicationController
skip_before_action :authorized, only: %i[new create]
def index
User.who_to_follow_offset = 0
User.current_user = current_user
@posts = current_user.all_the_posts_for_timeline
@who_to_follow = current_user.who_to_follow
end
def new
redirect_to r... | 26.178082 | 103 | 0.69911 |
bb78078cb8da76b13b3ebf58753ec077f5b5a7fd | 502 | RSpec.shared_context "yammer GET" do |endpoint|
let(:request_url) { "https://www.yammer.com/api/v1/#{endpoint}" }
let!(:mock) {
stub_request(:get, request_url).with(
# See https://github.com/bblimke/webmock/issues/693
query: hash_including({}),
headers: {
'Authorization' => 'Bearer sha... | 25.1 | 67 | 0.583665 |
edcf3f315a95d722336c56781d9ac7a897c815d3 | 1,162 | # frozen_string_literal: true
# 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
Gem::Specification.new do |spec|
spec.name = "aws-sdk-athena"
spec.... | 36.3125 | 107 | 0.662651 |
1d7099ba44389006fb5017d54e2a6a23fc7df705 | 29,704 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Login' do
include TermsHelper
include UserLoginHelper
before do
stub_authentication_activity_metrics(debug: true)
end
describe 'password reset token after successful sign in' do
it 'invalidates password reset token' do
expec... | 32.641758 | 275 | 0.657151 |
ffce350a2bcdd5cc830046d74bef1554c5313f62 | 5,164 | shared_examples_for 'check' do
include_examples 'component'
module Format
include Arachni::Element::Capabilities::Mutable::Format
end
module Element
include Arachni::Element
end
module Severity
include Arachni::Severity
end
before( :all ) do
@issues = ... | 25.949749 | 87 | 0.562355 |
accca9e1aa491e9be4f577def88a9ebee071820b | 70 | require 'test/unit'
class LocalizameTest < Test::Unit::TestCase
end
| 11.666667 | 43 | 0.757143 |
1d5a582a44681c32c9661863482dab89deae0bfb | 10,628 | # encoding: UTF-8
# This file contains data derived from the IANA Time Zone Database
# (http://www.iana.org/time-zones).
module TZInfo
module Data
module Definitions
module America
module Pangnirtung
include TimezoneDefinition
timezone 'America/Pangnirtung' do |tz|
... | 51.342995 | 66 | 0.575461 |
7907b8d9c9078119bbea3f5fa9300c59a516710f | 1,191 | =begin
#Selling Partner API for Authorization
#The Selling Partner API for Authorization helps developers manage authorizations and check the specific permissions associated with a given authorization.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: ... | 29.04878 | 155 | 0.7733 |
e89921520fdf5c04f8c1822f37c47d1c1270b6aa | 5,910 | require 'spec_helper'
describe Admin::FoldersController do
describe '#create' do
describe 'as admin' do
it 'allows to add folder for any account' do
account = create(:account)
sign_in(create(:user, :admin), scope: :user)
expect do
post :create, params: {folder: attribute... | 33.202247 | 92 | 0.620812 |
219656818ffa5cf00a13189270bfe453ea89a7fd | 2,199 | # Copyright 2015 Google Inc. All rights reserved.
#
# 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... | 31.414286 | 84 | 0.652569 |
6ae55176032ec3ba4950cb6b173c056de8d48f0a | 459 | module UnpackStrategy
class Gzip
include UnpackStrategy
def self.can_extract?(path:, magic_number:)
magic_number.match?(/\A\037\213/n)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ?... | 24.157895 | 75 | 0.627451 |
e2e96bf4c7db509f265b02eaf2a1c1707a1613c4 | 2,468 | require 'active_record'
require 'simple_states'
require 'travis/model/encrypted_column'
# Models an incoming request. The only supported source for requests currently is Github.
#
# The Request will be configured by fetching `.travis.yml` from the Github API
# and needs to be approved based on the configuration. Once ... | 21.840708 | 145 | 0.708266 |
1c848ed3870f0f225b3ec12aa1418d84d793ed08 | 608 | module Carto
module Dbdirect
class MetadataManager
def initialize(config, metadata_server)
@config = config
@metadata = metadata_server
end
attr_reader :config
def save(key, ip_set = [])
@metadata.HSET(config['prefix_namespace'] + key, config['hash_key'], ip_set.j... | 22.518519 | 94 | 0.595395 |
b9269f175cc2411b05353e71a5d78c74e1b54712 | 28,318 | # frozen_string_literal: true
require 'stringio'
require 'puma/thread_pool'
require 'puma/const'
require 'puma/events'
require 'puma/null_io'
require 'puma/compat'
require 'puma/reactor'
require 'puma/client'
require 'puma/binder'
require 'puma/delegation'
require 'puma/accept_nonblock'
require 'puma/util'
require '... | 27.386847 | 109 | 0.58394 |
ed0a95704046a455fa0e9638e4c5f17061bbada6 | 1,033 | require "language/node"
class BalenaCli < Formula
desc "The official balena CLI tool"
homepage "https://www.balena.io/docs/reference/cli/"
# balena-cli should only be updated every 10 releases on multiples of 10
url "https://registry.npmjs.org/balena-cli/-/balena-cli-12.7.0.tgz"
sha256 "f48464426b086a5e0eb38... | 35.62069 | 114 | 0.762827 |
fffbc805335e39fb20302342fadb94db21c547fa | 902 | require 'spec_helper'
describe Import::FogbugzController do
include ImportSpecHelper
let(:user) { create(:user) }
before do
sign_in(user)
end
describe 'GET status' do
before do
@repo = OpenStruct.new(name: 'vim')
stub_client(valid?: true)
end
it 'assigns variables' do
@p... | 23.128205 | 106 | 0.650776 |
1c1921b8e69d69f61a10c06d0c2d0641075a6299 | 10,222 | # frozen-string-literal: true
Sequel::JDBC.load_driver('org.apache.derby.jdbc.EmbeddedDriver', :Derby)
require_relative 'transactions'
module Sequel
module JDBC
Sequel.synchronize do
DATABASE_SETUP[:derby] = proc do |db|
db.extend(Sequel::JDBC::Derby::DatabaseMethods)
db.dataset_class = Se... | 32.868167 | 172 | 0.575426 |
e2c732c6838eef1f7b42b56b9fa4d8a6eecadbdf | 701 | Pod::Spec.new do |spec|
spec.name = 'CETableViewBindingHelper'
spec.version = '1.0.0'
spec.license = {
:type => 'MIT',
:file => 'MIT-LICENSE.txt'
}
spec.homepage = 'https://github.com/Advanced-Jewish-Technologies/CETableViewBinding'
spec.authors = {
'Dark Satyr' => 'i... | 31.863636 | 102 | 0.610556 |
f7423b8ca65e7db7416538db5cd32687c34838dc | 3,849 | # ****************************************************************************
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you ... | 24.673077 | 97 | 0.708756 |
18ac151d570c0d32933eb7841d991baf1434043e | 1,003 | # frozen_string_literal: true
module Doorkeeper
class AccessGrant < ActiveRecord::Base
belongs_to :resource, polymorphic: true
self.table_name = "#{table_name_prefix}oauth_access_grants#{table_name_suffix}".to_sym
include AccessGrantMixin
include ActiveModel::MassAssignmentSecurity if defined?(::Pro... | 26.394737 | 92 | 0.720837 |
e238466e60eba41a9fbb60e83f2a446907cc2a06 | 387 | class CreateLicenses < ActiveRecord::Migration
def change
create_table :licenses do |t|
t.integer :profile_id
t.string :license_type
t.string :unit
t.string :title
t.date :publish_at
t.text :source
t.string :source_link
t.text :origin_desc
t.text :memo
t... | 21.5 | 46 | 0.640827 |
874b60cc754a1c70f1333c79929f02b5594dcf52 | 717 | module Rucc
class Parser
module Goto
private
# @return [Node]
def read_goto_stmt
if next_token?('*')
# [GNU] computed goto. "goto *p" jumps to the address pointed by p.
tok = peek
expr = read_cast_expr
if expr.ty.kind != Kind::PTR
Util.... | 23.9 | 84 | 0.521618 |
4ac921e224b0de7e9027d2f612684d8467362f8e | 39 | module Reports::BasicDetailsHelper
end
| 13 | 34 | 0.871795 |
4ada5d1d2e73945d899fca4b9570648722052991 | 492 | # frozen_string_literal: true
RSpec.describe "copy_static_files", type: :rake do
before do
subject.execute
end
after(:all) do
cleanup
end
it "has the correct name" do
expect(subject.name).to eq("copy_static_files")
end
it "copy network security config xml " do
expect(File.open("rake/st... | 21.391304 | 94 | 0.721545 |
6a168e6f3031dba7dcbf5a3f31909f372f47395d | 267 | module EbayTrading # :nodoc:
module Types # :nodoc:
class SellerDashboardAlertSeverityCode
extend Enumerable
extend Enumeration
Informational = 'Informational'
Warning = 'Warning'
StrongWarning = 'StrongWarning'
end
end
end
| 20.538462 | 42 | 0.685393 |
1d8f0818a651040d19e54ca1a0c2e05a1faa92c8 | 5,446 | # encoding: UTF-8
require 'securerandom'
module Server
module Helpers
#
# ChefServer Module
#
# This module provides helpers related to the Chef Server Component
module ChefServer
module_function
# Password of the Provisioning User
# Generate or load the password of the provis... | 33.826087 | 112 | 0.641572 |
bf5de704a7f50061fe88b981f9d21b8ccf34ad2d | 783 | class ManageIQ::Providers::Microsoft::InfraManager::Vm < ManageIQ::Providers::InfraManager::Vm
include_concern 'ManageIQ::Providers::Microsoft::InfraManager::VmOrTemplateShared'
POWER_STATES = {
"Running" => "on",
"Paused" => "suspended",
"Saved" => "suspended",
"PowerOff" => "off",
}.freez... | 20.605263 | 94 | 0.675607 |
3347a55583c861879eb8479abad607c17e5be3d4 | 4,020 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2017 the original author or 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/... | 35.263158 | 118 | 0.670647 |
ff44a235ea5993c09552a385bff9c58086db4c11 | 5,162 | # frozen_string_literal: true
require 'spec_helper'
require_dependency 'active_model'
RSpec.describe ::Gitlab::Ci::Config::Entry::Product::Matrix do
subject(:matrix) { described_class.new(config) }
describe 'validations' do
before do
matrix.compose!
end
context 'when entry config value is corr... | 23.463636 | 94 | 0.506974 |
6ac6b360d08143c85e6a2f26c26f215fba3d713f | 4,197 | class Event::Page::CsvImporter
include Cms::CsvImportBase
self.required_headers = [ Event::Page.t(:filename) ]
attr_reader :site, :node, :user
def initialize(site, node, user)
@site = site
@node = node
@user = user
end
def import(file, opts = {})
@task = opts[:task]
put_log("import s... | 26.732484 | 106 | 0.641172 |
1a4eb9e8b0fe77ab01e043487f89dbf4c4f1af44 | 1,315 | # Loads a binary file from a module or file system and returns its contents as a `Binary`.
# The argument to this function should be a `<MODULE NAME>/<FILE>`
# reference, which will load `<FILE>` from a module's `files`
# directory. (For example, the reference `mysql/mysqltuner.pl` will load the
# file `<MODULES DIRECT... | 39.848485 | 141 | 0.735361 |
1ae7344ed2be94f9fd93e5cbc90b444e1b1c617b | 315 | require 'rails_helper'
RSpec.describe Water, type: :model do
describe 'associations' do
it { should belong_to(:user) }
end
describe 'validations' do
it { should validate_presence_of(:amount) }
it { should validate_presence_of(:user_id) }
it { should validate_presence_of(:total) }
end
end
| 22.5 | 48 | 0.707937 |
b9904eb446b55949235f01c6c78f19670d0805d8 | 5,542 | # frozen_string_literal: true
require 'spec_helper'
module Thredded
describe NotifyFollowingUsers do
describe '#targeted_users' do
subject(:targeted_users) { NotifyFollowingUsers.new(post).targeted_users(notifier) }
let(:post) { create(:post, user: poster, postable: topic) }
let(:poster) { cr... | 33.587879 | 110 | 0.624323 |
1ca2c0fa1cc63b7cf0a9556bf56840cb56500c1d | 8,067 | # frozen_string_literal: true
require 'appium_lib'
require_relative '../test_helper'
require_relative '../../lib/maze/capabilities'
require_relative '../../lib/maze/driver/appium'
require_relative '../../lib/maze/driver/resilient_appium'
require_relative '../../lib/maze/hooks/appium_hooks'
class AppiumHooksTest < Tes... | 36.174888 | 112 | 0.719598 |
1de3180473f05d6bf0b911ccfbd83e14f96b6ee7 | 20,341 | # NOTE: When updating Wine, please make sure to match Wine-Gecko and Wine-Mono
# versions:
# - https://wiki.winehq.org/Gecko
# - https://wiki.winehq.org/Mono
# with `GECKO_VERSION` and `MONO_VERSION`, as in:
# https://source.winehq.org/git/wine.git/blob/refs/tags/wine-3.0:/dlls/appwiz.cpl/addons.c
class Wine < For... | 39.497087 | 229 | 0.582567 |
bf67aa21a0650d17ef79416d810f35bfac7224a4 | 338 | module Bosh::Director
module Api
class BackupManager
attr_accessor :destination_path
def initialize
@destination_path = '/var/vcap/store/director/backup.tgz'
end
def create_backup(user)
JobQueue.new.enqueue(user, Jobs::Backup, 'bosh backup', [destination_path])
end
... | 21.125 | 83 | 0.66568 |
e8626b7f8fd9cf9a91bb2399fcf5eb8fc9b7e713 | 3,051 | class Cms::Node
include Cms::Model::Node
include Cms::PluginRepository
include Cms::Addon::NodeSetting
include Cms::Addon::EditorSetting
include Cms::Addon::GroupPermission
include Cms::Addon::NodeAutoPostSetting
include Cms::Addon::ForMemberNode
index({ site_id: 1, filename: 1 }, { unique: true })
... | 27 | 78 | 0.678466 |
f8b4c03d4de979f5aa1157475a9a17106c089e2f | 595 | require 'test_helper'
class SessionsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should login" do
jarvis = users(:one)
post :create, name: jarvis.name, password: 'secret'
assert_redirected_to admin_url
assert_equal jarvi... | 21.25 | 57 | 0.710924 |
bff6fe93268fef00554534ffd9d2ce1a2e521357 | 9,124 | =begin
#SCORM Cloud Rest API
#REST API used for SCORM Cloud integrations.
OpenAPI spec version: 2.0 beta
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.3
=end
require 'date'
module RusticiSoftwareCloudV2
class CreateRegistrationSchema
attr_accessor :course_id
... | 31.680556 | 191 | 0.636234 |
e98fa9d9ea240c5a578c28aea8260be1493c5a0c | 4,885 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = GreatRanking
include Msf::Exploit::Remote::SMB::Client
include Msf::Exploit::Brute
def initialize(info = {})
super... | 31.720779 | 103 | 0.555169 |
03eb7568b991079489e7e10181f4c51c673dd0f7 | 367 | module Pageflow
class UserMailer < ActionMailer::Base
def invitation(options)
@user = options[:user]
@password_token = options[:password_token]
I18n.with_locale(@user.locale) do
headers('X-Language' => I18n.locale)
mail(to: @user.email, subject: t('.subject'), from: Pageflow.con... | 26.214286 | 90 | 0.656676 |
08db2575bef2599c9317abff9af528afb1c46e4d | 364 | class CreateBudgets < ActiveRecord::Migration
def change
create_table :budgets do |t|
t.references :user, index: true, null: false
t.references :category, index: true, null: false
t.references :currency, index: true, null: false
t.decimal :limit, null: false, precision: 10, scale: 2
... | 28 | 60 | 0.673077 |
79eedd6182fcd6b63b5cba29642088efdf767447 | 2,451 | cask 'firefox-esr' do
version '60.1.0'
language 'cs' do
sha256 '8fd11e84e2a13b905709b48551348ddaaa65d39c0f1e0fbc925ef9600225bf78'
'cs'
end
language 'de' do
sha256 '769db2010a2a92b3f9d2e64925768e7dd400ecdf7d99c4d788ab7ac016ea1a54'
'de'
end
language 'en-GB' do
sha256 '893dda71ed99782a30... | 25.268041 | 129 | 0.72501 |
bfaecdb65818d11b62ae8b60b4516d1ebebf0acd | 3,423 | # frozen_string_literal: true
class BaseMailer < ActionMailer::Base
self.mailer_name = "base_mailer"
default to: "system@test.lindsaar.net",
from: "jose@test.plataformatec.com",
reply_to: "mikel@test.lindsaar.net"
def welcome(hash = {})
headers["X-SPAM"] = "Not SPAM"
mail({ subject:... | 24.625899 | 89 | 0.654105 |
284640ee547b89db665ca98b1d840455c3f06157 | 962 | require "conjoin/version"
require "dominate/inflectors"
# require "conjoin/recursive_ostruct"
require "conjoin/middleware"
require "conjoin/env_string"
require "conjoin/class_methods"
require "conjoin/cuba"
require "conjoin/seeds"
module Conjoin
extend ClassMethods
autoload :ActiveRecord, "conjoin/active_record"
... | 31.032258 | 49 | 0.698545 |
f858d52e7519597876d3f50eb129a9685d235889 | 1,296 | module Swagger
module V1
module Resources
module Apress
module AmazonAssets
class AssetsController < ::Apress::Documentation::Swagger::Schema
swagger_path('/asssets/{id}') do
operation :get do
key :produces, ['application/json']
ke... | 29.454545 | 86 | 0.449846 |
d57c9e56f5673b9d42609df9cf2334d5de35f7c2 | 1,086 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'materialistic/version'
Gem::Specification.new do |spec|
spec.name = "materialistic"
spec.version = Materialistic::VERSION
spec.authors = ["Yasuaki Uechi"]
spec.email ... | 37.448276 | 81 | 0.694291 |
e8c346b3d97dbc066f432bcd20b2461d3aaee2e7 | 401 | require 'spec_helper'
module GPhoto2
describe Port do
before do
allow_any_instance_of(Port).to receive(:new)
end
describe '#info=' do
let(:port) { Port.new }
before do
allow(port).to receive(:set_info)
end
it 'returns the input value' do
info = double(:por... | 17.434783 | 50 | 0.59601 |
61d93b809e504568fe3712dcef3853ce1133179e | 1,608 | #!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'binary'
class BinaryTest < Minitest::Test
def test_binary_0_is_decimal_0
assert_equal 0, Binary.new('0').to_decimal
end
def test_binary_1_is_decimal_1
assert_equal 1, Binary.new('1').to_decimal
end
def test_... | 25.52381 | 73 | 0.745647 |
386bd023ea25e5baeefc793533d1865b03566c6e | 1,318 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'chloride/version'
Gem::Specification.new do |spec|
spec.name = 'chloride'
spec.version = Chloride::VERSION
spec.authors = ['Brandon High', 'Eric Williamson', 'Nick Lewis']
spec.email ... | 37.657143 | 99 | 0.685888 |
d5d808eab72a4bd81821ed359ab48bbd2bb606cc | 1,479 | require_relative 'node'
class LinkedList
attr_reader :head
def initialize
@head = nil
end
# Time complexity - O(1)
# Space complexity - O(1)
def add_first(data)
if @head
new_node = Node.new(data, @head)
@head = new_node
else
@head = Node.new(data)
end
end
# Time com... | 16.617978 | 38 | 0.57336 |
625bd52d58a2e2838cf0705074840660f7693bf2 | 140 | module Wrxer
class CommentCollection
include Collection
xpath "item"
collection :comments, "//wp:comment", Comment
end
end
| 15.555556 | 49 | 0.707143 |
18a031b23b26c70a1cc170aa13ddb5a4f6c3b88e | 325 | class CreateProducts < ActiveRecord::Migration[5.2]
def change
create_table :products do |t|
t.string :title
t.text :description
t.decimal :price
t.decimal :size
t.boolean :is_spicy
t.boolean :is_veg
t.boolean :is_best_offer
t.string :path_to_image
t.timestamps
end
end... | 19.117647 | 51 | 0.670769 |
010bc39db455cd1c5c6c7ea4a7141c2f613d1675 | 4,219 | ActionController::Routing::Routes.draw do |map|
# Add your own custom routes here.
# The priority is based upon order of creation: first created -> highest priority.
# Here's a sample route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other... | 34.024194 | 84 | 0.546812 |
4a913adaf292282cee52409fa0cdf9cc6c75d22a | 288 | # frozen_string_literal: true
class CreateUserEvents < ActiveRecord::Migration[6.0]
def change
create_table :user_events do |t|
t.references :user, null: false, foreign_key: true
t.references :event, null: false, foreign_key: true
t.timestamps
end
end
end
| 22.153846 | 57 | 0.704861 |
6113b2c43943427a315d592f513801295cc82892 | 363 | require 'rubygems'
require 'midiator'
midi = MIDIator::Interface.new
midi.autodetect_driver
include MIDIator::Notes
C4MAJ = [ C4, E4, G4 ]
F4MAJII = [ C4, F4, A4 ]
G4MAJ = [ D4, G4, B4 ]
song = [ C3, C4MAJ, C3, C4MAJ, F3, F4MAJII, F3, F4MAJII, G3, G4MAJ, G3, G4MAJ, C5, C4MAJ, C2, C4MAJ]
4.times do
song.each do ... | 17.285714 | 100 | 0.652893 |
ff46ec7b8ee8de563fa798e4873fc21c959befd1 | 1,882 | require "sidekiq/web"
Rails.application.routes.draw do
root to: "projects#index"
# Sidekiq
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => "/sidekiq"
end
# ActionCable
mount ActionCable.server => "/cable"
# Auth
devise_for :users, controllers: { invitations: "users/invitatio... | 28.953846 | 113 | 0.63762 |
bf6b43efb90871587b9b2681069c3caca121df45 | 7,193 | # frozen_string_literal: true
require "dependabot/file_fetchers"
require "dependabot/file_fetchers/base"
require "dependabot/bundler/file_updater/lockfile_updater"
require "dependabot/errors"
module Dependabot
module Bundler
class FileFetcher < Dependabot::FileFetchers::Base
require "dependabot/bundler/fi... | 33.147465 | 97 | 0.633533 |
03df40879f1a6ad67a8a4518443ab18ff9319875 | 721 | # frozen_string_literal: true
require 'rails_helper'
describe Agent do
subject { build(:agent, :with_complete_metadata, aliases: [agent_alias]) }
let(:agent_alias) { build(:alias) }
describe '#given_name' do
its(:given_name) { is_expected.to eq('Johnny C.') }
end
describe '#sur_name' do
its(:sur_... | 21.205882 | 76 | 0.669903 |
3359087bfb0351b37ee1e53ec17111f4e93e4e45 | 607 | module Stripe
class Invoice < APIResource
include Stripe::APIOperations::List
include Stripe::APIOperations::Update
include Stripe::APIOperations::Create
def self.upcoming(params, api_key = nil)
response, api_key = Stripe.request(:get, upcoming_url, api_key, params)
Util.convert_to_stripe... | 21.678571 | 77 | 0.673806 |
ffcc1f2f02f29fdb846053ba6586fa068088c491 | 693 | require "m2config"
include M2Config
cfg = M2Config::Config.new
server = M2Config::Server.new
exComHost = M2Config::Host.new({matching:"example.com", name:"ex"})
pubDir = M2Config::Dir.new({base:"public/",default_ctype: "text/html"})
pubRoute = M2Config::Route.new( {path:"/", target:pubDir} )
appHand = ... | 33 | 74 | 0.626263 |
5d265420cd219978420169a580fdab543abae611 | 1,447 | class Liboil < Formula
desc "C library of simple functions optimized for various CPUs"
homepage "http://liboil.freedesktop.org/"
url "http://liboil.freedesktop.org/download/liboil-0.3.17.tar.gz"
sha256 "105f02079b0b50034c759db34b473ecb5704ffa20a5486b60a8b7698128bfc69"
bottle do
cellar :any
revision 1... | 32.155556 | 92 | 0.657913 |
1cf18fb57e67b86d44e5618ecafe5925babe8f1a | 8,791 | # frozen_string_literal: true
# This file was auto-generated by lib/tasks/api.rake
module Usps
module Api
module Endpoints
module CarrierPickupSchedule
# The Package Pickup Schedule API schedules a
# Package Pickup and provides the user a confirmation number for the scheduled
# pickup. Prior to maki... | 89.704082 | 485 | 0.747014 |
e89dfb49bfd2540672cb71e16667b5afbdf1e97c | 1,239 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'combine_pdf/version'
Gem::Specification.new do |spec|
spec.name = "combine_pdf"
spec.version = CombinePDF::VERSION
spec.authors = ["Boaz Segev"]
spec.email = ... | 44.25 | 243 | 0.677159 |
1cd2c74c58d189c8d0b4c13cdabd03ec56e88708 | 110 | <% module_namespacing do -%>
class <%= class_name.pluralize %>Controller < ResourcesController
end
<% end -%>
| 22 | 65 | 0.718182 |
01b2b83c06c1377383674cf4919341d32422d6c9 | 4,140 | # frozen_string_literal: true
module Meals
class MealDecorator < ApplicationDecorator
delegate_all
def title_or_no_title
title || "[No Menu]"
end
def link(*url_args)
h.link_to(title_or_no_title, h.meal_url(object, *url_args))
end
def form_section(section, **options, &block)
... | 30 | 104 | 0.646377 |
39af711b64223f71314c64ab1fb1e9284b139021 | 15,853 | # frozen_string_literal: true
require 'active_support'
require 'active_record'
require 'view_model'
require 'view_model/record'
require 'lazily'
require 'concurrent'
class ViewModel::ActiveRecord < ViewModel::Record
# Defined before requiring components so components can refer to them at parse time
# for funct... | 35.228889 | 123 | 0.704472 |
213ea8ccd22188362d11a93e3f69880349de9e35 | 1,131 | cask 'unity-vuforia-ar-support-for-editor@2018.1.0b6' do
version '2018.1.0b6,2c4679632cfb'
sha256 :no_check
url "http://beta.unity3d.com/download/2c4679632cfb/MacEditorTargetInstaller/UnitySetup-Vuforia-AR-Support-for-Editor-2018.1.0b6.pkg"
name 'Vuforia Augmented Reality Support'
homepage 'https://unity3d.c... | 31.416667 | 134 | 0.71618 |
26d0cd8e191fd45911d25bffdc5195976ead7616 | 2,715 | require 'spec_helper_acceptance'
describe 'lbvserver tests' do
it 'makes a lbvserver' do
pp = <<-EOS
netscaler_lbvserver { '1_8_lbvserver1':
ensure => 'present',
service_type => 'DNS',
state => true,
}
EOS
make_site_pp(pp)
run_device(allow_changes: true)
run... | 24.241071 | 48 | 0.561326 |
5d54f065e5005e8750e867c1157f468cb7c88193 | 641 | module Spree
module Admin
class MakesController < ResourceController
#Is this supposed to be a controller for the makes of cars?
def index
respond_with(@collection)
end
private
def collection
return @collection if @collection.present?
# params[:q] can be bl... | 22.892857 | 65 | 0.595944 |
26ca919fd3d2e43e53caa33dff91cd4ecce46938 | 6,255 | require_relative "steps_helper"
# Cenario: Cadastro realizado com sucesso (Caminho Feliz)
Given("Eu sou o Administrador") do
cria_administrador
end
Given("Eu sou Administrador") do
cria_administrador
end
Given("Eu estou logado") do
cria_administrador
fazer_login_Adm
end
When("Eu acesso pagina de criar ... | 32.409326 | 123 | 0.755556 |
6a269be9c979063984b0b04f7bebe72e81d34cd7 | 12,773 | =begin
#Hydrogen Nucleus API
#The Hydrogen Nucleus API
OpenAPI spec version: 1.9.4
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NucleusApi
# BankLink Object
class BankLink
# accountId
attr_... | 29.56713 | 335 | 0.617866 |
bbe8e56f205798b536fee60d7302762105abe478 | 1,156 | require_relative './sub_track.rb'
module SubsParsers
class VttParser
# Parses VTT formatted files and returns
# an array of SubTrack
#
# @param [File]
# @return [Array(SubTrack)]
def get_subs(file)
subs = []
track_line = ''
track_subs = []
file.each_line do |line|
... | 23.12 | 96 | 0.560554 |
d5c9fb3c7df63a0d2f49e605495b380bde98a023 | 157 | class AddRoleToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :role, :integer, null: false, after: :username, default: 0
end
end
| 26.166667 | 81 | 0.719745 |
bb7f7fb65fcf7a377b17a152a6ed2d9b83b40537 | 3,403 | class Handicap
include GladeGUI
def initialize()
@scores = []
end
def before_show()
@view = VR::ListView.new(rnd: String, date: VR::Col::CalendarCol,
course: String, rating_slope: String, score: String, diff: Score,
hcp: String)
@view.col_xalign(diff: 1, hcp: 1, score: 1)
@view.c... | 29.336207 | 158 | 0.604761 |
182cfcf4c1e49fced0a9c2928aac8d5e51769e19 | 92 | name 'mapr_tasktracker'
description 'MapR tasktracker'
run_list *%w[
role[mapr]
]
| 13.142857 | 30 | 0.684783 |
f76fbd32ac46616f140cce171abc61ba7a592143 | 471 | log_level :info
log_location STDOUT
node_name 'venkat'
client_key '/home/venkat/chef-cookbooks/.chef/venkat.pem'
validation_client_name 'chef-validator'
validation_key '/home/venkat/chef-cookbooks/chef-validator.pem'
chef_server_url 'https://c... | 47.1 | 73 | 0.687898 |
8775ad321b5ad2bcb3cc426cb4bcd369701d61f8 | 44 | module Transferwise
VERSION = "0.2.6"
end
| 11 | 19 | 0.704545 |
08f0c7bfab0798e172b8f3b9191f08ba1a21df52 | 521 | Spree::Core::Engine.routes.draw do
namespace :admin do
resources :dhl_shipping_methods do
resources :dhl_shipping_zones, only: [:index, :new, :create]
resources :dhl_surcharges, only: [:index, :new, :create]
end
resources :dhl_shipping_zones, except: [:index, :new, :create] do
resourc... | 28.944444 | 69 | 0.679463 |
38845ff2e2ddebdb81c8998455572b02757272ff | 3,026 | class User < ApplicationRecord
include Gravtastic
gravtastic
# 仮想の属性を作成 #has_secure_passwordの場合は(password属性)自動生成される
# remember_digestとセット
attr_accessor :remember_token, :activation_token, :reset_token
# メソッド参照の方が良い(before_action)
before_save :downcase_email
before_create :create_activation_digest
vali... | 28.819048 | 78 | 0.737277 |
915f61c80048628d81b14223518a566ae1da3bb0 | 4,735 | #!/usr/local/bin/ruby
if $0 == __FILE__
Dir.chdir File.dirname(__FILE__)+'/../'
$:.unshift File.expand_path('../lib/')
end
require 'rio'
require 'tc/testcase'
require 'tmpdir'
class TC_riorl < Test::RIO::TestCase
@@once = false
def self.once
@@once = true
end
def setup
super
self.class.once un... | 26.016484 | 79 | 0.549102 |
1120581a74718321e844568c2d3381b548bff862 | 157 | class CreateCerts < ActiveRecord::Migration
def change
create_table :certs do |t|
t.string :cert_name
t.string :exp_date
end
end
end
| 17.444444 | 43 | 0.675159 |
e8f22852015f4222e679c4bec0f3cae67b71e2d5 | 3,598 | module HipChat
class Client
include HTTParty
format :json
def initialize(token, options={})
@token = token
default_options = { api_version: 'v1', server_url: 'https://api.hipchat.com' }
@options = default_options.merge options
@api_version = options[:api_version]
@api = Hi... | 29.016129 | 121 | 0.59144 |
1a4039ce50e4fc766673e609e5c22c1dde659ce9 | 2,795 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2017 the original author or 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/... | 32.5 | 110 | 0.71449 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.