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 |
|---|---|---|---|---|---|
7a499efefef99466ffc7083ca4eb941c3fc0cb8c | 1,129 | # CVSS-Suite, a Ruby gem to manage the CVSS vector
#
# Copyright (c) Siemens AG, 2016
#
# Authors:
# Oliver Hambörger <oliver.hamboerger@siemens.com>
#
# This work is licensed under the terms of the MIT license.
# See the LICENSE.md file in the top-level directory.
require 'cvss_suite/cvss2/cvss2'
require 'cvss_suit... | 22.137255 | 103 | 0.69442 |
bb9af5be1d012f52a16dfd4da365ef33bcefaa8c | 6,347 | # -*- coding: utf-8 -*-
class RailsDataExplorer
class DataType
# This is an abstract class. Use sub_classes
#
# Responsibilities:
# * Provide available charts and statistics for quantitative data type.
# * Provide methods for quantitative data type.
#
# Collaborators:
# * DataSet
... | 43.176871 | 137 | 0.582795 |
6176311deefe1d5e853571809df703f2daafd82c | 933 | # encoding: UTF-8
# frozen_string_literal: true
module API
module V2
class Mount
get('/null') { '' }
get('/broken') { raise Error, code: 2_014_310, text: 'MtGox bankrupt' }
end
end
end
describe API::V2::Mount, type: :request do
let(:middlewares) { API::V2::Mount.middleware }
it 'should use... | 27.441176 | 112 | 0.648446 |
4a0687d1ebc63e46704f474eecede0dddf4437a0 | 868 | class Bingrep < Formula
desc "Greps through binaries from various OSs and architectures"
homepage "https://github.com/m4b/bingrep"
url "https://github.com/m4b/bingrep/archive/v0.8.2.tar.gz"
sha256 "5647d78166a2d768b98ae03bd40427f2263b28b81213882d42f638c5b96619e2"
license "MIT"
bottle do
cellar :any_ski... | 33.384615 | 94 | 0.786866 |
abc0561361f33be3694b05192155216f510fa558 | 75 | require "movement/version"
module Movement
# Your code goes here...
end
| 12.5 | 26 | 0.733333 |
f8e76ff1613dc6558660fa7b5e6450b3ffeb2eaf | 39 | module Sengiri
VERSION = "0.1.0"
end
| 9.75 | 19 | 0.666667 |
87dc27ec73915f9184e91ad60b662038199d126c | 2,086 | # frozen_string_literal: true
require "guard/cli/environments/bundler"
require "guard/commander"
require "guard/guardfile/generator"
module Guard
module Cli
module Environments
class Valid
def initialize(options)
@options = options
end
def start_guard
# TODO: j... | 28.972222 | 75 | 0.59348 |
617458c5dda722a8912bcb923a84ced01aa1fe85 | 2,180 | class Duff < Formula
desc "Quickly find duplicates in a set of files from the command-line"
homepage "https://duff.sourceforge.io/"
url "https://downloads.sourceforge.net/project/duff/duff/0.5.2/duff-0.5.2.tar.gz"
sha256 "15b721f7e0ea43eba3fd6afb41dbd1be63c678952bf3d80350130a0e710c542e"
bottle do
sha256 ... | 53.170732 | 123 | 0.758257 |
080bc3b23e7b3493bb970eefe7ef7dbc7adf9d30 | 916 | class RoastsController < ApplicationController
def index
roasts = Roaster.find(params[:roaster_id]).roast
render json: { status: 200, roasts: roasts }
end
def new
roast = Roast.new
end
def destroy
roaster = Roaster.find(params[:roaster_id])
roast = roaster.roast.find(params[:id])
ro... | 21.809524 | 118 | 0.684498 |
ab7301fc6c16bafac69cd894d1ebe7074000c91d | 9,385 | class ManageIQ::Providers::Vmware::InfraManager::Scanning::Job < VmScan
# Make updates to default state machine to take into account snapshots
def load_transitions
super.tap do |transitions|
transitions.merge!(
:start_snapshot => {'before_scan' => 'snapshot_create'},
:sna... | 33.280142 | 138 | 0.63154 |
2845190d428d1da68b539c2c062740c09cf7114f | 221 | class CreateStorePrices < ActiveRecord::Migration[5.1]
def change
create_table :store_prices do |t|
t.references :item
t.references :store
t.float :price
t.timestamps
end
end
end
| 18.416667 | 54 | 0.647059 |
f86992c41ce8e8f045acf097685ad0f2daa2bf1c | 346 | Spree::SubscriptionInterval.create( :name =>"1 Month", :times => 1, :time_unit => 3 )
Spree::SubscriptionInterval.create( :name =>"2 Months", :times => 2, :time_unit => 3 )
Spree::SubscriptionInterval.create( :name =>"3 Months", :times => 3, :time_unit => 3 )
Spree::SubscriptionInterval.create( :name =>"4 Months", :tim... | 86.5 | 86 | 0.66763 |
18de3e700602c24dbc1a103f9ca531bfef0bf6c8 | 47 | class Class1
def method_of_class_1
end
end
| 9.4 | 23 | 0.787234 |
4a20f4aab5286b7efa63ebd2916086a7c3767044 | 1,529 | class <%= "#{file_name.capitalize+ "editor" + "Controller"}" %> < ApplicationController
def add_menu_form
@menu_id=params[:<%="#{file_name}"%>_id]
end
def add_menu
<%= file_name.capitalize %>.add_child(params[:<%="#{file_name}"%>_id].to_i, params[:title], params[:link])
<%= file_name.capitalize %>... | 30.58 | 130 | 0.6586 |
ed70114d5c84618eb8abf65645cda93948324760 | 985 | class Librsync < Formula
desc "Library that implements the rsync remote-delta algorithm"
homepage "https://librsync.github.io/"
url "https://github.com/librsync/librsync/archive/v2.1.0.tar.gz"
sha256 "f701d2bab3d7471dfea60d29e9251f8bb7567222957f7195af55142cb207c653"
bottle do
cellar :any_skip_relocation
... | 33.965517 | 94 | 0.771574 |
2115d94ca0f1fac03d46adc91087bff513b9ec4c | 1,154 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'xcbuildfaster/version'
Gem::Specification.new do |spec|
spec.name = "XCBuildFaster"
spec.version = XCBuildFaster::VERSION
spec.authors = ["Dave Schukin"]
spec.email ... | 38.466667 | 93 | 0.688042 |
ed453a4fcd819499f8d7da26bf86a8bcb807bd9a | 112 | #!/usr/bin/env ruby
puts $*[0][2..-1].split('').each_slice(2).map {|_| '0x%02X' % _.join.to_i(16) }.join(', ')
| 28 | 90 | 0.535714 |
1aad5c6502a6857dedfa59dbf2ad13a291490600 | 7,776 | require "net/http/proxy_authenticate_ntlm/version"
require "net/http"
require "net/https"
require "net/ntlm"
require "kconv"
# monkey patching Net::NTLM
class << Net::NTLM
def apply_des(plain, keys)
dec = OpenSSL::Cipher::DES.new
keys.map {|k|
dec.encrypt
dec.key = k
dec.update(plain)
... | 34.40708 | 122 | 0.579475 |
ed1df1a2ee12bc4447408fccaa155e7cc72aff75 | 91 | # desc "Explaining what the task does"
# task :easel_helpers do
# # Task goes here
# end
| 18.2 | 38 | 0.692308 |
1c770f06fde2c4f1439103b79c4f35db21ca6170 | 1,020 | nexus3_cleanup_policy 'integration_cleanup_policy' do
format 'raw'
criteria lastBlobUpdated: '604800', lastDownloaded: '259200'
end
nexus3_repo 'integration_repo' do
attributes storage: { blobStoreName: 'default', writePolicy: 'ALLOW_ONCE' }
repo_type 'rubygems-hosted'
end
nexus3_group 'integration_group' do
... | 24.878049 | 85 | 0.739216 |
6143f2cddaf534f8a95136dfaa88e16bad7034c0 | 2,721 | class IpBan < ApplicationRecord
belongs_to :creator, class_name: "User"
validate :validate_ip_addr
validates :reason, presence: true
before_save :create_mod_action
deletable
enum category: {
full: 0,
partial: 100
}, _suffix: "ban"
def self.ip_matches(ip_addr)
where("ip_addr >>= ?", ip_ad... | 30.573034 | 143 | 0.668504 |
f89c745e61e752160d66c1d86f13bcb269969ad9 | 21 | # typed: true
yield
| 5.25 | 13 | 0.666667 |
187890f6fe29c6514e9b4234750ed84463e61291 | 737 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'adv_image_picker'
s.version = '0.3.1'
s.summary = 'An advanced image picker with crop'
s.description = <<-DESC
An advanced image picker with crop
... | 30.708333 | 83 | 0.559023 |
08a941d68fd875f09c8c82cd122690eb70d0f902 | 175 | class Admin::DeviseAuthyController < Devise::DeviseAuthyController
layout "twofactor"
def after_authy_enabled_path_for(resource)
admin_dashboard_index_path
end
end
| 21.875 | 66 | 0.822857 |
26b25bf6ae6c07a141be8cf7748acb80023b3f37 | 36 | module LAMA
VERSION = '0.0.1'
end
| 9 | 19 | 0.638889 |
6a5b2e8cc5bacec3fc75e002d9aafe187cf6b666 | 1,940 | class Jenkins < Formula
desc "Extendable open source continuous integration server"
homepage "https://jenkins-ci.org"
url "http://mirrors.jenkins-ci.org/war/1.643/jenkins.war"
sha256 "b8c6387e56d04a0a4a7ec8d9dacd379fbd5d4001d01fdfcd443f9864809f9293"
head do
url "https://github.com/jenkinsci/jenkins.git"
... | 26.575342 | 106 | 0.618557 |
0137df95302c22b1ba863dbc4b6c8d3f36b6074f | 94 | FactoryBot.define do
factory :secret do
content { "MyText" }
user { nil }
end
end
| 13.428571 | 24 | 0.62766 |
18eff5bcc563d8e56a35adb8c3ef759d30e9df33 | 5,953 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.0-SNAPSHOT
=en... | 30.065657 | 198 | 0.626071 |
1a6193bc41d4b3e18623a95077fb8cc2fc3993b0 | 1,084 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "jekyll-github-meta/version"
Gem::Specification.new do |spec|
spec.name = "jekyll-github-meta"
spec.summary = "Add meta data from GitHub account to site config"
spec.description = "Add meta ... | 47.130435 | 105 | 0.663284 |
e27b724fd90cb02cc7f7e20f8fb1afc0f7e2bc1c | 4,136 | require 'spec_helper'
module VCAP::CloudController
describe ServiceDashboardClient do
let(:service_broker) { ServiceBroker.make }
let(:other_broker) { ServiceBroker.make }
let(:uaa_id) { 'claimed_client_id' }
it { is_expected.to have_timestamp_columns }
describe 'Associations' do
it { is_... | 33.088 | 106 | 0.670696 |
e895746ca2f0b9194e748c55e3f8e939949d7a0d | 7,176 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 23.45098 | 77 | 0.620262 |
624bd34bc1b31cfa9cc8903679ec1a45e8022a20 | 175 | class CreateGames < ActiveRecord::Migration[5.0]
def change
create_table :games do |t|
t.string :name
t.integer :price
t.timestamps
end
end
end
| 15.909091 | 48 | 0.64 |
39aecc0b09bbc528df6902c9709538dd48e3e2b5 | 4,108 | require 'msf/core'
require 'msf/core/handler/bind_tcp'
require 'msf/base/sessions/command_shell'
require 'msf/base/sessions/command_shell_options'
module Metasploit3
include Msf::Payload::Single
include Msf::Payload::Linux
include Msf::Sessions::CommandShellOptions
def initialize(info = {})
super(merge_info(in... | 28.727273 | 84 | 0.525316 |
bf90063a033c03efcef653dfec71234e9fc7aa8f | 9,148 | module Travis
module Build
class Script
class NodeJs < Script
DEFAULT_VERSION = '0.10'
YARN_REQUIRED_NODE_VERSION = '4'
NPM_QUIET_TREE_VERSION = '5'
NPM_CI_CMD_VERSION = '5.8.0'
def export
super
if node_js_given_in_config?
s... | 32.55516 | 297 | 0.486773 |
f7a7b276c7c49adbbf5832b6ba64cc535e57a9fc | 2,848 | class SupplyTeachers::GenerateBranches
include SupplyTeachers::DataImportHelper
attr_reader :supplier_branches
def initialize(current_data)
@current_data = current_data
end
def generate_branches
@supplier_branches = collate(branches.map { |row| nest(row, :branches) })
end
private
# rubocop:... | 34.731707 | 96 | 0.601826 |
87ff56a78a8223e83d08d96a0da6e21cbc67c1ec | 780 | require 'spec_helper'
RSpec.describe SixSaferpay::Address do
subject { SpinningWheel.create('address') }
let(:hash) {
{
first_name: subject.first_name,
last_name: subject.last_name,
date_of_birth: subject.date_of_birth,
company: subject.company,
legal_form: subject.legal_form,
... | 24.375 | 65 | 0.680769 |
395d2bce2cd4855daca6d8ed0b92183a88345813 | 2,327 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::EdgeGateway::Mgmt::V2019_03_01
module Models
#
# The security settings of a device.
#
class SecuritySettings < ARMBaseModel
include MsR... | 29.833333 | 79 | 0.50795 |
6299e34cbe6c04191c1d603adb7fd52da796a2fd | 1,136 | require 'lknovel/utils'
require 'uri'
module Lknovel
class Image
attr_reader :uri, :file
def initialize(url)
@uri = URI(url)
@file = @uri.path.split('/').last
end
def download(dir = '.')
file = File.join(dir, @file)
if !File.exists?(file)
File.open(file, 'wb') do |w... | 21.846154 | 73 | 0.516725 |
21cc2a570952c714df12a318966d2a30d2c2f045 | 1,613 | require 'spec_helper'
RSpec.describe 'Vertpig integration specs' do
let(:client) { Cryptoexchange::Client.new }
let(:vtc_eur_pair) { Cryptoexchange::Models::MarketPair.new(base: 'VTC', target: 'EUR', market: 'vertpig') }
it 'fetch pairs' do
pairs = client.pairs('vertpig')
expect(pairs).not_to be_empty
... | 33.604167 | 110 | 0.719157 |
e27cb5a2573b9097ef606971a1152391cdd48602 | 547 | cask 'letterfix' do
version '2.5.3,67423'
sha256 'b6125a0f55ef0c52711403613473ba6fc396745f7d2ace88cc46f9d9df57b41d'
url "http://dl.osdn.jp/letter-fix/#{version.after_comma}/LetterFix-#{version.before_comma}.dmg"
appcast 'https://osdn.jp/projects/letter-fix/releases/rss',
checkpoint: '8fa3a0fc1cb40fd5... | 36.466667 | 97 | 0.773309 |
91ef4268a0098f092e7d623229b31b050515029c | 1,729 | # Returns abbr as an uppercase symbol, stripping whitespace.
def get_uppercase_symbol(abbr)
return abbr.to_s.strip.upcase.to_sym
end
# Returns the state name associated with the state abbreviation abbr.
# abbr: A two character (uppercase or lowercase) symbol or string.
# include_dc: (default: false) Whether to inclu... | 23.364865 | 75 | 0.665124 |
0821d90daa29398f1561ef669f1acda59faf590f | 206 | ActionController::Routing::Routes.draw do |map|
map.namespace('registry') do |registry|
registry.root :controller => 'registry'
registry.connect ':action/:id', :controller => 'registry'
end
end
| 29.428571 | 61 | 0.703883 |
7a875f2059b390449524d7f20d8d0616d1dc4212 | 6,353 | require 'pathname'
Puppet::Type.newtype(:dsc_xaddomaincontroller) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xADDomainController resource type.
Automatically gener... | 31.450495 | 150 | 0.677947 |
396001390e6a66570272b1ac0d5760151082b629 | 7,953 | # frozen_string_literal: true
module Octokit
class Client
# Methods for the ReposReleases API
#
# @see https://developer.github.com/v3/repos/releases/
module ReposReleases
# Get a release
#
# @param repo [Integer, String, Repository, Hash] A GitHub repository
# @param release_... | 47.909639 | 261 | 0.663146 |
ed3bef1fef2c6e951e888652e1115a24974c2547 | 4,359 | #!/usr/bin/env rspec
require 'spec_helper'
property = Puppet::Type.type(:file).attrclass(:owner)
describe property do
before do
# FIXME: many of these tests exercise the provider rather than `owner`
# and should be moved into provider tests. ~JW
@provider = Puppet::Type.type(:file).provider(:posix).new
... | 29.06 | 97 | 0.650837 |
87847df478d493ddbed8b9ad0d86f1acc2ff3d44 | 457 | #!/usr/bin/ruby -I.
require 'minitest/unit'
require 'tmpl'
include MiniTest
Unit.autorun
class TestTmpl < Unit::TestCase
def test_tmpl
tmpl = Tmpl.new(file: "test.erb")
tmpl.set('test1', 'value1')
tmpl.set('test2', '<>&"')
result = tmpl.result
$stderr.puts result
assert_equal(tmpl.result, ... | 18.28 | 37 | 0.654267 |
ffec6236d933c5111b856608f94bf24c6af5e2fb | 20,183 | require 'linguist/file_blob'
require 'test/unit'
require 'mime/types'
require 'pygments'
class TestBlob < Test::Unit::TestCase
include Linguist
Lexer = Pygments::Lexer
def fixtures_path
File.expand_path("../fixtures", __FILE__)
end
def blob(name)
FileBlob.new(File.join(fixtures_path, name), fixtu... | 39.730315 | 105 | 0.705297 |
6174aec12dc4639e53c803fbbae3a2300f7e65c2 | 412 | name 'lempit'
maintainer 'Ross Timson'
maintainer_email 'ross@rosstimson.com'
license 'MIT'
description 'Installs a LEMP stack for local development of PHP projects.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'my... | 25.75 | 80 | 0.63835 |
87b1bc7ff13b6fbb8f18f64684c7ad9bfbadb96d | 2,701 | #
# Fluent
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 28.734043 | 121 | 0.664198 |
7968c9425f2ac498481ae46059b4824913c11962 | 819 | require 'spec_helper'
describe Projects::ServicesController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project_empty_repo, namespace: namespace, ... | 26.419355 | 97 | 0.71917 |
ab1ed9c24c8232468ec67a4d36a41424b1cae680 | 328 | cask 'font-tauri' 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/tauri/Tauri-Regular.ttf'
name 'Tauri'
homepage 'http://www.google.com/fonts/specimen/Tauri'
font 'Tauri-Regular.t... | 27.333333 | 86 | 0.743902 |
9136bd08e2c03236a8a7d08cd0af33e03918b133 | 330 | class CreateTodoItems < ActiveRecord::Migration[4.2]
def self.up
create_table :todo_items do |t|
t.string :description
t.string :action
t.string :url
t.string :image_url
t.integer :plaque_id
t.integer :user_id
t.timestamps
end
end
def self.down
drop_table :todo_items
... | 19.411765 | 53 | 0.666667 |
bb4d8cb074f9baccba8230bd3ad644673e2a6672 | 6,284 | module Expando::ApiAi::Objects
# Initialized with a hash representing an existing API.ai intent, and the path
# to an Expando file for that intent, generates the JSON for a new version of
# the intent.
#
# @see https://docs.api.ai/docs/intents#intent-object
class Intent < Base
# The list of attributes t... | 35.303371 | 103 | 0.64147 |
8734bc521574c6b41cbc98c866ef369f9c3b671b | 1,758 | module Bullet
module Mongoid
def self.enable
require 'mongoid'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_method :origin_eager_load, :eager_load
def first... | 31.392857 | 86 | 0.630262 |
213d404049ba10bbc45e2976c24fa45d82d605d1 | 2,759 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ApiManagement::Mgmt::V2019_01_01
module Models
#
# Paged email template list representation.
#
class EmailTemplateCollection
include Ms... | 28.153061 | 80 | 0.529177 |
18f2dde1e8ed9b9061dd9ee6ef64f53387858181 | 957 | module Xiki::Menu
class Ruby
def self.classes clazz=nil, method=nil
# /classes/, so show list of classes...
if clazz.nil?
result = []
ObjectSpace.each_object(Class) do |c|
name = c.to_s
next if name =~ /^#/
result << "- #{name}/\n"
end
re... | 26.583333 | 79 | 0.508882 |
621bdd673dd1fa89436dafd6989b1553853d9d86 | 1,892 | ##
# $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'
class Metasploit3 < Msf::Auxiliary
include ... | 30.516129 | 142 | 0.678118 |
bfc02c96484c918453fc5cb63e611d1262442d15 | 830 | class ::Hash
# Inspired by: http://stackoverflow.com/a/9381776
def deep_merge(second)
merger = proc { |_key, v1, v2|
v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2
}
merge(second, &merger)
end
# converts a deep hash into a flat hash
# hash = {
# 'a' => 1,
# 'b' => {'c... | 21.842105 | 67 | 0.551807 |
08c1580b1fed16ed60f7d0cf21774ee7275ce3c7 | 12,724 | # Copyright 2011 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" file acc... | 36.045326 | 81 | 0.687127 |
085f4f316a1d8cfdf1bde71453da4c54429163e6 | 2,863 | module PartnerLogoUploader
CONTENT_TYPES = [
'image/png',
'image/jpeg'
].freeze
def self.content_types
CONTENT_TYPES.join(', ')
end
def self.form params
raise if params[:partner_id].blank?
raise if params[:redirect_url].blank?
raise unless params[:filetype].in?(CONTENT_TYPES)
ex... | 25.792793 | 91 | 0.702061 |
ac9f37d290c958cbecd4041d2f2617667b189ed5 | 2,564 | class HighlightSuggestion < ApplicationRecord
belongs_to :run
validates :run, uniqueness: true
class << self
# from_run looks on Twitch for past broadcasts whose timestamps show that it contains the given run's PB. If found,
# the highlight suggestion is created and returned. If not found, nothing is cr... | 41.354839 | 144 | 0.652496 |
bbed6d9686b1a442c79354739534963f402dc8fd | 53 | class ChattingController < FayeRails::Controller
end
| 17.666667 | 48 | 0.849057 |
ff8b80c529b70765f50076c6259a79b4d2eec113 | 183 | # Sample code from Programing Ruby, page 548
a = [ 'cat', 'dog' ]
b = [ 'cat', 'dog' ]
a == b
a.id == b.id
a.eql?(b)
a.equal?(b)
| 22.875 | 44 | 0.377049 |
39d9199a5213257fb1ac8162d0ea84cea8664ccc | 2,393 | # frozen_string_literal: true
describe Barong::RedisSession do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:user) { create(:user) }
let!(:session_id) { SecureRandom.hex(16) }
let!(:hash_sid) { Barong::RedisSession.hexdigest_session(session_id) }
let!(:encr... | 27.825581 | 79 | 0.666109 |
219b85bd6398e46b215e74e101bdd17dd8f99893 | 1,470 | require File.dirname(__FILE__) + '/../../../test/test_helper'
require File.dirname(__FILE__) + '/../../spec_helper'
require 'admin/tags_controller'
# Re-raise errors caught by the controller.
class Admin::TagsController; def rescue_action(e) raise e end; end
describe Admin::TagsController do
before do
request.... | 20.704225 | 91 | 0.634694 |
210928cfc4c149e2213a0920b023864971aa1817 | 3,876 | require "spec_helper"
require "active_model/serializer_support"
require "app/models/pricing"
RSpec.describe Pricing do
describe ".all" do
it "returns all of the pricings" do
pricings = Pricing.all
expect(pricings.count).to eq 4
[
[0, "basic", 0, "Hound"],
[4, "tier1", 49, "Chi... | 23.490909 | 77 | 0.557792 |
380895e6df52167ba62f95a6ecbb2130be64dba1 | 1,525 | require 'cicu'
describe Cicu::Ruleset do
describe "#new" do
it "should raise ArgumentError if rules are invalid" do
expect(proc { Cicu::Ruleset.new("?") }).to raise_exception(ArgumentError)
end
it "should raise TypeError if argument is not a string" do
expect(proc { Cicu::Ruleset.new([123]) }... | 42.361111 | 81 | 0.638689 |
39e3157ff6ab03125d891f8000a210c05c517307 | 1,279 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-securityhub'... | 38.757576 | 115 | 0.668491 |
abff8025c576880bcaa762e196fbf6f3c1256b57 | 3,401 | module Ethereum
class Decoder
def decode(type, value, start = 0)
is_array, arity, array_subtype = Abi::parse_array_type(type)
if is_array && arity
decode_static_array(arity, array_subtype, value, start)
elsif is_array
decode_dynamic_array(array_subtype, value, start)
else
... | 30.63964 | 104 | 0.610409 |
790417128cb89193e9cc4db580fa95ed64d7985f | 3,495 | module Xcodeproj
class Project
module Object
class XCBuildConfiguration < AbstractPBXObject
COMMON_BUILD_SETTINGS = {
:all => {
'GCC_VERSION' => 'com.apple.compilers.llvm.clang.1_0',
'GCC_PRECOMPILE_PREFIX_HEADER' => 'YES',
'P... | 36.030928 | 95 | 0.467525 |
91094a5eada4b41d10467e9fbf4bdf700811399f | 781 | # frozen_string_literal: true
class OrgAdmin::TemplateCustomizationsController < ApplicationController
include Paginable
include Versionable
after_action :verify_authorized
# POST /org_admin/templates/:id/customize
def create
@template = Template.find(params[:template_id])
authorize(@template, :cus... | 27.892857 | 72 | 0.724712 |
61cc50945b2133379191ef560ccf07e03524000a | 9,044 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'email_address', type: :request do
include SchemaMatchers
let(:token) { 'fa0f28d6-224a-4015-a3b0-81e77de269f2' }
let(:auth_header) { { 'Authorization' => "Token token=#{token}" } }
let(:user) { build(:user, :loa3) }
before do
Timecop.... | 35.190661 | 101 | 0.611345 |
d5c9bc2193c95d4d35bfb6e62477ed668d1f596c | 1,465 | # 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::Hdinsight::Mgmt::V2018_06_01_preview
module Models
#
# The information of AAD security group.
#
class ClientGroupInfo
... | 25.258621 | 70 | 0.524232 |
ff8c06b479aeaf48c619de6bf8c5e5ba77b48e82 | 9,758 | # frozen_string_literal: true
require "isolation/abstract_unit"
require "active_support/dependencies/zeitwerk_integration"
class ZeitwerkIntegrationTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
def setup
build_app
end
def boot(env = "development")
app(env)
end
def tea... | 27.105556 | 104 | 0.723919 |
0334d87655c76710533927d4b2e83155c6dd718e | 628 | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::UnindexedForeignKeysTest < Minitest::Test
def test_unindexed_foreign_key_is_reported
create_table(:companies)
create_table(:users) do |t|
t.references :company, foreign_key: true, index: false
end
assert_success(<<OUTPUT)
The f... | 25.12 | 78 | 0.753185 |
bf13ca4a74d8380e78bb6bbee47454f5f4f25adc | 8,677 | module Neo4j::Shared
module Property
extend ActiveSupport::Concern
include Neo4j::Shared::MassAssignment
include Neo4j::Shared::TypecastedAttributes
include ActiveModel::Dirty
class UndefinedPropertyError < Neo4j::Error; end
class MultiparameterAssignmentError < Neo4j::Error; end
attr_r... | 37.081197 | 149 | 0.667051 |
d5e6c4783c1dc3de8f2d6f43681eddbcbfd88813 | 2,879 | # frozen_string_literal: true
# Finders::MergeRequest class
#
# Used to filter MergeRequests collections by set of params
#
# Arguments:
# current_user - which user use
# params:
# scope: 'created_by_me' or 'assigned_to_me' or 'all'
# state: 'open', 'closed', 'merged', 'locked', or 'all'
# group_id: in... | 23.991667 | 76 | 0.704411 |
b9a5fb274e99c0732aabb9a8f50f76a8b6a8fe3a | 5,769 | class MysqlAT56 < Formula
desc "Open source relational database management system"
homepage "https://dev.mysql.com/doc/refman/5.6/en/"
url "https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.51.tar.gz"
sha256 "262ccaf2930fca1f33787505dd125a7a04844f40d3421289a51974b5935d9abc"
license "GPL-2.0-only"
bot... | 32.410112 | 101 | 0.678454 |
28d03832c8f94710753a805d6e3dd5304542ce94 | 3,291 | module RailsAdmin
module Models
module Setup
module AlgorithmAdmin
extend ActiveSupport::Concern
included do
rails_admin do
navigation_label 'Compute'
navigation_icon 'fa fa-cog'
weight 400
object_label_method { :custom_title }
... | 33.242424 | 102 | 0.512306 |
5d5f1e459b04a6480f34db7bb2c853c3c8f566ad | 883 | Pod::Spec.new do |s|
s.name = "CWPopup"
s.version = "1.2.4"
s.summary = "A category on UIViewController to present a popup view controller."
s.description = "CWPopup adds a category on UIViewController to present a popup view controller. It offers an animated and non-animated presentation of ... | 55.1875 | 239 | 0.667044 |
e9a7d6a315240d122b05037588122999330eb063 | 1,763 | # frozen_string_literal: true
module GroupTree
# rubocop:disable Gitlab/ModuleWithInstanceVariables
# rubocop: disable CodeReuse/ActiveRecord
def render_group_tree(groups)
groups = groups.sort_by_attribute(@sort = params[:sort])
groups = if params[:filter].present?
filtered_groups_with_an... | 35.26 | 80 | 0.695406 |
1c1f709f9d0ccf71989296a69805e4cf6d0516fd | 3,503 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'English'
require 'json'
require 'shellwords'
require_relative 'base'
module Commands
class In < Commands::Base
attr_reader :destination
def initialize(destination:, input: Input.instance)
@destination = destination
super(input: input)
... | 29.191667 | 127 | 0.587782 |
6a90605a212aeaf3372671603cd21f61b725fd56 | 2,536 | require 'lotus/utils/class'
require 'lotus/views/default'
require 'lotus/views/null_view'
module Lotus
# Rendering policy
#
# @since 0.1.0
# @api private
class RenderingPolicy
STATUS = 0
HEADERS = 1
BODY = 2
LOTUS_ACTION = 'lotus.action'.freeze
SUCCESSFUL_STATUSES = (200..201).fre... | 27.268817 | 126 | 0.629338 |
8781dc1d9c45786d94400ac94063350a4e3385f4 | 14,464 | # frozen_string_literal: true
require "helper"
module Nokogiri
module XML
class TestDocumentFragment < Nokogiri::TestCase
describe Nokogiri::XML::DocumentFragment do
let(:xml) { Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE) }
def test_replace_text_node
html = "foo"
... | 36.897959 | 119 | 0.577848 |
18ccc6e6f8ec12a4d3599c15dba78934ebdfdaa8 | 1,615 | class GitNow < Formula
desc "Light, temporary commits for git"
homepage "https://github.com/iwata/git-now"
url "https://github.com/iwata/git-now.git",
:tag => "v0.1.1.0",
:revision => "a07a05893b9ddf784833b3d4b410c843633d0f71"
head "https://github.com/iwata/git-now.git"
bottle do
cellar :any... | 32.959184 | 107 | 0.705263 |
7a7f8052b8f314afc195524e5057a6edbe7e57bd | 983 | Rails.application.routes.draw do
devise_for :users
get 'get_user' => 'users#get_user'
get 'render_post' => 'posts#render_post'
get 'active_chatrooms' => 'chatrooms#active_chatrooms'
resources :users do
resources :posts do
resources :comments, :only => [:show, :create, :destroy, :edit, :update, :new]... | 23.404762 | 87 | 0.639878 |
bb27015ebfe496fb8597f3275343129b3049d2d5 | 551 | # frozen_string_literal: true
require 'tilt'
# Load tilt/haml only when haml is available
begin
require 'haml'
rescue LoadError
else
require 'tilt/haml'
end
require_relative 'engine'
module Faml
class Tilt < Tilt::Template
def prepare
filename = nil
if file
filename = File.expand_path(fil... | 18.366667 | 70 | 0.669691 |
280a2c72c3c3d921eee04036d3ce957767747eee | 1,150 | # encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'spec_helper'
include TwitterCldr::Formatters
describe CurrencyFormatter do
describe "#format" do
before(:each) do
@formatter = CurrencyFormatter.new(:locale => :msa)
end
it "should use a dollar... | 30.263158 | 109 | 0.666087 |
084c35a9623408dbf84e49f3d311b3cd045104c1 | 1,644 | class Asio < Formula
desc "Cross-platform C++ Library for asynchronous programming"
homepage "https://think-async.com/Asio"
url "https://downloads.sourceforge.net/project/asio/asio/1.14.0%20%28Stable%29/asio-1.14.0.tar.bz2"
sha256 "2e1be1a518a568525f79b5734d13731b6b4e4399ec576a0961db6e2d86112973"
head "https:... | 30.444444 | 101 | 0.666058 |
ed6af368434c8118252a2558831e4196a7961535 | 1,953 | # -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "cucumber/platform"
Gem::Specification.new do |s|
s.name = 'cucumber'
s.version = Cucumber::VERSION
s.authors = ["Aslak Hellesøy"]
s.description = 'Behaviour Driven Development with elegance and joy'
s.su... | 39.06 | 89 | 0.640553 |
5d8f3789555b2805f8ba11056ae7e33e863577f1 | 2,620 | # frozen_string_literal: true
require 'openssl'
require 'acme-client'
require 'redis'
require 'letsencrypt/railtie'
require 'letsencrypt/engine'
require 'letsencrypt/configuration'
require 'letsencrypt/logger_proxy'
require 'letsencrypt/redis'
# :nodoc:
module LetsEncrypt
# Production mode API Endpoint
ENDPOINT =... | 27.578947 | 93 | 0.683206 |
39cb01dbdee74eb0eb9ccadcaf4bbfa06a0f925f | 5,866 | class Title
def initialize(window)
@window = window
@cursor = 0
@white = 0xffffffff
@black = 0xff000000
@mode = :title # :title, :white_fade
@animation = Gosu::Image::load_tiles(window, "media/sprites/ruby.png", 16, 16, true)
calc_animation
@corn = Gosu::Image::load_tiles(window, "medi... | 29.626263 | 159 | 0.571258 |
f7262d5d05a4e9a2616ccae87a2b4003fb9fd6d1 | 1,152 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-apigateway'
spec.version = File.read(F... | 38.4 | 112 | 0.663194 |
287ea0a769943f4890937d46d421e88886855894 | 4,005 | require 'spec_helper'
describe HdfsEntryPresenter, :type => :view do
let(:hdfs_data_source) { hdfs_data_sources(:hadoop) }
let(:options) {{}}
let(:presenter) { HdfsEntryPresenter.new(entry, view, options) }
describe "#to_hash" do
let(:hash) { presenter.to_hash }
shared_examples_for :rendering_activi... | 29.021739 | 70 | 0.571036 |
38e4c161e604238f4f86176e027e77bf25c2e1c0 | 295 | json.extract! @comment, :id
json.body h(@comment.body)
json.created_at l(@comment.created_at)
json.user do
json.display_name @comment.user.display_name
json.image do
json.thumbnail do
json.src @comment.user.image.thumbnail.url
end
end
json.url user_path(@comment.user)
end
| 22.692308 | 48 | 0.738983 |
ac3611ac005f3aacddc67963a6862114d3a0c6a9 | 9,802 | require File.expand_path("../../../lib/LitleOnline",__FILE__)
require 'test/unit'
module LitleOnline
class Litle_certTest5 < Test::Unit::TestCase
@@merchant_hash = {
'reportGroup'=>'Planets',
'url'=> 'https://payments.vantivprelive.com/vap/communicator/online',
'id'=>'test'
}
... | 47.352657 | 131 | 0.677311 |
f88b6fc571e69b8accd01b0a8dc0d36c174c5307 | 7,358 | class UsageError < RuntimeError; end
class FormulaUnspecifiedError < UsageError; end
class KegUnspecifiedError < UsageError; end
class MultipleVersionsInstalledError < RuntimeError
attr_reader :name
def initialize name
@name = name
super "#{name} has multiple installed versions"
end
end
class NotAKegEr... | 25.460208 | 96 | 0.682387 |
e9d23e72d2142865b1ea47e6eac15daeaadf17b8 | 50,894 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 45.563115 | 106 | 0.639191 |
28d59222bab8646c53e69e55b728b48dbd83ad60 | 898 | class MealsController < ApplicationController
def create
meal = current_user.meals.create(meal_params)
redirect_to meals_path
end
def update
if Meal.find(params[:id]).update(meal_params)
redirect_to meals_path
else
end
end
def index
@planner = TwoWeekPlanner.new
@meals = Me... | 20.883721 | 68 | 0.688196 |
339098674e1471052cd492b17fa7f19c7c62b00c | 127 | class AddStatusToComplaints < ActiveRecord::Migration[5.0]
def change
add_column :complaints, :status, :string
end
end
| 21.166667 | 58 | 0.755906 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.