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 |
|---|---|---|---|---|---|
01e7f899792ca5e6fc11ae888738e1b6da9cd85c | 190 | module Ecommerce
class PaymentMethod < ApplicationRecord
has_many :payments
enum status: {active: 1, inactive: 2}
scope :is_active, -> { where(status: "active") }
end
end
| 17.272727 | 52 | 0.678947 |
eda5a8b4e89815bf85635dea4bf440695616dbdd | 266 | # frozen_string_literal: true
class AddIndexesOnChannlType < ActiveRecord::Migration[5.0]
disable_ddl_transaction!
def change
add_index :channels, :channel_type, algorithm: :concurrently
add_index :channels, :status, algorithm: :concurrently
end
end
| 24.181818 | 64 | 0.778195 |
38a8e8af35c8c81cbe38e8ce5295145776701216 | 7,960 | module Gitlab
module Auth
MissingPersonalTokenError = Class.new(StandardError)
REGISTRY_SCOPES = [:read_registry].freeze
# Scopes used for GitLab API access
API_SCOPES = [:api, :read_user].freeze
# Scopes used for OpenID Connect
OPENID_SCOPES = [:openid].freeze
# Default scopes for OAu... | 33.586498 | 138 | 0.655402 |
7a1aa6ece617e5036788c640237f06d6640c36b1 | 1,018 | class CommentsController < ApplicationController
before_action :set_comment, only: [:show, :edit, :update, :destroy]
def create
@link = Link.find(params[:link_id])
@comment = @link.comments.new(comment_params)
@comment.user = current_user
respond_to do |format|
if @comment.save
forma... | 26.789474 | 93 | 0.663065 |
0354f666ed16087c05516f3733b0d0e1d44763cb | 2,709 | class Ice < Formula
desc "Comprehensive RPC framework"
homepage "https://zeroc.com"
url "https://github.com/zeroc-ice/ice/archive/v3.7.3.tar.gz"
sha256 "7cbfac83684a7434499f165e784a7a7bb5b89140717537067d7b969eccc111eb"
revision 1
bottle do
cellar :any
sha256 "0f6f68633091f43037d3e089c7a0b1d6eae005b... | 29.445652 | 109 | 0.641196 |
18a5d1dc616005539ebc07f1f387d0794e55b21e | 10,328 | =begin
Trulioo Ruby SDK
Gem version: 1.0.3
Trulioo OpenAPI version: v1
Generated by OpenAPI Generator version: 5.0.1
=end
require 'date'
require 'time'
module Trulioo
class Location
# House / Civic / Building number of home address
attr_accessor :building_number
# Name of building of home address
... | 29.678161 | 195 | 0.611445 |
284fc1d7f11823fa98cde4623fc1a94d176798e9 | 718 | # frozen_string_literal: true
module Stupidedi
module Versions
module ThirtyForty
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
FOB = s::SegmentDef.build(:FOB, "F.O.B. Related Instructions",
"To specify transportation instructions relating to shipme... | 34.190476 | 72 | 0.630919 |
bf3c30476e31754a10b9df1eaa1a1517a070880e | 367 | # -*- encoding : utf-8 -*-
Gistub::Application.config.secret_token = ENV['GISTUB_SECRET_TOKEN'] || '9d823ec9de09d00bec258fee515a324f9499cc3d334bdd8955a4e779094cf1bf37f6c2d77ff65ef6222ab038a8b49f6e1fd81949b05ffdbaa64e5df2fc5f507b'
Gistub::Application.config.secret_key_base = ENV['GISTUB_SECRET_KEY_BASE'] || 'something l... | 73.4 | 202 | 0.852861 |
8792ff4dcd0d9d47dc963955c9cdc961c274f5bb | 18,385 | require "hanami/cli/commands/generate/app"
module Hanami
# Hanami CLI
#
# @since 1.1.0
class CLI
module Commands
# @since 1.1.0
# @api private
class New < Command # rubocop:disable Metrics/ClassLength
# @since 1.1.0
# @api private
class DatabaseConfig
# @... | 31.918403 | 208 | 0.553875 |
b92b682989d12ba1dcb1799c3d82b1b0eae3c190 | 214 | class AddRegistrantChangedAtToDomain < ActiveRecord::Migration
def change
add_column :domains, :registrant_verification_asked_at, :datetime
add_index :domains, :registrant_verification_asked_at
end
end
| 30.571429 | 69 | 0.82243 |
e8e25219772d13cb09f53fc25c7798941dedfcba | 2,041 | class Zbackup < Formula
desc "Globally-deduplicating backup tool (based on ideas in rsync)"
homepage "http://zbackup.org"
url "https://github.com/zbackup/zbackup/archive/1.4.4.tar.gz"
sha256 "efccccd2a045da91576c591968374379da1dc4ca2e3dec4d3f8f12628fa29a85"
revision 8
bottle do
cellar :any
sha256 "... | 32.396825 | 110 | 0.732974 |
e8d28bba1b48569914dde06cb0cdf5597746043e | 276 | # coding: utf-8
require 'yard'
YARD::Rake::YardocTask.new(:doc) do |yard|
yard.files = Dir['lib/**/*.rb']
yard.options = [
'--no-private',
'--readme', 'README.rdoc',
'--output-dir', 'doc/yardoc',
'--template-path', 'doc/yardoc_templates'
]
end
| 19.714286 | 45 | 0.565217 |
1d3eae5c89d1e8908736a722202a10570da75ee2 | 8,908 | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 60.598639 | 540 | 0.700269 |
6a914c8f8318aaf2e5ec6d3e2fefd378c9dc6d87 | 1,458 | class AddDeviseToUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
## Database authenticatable
t.string :email, null: false
t.string :encrypted_password, null: false
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_s... | 21.761194 | 57 | 0.670782 |
9174b71a6f0e1185d86a6825f5b1437d3b4e0eb2 | 711 | # Prompt https://adventofcode.com/2018/day/2
boxes = File.open("input.txt").read
boxes = boxes.split("\n").map(&:strip)
answer = "Shit."
File.readlines("input.txt").each do |box_id|
box_id = box_id.strip
tracker = Hash.new(0)
box_id.each_char do |x|
tracker[x] += 1
end
boxes.each do |box|
... | 25.392857 | 55 | 0.535865 |
f8bd6096f2539345604651cae234d054891f7f6b | 17,982 | require 'fileutils'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/object/blank'
require 'active_support/key_generator'
require 'active_support/message_verifier'
require 'rails/engine'
module Rails
# In Rails 3.0, a Rails::Application object was introduced which is nothing more than
#... | 34.186312 | 135 | 0.671449 |
1d840dd47f45bb7d9636246d71fbc47e1c04cb2e | 503 | cask 'blu-ray-player-pro' do
version '3.2.9'
sha256 '792bb782fec10576ab69d2980189bf617eca2a9e1acc4b6a65d1ee2e288876b8'
url 'https://www.macblurayplayer.com/user/download/Macgo_Mac_Bluray_Player_Pro.dmg'
appcast 'https://macblurayplayer.com/products/mac-bluray-player-pro/Appcast.xml',
checkpoint: '5a2... | 38.692308 | 88 | 0.789264 |
212b3e05466bd9f7a2c4d5a2b8edf468c29434c6 | 862 | # 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
# Shared Smoke Test Definitions
Given(/I create a client in region '(.*?)'/) do |region|
@regional_client = Aw... | 28.733333 | 81 | 0.75058 |
62d8cf72912b7b68ededa8a5392bad393b6eaad8 | 4,818 | require 'rails_helper'
RSpec.describe PrivacyNotification, type: :model do
it "has a valid factory" do
expect(FactoryBot.build(:privacy_notification)).to be_valid
end
describe "#petitions.sample" do
let(:subject) { privacy_notification.petitions.sample }
let(:ignore_petitions_before) { 1.year.ago }
... | 26.916201 | 104 | 0.565172 |
033cf4983dd7208f4797196e58ad885cbe93d1db | 519 | module GlobalConstant
class ClientToken < GlobalConstant::Base
class << self
def not_deployed
'notDeployed'
end
def deployment_started
'deploymentStarted'
end
def deployment_completed
'deploymentCompleted'
end
def deployment_failed
'... | 12.658537 | 42 | 0.576108 |
1c48f0d64e2834a4feddfb02bd6527080e042d94 | 1,806 | #
# Be sure to run `pod lib lint RTRootNavigationController_Swift.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... | 42 | 128 | 0.674972 |
390bc6f130eada28f5ca0188698555350e3ed311 | 1,497 | require 'rdf'
require 'rdf/reasoner/extensions'
module RDF
##
# RDFS/OWL reasonsing for RDF.rb.
#
# @see https://www.w3.org/TR/2013/REC-sparql11-entailment-20130321/
# @author [Gregg Kellogg](https://greggkellogg.net/)
module Reasoner
require 'rdf/reasoner/format'
autoload :OWL, 'rdf/reasoner/o... | 26.263158 | 97 | 0.514362 |
1d77d2058ed73a21a118a53f4f847709267be617 | 2,673 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::RecoveryServicesBackup::Mgmt::V2019_05_13
module Models
#
# Generic backup copy.
#
class GenericRecoveryPoint < RecoveryPoint
include M... | 28.136842 | 75 | 0.521511 |
e81977169ffaf4d0837a56e2ea0efb0eecc2a96f | 8,774 | #--
# Copyright 2006, 2007 by Chad Fowler, Rich Kilmer, Jim Weirich, Eric Hodel
# and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
# Make sure rubygems isn't already loaded.
if ENV['RUBYOPT'] and defined? Gem then
ENV.delete 'RUBYOPT'
require 'rbconfig'
config = defined?(RbConfig) ? RbC... | 26.191045 | 94 | 0.656143 |
d50a21bce5761f203571eaf735da5db7118878d7 | 4,985 | class NationalProject < ActiveRecord::Base
self.inheritance_column = nil # иначе колонка type используется для
# single table inheritance т.е наследования сущностей, хранящихся в одной таблице
acts_as_journalized
has_many :projects, foreign_key: "national_project_id"
has_many :projects_federal, foreign_key: "... | 43.72807 | 166 | 0.687061 |
d5cbfad8ed1b4ae39f43178aeb665135b47aae57 | 46 | module HashExtensions
VERSION = "0.1.0"
end
| 11.5 | 21 | 0.717391 |
6aab22611b3537fe4362521aad03cfb73d32d065 | 5,338 | module ActiveRecord
class Base
class ConnectionSpecification #:nodoc:
attr_reader :config, :adapter_method
def initialize (config, adapter_method)
@config, @adapter_method = config, adapter_method
end
end
##
# :singleton-method:
# The connection handler
class_attribu... | 37.591549 | 188 | 0.667853 |
01505924cb5d01c58df85b557179e9fef18755cb | 7,673 | #
# Author:: AJ Christensen (<aj@hjksolutions.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 41.252688 | 152 | 0.595074 |
7a2b4c7b28ff325689e29b109d237f1163da3ab8 | 114 | class AddPlanetToUser < ActiveRecord::Migration[5.2]
def change
add_column :users, :planet, :text
end
end
| 19 | 52 | 0.72807 |
f815de31192302c11ea738c3756ec8d9ef1fe046 | 2,673 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Mysql::Mgmt::V2017_12_01_preview
module Models
#
# Represents a server to be created.
#
class ServerForCreate
include MsRestAzure
... | 29.054348 | 77 | 0.481481 |
e83e4668168a280f3b4c46e760b91d02eb985439 | 145 | class AddExcludeStateToPatrons < ActiveRecord::Migration
def change
add_column :patrons, :exclude_state, :integer, :default => 0
end
end
| 24.166667 | 64 | 0.758621 |
1d05ca3a55ce3df05ed553c205b4df6bd0451e62 | 499 | require 'formula'
class Lensfun < Formula
homepage 'http://lensfun.sourceforge.net/'
head 'git://git.code.sf.net/p/lensfun/code'
url 'https://downloads.sourceforge.net/project/lensfun/0.2.8/lensfun-0.2.8.tar.bz2'
sha1 '0e85eb7692620668d27e2303687492ad68c90eb4'
revision 1
depends_on 'doxygen' => :optional
... | 24.95 | 85 | 0.707415 |
e86fd3721cd62202e53f9d799de37176a1d4b0b5 | 11,048 | =begin
#Xero Payroll AU
#This is the Xero Payroll API for orgs in Australia region.
The version of the OpenAPI document: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'time'
require 'date'
module XeroRuby::PayrollAu
require 'bigdecimal'
... | 32.398827 | 212 | 0.638758 |
336b4fcd3c867a1f18121cc89c4b3f2a48d1376f | 254 | class Servel::HomeApp
FAVICON_PATH = "/favicon.ico"
def initialize(roots)
@roots = roots
end
def call(env)
return [404, {}, []] if env["PATH_INFO"] == FAVICON_PATH
Servel::HamlContext.render('home.haml', { roots: @roots })
end
end | 21.166667 | 62 | 0.641732 |
e25adef072733974d1efe95ed1aac6dc8e8b364d | 162 | require 'spec_helper'
describe 'customer-syslog' do
context 'with defaults for all parameters' do
it { should contain_class('customer-syslog') }
end
end
| 20.25 | 50 | 0.740741 |
62c8f4422cc65aed44b20a0304f6ea8f7a0ea9df | 71 | module QuickSearchArchivesSpaceSearcher
VERSION = '1.0.0'.freeze
end
| 17.75 | 39 | 0.802817 |
ff46eab8bba7e7e534af38abe030623d76bc75ad | 7,354 | ##
# Manages changes of attributes in a block of text
class RDoc::Markup::AttributeManager
##
# The NUL character
NULL = "\000".freeze
##
# We work by substituting non-printing characters in to the text. For now
# I'm assuming that I can substitute a character in the range 0..8 for a 7
# bit character... | 23.722581 | 82 | 0.605249 |
acc244d92e04adec4fb667eac048788bac493090 | 8,589 | Петронелла Уайет: Надо Мной запугали из Оксфорда для того, чтобы быть Тори
Это не просто сегодняшние студенты университета, которые подвергаются нападению за их взгляды
Я не могу помнить время, когда я не мечтал о победе места в Оксфордском университете.
И мой отец и мой старший брат были, в каком я вообразил, было... | 89.46875 | 298 | 0.808476 |
91dc350a46bdec902623decba9b48e93563a99cb | 3,244 | # encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'cucumber/rb_support/rb_step_definition'
require 'cucumber/rb_support/rb_language'
module Cucumber
describe StepMatch do
WORD = Cucumber::RUBY_1_9 ? '[[:word:]]' : '\w'
before do
@rb_language = RbSupport::Rb... | 47.014493 | 150 | 0.624229 |
5dd0630c3df0bf14aa13cdd5b0c578dd7f704348 | 2,231 | require File.expand_path('../../../test/test_helper.rb', __FILE__)
class SegmentTest < Minitest::Test
include Test::Helpers::All
def test_create
assert_tend_class "segment", "create", {name: "test by steve 2"}
end
def test_get_find
assert_tend_class "segment", "find", 1
end
def test_update
a... | 35.983871 | 202 | 0.755715 |
87a52194245000accafda0882271b343cc7cd0c1 | 860 | require 'spec_helper'
describe 'freeradius::policy' do
include_context 'redhat_common_dependencies'
let(:title) { 'test' }
let(:params) do
{
:source => 'puppet:///modules/test/path/to/policy',
}
end
it do
is_expected.to contain_file('/etc/raddb/policy.d/test')
.with_ensure('present... | 25.294118 | 64 | 0.646512 |
089854d45af11bc44a8c5e6f66b15bd539250de0 | 525 | class StoryMailer < ApplicationMailer
def for_campaign(campaign, story, email_subscription)
@campaign = campaign
@story = story
@email_subscription = email_subscription
@unsubscribe_url = unsubscribe_url(id: Rails.application.message_verifier(:unsubscribe).generate(@email_subscription.id), title: @ca... | 37.5 | 180 | 0.752381 |
ff075259e213974f598eec4f9b5bb83514df3085 | 3,490 | #! /usr/bin/env ruby
#
# <script name>
#
# DESCRIPTION:
# what is this thing supposed to do, monitor? How do alerts or
# alarms work?
#
# OUTPUT:
# plain text, metric data, etc
#
# PLATFORMS:
# Linux, Windows, BSD, Solaris, etc
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: <?>
#
# USAGE:
# example comma... | 28.373984 | 136 | 0.62235 |
26c70c9d19ca8fd4a1f875a63fc53a5221175751 | 818 | class YouTube < Liquid::Tag
Syntax = /^\s*([^\s]+)(\s+(\d+)\s+(\d+)\s*)?/
def initialize(tagName, markup, tokens)
super
if markup =~ Syntax then
@id = $1
if $2.nil? then
@width = 560
@height = 420
else
@width = $2.to_i
@height = $3.to_i
end
... | 28.206897 | 187 | 0.56846 |
d5765f6d620ea6899b2bb96e75c841229523efdc | 186 | module Hardware
def self.oldest_cpu
if MacOS.version >= :mojave
:nehalem
elsif MacOS.version >= :sierra
:penryn
else
generic_oldest_cpu
end
end
end
| 15.5 | 34 | 0.634409 |
211a53aca6407057b87b94135c00ff2049901a97 | 1,818 | class IcarusVerilog < Formula
desc "Verilog simulation and synthesis tool"
homepage "http://iverilog.icarus.com/"
url "ftp://icarus.com/pub/eda/verilog/v10/verilog-10.3.tar.gz"
mirror "https://deb.debian.org/debian/pool/main/i/iverilog/iverilog_10.3.orig.tar.gz"
sha256 "86bd45e7e12d1bc8772c3cdd394e68a9feccb2a... | 33.666667 | 93 | 0.707921 |
21912b1d5d724f2e07e6ed3c61e8adee3c45afc2 | 5,015 | 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... | 44.380531 | 114 | 0.762512 |
e28d5001c20ee2f255ace766f88a45b922db96ae | 519 | class TimestampVotes < ActiveRecord::Migration[5.1]
def change
add_column :votes, :updated_at, :datetime, null: true
ActiveRecord::Base.connection.execute("update votes set updated_at = comments.created_at from comments where comments.id = comment_id and votes.updated_at is null")
ActiveRecord::Base.conne... | 57.666667 | 168 | 0.776493 |
87f3a09f29b44bd3bca4d4bdcebdc11145088a71 | 266 | class Payment < ApplicationRecord
belongs_to :order
has_one_attached :file
validates :file, attached: true, content_type: [:png, :jpg, :jpeg], :unless => :compra_click_method?
private
def compra_click_method?
self.payment_method == "compra_click"
end
end
| 20.461538 | 101 | 0.755639 |
3837e88c949d02896794824282f99dd10051b003 | 509 | module Coupler
module Models
class Transformer
class Runner
instance_methods.each do |m|
undef_method m unless m =~ /^__|^instance_eval$/
end
def initialize(code, input)
@input = input
@code = code
end
def run
instance_eval(@c... | 17.551724 | 58 | 0.526523 |
d5aad4519ab4e1d4d687dc1aa16dab5fa990e9b8 | 6,743 | require_relative '../spec_helper'
describe "Ruby apps" do
# https://github.com/heroku/heroku-buildpack-ruby/issues/1025
describe "bin/rake binstub" do
it "loads git gems at build time when executing `rake`" do
Hatchet::Runner.new("git_gemspec").tap do |app|
app.before_deploy do
File.op... | 32.109524 | 149 | 0.614563 |
7a15eb24082a0af0931532a7797f09304ea2cd6d | 1,374 | module HTMLProofer
# Mostly handles issue management and collecting of external URLs.
class Check
attr_reader :node, :html, :element, :src, :path, :options, :issues, :external_urls
def initialize(src, path, html, options)
@src = src
@path = path
@html = remove_ignored(html)
@... | 21.46875 | 86 | 0.601892 |
d59ebe5b393635cad95491e614d8f60e52a50ae1 | 1,179 | #--
# Copyright (c) 2019 Fuyuki Academy
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | 40.655172 | 72 | 0.771841 |
bf1ebdb4c5739f0cd4f703777566a39172652c6a | 8,726 | # frozen_string_literal: true
require "cases/helper"
module ActiveRecord
class Migration
class IndexTest < ActiveRecord::TestCase
attr_reader :connection, :table_name
def setup
super
@connection = ActiveRecord::Base.connection
@table_name = :testings
connection.crea... | 39.844749 | 118 | 0.675567 |
21f824ae96eeaa647bdcd4bbf1f37537ccc4971c | 291 | test_cask 'with-zap-quit' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
homepage 'http://example.com/fancy-pkg'
pkg 'MyFancyPkg/Fancy.pkg'
zap quit: 'my.fancy.package.app'
end
| 24.25 | 75 | 0.756014 |
625fbc483029c000890adb1dec5ce9f6fa8ddb00 | 6,178 | # To add new service you should build a class inherited from Service
# and implement a set of methods
class Service < ActiveRecord::Base
include Sortable
serialize :properties, JSON
default_value_for :active, false
default_value_for :push_events, true
default_value_for :issues_events, true
default_value_fo... | 25.113821 | 95 | 0.696018 |
918e6a9eb774e04f2fbff7b089b19c6d0a3f3985 | 5,911 | require 'spec_helper'
describe 'cis_hardening::services::special' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for main class
it {
is_expected.to contain_class('cis_hardening::services::special')
}
# 2.2.1 - Time Synchron... | 25.812227 | 76 | 0.521401 |
1cb61208bfc0d907d6370e3ad2c925d2f71fc0f3 | 2,299 | require 'spec_helper'
describe OpenSSLExtensions::X509::Request do
subject { extended_certificate_request('geocerts') }
context 'subject_alternative_names' do
context 'on a CSR with SANs' do
subject { extended_certificate_request('sans') }
it 'returns a collection of the alternative names' do
... | 29.474359 | 72 | 0.667247 |
b9aa54684215a63adb81e9668c8ec8a19f2dd3cd | 52 | module JsonMatchers
VERSION = "0.10.0".freeze
end
| 13 | 27 | 0.730769 |
bf56e1d5aea7de9d48c090dff7ea70b48d81b978 | 1,108 | #! /usr/bin/env ruby
#: Count trees on the way down with a toboggan
def read_map(filename)
hsize = (File.open(filename) { |f| next f.readline }).rstrip.size
res = Array.new(hsize)
File.open(filename) do |f|
f.each_line.each_with_index do |l, row|
res[row] = l.rstrip.each_char.map { |c| c == '#' ? 1 : 0... | 23.574468 | 68 | 0.636282 |
abf8fed81d93152bcea64842fb664b68ed39dfa0 | 2,181 | # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... | 35.754098 | 85 | 0.770747 |
337f381485e96c9a59ceb1898538b1057d770d8d | 2,193 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
require 'sinatra'
require_relative 'sinatra_test_cases'
require_relative '../../../helpers/exceptions'
include NewRelic::TestHelpers::Exceptions
... | 21.086538 | 94 | 0.705426 |
917ed0a038d5aff2b2c3c6091537d75fae22ed31 | 2,108 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 29.277778 | 108 | 0.553605 |
bb56046aa9172864e8bf4f015e57d19e4fe87e14 | 212 | class AddUploadRefToInspectionsAndRoadways < ActiveRecord::Migration[5.2]
def change
add_reference :inspections, :upload, foreign_key: true
add_reference :roadways, :upload, foreign_key: true
end
end
| 30.285714 | 73 | 0.783019 |
f781b36535382cb81faac654d984e65d9e2364cf | 458 | Rails.application.routes.draw do
get 'home/index'
get 'home/tables_simple'
get 'home/data'
get 'home/dashboard'
devise_for :users, controllers: {
registrations: 'users/registrations', confirmations: 'users/confirmations'
}
devise_scope :user do
authenticated :user do
root 'home#index',... | 20.818182 | 78 | 0.69214 |
e2eff528b6f6911c04d9af72104807984fe844a7 | 172 | class AddFieldsToSignUp < ActiveRecord::Migration
def change
add_column :users, :tos_accepted, :boolean
add_column :users, :camping_preferred, :boolean
end
end
| 24.571429 | 51 | 0.761628 |
bbe42305509a3c961c0bcada1dac7c91198bffe8 | 408 | module Invitable
extend ActiveSupport::Concern
included do
include InstanceMethods
end
module InstanceMethods
def attendances
invitations.accepted
end
def attending_students
invitations.where(role: "Student").accepted.order('updated_at asc')
end
def attending_coaches
... | 17 | 73 | 0.710784 |
aba07da209d858cbc395ebb44a34661753045688 | 425 | # Rahel: TimeSpan
# 2014-04-17 martin.stricker@gmail.com
module Rahel
class TimeSpan < Individual
property "begin", :date, cardinality: 1
property "end", :date, cardinality: 1
property "display_as_year", :bool, cardinality: 1, default: true
property "time_span_label", :string, cardinality: 1
pro... | 32.692308 | 101 | 0.712941 |
e9c129b3f2dae66313d2c9a7f23edc3a8002fd48 | 2,214 | # frozen_string_literal: true
#
# Cookbook:: vault_resources
# Resource:: vault_initialize
#
# See LICENSE file
#
resource_name :vault_initialize
provides :vault_initialize
unified_mode true
property :secret_shares, Integer, required: true, desired_state: false
property :secret_threshold, Integer, required: true, de... | 36.295082 | 96 | 0.743902 |
b99b9987eb2b15633abb51a7c9837e3084f7bff2 | 1,695 | class DevelopersController < ApplicationController
before_action :authenticate_user!, only: %i[new create edit update]
before_action :require_new_developer!, only: %i[new create]
def index
@developers_count = Developer.count.round(-1)
@query = DeveloperQuery.new(params)
end
def new
@developer = ... | 22.905405 | 69 | 0.683186 |
183eb2bb3c78fd4a9407e18f3676e3bc3e6b717f | 11,221 | require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
class RequestTest < Test::Unit::TestCase
context "Authrequest" do
should "create the deflated SAMLRequest URL parameter" do
settings = OneLogin::RubySaml::Settings.new
settings.idp_sso_target_url = "http://example.com"
... | 46.176955 | 151 | 0.698957 |
3802fff5a445f46a45333197fe9b61b13c95b8ce | 221 | # frozen_string_literal: true
module LogMarker
class << self
attr_accessor :ml_alias, :marker
def config
yield self
end
end
@ml_alias = :p!
@marker = -> { (['=' * 150] * 5).join("\n") }
end
| 14.733333 | 49 | 0.574661 |
61fec39bb9ba3d503fcd8137fe104bf71ec8b477 | 184 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "LWRPs for managing AWS resources"
version "0.8"
| 30.666667 | 52 | 0.641304 |
01aa762694b18df71ed58d3a20ddf2c12f7bc072 | 382 | # encoding: utf-8
name 'bach_krb5'
maintainer 'Bloomberg Finance L.P.'
description 'Wrapper cookbook for krb5 community cookbook'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'krb5', '~> 2.0.0'
depends 'bcpc', '= 0.1.0'
depends 'bcpc-... | 23.875 | 72 | 0.643979 |
618a4844d27dc855d8361b40a3a499c5627a9a39 | 567 | #encoding: utf-8
##
## config.rb
## Gaetan JUVIN 27/07/2015
##
require 'logger'
require 'gconfig'
module Rabbitmq
class Receiver
extend GConfig
default logger: Logger.new(STDOUT)
default host: '8.8.8.8'
default port: 5672
default user: nil
default password: nil
... | 19.551724 | 43 | 0.608466 |
f7c9fed22bdeae13e26d5f6e8c2cd0e1ce8f5491 | 9,027 | require File.dirname(__FILE__) + '/migs/migs_codes'
require 'digest/md5' # Used in add_secure_hash
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class MigsGateway < Gateway
include MigsCodes
API_VERSION = 1
SERVER_HOSTED_URL = 'https://migs.mastercard.com.au/vpcpay'
MERCHANT_H... | 34.719231 | 123 | 0.624792 |
188f46edb5921e4be13271d83784ba412352af23 | 365 | class AddRatingOfDifficultyToQuestions < ActiveRecord::Migration[4.2]
def self.up
add_column :questions, :average_difficulty_rating, :float, default: 0
add_column :questions, :number_of_ratings, :integer, default: 0
end
def self.down
remove_column :questions, :number_of_ratings
remove_column :que... | 30.416667 | 73 | 0.775342 |
e93d4a0414dfbdb37d57103ef8d67be2d87f7035 | 965 | Pod::Spec.new do |s|
s.name = "HHStringAttributes"
s.version = "0.1.0"
s.summary = "A simple Attributes Library."
s.description = <<-DESC
Makes it way easier to generate attribute dictionaries needed for NSAttributedString.
DESC
... | 38.6 | 114 | 0.59171 |
ff12ec28459b03d22990ac0329afb39facd5c699 | 570 | module ApplicationHelper
def footer_class
'page-footer row bg-dark text-white'
end
def main_col_class(text)
content_for :main_col_class, text
end
def title(text)
content_for :title, text
end
def body_container_class
"container mt-5"
end
def card_... | 16.285714 | 53 | 0.592982 |
ed572c14bd28533e123071e206b72f7b606d5263 | 727 | name 'mszlx_baseline'
maintainer 'The Authors'
maintainer_email 'you@example.com'
license 'All Rights Reserved'
description 'Installs/Configures mszlx_baseline'
version '0.1.0'
chef_version '>= 14.0'
# The `issues_url` points to the location where issues for this cookbook are
# tracked. A `View Issues` link will be d... | 34.619048 | 79 | 0.775791 |
ff7a68b15e6bc9d9341e3116a2f4802a02ea934e | 233 | class CoupError < StandardError
end
class CommandError < CoupError
end
class ValidationError < CoupError
end
class InternalError < StandardError
end
class CallError < InternalError
end
class ConfigError < InternalError
end | 10.130435 | 35 | 0.802575 |
623deae99926149337ff1ccf667a0ae564079f7a | 1,184 | # Cookbook Name:: travis_php
# Recipe:: default
# Copyright 2011-2015, Travis CI GmbH <contact+travis-cookbooks@travis-ci.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restri... | 53.818182 | 79 | 0.779561 |
1c0a2b63d7ea69916b73ec2926324453cb5b9618 | 3,298 | module Fog
module Compute
class AWS
class Real
require 'fog/aws/parsers/compute/describe_tags'
# Describe all or specified tags
#
# ==== Parameters
# * filters<~Hash> - List of filters to limit results with
#
# === Returns
# * response<~Excon... | 30.537037 | 131 | 0.487871 |
0127ec69650527f17df476a629529fb04e400b00 | 361 | class ApplicationController < Sinatra::Base
configure do
set :public_folder, 'public'
set :views, 'app/views'
enable :sessions
set :session_secret, "testing"
end
get '/' do
erb :index
end
helpers do
def logged_in?
!!session[:user_id]
end
def current_user
User.f... | 14.44 | 43 | 0.628809 |
f8a9384d996557a4b3b8eda7c87658dca900782b | 338 | # frozen_string_literal: true
class ViteRuby::CLI::Dev < ViteRuby::CLI::Build
DEFAULT_ENV = CURRENT_ENV || 'development'
desc 'Start the Vite development server.'
shared_options
option(:force, desc: 'Force Vite to re-bundle dependencies', type: :boolean)
def call(**options)
super { |args| ViteRuby.run(... | 24.142857 | 78 | 0.713018 |
ff5a8b564d6b535e421faa9cdf9963acd64d926f | 2,956 | # 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_12_01
module Models
#
# Response for ListAuthorizations API service call retrieves all
# authorizations tha... | 29.267327 | 85 | 0.548038 |
9131513d1dbf1850baac1c4fdf218ffa8d998aa6 | 570 | cask :v1 => 'visual-studio-code' do
version '0.10.2'
sha256 '3371bff1e11daa49ad77ad1eed683d1baaf073477c1baff20626250d5ee6153e'
# vo.msecnd.net is the official download host per the vendor homepage
url "https://az764295.vo.msecnd.net/public/#{version}/VSCode-darwin.zip"
name 'Visual Studio Code'
homepage 'h... | 30 | 75 | 0.661404 |
61ee7a44b0aa0db382b96bbf6461fc3078119be0 | 318 | class SponsorPolicy < ApplicationPolicy
def index?
is_admin_or_chapter_organiser?
end
def create?
is_admin_or_chapter_organiser?
end
def show?
is_admin_or_chapter_organiser?
end
def edit?
is_admin_or_chapter_organiser?
end
def update?
is_admin_or_chapter_organiser?
end
end
| 14.454545 | 39 | 0.748428 |
5ddcd24dcfa77b077098c2bb6f51b75314cbfb53 | 4,654 | # Copyright 2018 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, so... | 36.645669 | 99 | 0.698539 |
e84d0015e6722cda97d640d75bd4238659950d04 | 1,169 | # 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::Scheduler::Mgmt::V2016_03_01
module Models
#
# Model object.
#
#
class Sku
include MsRestAzure
# @return [... | 23.38 | 77 | 0.518392 |
1c38d42269a4744cf533091e546ece44b8cb4dab | 1,407 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "brcobranca/version"
Gem::Specification.new do |s|
s.name = "brcobranca"
s.version = Brcobranca::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Kivanio Barbosa"]
s.date = %q{2011-04-14}
s.description = %q{G... | 41.382353 | 94 | 0.5828 |
2861e613f7758bc4ce7a6f28e68fac815bd5f31f | 1,645 | ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
... | 42.179487 | 113 | 0.67234 |
1a0dd99c8e54d9e071db254969caf2e7578d0555 | 405 | class CreateMailees < ActiveRecord::Migration
def self.up
create_table :mailees, :force => true, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
t.column :user_id, :integer
t.column :email, :string
t.timestamp :created_at
end
add_index :mailees, :user_id
end
def ... | 23.823529 | 98 | 0.646914 |
62ab001d2b10b4ecbb655793a259088d70a0e3dc | 1,929 | #!/usr/bin/env gem build
# encoding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sneakers/version'
Gem::Specification.new do |gem|
gem.name = 'sneakers'
gem.version = Sneakers::VERSION
gem.authors = ['Dotan Nahum']
gem.... | 41.934783 | 92 | 0.667185 |
217db36bc11fe8caa7021ae674d82627470f8919 | 661 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | 50.846154 | 176 | 0.815431 |
1d0478869c31a7ff4751765cbf542df6382fc254 | 3,842 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'aws-sdk-iam'
class MetasploitModule < Msf::Auxiliary
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Amazon Web Services ... | 30.983871 | 128 | 0.603071 |
e844c7f8d4a293c3dc32f4e5e9e1dc1620ff53dc | 23,357 | require 'java'
require 'rbconfig'
require 'test/unit'
TopLevelConstantExistsProc = Proc.new do
include_class 'java.lang.String'
end
class TestHigherJavasupport < Test::Unit::TestCase
TestHelper = org.jruby.test.TestHelper
JArray = ArrayList = java.util.ArrayList
FinalMethodBaseTest = org.jruby.test.FinalMetho... | 28.55379 | 131 | 0.715374 |
03cfa8f9ffeb629288644b1829c135a4ab710538 | 198 | class CreateTweets < ActiveRecord::Migration
def change
create_table :tweets do |t|
t.string :handle1
t.string :handle2
t.string :tweet
t.timestamps
end
end
end
| 16.5 | 44 | 0.646465 |
4a75a31d00406c604e30df8b97665d9a6c9aecc0 | 55 | # frozen_string_literal: true
require 'spree/core'
| 13.75 | 30 | 0.745455 |
7a3dde4cb0718a14ae67acfc8d3dd2abc3e61fd0 | 970 | module Endicia
class Label
attr_accessor :image,
:status,
:tracking_number,
:final_postage,
:transaction_date_time,
:transaction_id,
:postmark_date,
:postage_balance,
... | 30.3125 | 69 | 0.513402 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.