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 |
|---|---|---|---|---|---|
5db065bad7fa587b2ab489c88f1491f76931096c | 1,548 | # frozen_string_literal: true
module Clusters
module Applications
class Runner < ApplicationRecord
VERSION = '0.36.0'
self.table_name = 'clusters_applications_runners'
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
include ::Clusters:... | 22.114286 | 75 | 0.616279 |
26b1aef20506db6ebaf718d0c8f6020294d0f909 | 139 | class Address
include Entrepot::Mongo::Model
attribute :street, String
attribute :city, String
attribute :country, String
end
| 17.375 | 32 | 0.733813 |
ac987386b53e5794847adcc6917407014d2751fa | 1,056 | platform "el-6-s390x" do |plat|
plat.servicedir "/etc/rc.d/init.d"
plat.defaultdir "/etc/sysconfig"
plat.servicetype "sysv"
plat.add_build_repository "http://pl-build-tools.delivery.puppetlabs.net/yum/el/6/s390x/pl-build-tools-s390x.repo"
plat.add_build_repository "http://pl-build-tools.delivery.puppetlabs.n... | 27.789474 | 118 | 0.658144 |
5d6bb3ec71f9337ab36d583f2654872460ae2c7b | 2,630 | module SS::Model::Group
extend ActiveSupport::Concern
extend SS::Translation
include SS::Document
include SS::Scope::ActivationDate
include Ldap::Addon::Group
include SS::Fields::DependantNaming
attr_accessor :in_password
included do
store_in collection: "ss_groups"
index({ name: 1 }, { unique... | 22.10084 | 118 | 0.613688 |
f81abcf26a185e9baa4215bfd62f0f24a62c44cc | 1,447 | #!/usr/bin/env ruby
$:.unshift(File.join("..", "lib"))
# Enter notes using MIDI input
require "diamond"
# Select the MIDI input that your controller or other device is connected to
#
# here is an example that explains a bit more about selecting devices with unimidi:
# http://github.com/arirusso/unimidi/blob/master/... | 29.530612 | 102 | 0.731168 |
e93b8234d739788b5ef6a8fa2ca0a782695035a7 | 1,578 | # encoding: utf-8
class BookpdfUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
#storage :file
if Rails.env.development? || Rails.env.test?
storage :... | 28.690909 | 81 | 0.685044 |
b93ed21a5f48c346e1bc079b3773fc589598d85a | 890 | require "spec_helper"
describe Saml::ComplexTypes::LocalizedNameType do
let(:localized_name_type) { FactoryGirl.build(:localized_name_type_dummy) }
describe "Required fields" do
[:language].each do |field|
it "should have the #{field} field" do
localized_name_type.should respond_to(field)
... | 30.689655 | 114 | 0.708989 |
7afefaa6932998d2c641ad550c80e5805e662774 | 1,456 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'open3'
def get(fact)
if Gem.win_platform?
require 'win32/registry'
installed_dir =
begin
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Puppet Labs\Puppet') do |reg|
# rubocop:disable Style/RescueModifier
# Rescu... | 25.103448 | 88 | 0.62706 |
ff1c0889654888dcc385427a5425e41b86d42d8a | 3,693 | class Protobuf < Formula
desc "Protocol buffers (Google's data interchange format)"
homepage "https://github.com/protocolbuffers/protobuf/"
url "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-all-3.14.0.tar.gz"
sha256 "6dd0f6b20094910fbb7f1f7908688df01af2d4f6c5c21331b9f636048674a... | 35.509615 | 134 | 0.714054 |
bb4f0760262836b2a209fe2ad39a88d8dcc83fc8 | 3,566 | module SoberSwag
class Compiler
##
# This compiler transforms a {SoberSwag::Controller::Route} object into its associated OpenAPI V3 definition.
# These definitions are [called "paths" in the OpenAPI V3 spec](https://swagger.io/docs/specification/paths-and-operations/),
# thus the name of this compile... | 28.301587 | 129 | 0.57263 |
1ac6c59088ba1c35827f97b43eb26b0b8add8016 | 427 | require File.expand_path('../../../../spec_helper', __FILE__)
describe :numeric_conj, :shared => true do
before(:each) do
@numbers = [
20, # Integer
398.72, # Float
Rational(3, 4), # Rational
bignum_value,
infinity_value,
nan_value
]
end
it "return... | 20.333333 | 61 | 0.569087 |
281658e92dd86df794cad9bb24e43082bc4e8aac | 210 | class CreateAnswervotes < ActiveRecord::Migration
def change
create_table :answervotes do |t|
t.integer :answer_id
t.integer :user_id
t.integer :answer_vote_count
t.timestamps
end
end
end
| 16.153846 | 49 | 0.738095 |
bf0978b77a496908d15eea9aa9c25c1239444855 | 3,221 | # frozen_string_literal: true
require 'glimmer-dsl-libui'
include Glimmer
window('Grid') {
tab {
tab_item('Span') {
grid {
4.times do |top_value|
4.times do |left_value|
label("(#{left_value}, #{top_value}) xspan1\nyspan1") {
left left_value
top t... | 29.550459 | 146 | 0.524061 |
d559932205e4f8adfb99c5946bf2e683f83dd2e2 | 169 | # TODO: flag game as finished instead of GameOver
class GameOver < StandardError; end
class InvalidGameState < StandardError; end
class InvalidHint < StandardError; end
| 33.8 | 49 | 0.810651 |
01d5cf08b0afefbc662115e44b860cc9e30663b1 | 68 | require 'rubygems'
require 'aws-sdk-rds'
require 'aws-sdk-redshift'
| 17 | 26 | 0.764706 |
e8cb22952053c5a6db14f5ea2ae57db0326b0aea | 1,412 | #!/usr/bin/env ruby
require 'aws-sdk'
Dir.chdir File.expand_path File.dirname(__FILE__)
slug = ARGV.join
config = File.read("aws/#{slug}.profile")
if !config
puts "No config file found for #{slug}"
exit
end
access_key_id = config.match(/AWS_ACCESS_KEY=(.+)/)[1]
secret_access_key = config.match(/AWS_SECRET_KEY=... | 29.416667 | 129 | 0.674929 |
bb44d0613623c014fd735ed9dc6895e1c6a0b485 | 2,250 | # NOTE: file contains code adapted from **sqlserver** adapter, license follows
=begin
Copyright (c) 2008-2015
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... | 33.088235 | 90 | 0.732444 |
e81ade0eda287bcedbba6fec852fa7132e17656c | 1,250 | require 'formula'
class KyotoTycoon < Formula
homepage 'http://fallabs.com/kyototycoon/'
url 'http://fallabs.com/kyototycoon/pkg/kyototycoon-0.9.56.tar.gz'
sha1 'e5433833e681f8755ff6b9f7209029ec23914ce6'
option "no-lua", "Disable Lua support"
depends_on 'lua' unless build.include? "no-lua"
depends_on 'ky... | 28.409091 | 93 | 0.6344 |
f810041a5e71416d9f32da8bfe5557c3cec9aef6 | 1,076 | class UpdateTasksThread < BaseThread
def go
$log.debug('Update tasks')
check_tasks(:delete)
check_tasks(:copy)
end
def check_tasks(type)
count = 0
limit = FC::Var.get("daemon_tasks_#{type}_group_limit", 1000).to_i
tasks = (type == :copy ? $tasks_copy : $tasks_delete)
$storages.sele... | 35.866667 | 83 | 0.604089 |
181907452e43cfbd01ccb973ae99bec42c1938ad | 44 | module TabloConnect
VERSION = "0.0.4"
end
| 11 | 19 | 0.704545 |
333d5ab1254b6e5e13bad6946969d95328bc2b29 | 934 | require 'fpm'
class Dockly::Rpm < Dockly::Deb
logger_prefix '[dockly rpm]'
dsl_attribute :os
default_value :deb_build_dir, 'rpm'
default_value :os, 'linux'
def output_filename
"#{package_name}_#{version}.#{release}_#{arch}.rpm"
end
def startup_script
scripts = []
bb = Dockly::BashBuilder.ne... | 25.944444 | 85 | 0.689507 |
b94761e7186da3ca9c5f48462e196775a9bd0fb6 | 1,580 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2009 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
#
# htt... | 26.333333 | 74 | 0.629114 |
5d9e543e1f72ce6056d1193c06f64b36cd4d20cc | 1,738 | class Kubie < Formula
desc "Much more powerful alternative to kubectx and kubens"
homepage "https://blog.sbstp.ca/introducing-kubie/"
url "https://github.com/sbstp/kubie/archive/v0.13.0.tar.gz"
sha256 "0a26554a211517cead3ed8442dfa10e000de428983c6c0d8975e230cec2d58b1"
license "Zlib"
livecheck do
url :st... | 31.6 | 117 | 0.688723 |
5db4acfddbb5ece1ac4145bf86f9d0b86ba9beb5 | 549 | Pod::Spec.new do |s|
s.name = 'BNHtmlPdfKit'
s.version = '0.6.3'
s.platform = :ios
s.summary = 'Easily turn HTML data from an HTML string or URL into a PDF file on iOS.'
s.homepage = 'https://github.com/brentnycum/BNHtmlPdfKit'
s.author = { 'Brent Nycum' => 'brentnycum@gmail.... | 42.230769 | 95 | 0.590164 |
2142b7b52755949e7040c754fa2b129cfda9aa97 | 1,470 | # frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20180420010616_cleanup_build_stage_migration.rb')
describe CleanupBuildStageMigration, :migration, :redis do
let(:migration) { spy('migration') }
before do
allow(Gitlab::BackgroundMigration::MigrateBuildStage)
... | 26.25 | 91 | 0.681633 |
39502e07948fa022c6535bd834494880338161c9 | 2,167 | require 'spec_helper'
RSpec.describe DarkPrism::Config::MainConfig do
let(:instance) { DarkPrism::Config::MainConfig.instance }
it 'returns a Config instance' do
expect(instance)
.to be_a(DarkPrism::Config::MainConfig)
end
it 'returns a GcloudConfig instance' do
expect(Google::Cloud::Pubsub).to... | 24.908046 | 123 | 0.666359 |
b9fb1e40d003642382920ee76c6589e6a956763a | 366 | class Segment
attr_accessor :key, :translation, :language
def initialize(key, translation, language)
@key = key
if translation.nil?
puts 'empty translation of key:' + key
@translation = ''
else
@translation = translation.replace_escaped
end
@language = language
en... | 17.428571 | 48 | 0.631148 |
7a15dd1ae8b6f24654a523644e4d52ae5280d7a0 | 333 | # encoding: UTF-8
# frozen_string_literal: true
# This file is auto-generated from the current state of VCS.
# Instead of editing this file, please use bin/gendocs.
module Peatio
class Application
GIT_TAG = '2.3.33'
GIT_SHA = '821321f'
BUILD_DATE = '2019-09-18 16:47:34+00:00'
VERSION = GIT_T... | 23.785714 | 60 | 0.684685 |
ff4e00df83f8edc75d8084756dde4528587eb55a | 1,787 | class AuthTokensController < ApplicationController
before_action :set_auth_token, only: [:show, :edit, :update, :destroy]
authorize_resource only: [:new, :edit, :create, :update, :destroy]
# GET /auth_tokens
# GET /auth_tokens.json
def index
@auth_tokens = AuthToken.all
end
# GET /auth_tokens/1
# ... | 25.898551 | 99 | 0.691102 |
e844a2f719064c2e014190b7f7cfdd1107ca502f | 440 | class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your... | 36.666667 | 73 | 0.761364 |
7ac5b1c0c3e2e1fcc96de5b3736cba8f15b24e17 | 10,107 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'openssl'
class Metasploit3 < Msf::Aux... | 21.413136 | 103 | 0.565845 |
62ea522cdef6fda0b1747b4f3298533d07c2dce8 | 373 | require 'test/unit'
require 'jr/cli/core_ext/enumerator'
class EnumerableTest < Test::Unit::TestCase
sub_test_case '#size' do
test 'returns number of elements' do
enumerator = Enumerator.new do |yielder|
yielder.yield 1
yielder.yield 2
yielder.yield 3
end
assert do
... | 19.631579 | 46 | 0.635389 |
8702d7649cfcbe87af5a97cabf5541e14913a73d | 1,495 | class Hadolint < Formula
desc "Smarter Dockerfile linter to validate best practices"
homepage "https://github.com/hadolint/hadolint"
url "https://github.com/hadolint/hadolint/archive/v1.22.1.tar.gz"
sha256 "d24080c9960da00c7d2409d51d0bbe8b986e86be345ed7410d6ece2899e7ac01"
license "GPL-3.0-only"
bottle do
... | 31.808511 | 121 | 0.729097 |
e9169676c6246bfdd231b40b2a6bc2583bef627f | 326 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe UntilGlobalExpiredJob do
it_behaves_like "sidekiq with options" do
let(:options) do
{
"retry" => true,
"lock" => :until_expired,
}
end
end
it_behaves_like "a performing worker" do
let(:args) { "one" }
en... | 18.111111 | 43 | 0.638037 |
87030ebc75ce84355cfc725f63225d0c1dfbc994 | 891 | class Lib3ds < Formula
desc "Library for managing 3D-Studio Release 3 and 4 '.3DS' files"
homepage "https://code.google.com/p/lib3ds/"
url "https://lib3ds.googlecode.com/files/lib3ds-1.3.0.zip"
sha256 "f5b00c302955a67fa5fb1f2d3f2583767cdc61fdbc6fd843c0c7c9d95c5629e3"
bottle do
cellar :any
revision 1
... | 34.269231 | 95 | 0.741863 |
ac712234b27c55b4995c598edea5ad5893983c6e | 1,607 | namespace :gitlab do
namespace :app do
desc "GITLAB | Check gitlab installation status"
task :status => :environment do
puts "Starting diagnostic"
git_base_path = Gitlab.config.git_base_path
print "config/database.yml............"
if File.exists?(File.join Rails.root, "config", "data... | 25.507937 | 86 | 0.546982 |
ed59ee179b9db21ecb4b2ebafc278c7b1760e7fd | 189 | require 'spec_helper_acceptance'
describe 'cis_hardening__accounts class' do
context 'default parameters' do
it 'behaves idempotently' do
idempotent_apply(pp)
end
end
end | 21 | 43 | 0.756614 |
6206e3a20b3d3e65758f0e8eb1753a62297ed3b7 | 1,465 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.afilias-grs.info/bz/status_available.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_helper'
... | 33.295455 | 89 | 0.724232 |
28e13a556125a4bb1c7ce18a3c7d0bc9bffa774e | 1,696 | CapybaraScreenshotTest::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# 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... | 42.4 | 85 | 0.78066 |
917a11a0ac6b7961dfdf0dd8af13280791973b2b | 710 | require "configurations"
require 'require_all'
require "ruflow/version"
require "ruflow/type_checker"
require "ruflow/action"
require "ruflow/flow"
require "ruflow/error/bad_return"
require "ruflow/error/mismatch_input_type"
require "ruflow/error/mismatch_output_type"
require "ruflow/error/mismatch_output_input_type"... | 21.515152 | 67 | 0.760563 |
03b10a60484b18ffcdcb12f427dfcd13da620f20 | 4,310 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/analytics/data/v1alpha/analytics_data_api.proto for package 'google.analytics.data.v1alpha'
# Original file comments:
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | 54.556962 | 168 | 0.695824 |
214a8f91462b2d66b6ef999cf31d437e0cd8ed20 | 272 | class CreateCategorizations < ActiveRecord::Migration[6.0]
def change
create_table :categorizations do |t|
t.references :article, null: false, foreign_key: true
t.references :category, null: false, foreign_key: true
t.timestamps
end
end
end
| 24.727273 | 60 | 0.709559 |
bb657d19684d4d8de2ca3658ca8abe6b330ab550 | 183 | Rails.application.routes.draw do
root 'top#show'
post 'mortor/control'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
| 30.5 | 102 | 0.759563 |
e8d9bd6f3b7e9703dfc831b6355e1e25a9409034 | 287 | Sequel.migration do
up do
drop_index :measure_components_oplog, :measure_sid
drop_index :measure_components_oplog, :duty_expression_id
end
down do
add_index :measure_components_oplog, :measure_sid
add_index :measure_components_oplog, :duty_expression_id
end
end
| 23.916667 | 61 | 0.794425 |
ede84161de3eee4ef5c23118ab78c7e6bbfabf65 | 1,874 | require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php55Molten < AbstractPhp55Extension
init
desc "PHP extension for Molten"
homepage "https://github.com/chuan-yun/Molten"
url "https://github.com/chuan-yun/Molten/archive/v0.1.1.tar.gz"
sha256 "9502d915c406326ce16fc2bc428a04188c... | 33.464286 | 93 | 0.723052 |
bb7002ae95142a5ab6ecc5bef5b7d19173107b10 | 953 | require "forwardable"
module Rucc
class FileIOList
extend Forwardable
# @param [FileIO] file
def initialize(file)
@files = [file]
@stashed = [] # buffer for stashed files
end
delegate [:push, :first, :last] => :@files
# @return [FileIO]
def current
@files.last
end... | 16.719298 | 47 | 0.534103 |
ffb03b0838da9befad2dcf9cebd7edf1d8a3e2db | 2,479 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
def initialize(info = {})
... | 28.494253 | 99 | 0.578862 |
6adcfc5269138ee94de893f9a575a475b4ee0f29 | 30,826 | require_relative "spec_helper"
describe "Sequel::Model()" do
before do
@db = Sequel::Model.db
end
it "should return a model subclass with the given dataset if given a dataset" do
ds = @db[:blah]
c = Sequel::Model(ds)
c.superclass.must_equal Sequel::Model
c.dataset.row_proc.must_equal c
end... | 31.61641 | 139 | 0.664439 |
0384c741cd1d3e6f3982c05556d485daeee1ba56 | 2,052 | # frozen_string_literal: true
module SearchObject
module Plugin
module Graphql
def self.included(base)
raise NotIncludedInResolverError, base unless base.ancestors.include? GraphQL::Schema::Resolver
base.include SearchObject::Plugin::Enum
base.extend ClassMethods
end
a... | 32.0625 | 121 | 0.647661 |
01abd2891e96bff343d029ecdff521750e9ceacb | 464 | module Fog
module Parsers
module AWS
module Elasticache
require 'fog/aws/parsers/elasticache/cache_cluster_parser'
class SingleCacheCluster < CacheClusterParser
def end_element(name)
case name
when 'CacheCluster'
@response[name] = @cache_clust... | 21.090909 | 66 | 0.551724 |
18e5d3f09eb1a167ab1b05a885a4edaaece89e3c | 194 | require 'spec_helper'
describe CurationConcern::ImageActor do
# Can't include this spec because Image doesn't have linked_resources
#include_examples 'is_a_curation_concern_actor', Etd
end
| 27.714286 | 71 | 0.819588 |
620dee4626cf2d9c437e15afa82a00ecdc841930 | 9,010 | # Tabulous gives you an easy way to set up tabs for your Rails application.
#
# 1. Configure this file.
# 2. Add <%= tabs %> and <%= subtabs %> in your layout(s) wherever you want
# your tabs to appear.
# 3. Add styles for these tabs in your stylesheets.
# 4. Profit!
Tabulous.setup do |config|
#-------... | 48.44086 | 165 | 0.483352 |
267e56a723de9ab7b1d42950e3228a3c390dd41d | 84 | class ApplicationController < ActionController::Base
include SessionsHelper
end
| 12 | 52 | 0.833333 |
01c09f4e470b9be301c3c105ac669eaa70ddc1df | 196 | class CreateJointTable < ActiveRecord::Migration
def change
create_table(:shoes_stores) do |t|
t.belongs_to(:shoe)
t.belongs_to(:store)
t.timestamps()
end
end
end
| 15.076923 | 48 | 0.658163 |
ab65c2bae56040c01ecf472f3c73ef8eaf205fb4 | 3,406 | #####################################################################
# Attempt to check for the deprecated ruby-atomic gem and warn the
# user that they should use the new implementation instead.
if defined?(Atomic)
warn <<-RUBY
[ATOMIC] Detected an `Atomic` class, which may indicate a dependency
on the ruby-atomic... | 37.021739 | 100 | 0.592777 |
61bb4bca9bd8d9fac8db2463e8473244631ace4a | 1,047 | class SessionsController < ApplicationController
def new
if session[:user_id]
current_user
redirect_to user_path(@user)
end
end
def create
if session[:user_id]
current_user
redirect_to user_path(@user)
elsif params[:code]
@user = User.find_or_create_by(uid: auth['ui... | 20.94 | 62 | 0.602674 |
1c149028467875307241705355d1bc50ba825b75 | 162 | # frozen_string_literal: true
require_dependency "renalware/snippets"
module Renalware
module Snippets
class SnippetPolicy < BasePolicy
end
end
end
| 14.727273 | 39 | 0.777778 |
ede5a83363f411fe2b15248acf73183ee794c430 | 86 | module MuseumProvenance
# Version number for this gem
VERSION = "0.2.0.alpha"
end
| 17.2 | 31 | 0.732558 |
623a12e24aa7e656992b23fa1aa731b4fd26d329 | 120 | require "kaplan_meier/version"
require "kaplan_meier/survival"
# module KaplanMeier
# # Your code goes here...
# end
| 17.142857 | 31 | 0.741667 |
613420deaaafb43d480f395d3c6e037c17bbb6bb | 1,614 | require 'spec/spec_helper'
class RiddleSpecConnectionProcError < StandardError; end
describe "Sphinx Client" do
before :each do
@client = Riddle::Client.new("localhost", 9313)
end
after :each do
Riddle::Client.connection = nil
end
describe '.connection' do
it "should use the given block" do
... | 27.355932 | 62 | 0.657993 |
61bac23256f38ef9ec0f11d3bb10518233fbc7d9 | 3,815 | require 'caracal/core/models/namespace_model'
require 'caracal/errors'
module Caracal
module Core
# This module encapsulates all the functionality related to registering and
# retrieving namespaces.
#
module Namespaces
def self.included(base)
base.class_eval do
#-----------... | 41.923077 | 120 | 0.472084 |
d553449c0619e14701d3f14646b6d4313aed6bdb | 226 | module Gws::Addon::Schedule::Todo::CommentPost
extend ActiveSupport::Concern
extend SS::Addon
included do
has_many :comments, class_name: 'Gws::Schedule::TodoComment', dependent: :destroy, validate: false
end
end
| 25.111111 | 102 | 0.747788 |
398e88a1918ce89f2c0625bd71e7c45fe2898f44 | 240 | class Feedback < ActiveRecord::Base
belongs_to :user
belongs_to :post
validates :owner_comment, uniqueness: { scope: [ :user_id, :owner_id ]}
validates :owner_comment, uniqueness: { scope: [ :post_id, :owner_id ]}
end | 24 | 76 | 0.683333 |
0198a2cabb8ba139db3b8adb63cd386ba097161e | 6,971 | # frozen_string_literal: true
# encoding: utf-8
# Copyright (C) 2014-2020 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
#
# Un... | 30.845133 | 106 | 0.599053 |
ed21f8d052af7db52da366646eed8c6e7d90c5aa | 5,167 | #
# Be sure to run `pod spec lint Corridor.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.co... | 37.992647 | 179 | 0.604219 |
39c419e9f310563d30320fde7c46724051cad3e9 | 1,375 | class Scraper
attr_accessor :city_array, :article_array
def self.cities_scraper
@city_array = []
doc = Nokogiri::HTML(open("https://www.eater.com/cities-directory"))
cities = doc.css("div.c-directory__short-body")
cities.each do |city|
city_hash = {
:name => city.search("h2").text,
... | 35.25641 | 162 | 0.634182 |
1165b0935539d5a62479172c4c0e632f3781d242 | 3,285 | CONSTRUCTOR_VERSION = '1.0.0'
class Class
def constructor(*attrs)
# Look for embedded options in the listing:
opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) }
do_acc = opts.nil? ? false : opts[:accessors] == true
require_args = opts.nil? ? true : opts[:strict] != false
super_args =... | 30.700935 | 81 | 0.618874 |
ab49b81dba89bc8d0bc9446201b63e5ffabbadac | 4,762 |
class CsvReader
class Converter
# A Regexp used to find and convert some common Date formats.
DATE_MATCHER = / \A(?: (\w+,?\s+)?\w+\s+\d{1,2},?\s+\d{2,4}
|
\d{4}-\d{2}-\d{2} )\z
/x
# A Regexp used to find and convert some c... | 30.525641 | 98 | 0.49685 |
1c1e05370511820b3f8cf9cae81c9c82b5f82cab | 6,702 | # frozen_string_literal: true
require 'discordrb'
class NicknamerModule
def register_user_commands
nicknamer_commands
end
def nicknamer_commands
@app_class.register_user_cmd(:nicknamer, %w[nicknamer nickname nick]) do |_command, args, event|
language = @language.get_json(event.server.id)['command... | 31.613208 | 184 | 0.612802 |
bf3709f41e607e7a16d8f1203ca7a35a930f8c0e | 139 | class AddShortDescriptionToDevsite < ActiveRecord::Migration
def change
add_column :dev_sites, :short_description, :string
end
end
| 23.166667 | 60 | 0.798561 |
796b27ebd98e7ce41d818fb2e213e250e57c501e | 4,452 | # #Company class used for create company for add users to work
class CompaniesController < ApplicationController
before_action :set_company, only: %i[show edit update]
before_action :set_company_reports, only: %i[report_employees send_report]
before_action :authenticate_user!, except: %i[accept_invitation_to_comp... | 30.493151 | 159 | 0.666891 |
01ef6026a302c0125b2d622e7c11bdb78b702ae4 | 537 | atom_feed do |feed|
feed.title "Upcoming Open Source Rails Projects"
@upcoming.each do |upcoming|
feed.entry(upcoming, :published => upcoming.promoted_at, :updated => upcoming.promoted_at) do |entry|
entry.title(upcoming.title)
entry.content(image_tag(AppConfig.site_url+upcoming.preview_url, :style ... | 41.307692 | 194 | 0.703911 |
391b817e818a006e07480be9b923c1af4327dab5 | 6,844 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 26.42471 | 78 | 0.59775 |
ac54cb779d8f0ef0e54b33f809a7420d760719b6 | 1,727 | # -*- coding: utf-8 -*-
class IniFile
def initialize(fileName)
@fileName = fileName
getInfos
end
def getInfos
@infos = {}
lines = []
if File.exist?(@fileName)
lines = File.readlines(@fileName)
end
section = nil
lines.each do |line|
case line
when /^;/
... | 16.140187 | 46 | 0.552982 |
332222baa35cf5ebdf891af48a11a13188d0ed46 | 2,051 | # lib/bronze/entities/associations/builders/has_one_builder.rb
require 'bronze/entities/associations/builders/association_builder'
require 'bronze/entities/associations/metadata/has_one_metadata'
module Bronze::Entities::Associations::Builders
# Service class to define has_one associations on an entity.
class Has... | 32.046875 | 73 | 0.735251 |
0811a8ec5cd7869f25a321348ae7e803f2f65eef | 2,261 | ##
# 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 = AverageRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
... | 26.916667 | 119 | 0.528969 |
1ca0bdb25030b010c26598cc8285d58db2695f67 | 279 | require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get home" do
get static_pages_home_url
assert_response :success
end
test "should get help" do
get static_pages_help_url
assert_response :success
end
end | 21.461538 | 65 | 0.774194 |
e83b7ff02bc3e9fe62a2459e1dbd93d4deef90d5 | 1,574 | # frozen_string_literal: true
module ActiveRecord
module AttributeMethods
module Read
extend ActiveSupport::Concern
module ClassMethods # :nodoc:
private
def define_method_attribute(name, owner:)
ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method(... | 34.217391 | 106 | 0.625159 |
088be540e07ac9c6a41e657836884e88e41eec38 | 169 | module Netzke
module Core
module Version
MAJOR = 0
MINOR = 7
PATCH = 5
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
end
end
| 14.083333 | 54 | 0.556213 |
1dd6ab5acf44599a05f7790d76c35a6fe55924a3 | 528 | class Review < ApplicationRecord
belongs_to :product
belongs_to :user
has_many :manufacturers, through: :products
accepts_nested_attributes_for :product, update_only: true
validates :rating, presence: true, numericality: {greater_than_or_equal_to: 1, less_than_or_equal_to: 10}
validates :comment, presence: ... | 33 | 107 | 0.731061 |
1d98814b5c91cb008f9ad8f97b12fab9eb1f9a47 | 4,384 | class Grafana < Formula
desc "Gorgeous metric visualizations and dashboards for timeseries databases"
homepage "https://grafana.com"
url "https://github.com/grafana/grafana/archive/v6.4.2.tar.gz"
sha256 "28f961f7b2c68e5961561fca99dd02a03382503a6179df9b62487df2501e171f"
head "https://github.com/grafana/grafana... | 32.474074 | 341 | 0.639827 |
3966a8ab5ad9f43ab1da07e4d87410b5abb9b61d | 1,643 | class Hbc::CLI::Install < Hbc::CLI::Base
def self.run(*args)
cask_tokens = cask_tokens_from(args)
raise Hbc::CaskUnspecifiedError if cask_tokens.empty?
force = args.include? '--force'
skip_cask_deps = args.include? '--skip-cask-deps'
retval = install_casks cask_tokens, force, skip_cask_deps
# ... | 29.872727 | 106 | 0.669507 |
e8402ea7861f36f058d84114360a2c4b42a8fa97 | 290 | def parse_dependency_versions(provision_cookbook)
new_dependencies = {}
run_context.cookbook_collection[provision_cookbook].metadata.dependencies.each do |cookbook, md_version|
version = md_version.split(" ")[1]
new_dependencies[cookbook] = version
end
new_dependencies
end
| 32.222222 | 106 | 0.793103 |
e2c9a7cd9c4f0a8dde203bc4913786e31d5a9502 | 1,101 | # frozen_string_literal: true
require_relative "../../concourse-objects"
module ConcourseObjects
module Resources
class DeployGate < Resource
RESOURCE_NAME = "deploygate"
RESOURCE_LICENSE = "MIT"
GITHUB_OWNER = "YuukiARIA"
GITHUB_REPOSITORY = "YuukiARIA/concourse-deploygate-res... | 28.230769 | 67 | 0.627611 |
ab0b9eaaea47f0b28a6189f03ee85c116d6f439f | 2,010 | require 'time'
require 'date'
require 'tzinfo'
require 'active_support/core_ext/time/zones'
require 'active_support/core_ext/time/calculations'
require 'active_support/time_with_zone'
require 'active_support/core_ext/object/try'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/hash/keys'
... | 28.309859 | 88 | 0.700498 |
7aca59d700160f2e4aab0e3efe27209af67e8b28 | 2,007 |
Pod::Spec.new do |s|
# 库名字
s.name = "LFBPageController"
# 库的版本
s.version = "1.0.0"
# 库摘要
s.summary = "一款仿网易标题滚动切换页面的框架"
# 库描述
s.description = <<-DESC
简单易容的标题滚动切换页面框架,通过点击标题或者滑动页面,切换页面和标题...
DESC
# 远程仓库地址,即GitHub地址,或者你使用的其他Gitlab地址
s.homepag... | 24.777778 | 109 | 0.653214 |
e9f99233d447342603fc4cb92acd93399525410c | 105 | require 'fog/volume/openstack/requests/replace_metadata'
require 'fog/volume/openstack/v1/requests/real'
| 35 | 56 | 0.838095 |
1d69c3fb5825171dc039705687685c6aed185f3a | 684 | class Api::V1::UsersController < ApplicationController
def new
user = User.new
render json: user, status: 200
end
def create
user = User.new(user_params)
if user.save
log_in(user)
cookies["logged_in"] = true
render json: user, exc... | 22.8 | 75 | 0.557018 |
1cbc6c2837938a947f7a6508f7e5785bf218cbfa | 757 | require "rspec/expectations"
RSpec::Matchers.define :have_delivered_notification do |notification_type|
supports_block_expectations
match do |proc|
raise ArgumentError, "have_delivered_notification only supports block expectations" unless proc.respond_to?(:call)
expected_attributes = {
type: notifi... | 30.28 | 118 | 0.775429 |
bfd3bd22cd2f608b1a81e21b55875833db377831 | 80 | class RecipeTag < ActiveRecord::Base
belongs_to :recipe
belongs_to :tag
end
| 16 | 36 | 0.775 |
f80e72249cb06b48d8f9410a65ecc6c57bcc1d62 | 853 | class StaticPagesController < ApplicationController
def home
if user_signed_in?
redirect_to :controller => 'dashboard', :action => 'index'
end
if company_signed_in?
redirect_to :controller => 'dashboard_empresa', :action => 'index'
end
@title = 'GetXp'
@jumbotron = 'Nossa mi... | 30.464286 | 226 | 0.710434 |
39f7357bf6cc111ae2d61524185132fd2a4d4945 | 2,615 | class Jrnl < Formula
desc "Command-line note taker"
homepage "https://maebert.github.io/jrnl/"
url "https://github.com/maebert/jrnl/archive/1.9.7.tar.gz"
sha256 "789de4bffe0c22911a4968e525feeb20a6c7c4f4fe762a936ce2dac2213cd855"
bottle do
cellar :any_skip_relocation
sha256 "b5f24dc1ba2c58e7a9cebd7ae04... | 36.830986 | 94 | 0.764436 |
e8da29e1cb7665210c3303935ebec47eb0f8a770 | 176 | class AddMissingReadingsLimitToAmrDataFeedConfig < ActiveRecord::Migration[6.0]
def change
add_column :amr_data_feed_configs, :missing_readings_limit, :integer
end
end
| 29.333333 | 79 | 0.823864 |
ac8c236e1784494f51d8ce2087d1ff1596ac4070 | 463 | require_relative "pyrite/version"
require_relative "pyrite/parser"
require_relative "pyrite/transformer"
require_relative "pyrite/cli"
module Swift
module Pyrite
def self.generate_fake_for(file_path, output_path)
code = File.read(file_path)
parser = Parser.new
ast = parser.parse(code)
t... | 21.045455 | 54 | 0.699784 |
f871b221564954b9506cc169f3263951694c9750 | 12,931 | =begin
Wallee API: 1.0.0
The wallee API allows an easy interaction with the wallee web service.
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... | 30.714964 | 342 | 0.628412 |
ff71920d0443a6967f98250c24476e704bc30092 | 7,978 | # encoding: utf-8
require 'spec_helper'
describe "URL validation" do
before(:all) do
ActiveRecord::Schema.define(version: 1) do
create_table :users, force: true do |t|
t.column :homepage, :string
end
end
end
after(:all) do
ActiveRecord::Base.connection.drop_table(:users)
end
... | 23.886228 | 79 | 0.618576 |
2146d1fc8ccbd4eaaa9d02c30b306592e5e374cb | 107 | Rails.application.routes.draw do
mount ActiveRecordVisualizer::Engine => "/active_record_visualizer"
end
| 26.75 | 69 | 0.82243 |
d5f422b12ca79976fe89d4346febbe996ab6d884 | 10,404 | require 'secure_random_string'
module Authie
class Session < ActiveRecord::Base
# Errors which will be raised when there's an issue with a session's
# validity in the request.
class ValidityError < Error; end
class InactiveSession < ValidityError; end
class ExpiredSession < ValidityError; end
... | 30.781065 | 136 | 0.661669 |
87c4b5bb94759b1edcca237c4eb0438051bf0749 | 1,165 | # see https://stripe.com/docs/checkout/guides/sinatra
require 'sinatra'
require 'stripe'
set :publishable_key, ENV['STRIPE_PUBLISHABLE_KEY']
set :secret_key, ENV['STRIPE_SECRET_KEY']
Stripe.api_key = settings.secret_key
get '/' do
erb :index
end
post '/charge' do
@amount = 500
customer = Stripe::Customer.... | 18.790323 | 79 | 0.614592 |
e8a192f2692765d3f08f078d8b4eca751157eb42 | 1,221 | cask "font-genshingothic" do
version "20150607,8.637"
sha256 "b8e00f00a6e2517bfe75ceb2a732b596fe002457b89c05c181d6b71373aada58"
# osdn.jp/ was verified as official when first introduced to the cask
url "https://osdn.dl.osdn.jp/users/#{version.after_comma.major}/#{version.after_comma.no_dots}/genshingothic-#{ve... | 38.15625 | 139 | 0.774775 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.