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 |
|---|---|---|---|---|---|
3975e969d1f757eb9d749d70e45dfb618d21d228 | 681 | module AMQ
module Protocol
TLS_PORT = 5671
SSL_PORT = 5671
# caching
EMPTY_STRING = "".freeze
PACK_INT8 = 'c'.freeze
PACK_CHAR = 'C'.freeze
PACK_UINT16 = 'n'.freeze
PACK_UINT16_X2 = 'n2'.freeze
PACK_UINT32 ... | 27.24 | 42 | 0.515419 |
f8ace6338767af6e4d19dc456b8256205b1ae61a | 14,452 | require "spec_helper"
require "ohai"
module Omnibus
describe Project do
subject do
described_class.new.evaluate do
name "sample"
friendly_name "Sample Project"
install_dir "/sample"
maintainer "Sample Devs"
homepage "http://example.com/"
build_version "1.0"
... | 32.187082 | 108 | 0.634445 |
185cf460c2c269ffa72dacfea714ca07db8084a6 | 2,837 | # Integer : shrink to zero
class Integer
def shrink
shrunk = if self > 8
self / 2
elsif self > 0
self - 1
elsif self < -8
(self + 1) / 2
elsif self < 0
self + 1
else
0
end
shrunk
... | 14.623711 | 75 | 0.541065 |
081295495b9ac6fad6ef7a1213b37328df2e72b2 | 106 | FactoryGirl.define do
factory :daycare do
name 'My Daycare'
structure 'home'
user
end
end
| 13.25 | 21 | 0.669811 |
bfedc2f0b504e8d36ff06e69a0858997d1c9e2e2 | 129 | # TODO: NOT WORKING
factorial = Proc.new do |num|
if num == 1
num
else
factorial.(num-1)
end
end
p factorial.(5)
| 10.75 | 29 | 0.604651 |
38bd6da54726e080736a8c92270a48b9350a6443 | 1,863 | #
# Copyright (C) 2010-2016 dtk contributors
#
# This file is part of the dtk project.
#
# 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
#
# Unles... | 26.614286 | 89 | 0.615674 |
08803b4df331a309d75a293c58cbb582760aee39 | 281 | class MacpawGemini < Cask
version :latest
sha256 :no_check
url 'http://dl.devmate.com/download/com.macpaw.site.Gemini/macpaw%20gemini.dmg'
appcast 'http://updates.devmate.com/com.macpaw.site.Gemini.xml'
homepage 'http://macpaw.com/gemini'
app 'MacPaw Gemini.app'
end
| 25.545455 | 81 | 0.743772 |
1c7986db175dba7e679f9c5f0043f46173a8cf8d | 403 | class CreateFocuses < ActiveRecord::Migration
def change
create_table :focuses, id: false do |t|
t.integer :id, null: false
t.string :type, null: false
t.string :section
t.string :name, null: false
t.string :description
t.integer :comments_count, default: 0
t.json :data, ... | 25.1875 | 45 | 0.620347 |
39daf84b1a56a09b36f0684ccac707b78ac31b62 | 1,855 | require 'spec_helper'
module Refinery
module Pages
describe ContentPagesHelper, :type => :helper do
let(:content_presenter) { double(ContentPresenter, :hide_sections => nil, :fetch_template_overrides => nil, :to_html => nil) }
describe "when rendering content presenter" do
it "asks to conten... | 41.222222 | 132 | 0.684097 |
ac98bb40840f47162aff9c51729908da796de9b3 | 238 | class CreateArtists < ActiveRecord::Migration[5.1]
def change
create_table :artists do |t|
t.string :name
t.string :genre
t.integer :age
t.string :hometown
end
end
def up
end
def down
end
end
| 14 | 50 | 0.621849 |
1c74f99cb4a0f7310014825028d4f75d3a85ce7e | 2,754 | require 'launchpad'
interaction = Launchpad::Interaction.new
current_color = {
:red => :hi,
:green => :hi,
:mode => :normal
}
def update_scene_buttons(d, color)
on = {:red => :hi, :green => :hi}
d.change(:scene1, color[:red] == :hi ? on : {:red => :hi})
d.change(:scene2, color[:red] == :med ? on : ... | 39.913043 | 88 | 0.687001 |
e2f016bd32bb9c993e3e90990d3888d6bf38d075 | 1,135 | module EspSdk
class Configure
attr_accessor :token, :email, :version, :token_expires_at, :end_point, :domain
def initialize(options)
self.email = options[:email]
self.version = options[:version] || 'v1'
self.domain = options[:domain]
self.token = options[:password] || options[:token]
... | 27.682927 | 82 | 0.618502 |
0142bbd34ff1af3fd87d7ed6747c3e87794cb694 | 1,917 | class FontIosevkaSlab < Formula
version "2.3.2"
sha256 "f0fbec19706f38b9f9b751bb3217883340e64b0f1d004fa84d53c4d65d42e11d"
url "https://github.com/be5invis/Iosevka/releases/download/v#{version}/ttc-iosevka-slab-#{version}.zip"
desc "Iosevka Slab"
homepage "https://github.com/be5invis/Iosevka/"
def install
... | 49.153846 | 105 | 0.718832 |
1a1eabaa72605a434743b7938097edc2b2b511c8 | 358 | class FontCagliostro < Cask
version '0'
sha256 '0d205e9a9b34691dca50064ea681404157f1747e39b592fce978b2a32bd5fb61'
url 'https://googlefontdirectory.googlecode.com/hg-history/67342bc472599b4c32201ee4a002fe59a6447a42/ofl/cagliostro/Cagliostro-Regular.ttf'
homepage 'http://www.google.com/fonts/specimen/Cagliostro'... | 35.8 | 140 | 0.829609 |
4ab6a1b73af30376629a81f19a21d91f60e9a423 | 926 | class CreateTwitterUserNewFriendsWorker
include Sidekiq::Worker
prepend TimeoutableWorker
sidekiq_options queue: 'creating_low', retry: 0, backtrace: false
def unique_key(twitter_user_id, options = {})
twitter_user_id
end
def unique_in
10.minutes
end
def expire_in
10.minutes
end
def ... | 23.74359 | 106 | 0.728942 |
4a0e23c618453c8dc9ce78e264a7eb0216a3ad76 | 2,808 | # frozen_string_literal: true
module PasswordManager
# Convert data between several format (site array, json, encrypted)
# Use the given crypters to encrypt / decrypt.
#
# Converter is build from formated data,
# parse and store the data and can be re-use to re-format the data
#
# Encrypting apply the ... | 33.428571 | 99 | 0.672721 |
391231b60f52da39330bc739cd9f91fa9b533775 | 430 | $LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "../../../../lib")))
require 'living_dead'
def run
string = ""
LivingDead.trace(string)
return nil
end
run
alive_count = LivingDead.traced_objects.select { |tracer| tracer.retained? }.length
expected = Integer(ENV["EXPECTED_OUT"] || 0)
actual = alive_c... | 21.5 | 83 | 0.690698 |
62a559dd6177106ea94cbcc66ebc7bf31d7287a6 | 569 | require 'rails_helper'
RSpec.describe User, type: :model do
describe 'A user can be created' do
let(:name) { 'simple name' }
it 'user is valid if it has name' do
user = User.create(name: 'username')
expect(user).to be_valid
end
it 'user is not valid if name is not present' do
user... | 23.708333 | 61 | 0.639719 |
e28e4fa0936f7e41de4e698f069ade01a6d13e5e | 16,290 | # frozen_string_literal: true
require "formula_installer"
require "unpack_strategy"
require "cask/topological_hash"
require "cask/config"
require "cask/download"
require "cask/staged"
require "cask/verify"
require "cask/quarantine"
require "cgi"
module Cask
# Installer for a {Cask}.
#
# @api private
class I... | 29.944853 | 117 | 0.669982 |
bf951cd60b3c2c5067a95fd5e897ae8e5f311570 | 36,843 | # 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
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
... | 39.153029 | 199 | 0.651956 |
f81308e442e71e838384e8705b387829a0f4eb65 | 1,568 | # encoding: UTF-8
lib = File.expand_path('../lib/', __FILE__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
require 'spree_nice_admin/version'
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_nice_admin'
s.version = SpreeNiceAdmin.version
s.summary = 'A... | 35.636364 | 109 | 0.735332 |
61f8b5a81125b1efa36cf0c3fd4a2d76e8fb574e | 1,538 | require_relative '../../helper'
class Repositext
class Services
describe ExtractContentAtMainTitles do
describe 'call' do
[
[
"# *The title*{: .a_class}\n\nAnd a para\n\n",
:plain_text,
false,
'The title'
],
[
... | 26.067797 | 93 | 0.419376 |
873b886c6a2bdba23652cf2c5eff7b293eab7a99 | 534 | cask 'superproductivity' do
version '2.7.7'
sha256 'fb16e40859cff975474063aa8f99afb0e5db7a616198fdfb953c5c0b7d92fe18'
# github.com/johannesjo/super-productivity was verified as official when first introduced to the cask
url "https://github.com/johannesjo/super-productivity/releases/download/v#{version}/superPr... | 41.076923 | 123 | 0.797753 |
79491a116aa4b8c91575b1b85ee6a8028c244a01 | 322 | module ActiveSupport
# Returns the version of the currently loaded Active Support as a <tt>Gem::Version</tt>.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 5
MINOR = 1
TINY = 7
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
en... | 20.125 | 90 | 0.649068 |
ac0554b20f5c90d0b3e378373a3dadc349a1817f | 785 | cask 'taskexplorer' do
version '2.0.1'
sha256 '87867920e2d3bde91df9ebd7e416c20be997dfa707471b8b32732bd856de85fd'
# bitbucket.org/objective-see was verified as official when first introduced to the cask
url "https://bitbucket.org/objective-see/deploy/downloads/TaskExplorer_#{version}.zip"
appcast 'https://obj... | 32.708333 | 90 | 0.73121 |
08d6d312c06e7a087a8d89d8c40db1e202cb0da8 | 292 | cask 'fritzing' do
version '0.9.2b'
sha256 'ad0a23897a761b1342cf1aaae2806109824fbc37d95567aab836877363385fdd'
url "http://fritzing.org/download/#{version}/mac-os-x-105/Fritzing#{version}.dmg"
name 'Fritzing'
homepage 'http://fritzing.org/'
license :gpl
app 'Fritzing.app'
end
| 24.333333 | 83 | 0.743151 |
bb15e68af13b8191c7906c767c5f23cdc26b39af | 9,513 | require 'date'
module Phrase
class LocaleUpdateParameters
# specify the branch to use
attr_accessor :branch
# Locale name
attr_accessor :name
# Locale ISO code
attr_accessor :code
# Indicates whether locale is the default locale. If set to true, the previous default locale the project ... | 33.262238 | 222 | 0.629454 |
1ad3759354db96bb8753a4b6d023bed0a5060bd8 | 1,350 | # frozen_string_literal: true
# Copyright 2021 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 applicabl... | 39.705882 | 91 | 0.800741 |
bbba51449ac250fee429435088303ac1b81656e0 | 1,598 | require File.dirname(__FILE__) + "/../spec_helper"
require 'java'
describe "Loading scripts from jar files" do
# JRUBY-4774, WARBLER-15
it "works with classpath URLs that have spaces in them" do
url_loader = java.net.URLClassLoader.new([java.net.URL.new("file:" + File.expand_path("test/dir with spaces/test_jar... | 38.97561 | 151 | 0.680225 |
086a55fd2608ff223b1040b31166a83d191ecbda | 221 | # frozen_string_literal: true
module Error
# Centralized CLI APP runner custom error handler
class ErrorHandler < Parent::Speaker
def handle(error)
@prompt.send(error.kind, error.message)
end
end
end
| 20.090909 | 51 | 0.728507 |
ed8c9d0ccc9e1d6aabcc50908ce3333025dfbdd6 | 2,636 | require 'test_helper'
class ReppV1ContactsTechReplaceTest < ActionDispatch::IntegrationTest
def setup
@user = users(:api_bestnames)
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
token = "Basic #{token}"
@auth_headers = { 'Authorization' => token }
end
def test_replac... | 38.202899 | 88 | 0.748483 |
910f1965f7014c8e2fbb7b0495689660aed6686b | 1,202 | module Job::SS::Binding::Task
extend ActiveSupport::Concern
included do
# task class
mattr_accessor(:task_class, instance_accessor: false) { SS::Task }
# task
attr_accessor :task_id
around_perform :ready
end
def task
@task ||= begin
return nil if task_id.blank?
self.class.... | 18.78125 | 70 | 0.601498 |
79f12db0196af951b52f761ceaa11034ce71f56c | 73 | require "lol_auth/engine"
module LolAuth
# Your code goes here...
end
| 12.166667 | 26 | 0.726027 |
e8c3d42ce9458479e35fdbb5dc41bbcf0f66c7fb | 350 | module BookTicketComponent
module Messages
module Commands
class BookTicketM
include Messaging::Message
attribute :book_ticket_id, String
attribute :request, Hash # meeeeeh, should be [("mow-led", "galileo"), ("led-par", "sirena"), ("par-lon", "sita")]
attribute :time, Strin... | 25 | 122 | 0.634286 |
f7aac5d43e947fb565d79590e12917978be8a9d2 | 1,917 | shared_examples_for 'dom_only' do |source|
it_should_behave_like 'element'
it_should_behave_like 'inputtable'
it_should_behave_like 'with_node'
it_should_behave_like 'with_dom', source
it "supports #{Arachni::RPC::Serializer}" do
expect(subject).to eq(Arachni::RPC::Serializer.deep_clone( su... | 29.492308 | 83 | 0.568597 |
ff4d719ae63f4bd6cd8c22dc6c5e4a8aeb0ec27b | 6,571 | module RDF; class Literal
##
# An floating point number literal.
#
# @example Arithmetic with floating point literals
# RDF::Literal(1.0) + 0.5 #=> RDF::Literal(1.5)
# RDF::Literal(3.0) - 6 #=> RDF::Literal(-3.0)
# RDF::Literal(Math::PI) * 2 #=> RDF::Li... | 29.466368 | 225 | 0.520012 |
6aac524c62a4982aab8b1f78a5db53343fc6ca5e | 715 | # frozen_string_literal: true
require 'rainbow'
module Root
module Display
# Handle logic for showing the victory points
# Either stack, or all one square?
# Some way to handle it so it's not shifting constantly.
class ActiveQuests
attr_reader :quests
def initialize(quests)
@que... | 21.029412 | 65 | 0.584615 |
08b7740e5c231e3c413d1c65b3cebd234943166d | 2,034 | # Copyright 2010-present Basho Technologies, 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 a... | 27.863014 | 85 | 0.702557 |
39d3e6dbc11394a0e850bfeb7f7964498da606e5 | 282 | class CreateGradeEntryStudentsTas < ActiveRecord::Migration
def self.up
create_table :grade_entry_students_tas, :id => false do |t|
t.integer :grade_entry_student_id
t.integer :ta_id
end
end
def self.down
drop_table :grade_entry_students_tas
end
end
| 21.692308 | 62 | 0.737589 |
e96aa188ee86f22053fa3c63c4df1432c8777c78 | 36 | # placeholder for v0.14 time module
| 18 | 35 | 0.777778 |
e2f1d9e8d1467a78a26dcfed49f3d835e08d6ce1 | 1,811 | # encoding: utf-8
module Mongoid # :nodoc:
module Relations #:nodoc:
module Bindings #:nodoc:
module Embedded #:nodoc:
# Binding class for embeds_one relations.
class One < Binding
# Binds the base object to the inverse of the relation. This is so we
# are referenced to... | 32.339286 | 79 | 0.541137 |
083e89b9194695f696fda91e57ba6f55999d8ed8 | 1,584 | class CustomersController < ApplicationController
def index
render json: fetch_customers, each_serializer: customer_serializer, root: customers_root
end
def show
render_result_for Customer.rpc_find(params[:id])
end
def get_crm_tickets
if tickets = CrmTicket.rpc_fetch(params[:requester_id], fo... | 18.418605 | 92 | 0.707071 |
e9bcd4bc53bf737188253166b732a67118312a13 | 141 | require File.expand_path('../../../spec_helper', __FILE__)
describe "Delegator#!=" do
it "needs to be reviewed for spec completeness"
end
| 23.5 | 58 | 0.716312 |
1a65ebbc617d6ec221be24764399e334630141e8 | 872 | # relationship between a supervisor and volunteer
class SupervisorVolunteer < ApplicationRecord
has_paper_trail
belongs_to :volunteer, class_name: "User"
belongs_to :supervisor, class_name: "User"
validates :supervisor_id, uniqueness: {scope: :volunteer_id} # only 1 row allowed per supervisor-volunteer pair
end... | 30.068966 | 113 | 0.708716 |
286cbd10d5568208f847f9648491757bedb03662 | 61 | code_deploy_agent 'codedeploy-agent' do
action :enable
end
| 15.25 | 39 | 0.803279 |
91e6b07532639445179cba2b1f4bed123d2427a7 | 3,870 | module Cts
module Mpx
# Enumerable collection that can store an entry field in it
# @attribute collection storage for the individual field
# @return [Field[]]
class Fields
include Enumerable
extend Creatable
attribute name: 'collection', kind_of: Array
# Create a new fields... | 31.983471 | 110 | 0.601034 |
f70b820d81bdd4b4ce42149142271c633876723c | 2,029 | # coding: utf-8
require_relative 'lib/autotest-fsevent/version'
Gem::Specification.new do |spec|
spec.name = 'autotest-fsevent'
spec.version = Autotest::FSEvent::VERSION
spec.summary = 'Use FSEvent instead of filesystem polling'
spec.description = <<~END
Autotest relies on filesystem polling... | 39.019231 | 136 | 0.670281 |
d5992238f99f71b0a6916bd84579b0c2342a7209 | 300 | # frozen_string_literal: true
require 'test_helper'
class ApplicationHelperTest < ActionView::TestCase
test 'full title helper' do
assert_equal full_title, 'Ruby on Rails Tutorial Sample App'
assert_equal full_title('Help'), 'Help | Ruby on Rails Tutorial Sample App'
end
end
| 27.272727 | 80 | 0.74 |
f8d929d70c4ea5850b82a0a894bd5a694a474267 | 956 | # encoding: UTF-8
version = File.read(File.expand_path("../../SOLIDUS_VERSION", __FILE__)).strip
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'solidus_backend'
s.version = version
s.summary = 'backend e-commerce functionality for the Spree project.'
s.description ... | 34.142857 | 111 | 0.642259 |
ff8f43baee75a7c05c8377dcfa9433cbc5b47728 | 4,754 | # ~*~ encoding: utf-8 ~*~
module Gollum
# FileView requires that:
# - All files in root dir are processed first
# - Then all the folders are sorted and processed
class FileView
# common use cases:
# set pages to wiki.pages and show_all to false
# set pages to wiki.pages + wiki.files and show_all ... | 28.812121 | 199 | 0.567732 |
618d75b5cf8557eebec2de4b341f5c9256c4af3e | 5,701 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 36.312102 | 245 | 0.684792 |
e2a61411db290e308266d992a9f55c1ac4a82e3c | 95 | # desc "Explaining what the task does"
# task :database_counters do
# # Task goes here
# end
| 19 | 38 | 0.705263 |
1a0b258f608a15e3197c5786727f754719a4d736 | 1,415 | #
# Cookbook Name:: cloudcli
# Resources:: aws_s3_file
#
# Copyright 2016 Nick Downs
# Copyright 2014 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... | 39.305556 | 81 | 0.724382 |
1c9796ee77568331e9f8afe5c1af720b14a28d34 | 13,967 | require 'util/xml/xml_utils'
require 'util/miq-xml'
require 'util/miq-logger'
module MiqWin32
class System
attr_reader :os, :account_policy, :networks
OS_MAPPING = [
'ProductName', :product_name,
'CurrentVersion', :version,
'CurrentBuildNumber', :build,
'SystemRoot', ... | 41.817365 | 154 | 0.629054 |
6262d34b1e41e23f714c17ef399cbb9a9b96401d | 347 | # frozen_string_literal: true
# typed: true
# compiled: true
# Many of our benchmarks use a while loop with `+=` over 100M items.
#
# Use this benchmark as a baseline to check how much time is spent in an
# operation vs spent in the while loop & loop counter.
i = 0
while i < 100_000_000
# ... potential extra stuff... | 18.263158 | 72 | 0.691643 |
bb6a2fd1614f8ee1985d7b06c3b50f3909f658a2 | 6,588 | require 'abstract_unit'
require 'fixtures/article'
require 'fixtures/product'
require 'fixtures/tariff'
require 'fixtures/product_tariff'
require 'fixtures/suburb'
require 'fixtures/street'
require 'fixtures/restaurant'
require 'fixtures/dorm'
require 'fixtures/room'
require 'fixtures/room_attribute'
require... | 40.919255 | 132 | 0.735276 |
113d8f76023c4590ec76d60e76cfb3b8f92c7f96 | 1,208 | module EmailService::SES
class Logger
def log_request(method, params)
request_id = SecureRandom.uuid
Rails.logger.info(to_json_log_entry(:request,
method,
params,
request_id))... | 30.2 | 95 | 0.44702 |
d51b702cd34f11c2fce7162b25c7d609b3cdf179 | 970 | #
# Cookbook:: isc_kea
# Resource:: config_dhcp6_control_socket
#
# Copyright:: Ben Hughes <bmhughes@bmhughes.co.uk>
#
# 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.... | 27.714286 | 74 | 0.762887 |
bb67f62d76d00aa97278052d7266a1df97544b53 | 4,023 | require_relative 'sequence_renderer'
require_relative 'thing'
require_relative 'process'
module Dogviz
class Flow
FLOW_RENDERERS = {
sequence: WebSequenceDiagramsSequenceRenderer,
plantuml: PlantUmlSequenceRenderer,
png: PngSequenceRenderer
}
attr_reader :sys
attr_accessor :executo... | 25.301887 | 128 | 0.598807 |
014c1deab3452d3fd406f08cd78a9fa85316d6f6 | 5,160 | require "spec_helper"
module Nyanko
describe Invoker do
let(:view) do
Class.new(ActionView::Base) do
include Nyanko::Invoker
include Nyanko::Helper
include Nyanko::UnitProxyProvider
end.new
end
let(:controller) do
Class.new(ActionController::Base) do
inc... | 32.866242 | 94 | 0.600969 |
1123c00a4bcffa1e21f24e9360380baedbee7ecd | 422 | # == Schema Information
#
# Table name: nc_category_groups
#
# id :bigint(8) not null, primary key
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null
#
module NationalCircumstance
class CategoryGroup < ApplicationRecord
self.... | 22.210526 | 53 | 0.661137 |
ff59fb24c721066d0c2253c9fb7d25aab0b37658 | 639 | class Beer < ActiveRecord::Base
attr_accessible :ibus, :srm, :abv, :name, :brewery, :manufacturer_id
has_many :kegs
has_many :votes
has_many :ratings
belongs_to :manufacturer
validates_presence_of :name
def rating
ratings.average(:value)
end
def serializable_hash(options={})
options[:only] =... | 22.821429 | 88 | 0.657277 |
7ac526cf2a1670309513b198f5cbd1231af5e3cc | 813 | class SfPwgen < Formula
desc "Generate passwords using SecurityFoundation framework"
homepage "https://github.com/anders/pwgen/"
url "https://github.com/anders/pwgen/archive/1.5.tar.gz"
sha256 "e1f1d575638f216c82c2d1e9b52181d1d43fd05e7169db1d6f9f5d8a2247b475"
head "https://github.com/anders/pwgen.git"
bott... | 33.875 | 93 | 0.777368 |
262c8673f054a84a0084565a5366e101f1cd4f38 | 131 | require_relative 'base_icann_compliant'
module Whois
class Parsers
class WhoisNicAnz < BaseIcannCompliant
end
end
end | 14.555556 | 42 | 0.778626 |
b97d07b526bc4bb39ebad89b430140cc30407e37 | 227 | class ConfigurationProfileDecorator < MiqDecorator
def fonticon
if id.nil?
'pficon pficon-folder-close'
else
'fa fa-list-ul'
end
end
def quadicon
{
:fonticon => fonticon
}
end
end
| 14.1875 | 50 | 0.61674 |
39d1aebe8ae0420a6887bfeebb1d489d7a232ff8 | 871 | require 'rails_helper'
RSpec.describe EarlyAllocationEventJob, type: :job do
let(:prison) { create(:prison) }
let(:offender) { build(:offender) }
context 'when the offender exists in NOMIS' do
before do
stub_offender(build(:nomis_offender, prisonerNumber: offender.nomis_offender_id, prisonId: prison.c... | 30.034483 | 110 | 0.748565 |
d50d012548d8f2cadec01b5bde2503503bbacb8d | 1,444 | Brakeman.load_brakeman_dependency 'multi_json'
require 'brakeman/report/initializers/multi_json'
class Brakeman::Report::JSON < Brakeman::Report::Base
def generate_report
errors = tracker.errors.map{|e| { :error => e[:error], :location => e[:backtrace][0] }}
app_path = tracker.options[:app_path]
warning... | 30.723404 | 91 | 0.668283 |
7a00e380023b1aed6dafd27ce1047087ff0be0b3 | 979 | class Odo < Formula
desc "Atomic odometer for the command-line"
homepage "https://github.com/atomicobject/odo"
url "https://github.com/atomicobject/odo/archive/v0.2.2.tar.gz"
sha256 "52133a6b92510d27dfe80c7e9f333b90af43d12f7ea0cf00718aee8a85824df5"
bottle do
cellar :any_skip_relocation
rebuild 1
... | 33.758621 | 93 | 0.772217 |
034eb583ad2d3446e82a729fd618c449f31d29e8 | 196 | #
# ${TM_NEW_FILE_BASENAME}
#
# Created by ${TM_FULLNAME} on ${TM_DATE}.
# Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
#
Shoes.app do
# Just a simple app, yes?
end
| 17.818182 | 73 | 0.678571 |
ed7a67134d8468a774f3c8db7cf702d510215a44 | 196 | Fabricator(:app, from: OpsWorks::App) do
initialize_with { @_klass.new(opsworks_stub) }
id { SecureRandom.uuid }
name { Fabricate.sequence(:name) { |i| "app#{i}" } }
revision 'master'
end
| 28 | 54 | 0.673469 |
e2c4fe3b70977d97a10dbda1e86706df5f6ae713 | 1,047 | class Area < ActiveRecord::Base
has_enumeration_for :status, with: AreaStatus, create_scopes: true, create_helpers: true
has_many :areas, dependent: :delete_all
has_many :resources, -> { order(:code) }, dependent: :delete_all
has_many :activities, dependent: :delete_all
belongs_to :institute
belongs_to ... | 29.914286 | 90 | 0.722063 |
081577eddcdf8f4279c381fd23c9175c4ce7bd18 | 2,910 | require 'test_helper'
class PasswordResetsTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
@user = users(:michael)
end
test "password resets" do
get new_password_reset_path
assert_template 'password_resets/new'
assert_select 'input[name=?]', 'password_res... | 36.375 | 72 | 0.657388 |
e81a89ac4c87f079c6cb2309be7486e03a13c231 | 298 | class FontMiama < Formula
head "https://github.com/google/fonts/raw/main/ofl/miama/Miama-Regular.ttf", verified: "github.com/google/fonts/"
desc "Miama"
homepage "https://fonts.google.com/specimen/Miama"
def install
(share/"fonts").install "Miama-Regular.ttf"
end
test do
end
end
| 27.090909 | 115 | 0.718121 |
d5ef87d7081b8eab119278d6840012fe56b41ad5 | 229 | class CreateDeployments < ActiveRecord::Migration[5.0]
def change
create_table :deployments do |t|
t.string :name
t.references :app, foreign_key: true
t.string :image
t.timestamps
end
end
end
| 19.083333 | 54 | 0.663755 |
d539606712f673c6f3219d741c41367f9fb5aa8a | 703 | require 'spec_helper'
class Convection::Model::Template::Resource
describe ElastiCacheSecurityGroup do
let(:elasticache_template) do
Convection.template do
description 'Elasticache Test Template'
elasticache_security_group 'MyRedisSecGroup' do
description 'Redis cache security gr... | 21.30303 | 72 | 0.665718 |
6a3ab826e0db53324886e0efef008c9ecc2a84dd | 1,933 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::TimeSeriesInsights::Mgmt::V2018_08_15_preview
module Models
#
# Properties required to create any resource tracked by Azure Resource
# Manager.
... | 28.850746 | 78 | 0.523021 |
bb3b43b5b2e15a34489a3e8554317f15d935ab61 | 2,588 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10
module Models
#
# This class represents the details for a failover job.
#
class FailoverJobDet... | 29.747126 | 92 | 0.493431 |
03be955ddcdbf102d8092a113dc947f282e353f7 | 2,573 | # frozen_string_literal: true
module Api::V2
class InputMappingsController < BaseController
before_action :check_whodunnit!, only: %i[create update delete]
def create
activity = current_activity
state_code = input_params[:attributes][:code]
state = if state_code
# ease clie... | 27.666667 | 99 | 0.598523 |
03b000476b171844483160a8616f06421ce12182 | 4,471 | # frozen_string_literal: true
module Jekyll
module RemoteTheme
class Downloader
PROJECT_URL = "https://github.com/benbalter/jekyll-remote-theme"
USER_AGENT = "Jekyll Remote Theme/#{VERSION} (+#{PROJECT_URL})"
MAX_FILE_SIZE = 1 * (1024 * 1024 * 1024) # Size in bytes (1 GB)
NET_HTTP_ERRORS ... | 29.222222 | 91 | 0.607694 |
622b5da3539fe5902a7e4d641c33a5fbcd9ce785 | 8,273 | # encoding: utf-8
require "rubygems/package"
require "logstash/util/loggable"
require "logstash/plugin"
require "logstash/plugins/hooks_registry"
module LogStash module Plugins
class Registry
include LogStash::Util::Loggable
# Add a bit more sanity with when interacting with the rubygems'
# specificatio... | 33.2249 | 187 | 0.646924 |
115a12f33bc87f85e7710ad129bae586970b1e40 | 1,439 | # frozen_string_literal: true
describe "POST /db/trailers/:id/publishing", type: :request do
context "user does not sign in" do
let!(:trailer) { create(:trailer, :unpublished) }
it "user can not access this page" do
post "/db/trailers/#{trailer.id}/publishing"
trailer.reload
expect(respon... | 24.810345 | 63 | 0.641418 |
1a503b42c09ad815a9992261f254c60b2aa46758 | 4,511 | # frozen_string_literal: true
require "dry/monads/do"
module Dry
module Monads
module Do
# Do::All automatically wraps methods defined in a class with an unwrapping block.
# Similar to what `Do.for(...)` does except wraps every method so you don't have
# to list them explicitly.
#
... | 28.19375 | 88 | 0.522279 |
f890a7db0cce2465d577ad7e9f83eef3b602eae6 | 1,548 | module NetSuite
module Records
class VendorBillItem
include Support::Fields
include Support::RecordRefs
include Support::Records
include Namespaces::TranPurch
fields :amortization_end_date, :amortization_residual, :amortiz_start_date, :bin_numbers, :bill_variance_status,
... | 32.25 | 120 | 0.664083 |
bf8c612e5770aaad7d002000ff228520ed450d2c | 209 | class String
def is_binary_data?
self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" )
end
if RUBY_VERSION.to_f < 1.9
def force_encoding(enc)
self
end
end
end | 19 | 79 | 0.578947 |
9101d40be66218b9c033cd9d3b4f2e825cbd600e | 937 | require "anyway_config"
module Seatrain
# PRE-RELEASE: To be removed once the anyway_config 2.1 becomes available
Anyway.loaders.override :yml, Anyway::Loaders::YAML
class Config < Anyway::Config
DOCR_URL = "registry.digitalocean.com"
attr_config(
:ruby_version,
:pg_major_version,
:no... | 21.790698 | 75 | 0.640342 |
e8549094e08a54be6194b01b09eb65958d3589ff | 965 | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook Name:: homebrew
# Resources:: tap
#
# Copyright 2011-2016, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | 30.15625 | 74 | 0.701554 |
9142ed7bdd1280a877d7b655ce7be034f944f072 | 213 | ::Sequel.migration do
up do
create_table(:snp_assays) do
primary_key :id
String :name
String :allele_x
String :allele_y
end
end
down do
drop_table(:snp_assays)
end
end
| 14.2 | 32 | 0.629108 |
bb79ac54819e9cb3b4b0472b9626adeef557810f | 128 | class RemoveBookColumnFromBooks < ActiveRecord::Migration[5.1]
def change
remove_column :books, :book, :boolean
end
end
| 21.333333 | 62 | 0.757813 |
79f393f05702afee74b59301bfb2cc11a00691c4 | 331 | #!/usr/bin/env ruby
dir = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH.unshift dir + "/../lib"
require "coremidi"
require "pp"
# This will output a big list of Endpoint objects. Endpoint objects are what's used to input
# and output MIDI messages
pp CoreMIDI::Device.all.map { |device| device.endpoints.values... | 25.461538 | 92 | 0.743202 |
39c59b04ccdd4012be757b3afba9887c2ff41e88 | 1,162 | class Crypto::Scraper
def self.scrape_coinranking
doc = Nokogiri::HTML(open("https://coinranking.com/"))
#create an array of all the coins along with their attributes set that to a variable
@coins = doc.css(".coin-list__body .coin-list__body__row").collect do |row|
each_coin = row.css("span").coll... | 35.212121 | 156 | 0.674699 |
b916d9d1ca0d5a9fad808bcc2a00b4f8483ef408 | 510 | require 'bundler'
Bundler.setup
require 'rspec'
require 'jschematic'
RSpec::Matchers.define :accept do |instance_value|
match do |validator|
begin
validator.accepts?(instance_value)
rescue Jschematic::ValidationError
false
end
end
end
module Jschematic
class Parent
include Jschemati... | 15 | 50 | 0.684314 |
edc74ec6d8f64c11d0b964ba6c49cfc92163f793 | 4,232 | # frozen_string_literal: true
# It probably makes sense to configure PUMA_CLOUDWATCH_DIMENSION_VALUE to include your application name.
# For example if you're application is named "myapp", this would be a good value to use:
#
# PUMA_CLOUDWATCH_DIMENSION_VALUE=myapp-puma
#
# Then you can get all the metrics for the ... | 30.666667 | 104 | 0.568762 |
03c43dc6d9ee569352dd127bd3fc5c57f428d39c | 942 | # frozen_string_literal: true
require "test_helper"
# Tests to assure reviewers can mark agreement variables for resubmission.
class Reviewer::AgreementVariablesControllerTest < ActionDispatch::IntegrationTest
setup do
@reviewer = users(:reviewer_on_released)
@submitted = data_requests(:submitted)
@spec... | 30.387097 | 97 | 0.766454 |
e8910c1455559aa043b8be0b37b7585c1825448e | 20,986 | =begin
* Name: newtabbedpane.rb
* Description : This is radically simplified tabbedpane. The earlier version
was too complex with multiple forms and pads, and a scrollform. This uses
the external form and has some very simple programming to handle the whole thing.
* Author: rkumar (http://github.com/rkuma... | 33.048819 | 124 | 0.601115 |
b9b62c8373ebb2885f459c8479f1a054e9355ebd | 757 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(... | 47.3125 | 141 | 0.772787 |
38c64a82b1d9356597dcceeceeb67f18b474049d | 495 | class ReviewsController < ApplicationController
def create
@review = Review.create(review_params)
@review.project.user.notifications = true
@review.project.user.save
render 'reviews/show', :layout => false
end
def destroy
@review = Review.find(params[:id])
project = @review.project
@review.destroy
... | 21.521739 | 76 | 0.749495 |
e8ce1be394a8bc842576501bda19a9ec51ef15f2 | 1,899 | require 'rubygems'
require 'colors'
require 'columnize'
require 'net/http'
require 'json'
class Falconstock
def initialize()
@lookup_response = []
@quote_response = []
@lookup_url = 'http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?'
@quote_url = 'http://dev.markitondemand.com/MODApis/Api/v2/... | 27.521739 | 106 | 0.656135 |
1dc54eacd46c002550c2231e50225c59b2540248 | 2,064 | require 'bundler/setup'
Bundler.setup(:default, 'test', 'development')
require 'tempfile'
require 'pp'
require 'shoulda'
require 'matchy'
require 'mocha'
require 'mongo_mapper'
require File.expand_path(File.dirname(__FILE__) + '/../lib/joint')
MongoMapper.database = "testing"
class Test::Unit::TestCase
def setup
... | 21.5 | 90 | 0.698643 |
8713acf822f9ebf539340b520c0a525f20abf9f8 | 279 | require('rspec')
require('scrabble')
describe('String#scrabble') do
it('returns a scrabble score for a letter') do
expect("a".scrabble()).to(eq(1))
end
it('returns a scrabble score for a word') do
expect("abciou".scrabble()).to(eq(10))
end
end
| 19.928571 | 50 | 0.623656 |
ab733fb2de1fa5a4b163a66bdbaeb54c867dfa2e | 1,228 | # frozen_string_literal: true
require 'test_helper'
class StorefrontAccessTokenTest < Test::Unit::TestCase
def test_create_storefront_access_token
fake("storefront_access_tokens", method: :post, body: load_fixture('storefront_access_token'))
storefront_access_token = ShopifyAPI::StorefrontAccessToken.create(... | 39.612903 | 112 | 0.775244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.