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 |
|---|---|---|---|---|---|
e946f4aea7232c1563e0f084263faf634b885aba | 1,939 | module GemInstaller
class GemInteractionHandler
attr_writer :dependent_gem, :noninteractive_chooser_class, :valid_platform_selector
DEPENDENCY_PROMPT = 'Install required dependency'
def initialize
check_rubygems_version
end
def handle_ask_yes_no(question)
return unless questi... | 46.166667 | 134 | 0.734399 |
28fee95e4c2f73459b1bee422b5c5222f62bf45e | 2,224 | #
# Cookbook Name:: delivery-cluster
# Spec:: helpers_analytics_spec
#
# Author:: Salim Afiune (<afiune@chef.io>)
#
# Copyright:: Copyright (c) 2015 Chef Software, 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 compl... | 30.054054 | 74 | 0.663669 |
088301ac1470f02d1469e6f298280cd5fc44863a | 9,202 | require 'psych/scalar_scanner'
unless defined?(Regexp::NOENCODING)
Regexp::NOENCODING = 32
end
module Psych
module Visitors
###
# This class walks a YAML AST, converting each node to ruby
class ToRuby < Psych::Visitors::Visitor
def initialize ss = ScalarScanner.new
super()
@st = ... | 28.313846 | 111 | 0.501304 |
ab61895d57c89006e27311c4f2dd98acbd2f7ac8 | 1,167 | module Fog
module Compute
class Vsphere
class Real
def get_compute_resource(name, datacenter_name)
compute_resource = get_raw_compute_resource(name, datacenter_name)
raise(Fog::Compute::Vsphere::NotFound) unless compute_resource
compute_resource_attributes(compute_resou... | 27.785714 | 76 | 0.594687 |
f834f67522f3b67bf06692df298f46c819f6b628 | 164 | require_relative './directives/audio'
require_relative './directives/audio_player'
module Ralyxa
module ResponseEntities
module Directives
end
end
end
| 16.4 | 44 | 0.780488 |
e2ad6eb81cd76f12ffec7dcc1a39d1d7cd265994 | 139 | SimpleCov.profiles.define 'lib' do
add_filter '/test/'
add_filter '/config/'
add_group 'Libraries', 'lib'
end
SimpleCov.start 'lib'
| 17.375 | 34 | 0.71223 |
21ce2186776631bdc6523228da9161abdcfff5cd | 657 | class ItemsController < ApplicationController
before_action :set_item
def create
@item = current_user.items.new(item_params)
@item.project = @project
if @item.save
render json: @item, status: 201
else
render json: {errors: @comment.errors.full_messages}, status: 400
end
... | 23.464286 | 88 | 0.681887 |
62fd49efdf229bebd32a9e7cc3a68facb4f2d711 | 17,480 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 34.27451 | 155 | 0.678604 |
087c0e1434dccdef09aa0d367b351a2bdbd09dd7 | 654 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'FluentUI-React-Native-Avatar'
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.authors = package['author']
s.home... | 29.727273 | 115 | 0.61315 |
b97402c4086627f8cb0178497e234eb6e618fe9e | 270 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: "static_pages#root"
namespace :api, defaults: { format: :json } do
resources :posts, except: [:new, :edit]
end
end
| 30 | 101 | 0.718519 |
4aaef0354a4ff62a6532efdf6498ab74286c3b16 | 1,400 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'paper_rock_scissors/version'
Gem::Specification.new do |spec|
spec.name = "paper_rock_scissors"
spec.version = PaperRockScissors::VERSION
spec.authors = ["Stephen Mayeu... | 42.424242 | 155 | 0.680714 |
ff71b39a6287a4c25edba0bf9ef96e40c718fd7e | 2,222 | # 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::ServiceFabric::Mgmt::V2017_07_01_preview
module Models
#
# Defines a health policy used to evaluate the health of the cluster or of
... | 31.295775 | 78 | 0.567957 |
2166f81689078670a0ee67da0225e4b9674b0890 | 296 | class CreateRewardsTable < ActiveRecord::Migration[5.0]
def change
create_table :gamfora_rewards do |t|
t.references :action, foreign_key: true
t.references :metric, foreign_key: true
t.integer :count
t.string :text_value
t.timestamps
end
end
end
| 24.666667 | 55 | 0.672297 |
4afeaca8be8f9945e73725cf98b096e2d8b65320 | 535 | require 'rails/generators/active_record'
require "rails/generators/migration"
class ActsAsIdBankCertification::MigrationGenerator < ::Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
desc 'Installs ActsAsIdBankCertification migration file.'
de... | 31.470588 | 79 | 0.801869 |
7983c3d49ee0dd81b8ad0e3a494fb08517f5ed00 | 2,288 | require 'features_helper'
describe 'visit home page' do
before do
UserRepository.clear
PostRepository.clear
visit '/'
end
shared_examples 'default page' do
it 'should have app title' do
expect(page).to have_content('SS Tweets')
end
it 'should have Home on Nav bar' do
expect(p... | 28.6 | 113 | 0.626311 |
e2aa97b9866555c30f6ee80a864ab36e12b496a9 | 10,562 | # frozen_string_literal: true
module Discordrb
# Mixin for the attributes members and private members should have
module MemberAttributes
# @return [Time] when this member joined the server.
attr_reader :joined_at
# @return [Time, nil] when this member boosted this server, `nil` if they haven't.
a... | 33.318612 | 228 | 0.660954 |
2688277e09cbe6ceb25d28b5f6c6d825a248c731 | 1,025 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'newrelic_grabby/version'
Gem::Specification.new do |spec|
spec.name = "newrelic_grabby"
spec.version = NewRelic::Grabby::VERSION
spec.authors = ["Lew Cirne"]
spec.ema... | 39.423077 | 104 | 0.68 |
1d9cbcdb959ac320e24b9ef84c73ce4f08746158 | 751 | require "rspec/expectations"
RSpec::Matchers.define :terminate do |code|
actual = nil
def supports_block_expectations?
true
end
match do |block|
begin
block.call
rescue SystemExit => e
actual = e.status
end
actual and actual == status_code
end
chain :with_code do |status... | 18.317073 | 62 | 0.663116 |
bbc5cac62bf4a7a6373172222064c18bfc4f92b7 | 293 | module SimpleAttribute
module Helpers
def simple_attribute_for(record, attribute, options = {})
options = options.merge(record: record, attribute: attribute)
SimpleAttribute::Builder.new(self, options).render
end
alias :attribute_for :simple_attribute_for
end
end
| 26.636364 | 67 | 0.740614 |
5d51362c0181a076f91d07b17a9a195f6571dfef | 1,216 | require 'uri'
require 'open-uri'
class Attachment < ApplicationRecord
belongs_to :account
belongs_to :message
mount_uploader :file, AttachmentUploader #used for images
enum file_type: [:image, :audio, :video, :file, :location, :fallback]
before_create :set_file_extension
def push_event_data
data = {
... | 24.816327 | 78 | 0.662007 |
1a04ea869ac52435d4f00ce23426d28d60300e8e | 2,067 | module Bosh::Cli::Command
class Events < Base
usage 'events'
desc 'Show all deployment events'
option '--before-id id', Integer, 'Show all events with id less or equal to given id'
option '--before timestamp', String, 'Show all events by the given timestamp (ex: 2016-05-08 17:26:32)'
option '--aft... | 34.45 | 125 | 0.545718 |
abd5aa7822f774b3fedd6f48a394ddead5c46066 | 732 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... | 36.6 | 111 | 0.68306 |
5d0e6e6a709adbaf209ea88ea5fa9b779bae63f5 | 3,753 | require 'spec_helper'
require 'vcap_request_id'
module CloudFoundry
module Middleware
RSpec.describe VcapRequestId do
let(:middleware) { described_class.new(app) }
let(:app) { FakeApp.new }
let(:app_response) { [200, {}, 'a body'] }
let(:uuid_regex) { '\w+-\w+-\w+-\w+-\w+' }
class ... | 37.909091 | 117 | 0.609646 |
187645cf12661ab252ecb89e69b0002fab088214 | 56 | module Em
module Smtp
VERSION = "0.0.1"
end
end
| 9.333333 | 21 | 0.607143 |
e91285568ce47fbb676d7681057f9eb8d814b8cd | 1,873 | #
# Author:: Salim Alam (<salam@chef.io>)
# Copyright:: Copyright 2015 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
#
# http://www... | 29.730159 | 78 | 0.711692 |
113655347f761c3f5d0b087caa209e4c44822b02 | 5,020 | #--
# This file is part of the X12Parser library that provides tools to
# manipulate X12 messages using Ruby native syntax.
#
# http://x12parser.rubyforge.org
#
# Copyright (C) 2012 P&D Technical Solutions, LLC.
#
# This library is free software; you can redistribute it and/or
# modify it under ... | 33.466667 | 115 | 0.695219 |
e2fb300d4916e5bcd7e39520baa685b039e9c668 | 142 | class UniqueIndexOnUidAndProvider < ActiveRecord::Migration
def change
add_index :identities, [:uid, :provider], unique: true
end
end
| 23.666667 | 59 | 0.760563 |
01c8f774f4813b843e11fd6ec6de02590ab5280a | 1,327 | # Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
module Elasticsearch
module API
module Actions
# Deletes a script.
#
# @option arguments [Str... | 31.595238 | 95 | 0.666918 |
38289d4a2cbd07324c174388538d1db90ad0652c | 939 | Pod::Spec.new do |s|
s.name = "JVFloatLabeledTextField"
s.version = "1.2.2"
s.summary = "The original UITextField subclass implementing the Float Label Pattern."
s.homepage = "http://github.com/jverdi/JVFloatLabeledTextField"
s.screenshot = "https://github-camo.global.ssl.fastly.net/be... | 62.6 | 280 | 0.728435 |
21e83ad028a2d5b5fb4f92bfc3c5bc2bab5ace17 | 139 | class RemoveFailedAttemptsColumnFromUsers < ActiveRecord::Migration[5.2]
def change
remove_column :users, :failed_attempts
end
end
| 23.166667 | 72 | 0.798561 |
1d465fc5a64a070e7e200c48c8444ab9ae4ceb4d | 111 | require 'xxhash'
module DeterministicHash
def deterministic_hash(string)
XXhash.xxh32(string)
end
end
| 13.875 | 32 | 0.774775 |
bbc53164b8083093f9443f792f4ee14a9fcbc172 | 114 | # -*- coding:binary -*-
module MetasploitPayloads
VERSION = '2.0.29'
def self.version
VERSION
end
end
| 11.4 | 25 | 0.649123 |
1a269145a4d85f3df36f860b6398a379ad465861 | 496 | # Be sure to restart your server when you modify this file.
# Your secret key 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 dictionary attac... | 62 | 171 | 0.832661 |
e80b55332e7b04264bc682b04638225e4c8d41dc | 197 | require "rubygems"
require 'bundler/setup'
require 'bundler/gem_tasks'
require "test/unit"
require "rack"
require "rack/test"
Test::Unit::TestCase.class_eval do
include Rack::Test::Methods
end
| 16.416667 | 34 | 0.766497 |
26c3f7c3533b1e9c77e62a96ca40ff4e68e85e9e | 974 | require 'fileutils'
module Interfaces
class FtpSource < FtpSourceBase
include FtpSession
def ftp_get_files ftp, regexp
logger.debug{"#{self}: ftp nlst"}
files = ftp.nlst.select{|name| name =~ regexp}
logger.debug{"#{self}: ftp nlst: found files: #{files&&files.inspect}"}
files.each ... | 27.828571 | 77 | 0.571869 |
f7aafe2e1f30df29fa2e2b16c434bb5450b6c29d | 513 | # frozen_string_literal: true
module Ebayr #:nodoc:
# A response to an Ebayr::Request.
class Response < Record
def initialize(request, response)
ActiveSupport::XmlMini.backend = 'Nokogiri'
@request = request
@command = @request.command if @request
@response = response
@body = res... | 27 | 57 | 0.672515 |
ed78238de483885f5845e96fd5147ea4a2de058b | 12,771 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.30888 | 152 | 0.749432 |
e28522caafc2cb871f89d68f02fd7882c4e8d97c | 695 | require 'vagrant'
set :application, 'awesomeium'
set :repository, '.'
set :scm, :none # not recommended in production
set :deploy_via, :copy
server '192.168.33.10', :web, :app, :db, :primary => true
set :user, 'vagrant'
set :password, 'vagrant' # not recommended in production
set :deploy_to, "/home/#{user}/... | 19.305556 | 57 | 0.699281 |
7a964e5b37b4812e4a4cb44312ceeecd5ed46c7a | 1,375 | require 'rails_helper'
RSpec.describe ConsumptionTaxRate, type: :model do
describe ".calc" do
it "returns nil when arg is nil" do
expect(ConsumptionTaxRate.calc_current(nil)).to be_nil
end
it "returns 8% of argument with floored" do
expect(ConsumptionTaxRate.calc_current(10)).to eq 0
ex... | 44.354839 | 60 | 0.735273 |
6a7f8910cb89b1cc598a059a26cf004e9507fb22 | 43 | class AverageGrade < ApplicationRecord
end
| 14.333333 | 38 | 0.860465 |
bbd0b5ac8a924986b046cac6c40ebf60489d0e1a | 4,107 | # frozen_string_literal: true
# This file should only be used by sub-classes, not directly by any clients of the sub-classes
# please require all dependencies below:
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/module/delegation'
module Gitlab
module Redis
class Wrapper
DEF... | 27.563758 | 94 | 0.590942 |
014dc572f646d0a41d29d2842e7724c5b5c44e5c | 766 | Gem::Specification.new do |s|
s.name = 'yaml_zlib_blowfish'
s.version = '2.0.210127'
s.homepage = 'https://github.com/carlosjhr64/yaml_zlib_blowfish'
s.author = 'carlosjhr64'
s.email = 'carlosjhr64@gmail.com'
s.date = '2021-01-27'
s.licenses = ['MIT']
s.description = <<DESCRIPTION
Hav... | 23.212121 | 92 | 0.691906 |
b962eae74a93d28c738c32ed48c3749c59e14d1c | 1,942 | require 'spec_helper'
describe "dating agency" do
before(:each) do
class Love
include Asp::Element
asp_schema :name
end
class Person
include Asp::Element
def self.match?(string)
nil
end
def initialize(name, sex, status)
@name = name || "_"
@sex ... | 26.243243 | 127 | 0.57312 |
1d00c3603de49596c8ce82c1f985f052c11c6c65 | 189 | class Post < ActiveRecord::Base
translatable :title, :content, :published, :published_at
validates_presence_of :title
scope :with_some_title, -> { where(:title => 'some_title') }
end
| 31.5 | 62 | 0.73545 |
d5bd44b9db53840fe7a357ff1cab100b24419bb9 | 651 | require 'generators/generators_test_helper'
require 'rails/generators/rails/task/task_generator'
class TaskGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(feeds foo bar)
def test_task_is_created
run_generator
assert_file "lib/tasks/feeds.rake" do |content|
ass... | 26.04 | 53 | 0.741935 |
6228415971cbf0119fe544876a60d5fe467dcf69 | 1,522 | {
matrix_id: '2578',
name: 'AS365',
group: 'DIMACS10',
description: 'DIMACS10 numerical/AS365 : A 2-D Tri-Element mesh around a chopper',
author: 'C. S. Yin, J. T. Zhang',
editor: 'H. Meyerhenke',
date: '2011',
kind: 'undirected graph',
problem_2D_or_3D: '0',
num_rows: '3799275',... | 41.135135 | 86 | 0.626807 |
3377fd79e075968a520262a248a92f1d884590de | 5,488 | RSpec.describe Pcloud::Client do
before(:each) do
Pcloud::Client.remove_class_variable(:@@data_region) if Pcloud::Client.class_variable_defined?(:@@data_region)
Pcloud::Client.remove_class_variable(:@@access_token) if Pcloud::Client.class_variable_defined?(:@@access_token)
Pcloud::Client.remove_class_vari... | 37.589041 | 120 | 0.646684 |
7abb3bda2fc5527865af9e5bc172f21f7001b14c | 404 | cask "font-averia-gruesa-libre" do
version :latest
sha256 :no_check
# github.com/google/fonts/ was verified as official when first introduced to the cask
url "https://github.com/google/fonts/raw/master/ofl/averiagruesalibre/AveriaGruesaLibre-Regular.ttf"
name "Averia Gruesa Libre"
homepage "https://fonts.g... | 33.666667 | 102 | 0.777228 |
ac007bed86c0e5fc82d391c45b8323f35a98b17e | 534 | module Stupidedi
module Versions
module FunctionalGroups
module ThirtyForty
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
ST = s::SegmentDef.build(:ST, "Transaction Set Header",
"To indicate the start of a transaction set and ass... | 25.428571 | 85 | 0.597378 |
3881ca38fcd9fa8c9ab2093797b1f3b71e77a4a7 | 3,341 | require 'csv'
class SeedController < ApplicationController
"""
Access at /visitors/seed
This method is to seed the words from the corpus.
"""
def dictionary
"""
Dictionary.delete_all
array_global = []
count = 0
"""
#filename = "/home/prashant/cs76proj... | 30.372727 | 107 | 0.444777 |
bf77fdb45a303b6fb0547350828e04baf2b0fc02 | 616 | class Polaris::TextField::ComponentPreview < ViewComponent::Preview
def default
end
def number
end
def email
end
def multiline
end
def with_hidden_label
end
def with_label_action
end
def with_right_aligned_text
end
def with_placeholder_text
end
def with_help_text
end
def w... | 11 | 67 | 0.748377 |
87d002326ffca881e97f079f87cb490081d983fb | 142 | class ApplicationRecord < ActiveRecord::Base
# NOTE : Added for loading slug module
include Slugifiable
self.abstract_class = true
end
| 20.285714 | 44 | 0.774648 |
6afd30b3700bd0bef4a1df67ebc1235822d270a0 | 6,108 | # frozen_string_literal: true
#
# == SwimmerUserStrategy
#
# Strategy Pattern implementation for Swimmer-User relations and action-enable
# policy.
#
# @author Steve A.
# @version 4.00.285
#
class SwimmerUserStrategy
def initialize(swimmer)
@swimmer = swimmer
end
#-- -------------------------------------... | 35.929412 | 107 | 0.666503 |
394aef6ccafaa3d609aa085a124ba99532be4be7 | 2,159 |
if respond_to?(:require_relative, true)
require_relative 'common'
else
require File.dirname(__FILE__) + '/common'
end
describe RestGraph do
after do
WebMock.reset!
Muack.verify
end
should 'return true in authorized? if there is an access_token' do
RestGraph.new(:access_token => '1').authorized?... | 30.842857 | 74 | 0.613247 |
f744b087bf631f5753488d32d7090d1ac0f4b0a9 | 4,958 | # This file was generated by the `rails generate rspec:install`
# command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly requir... | 49.58 | 96 | 0.712586 |
ac369121bce64fa476bf0e66b870b721b48252b7 | 187 | class Helper
def self.current_user(session_hash)
User.find(session_hash[:user_id])
end
def self.logged_in?(session_hash)
!!session_hash[:user_id]
end
end | 20.777778 | 40 | 0.668449 |
1c458a098625f4d381f5cd821d9ac9fcb9458799 | 4,355 | RSpec.describe PowerApi::GeneratorHelper::RoutesHelper, type: :generator do
describe "#routes_path" do
let(:expected_path) { "config/routes.rb" }
def perform
generators_helper.routes_path
end
it { expect(perform).to eq(expected_path) }
end
describe "#api_version_routes_line_regex" do
... | 24.194444 | 96 | 0.632147 |
ff7b58414ff3dd6085e4934a551f3c81ae282e0c | 1,588 | platform_is_not :windows do
require File.expand_path('../../../spec_helper', __FILE__)
require 'syslog'
describe "Syslog.log" do
platform_is_not [:windows, :darwin] do
before :each do
Syslog.opened?.should be_false
end
after :each do
Syslog.opened?.should be_false
en... | 28.357143 | 77 | 0.584383 |
f7951b8d3a7c13e1aae535d80f493c5abfba5290 | 750 | require 'artemis_api/client'
require 'artemis_api/model'
require 'artemis_api/facility'
require 'artemis_api/user'
require 'artemis_api/version'
require 'artemis_api/zone'
require 'artemis_api/organization'
require 'artemis_api/batch'
require 'artemis_api/completion'
require 'artemis_api/discard'
require 'artemis_api/h... | 27.777778 | 38 | 0.833333 |
1c8df0a6a85ff12b76e27842d7afdbced208236f | 409 | require 'formula'
class Jags < Formula
homepage 'http://mcmc-jags.sourceforge.net'
url 'http://downloads.sourceforge.net/project/mcmc-jags/JAGS/3.x/Source/JAGS-3.3.0.tar.gz'
sha1 '79a50baaf1e2b2e7673d477e830963b49aad2a6c'
depends_on :fortran
def install
system "./configure", "--disable-dependency-track... | 25.5625 | 92 | 0.682152 |
1cef6fb776cc1c104c8a0178f7b4cb5994c38545 | 299 | module Slh
extend ActiveSupport::Autoload
autoload :ClassMethods
extend Slh::ClassMethods
autoload :Cli
module Models
extend ActiveSupport::Autoload
autoload :Base
autoload :Strategy
autoload :Host
autoload :Site
autoload :SitePath
autoload :Version
end
end
| 17.588235 | 34 | 0.722408 |
6219c2994b7a3896e35cc86a65ea43a52bc398f9 | 85 | json.extract! @project, :id, :name, :description, :user_id, :created_at, :updated_at
| 42.5 | 84 | 0.729412 |
e8163d9d99dc3d0850ea32e03304fec639e6afcb | 729 | module TwentyfourSevenOffice
module Services
class Invoice < Service
wsdl "https://api.24sevenoffice.com/Economy/InvoiceOrder/V001/InvoiceService.asmx?WSDL"
api_operation :save_invoices,
input_data_types: { invoices: Array[InvoiceOrder] }
def save(invoice)
if invoi... | 23.516129 | 93 | 0.62963 |
ac9f5251ee74e5663c8a991f9fba17d168b26d5f | 693 | module Extent
def extent_label
sanitized_format || "Physical extent"
end
def extent
[physical_string, characteristics_string].compact.join(' ')
end
private
def physical_string
return nil unless self[:physical].present?
Array[self[:physical]].flatten.join(', ')
end
def characteristics... | 21.65625 | 67 | 0.689755 |
1a1911555c437058aa9a6b39447c0709435b3f7e | 1,214 | class Libmp3splt < Formula
desc "Utility library to split mp3, ogg, and FLAC files"
homepage "https://mp3splt.sourceforge.io"
url "https://downloads.sourceforge.net/project/mp3splt/libmp3splt/0.9.2/libmp3splt-0.9.2.tar.gz"
sha256 "30eed64fce58cb379b7cc6a0d8e545579cb99d0f0f31eb00b9acc8aaa1b035dc"
revision 1
... | 36.787879 | 98 | 0.747117 |
032d09ff46dc8cc8affe2c24a79df4b1ee225e36 | 1,116 | class LoosePassengerValidator < ActiveModel::Validator
def validate record
if record.trip_id != nil
unless Trip.find(record.trip_id)
record.errors[:name] << 'Picked up Passenger must have valid Trip ID'
end
end
end
end
class Passenger < ApplicationRecord
include ActiveModel::Validatio... | 24.8 | 77 | 0.68638 |
1c9e9142fadcd154d732fd2c37d6bf225b01a561 | 72 | class Object
delegate :decorate, to: Rails::Decorators::Decorator
end
| 18 | 54 | 0.777778 |
1c2dafe6f0d627f61ea7c861cbbf24b704c07d7a | 38 | module Surfio
VERSION = "0.1.0"
end
| 9.5 | 19 | 0.657895 |
e9fc05b3c28228b18888d2259905a08735446a93 | 495 | # alexggordon.rb
require 'sinatra'
require 'sinatra/assetpack'
class AlexGGordon < Sinatra::Base
set :root, File.dirname(__FILE__) # You must set app root
register Sinatra::AssetPack
end
assets do
serve '/images', :from => 'app/images'
serve '/css', :from => 'app/css'
css :application, [
]
css :skelet... | 15.46875 | 59 | 0.632323 |
d5e060bdbe818ed9328745d5a8176079ff89244f | 8,503 | class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include SharedAuthentication
include SharedIssuable
include SharedProject
include SharedNote
include SharedPaths
include SharedMarkdown
include SharedDiffNote
step 'I click link "New Merge Request"' do
click_link "New Merge Reque... | 27.787582 | 83 | 0.689874 |
d5f31bf519ea043373e6ed391d394ce1f565fbb8 | 3,633 | # 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::Compute::Mgmt::V2019_03_01
module Models
#
# Identity for the virtual machine.
#
class VirtualMachineIdentity
include... | 35.271845 | 151 | 0.562896 |
383fa5de5cdeb3811ed83ab94e71db59f0de310a | 286 | class Auth::ConfirmationsController < Devise::ConfirmationsController
# most often it's needed to customize url of location to redirect user to after confirmation
# protected
# def after_confirmation_path_for(resource_name, user)
# edit_user_registration_path
# end
end
| 23.833333 | 94 | 0.786713 |
e2fa76522bccdb6a7d8749d2ed16f081efa863dd | 1,481 | require 'spec_helper'
describe Gitlab::Template::GitlabCiYmlTemplate do
subject { described_class }
describe '.all' do
it 'strips the gitlab-ci suffix' do
expect(subject.all.first.name).not_to end_with('.gitlab-ci.yml')
end
it 'combines the globals and rest' do
all = subject.all.map(&:nam... | 24.683333 | 89 | 0.64551 |
39447499d774a2277e1c6980c4687e59b8af0ff9 | 71 | # frozen_string_literal: true
Fabricator(:ignored_user) do
user
end
| 11.833333 | 29 | 0.788732 |
b98d3948ca8445d6f8eb864d0350f02feb508d6e | 159 | require 'settingslogic'
module EpiCas
class Settings < Settingslogic
source "#{Rails.root}/config/epi_cas_settings.yml"
namespace Rails.env
end
end | 22.714286 | 54 | 0.761006 |
91d809e8a46c4e12c9f510bbcb10f38b4ab67051 | 201 | class CreateKriteria < ActiveRecord::Migration[5.0]
def change
create_table :kriteria do |t|
t.string :nama
t.integer :tipe
t.float :bobot
t.timestamps
end
end
end
| 16.75 | 51 | 0.636816 |
f84590b3df06cad852faf20681a81d2786961265 | 2,313 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 36.140625 | 85 | 0.758755 |
794679a0b5f3a3f6c790b185fa2b1523c57d0925 | 138 | class AddRelevanceToAlerts < ActiveRecord::Migration[6.0]
def change
add_column :alerts, :relevance, :integer, default: 0
end
end
| 23 | 57 | 0.746377 |
62d74d83c28dcb82d63f97e88f5ffc67e698b30f | 5,552 | # frozen_string_literal: true
# Copyright 2020 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... | 46.655462 | 217 | 0.659402 |
1c606199a78a9e203996df621feef9280158d00f | 881 | # frozen_string_literal: true
module MLP
class Layer
attr_accessor :level, :neurons
def initialize(params)
@level = params[:level]
@neurons = params[:neurons]
end
def each(&block)
neurons.each do |n|
block.call(n)
end
end
def last_output
neurons.map(&:... | 16.314815 | 65 | 0.586833 |
7a5636e39d38a4e431b8b1112bc8d93b5c8f59cd | 100 | # This is a single ruby file that doesn't do anything for testing Zeus
# load tracking during boot.
| 33.333333 | 70 | 0.77 |
ff6e8b033d162be1512494ac93a62f2ec0a81834 | 272 | ##
# Main application class inherited from {https://www.rubydoc.info/gems/anoubis/Anoubis/ApplicationController Anoubis::ApplicationController}
class AnoubisSsoClient::ApplicationController < Anoubis::ApplicationController
include AnoubisSsoClient::ApplicationCommon
end | 54.4 | 140 | 0.852941 |
1ce81b6029e973725cd679bda5071d9ca498342d | 15,321 | #--
# Copyright 2013 Red Hat, 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 writ... | 32.322785 | 94 | 0.684094 |
ed4b5f8a14807711bc99a292e33d5667b6e9ec32 | 786 | require File.dirname(__FILE__) + '/../../../../spec_helper'
require 'net/http'
require File.dirname(__FILE__) + "/fixtures/classes"
describe "Net::HTTPHeader#delete when passed key" do
before(:each) do
@headers = NetHTTPHeaderSpecs::Example.new
end
it "removes the header entry with the passed key" do
@h... | 25.354839 | 59 | 0.650127 |
08062b3f2e644d71b6b0382b6253f6ab1f558204 | 426 | # frozen_string_literal: true
require 'bundler'
Bundler.setup(:test, :development)
require 'simplecov'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `mai... | 22.421053 | 66 | 0.755869 |
185d4e77f23fb5c78327e0217645b41540c9963b | 1,039 | # frozen_string_literal: true
module MSR
# Represents a single track from a magnetic stripe card.
class Track
# Whether or not the track contains any data.
# @return [Boolean] `true` if empty, `false` otherwise
def empty?
data.empty?
end
# Reverse the direction of the track, in place.
... | 28.081081 | 78 | 0.659288 |
87647791a810ee73270400e579fd6ec69c3cbe25 | 1,354 | Pod::Spec.new do |s|
s.name = "DesktopADView"
s.version = "2.3.3"
s.summary = "仿滴滴/Uber 的启动之后再控制器上面弹出多个广告,带删除按钮的动画绘制"
s.homepage = "https://github.com/tpctt/DesktopADView"
s.social_media_url = "https://github.com/tpctt/DesktopADView"
s.platform ... | 46.689655 | 232 | 0.587888 |
ff4f0c4fa71ebc422a7e1ccccb09c73d941af6e7 | 984 | #
# Created by teambition-ios on 2020/7/27.
# Copyright © 2020 teambition. All rights reserved.
#
Pod::Spec.new do |s|
s.name = 'ManagedObjectAdapter'
s.version = '0.0.7'
s.summary = 'ManagedObjectAdapter is a lightweight adapter for the converts between Model instances and C... | 39.36 | 142 | 0.643293 |
26e86be96b2b9b501a3457d8cfd1d12e267c2ebc | 131 | class Random
def next_move game
game.board.get_available_positions.sample
end
def name
"Frederick Random"
end
end
| 13.1 | 45 | 0.732824 |
21ff1d87d46ac3993ba6b70186c3540627980f02 | 513 | Given(/^the username is "(.*?)"$/) do |arg1|
@username = arg1
end
When(/^the password is "(.*?)"$/) do |arg1|
@password = arg1
end
Then(/^the result should be "(.*?)"$/) do |arg1|
@result = arg1
uuid = SecureRandom.uuid
user = "login_user_#{@username}_#{uuid}@jemurai.com"
register_as_user(user, "password"... | 20.52 | 54 | 0.623782 |
39f2458c4ab86956e6df8c8497aa3e841988f2fe | 1,610 | require 'time'
def silence_warnings
old_verbose, $VERBOSE = $VERBOSE, nil
yield
ensure
$VERBOSE = old_verbose
end
class Object
def blank?
respond_to?(:empty?) ? empty? : !self
end
def present?
!blank?
end
def try(m, *args)
send(m, *args) if respond_to?(m)
end
end
class NilClass
def ... | 14.907407 | 95 | 0.601242 |
910709cf57d4f980d2c0afafd47cb0169fc8ad86 | 119 | module MoneyS3
module Parsers
class FaktPrij < FakturaType
include ParserCore::BaseParser
end
end
end | 17 | 36 | 0.722689 |
d5008b369691de2beef2cbbb99197555e42a77b9 | 444 | # MODULE templates/en-us/html/extensions/MAB_Clubs_read_shop.rb
# VIEW views/Clubs_read_shop.rb
# SASS ~/megauni/templates/en-us/css/Clubs_read_shop.sass
# NAME Clubs_read_shop
club_nav_bar(__FILE__)
pretension!
div.substance! {
messages! {
everybody {
messages_or_guide
}
}
publish! {
... | 15.310345 | 63 | 0.650901 |
393745bc0db43dd727f648ab8f0a5750fbd071f7 | 1,321 | require 'rails_helper'
RSpec.describe 'Siging Up', type: :feature do
let(:user) { User.new(username: 'tarly', fullname: 'truly') }
scenario 'Sign up with valid inputs' do
visit login_path
click_on 'Sign up'
find(:css, '#new_fullname', visible: false).set user.fullname
find(:css, '#new_username', vi... | 30.022727 | 75 | 0.680545 |
26c99f48efda6684203ac23fd27fe262cdad4e56 | 350 | cask 'mediathekview' do
version '13.5.0'
sha256 'ac634ab0383270e61ed1fe91905c0f5c8dfa8a15408d1471ed1b2669974d07bd'
url "https://download.mediathekview.de/stabil/MediathekView-#{version}-mac.dmg"
appcast 'https://mediathekview.de/changelog/index.xml'
name 'MediathekView'
homepage 'https://mediathekview.de/'... | 29.166667 | 81 | 0.78 |
87d887b0cb4933896e169564a5d3e98fb153fcf5 | 301 | require "walmart_open/product_request"
module WalmartOpen
module Requests
class Taxonomy < ProductRequest
def initialize
self.path = "taxonomy"
end
private
def parse_response(response)
response.parsed_response["categories"]
end
end
end
end
| 16.722222 | 46 | 0.667774 |
f8088efc8ade3b51cfa2d63ee9b3af8de929f77e | 1,776 | require 'logger'
module Rack
class ContentLengthChecker
# @param app []
# @param logger [] logger
# @param options [Hash] opts チェックするオプション
# @option opts [Symbol] :warn lenght と 例外を排出するかの
# @option opts [Symbol] :fatal lenght と 例外を排出するかの
# @return Object
def initialize(app, warn: {}, fata... | 37 | 145 | 0.634009 |
abb1613023b8f2d8675829339f8e1744f1419968 | 1,077 | require 'formula'
class Nmap < Formula
homepage "http://nmap.org/"
head "https://guest:@svn.nmap.org/nmap/", :using => :svn
url "http://nmap.org/dist/nmap-6.47.tar.bz2"
sha1 "0c917453a91a5e85c2a217d27c3853b0f3e0e6ac"
bottle do
revision 1
sha1 "f866508268e57a381a1c2456456c5580f83e5bc4" => :mavericks
... | 23.413043 | 69 | 0.674095 |
3830e4ad404c8673b826670de96468ad38a37154 | 118 | # frozen_string_literal: true
module BenefitSponsors
module Organizations
class Organization
end
end
end
| 13.111111 | 29 | 0.771186 |
acb3bee5426ff6e4ddbf629a4b82739c138b98be | 5,254 | #
# Author:: Derek Groh (<derekgroh@github.io>)
# Copyright:: 2018, Derek Groh
#
# 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 re... | 40.415385 | 233 | 0.674343 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.