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 |
|---|---|---|---|---|---|
0866f4f611953e25acbc2a049d7f449f0354ffa8 | 757 | require 'test_helper'
class MicropostTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
# This code is not idiomatically correct.
@micropost = @user.microposts.build(content: "Lorem ipsum")
end
test "should be valid" do
assert @micropost.valid?
end
test "user id should be pres... | 22.939394 | 63 | 0.689564 |
1c7abd9eff332bbaa3b77dfb6185e819f0830dae | 1,827 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 35.823529 | 105 | 0.673235 |
e9cbf8a406d48edf1d73754596886176de957cad | 138 | if File.readable?("REVISION")
CurrentCommit = File.read("REVISION").strip
else
CurrentCommit = `git rev-parse --short HEAD`.chomp
end
| 23 | 52 | 0.731884 |
1c0b29fbcc66145387ea1b2398a9664b8b3a16ca | 543 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def current_user
if session[:user_id]
@current_user ||= User.find(session[:user_id])
end
end
def authorize
if !current_user
flash[:alert] = "You aren't authorized ... | 21.72 | 71 | 0.67035 |
33bb6190e621ea96b2827123741ff11910d5b2e3 | 124 | require "test_helper"
class PreferenceTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.5 | 46 | 0.709677 |
e8ba3b255ab646602f40b9644c53603234e354d0 | 192 | class ApplicationMailer < ActionMailer::Base
# The gmail address specified here will be used to send emails to recipients.
default from: Rails.application.credentials.email[:username]
end
| 38.4 | 79 | 0.802083 |
1a6c3580c2deefd4f03ae4f5fffff50102d5c66d | 3,418 | # encoding: utf-8
require File.join(File.dirname(__FILE__), "../spec_helper.rb")
describe ActiveService::Model::Aggregations do
describe :composed_of do
context "with multiple value object" do
before do
spawn_model "User" do
attribute :address_street
attribute :address_city
... | 33.509804 | 121 | 0.624927 |
01f0da120bfcfafc3ed81fcfe07e5c3d68fefea0 | 245 | #coding: utf-8
class ChangeVipDefaultAction < ActiveRecord::Migration
def up
sf = SystemFunction.find_by_subject_title('转账客户管理')
if sf.present?
sf.default_action = 'vips_path()'
sf.save!
end
end
def down
end
end
| 17.5 | 55 | 0.681633 |
91058b99ca9052444e2ceb2435fcea0e43ca397a | 7,076 | # frozen_string_literal: true
class V4::VerseFinder < ::VerseFinder
def random_verse(filters, language_code, words: true, tafsirs: false, translations: false, audio: false)
@results = Verse.unscope(:order).where(filters).order('RANDOM()').limit(3)
load_translations(translations) if translations.present?
... | 32.608295 | 117 | 0.687818 |
019b188015ff4e030c71f48a8fe755e046d3b378 | 908 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable... | 29.290323 | 82 | 0.784141 |
3865ef644ce0ab22a475c4923a06b3ef906d5c9c | 4,055 | module ELFShim
# See: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
MAGIC_NUMBER_OFFSET = 0
MAGIC_NUMBER_ASCII = "\x7fELF".freeze
OS_ABI_OFFSET = 0x07
OS_ABI_SYSTEM_V = 0
OS_ABI_LINUX = 3
TYPE_OFFSET = 0x10
TYPE_EXECUTABLE = 2
TYPE_SHARED = 3
ARCHITECTURE_OFFSET = 0x12
... | 25.664557 | 103 | 0.660912 |
6a1ff979c3f567acd4a6f83c0bc2cb7c4ad21548 | 954 | require "test_helper"
class DesktopTest < Minitest::Test
def setup
@app_roots = [
ONDEMAND.join("apps", "bc_desktop"),
AWESIM.join("apps", "bc_desktop"),
]
end
def test_that_it_is_same_across_portals
app_files = @app_roots.map do |p|
Dir.glob(p.join("**", "*")).map{|f| Pathname.new... | 28.909091 | 82 | 0.618449 |
e275a67ffe1fcccd335d331bb22cb0d8d231007b | 1,350 | class EventsController < ApplicationController
def new
init
@event = Event.new
@event.ticket_types.build
end
def index
params[:search] ? @events = Event.search(params[:search]).where("starts_at > ?", DateTime.now).where(published: true) : @events = Event.where("starts_at > ?", DateTime.now).where(published... | 24.545455 | 197 | 0.717037 |
2634f30c942c3db65e6be5483c327faec51cc932 | 4,577 | # 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::V2018_01_10
module Models
#
# HyperV replica 2012 R2 (Blue) replication details.
#
class HyperVReplicaBlue... | 31.349315 | 83 | 0.493118 |
acadac733c8229e6059090ae672b4af05a77dff6 | 209 | require 'twitch'
::TWITCH = Twitch.new({
client_id: ENV['TWITCH_CLIENT_ID'],
secret_key: ENV['TWITCH_CLIENT_SECRET'],
redirect_uri: 'http://japanesekoreanug.com',
scope: ['user_read']
})
TWITCH.link
| 19 | 46 | 0.708134 |
629c3c6560daec0cb76af4f7e1edad78549ec5a4 | 915 | Profiles::Application.routes.draw do
root 'users#me'
match '/search', to: 'users#search', via: 'post'
match '/groups', to: 'users#list_groups', via: 'get'
match '/users', to: 'users#list_users', via: 'get'
match '/years', to: 'users#list_years', via: 'get'
match '/user/:uid', to: 'users#user', v... | 50.833333 | 92 | 0.585792 |
f804345bbbdeba493f0df8360878a660894d64b1 | 4,108 | module Silicium
class IntegralDoesntExistError < RuntimeError
end
##
# A class providing numerical integration methods
class NumericalIntegration
# Computes integral from +a+ to +b+ of +block+ with accuracy +eps+
def self.three_eights_integration(a, b, eps = 0.0001, &block)
wrapper_method([a, ... | 29.985401 | 87 | 0.581548 |
8785014ef73aa69198dd681c902d6662027ae5af | 2,075 | control 'packages' do
impact 1.0
title 'confirm package installation'
desc 'confirm all desired packages are installed'
describe command('apk info') do
its('stdout') { should include ('curl') }
its('stdout') { should include ('python3') }
its('stdout') { should include ('build-base') }
its('stdo... | 29.642857 | 72 | 0.69494 |
bb9c8f802e321ca6fd5bc126cc2a1f95acef1c60 | 686 | # Copyright 2016 LINE
#
# LINE Corporation licenses this file to you 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 l... | 31.181818 | 77 | 0.740525 |
e8970fc59fa68c05c7e285490f814e81ce4cbb05 | 527 | #!/usr/bin/ruby
free = `sar -d 1 5|grep Average`.split("\n")
descriptions = free[0].split(/\s+|\|/).collect{|x| x.strip.sub("/s","")}
descriptions.shift(2)
free.shift
interfaces = Hash.new
free.each do |interface|
interface = interface.strip.split(/\s+/).collect(&:strip)
interface.shift
ifname = interface.shif... | 26.35 | 73 | 0.669829 |
d5959479b13b2f9fe39832b3a046964ba6d37921 | 1,109 | # typed: true
# frozen_string_literal: true
module EntityMapper
module ActiveRecord
class Context
def initialize(transaction_class: ::ActiveRecord::Base)
@tracked_aggregates = []
@transaction_class = transaction_class
end
def call
@transaction_class.transaction do
... | 24.644444 | 95 | 0.649234 |
91185177fb9d77d4aa40f85adfcbd0ce1daeaa73 | 2,486 | # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, ... | 35.514286 | 120 | 0.669348 |
4a6a80864495b5b58f350d7ae8bb961e8f418832 | 1,532 | #
# Be sure to run `pod lib lint XHLRUView.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'XHLRUView... | 36.47619 | 99 | 0.641645 |
e2b9bda130625e426d617e4a34b5c8765d06c145 | 2,273 | # encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'inspec/base_cli'
module Supermarket
class SupermarketCLI < Inspec::BaseCLI
namespace 'supermarket'
# TODO: find another solution, once https://github.com/erikhuda/thor/issues/261 is fixed
def self.banner(command, _namespac... | 30.306667 | 126 | 0.642763 |
1ca695ed47cd190153ddf6c4b0fb3e9b4d1d6895 | 2,630 | # frozen_string_literal: true
# Base class for implementing custom integration services.
class Integration::AbstractService < Integration::ServiceBase
class_attribute :adapter_class
attr_reader :integration, :adapter
def initialize(integration)
super
@adapter = adapter_class.new(integration.endpoint)
... | 22.672414 | 107 | 0.703802 |
e9a18e79415eee538a1ba60f1c222e7f6e1d3c42 | 1,198 | class UsersController < ApplicationController
before_action :authenticate_user!, only: [:secret]
# GET /accountsettings/profile
def info
@user = current_user
end
def credit_card
end
def secret
end
# PATCH /accountsettings/profile
def profile
puts "----------------------------------... | 19.966667 | 58 | 0.631886 |
1cb84bf1b2b638f9552c6dcde226c59c12bbce7d | 985 |
module EbayTrading # :nodoc:
module Types # :nodoc:
# == Attributes
# text_node :cancel_reason, 'CancelReason', :optional => true
# text_node :cancel_reason_details, 'CancelReasonDetails', :optional => true
# text_node :cancel_intiator, 'CancelIntiator', :optional => true
# datetime_node :can... | 41.041667 | 85 | 0.718782 |
18128e8403b80ff0f2d2630f8a9406d87fa60bd6 | 4,287 | # Copyright © 2011 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of c... | 45.126316 | 145 | 0.759272 |
3300139e4cc2833f7f149d09cb97150a894bcd46 | 12,138 | # 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::ApiManagement::Mgmt::V2016_10_10
module Models
#
# A single API Management service resource in List or Get response.
#
class... | 34.288136 | 99 | 0.480392 |
08f81c700718f66c29b512cf9228e611ad400920 | 1,713 | class ToolController < ApplicationController
# def actuator
# @files = get_displays()
# @ports = get_ports()
# # render :json => @ports
# render :layout => "full_screen"
# end
def midi
render :layout => "full_screen"
end
def annotator
render :layout => "full_screen"
end
def stat... | 22.246753 | 120 | 0.617046 |
08c8cbed7479e2d2c6f6abe1300bda5e15f571e1 | 8,024 | #======================== Change in Daily Electricity Consumption =============
require_relative 'alert_electricity_only_base.rb'
class AlertChangeInDailyElectricityShortTerm < AlertElectricityOnlyBase
MAXDAILYCHANGE = 1.05
attr_reader :last_weeks_consumption_kwh, :week_befores_consumption_kwh
attr_reader :last... | 42.680851 | 140 | 0.722832 |
e93d0aa3acec739f74a8c3fb06157b515f76ff62 | 5,992 | module Ridley
module Errors
class RidleyError < StandardError; end
class InternalError < RidleyError; end
class ArgumentError < InternalError; end
class ClientError < RidleyError; end
class ConnectionFailed < ClientError; end
class TimeoutError < ClientError; end
class ResourceNotFound <... | 31.703704 | 121 | 0.688752 |
bb68ecdbf6e79d7267572a721b7b1d096f1c6d7e | 972 | Pod::Spec.new do |s|
s.name = "PickImageAlert"
s.version = "1.0.6"
s.summary = "Photos or camera access using the system alert controller"
s.description = "PickImageAlert provides a list of your photos in your alert controller with three alert actions"
s.requires_arc... | 54 | 122 | 0.600823 |
0801fde038761b9b0f09893d51ecbc39d542bbfe | 10,243 | require 'kontena/cli/apps/yaml/validator_v2'
describe Kontena::Cli::Apps::YAML::ValidatorV2 do
describe '#validate_options' do
context 'build' do
it 'can be string' do
result = subject.validate_options('build' => '.')
expect(result.valid?).to be_truthy
expect(result.errors.key?('bui... | 33.917219 | 100 | 0.531485 |
87f6fd5927d41a054df9abc9643ab4eae9552e33 | 1,433 | require 'cinch'
module XDCC
class Client
attr_accessor :bot
attr_accessor :connected
alias_method :connected?, :connected
@mutex # Mutex
@connection_resource # ConditionVariable
def initialize(server, channel: nil, nickname: "Guest-#{Time.now.to_i}")
this = self
@mutex = mutex = ... | 24.288136 | 77 | 0.5806 |
e91a3edddcfeecfed82c97e5c653605b7ca080ec | 168 | class CreateUsersUsingReplication < BaseOctopusMigrationClass
def self.up
Cat.create!(:name => 'Replication')
end
def self.down
Cat.delete_all
end
end
| 16.8 | 61 | 0.732143 |
5d4cc02e882f7d5df0410f8fbb58aab059a2cb24 | 21,583 | default['mesos']['options'] = {
'master' => {
'acls' => {
'version' => ['0.20.0', '0.20.1', '0.21.0', '0.21.1', '0.22.0', '0.22.1', '0.23.0'],
'default' => '',
'flag' => false,
'deprecated' => false
},
'advertise_ip' => {
'version' => ['0.23.0'],
'default' => '',
... | 30.70128 | 90 | 0.418802 |
b9c25e89aea30e019a42ac2036775ea765c86b8f | 1,661 | FactoryBot.define do
trait :jmaxml_trigger_base do
cur_site { cms_site }
name { unique_id }
training_status { 'disabled' }
test_status { 'disabled' }
end
factory :jmaxml_trigger_quake_intensity_flash,
class: Jmaxml::Trigger::QuakeIntensityFlash, traits: [:jmaxml_trigger_base] do
earthquak... | 32.568627 | 82 | 0.748946 |
bbdcf5da6e0dc2d8588050e9e9e226213ce84990 | 10,415 | class App < Sinatra::Base
set :public_folder, File.dirname(__FILE__) + '/public'
set :static, true
set :logging, true
set :server, 'thin'
JS_FILES = [
'support/jquery.min.js',
'support/swfobject.js',
'support/web_socket.js',
'support/json2.js',
'support/underscore-min.js',
'support/... | 23.093126 | 168 | 0.597888 |
bb0369eddc43f337c57c34d3762cd2f5a6d31289 | 1,396 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DevTestLabs::Mgmt::V2018_09_15
module Models
#
# Represents an update resource
#
class UpdateResource
include MsRestAzure
# @ret... | 25.851852 | 70 | 0.49212 |
7ac80d3cc0919a17348c45d19e7658072f304130 | 1,759 | Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test ... | 39.977273 | 79 | 0.773735 |
b9f9242fdeeacd9523031fac18fc6dac3dfc1e93 | 432 | # frozen_string_literal: true
class LikesController < ApplicationController
before_action :set_cart
before_action :dish_params
def create
Like.create(user_id: current_user.id, dish_id: params[:id])
end
def destroy
Like.find_by(user_id: current_user.id, dish_id: params[:id]).destroy
end
private... | 17.28 | 72 | 0.724537 |
b928e0e4c736d9822758c7a67c776b6049d25ac1 | 75 | require "overkill/version"
module Overkill
# Your code goes here...
end
| 12.5 | 26 | 0.733333 |
11548f238d7b9d1c5482215a3988a34bad693740 | 465 | OpenFarm::Application.configure do
Delayed::Worker.delay_jobs = false
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation... | 35.769231 | 74 | 0.780645 |
796a9dfc1cda03f4e629411165a2470c3f605248 | 688 | module FanOut
class InsertAllWithSelectBuilder
attr_reader :attributes, :select_scope, :model, :connection
def initialize(model, attributes, select_scope, connection)
@model = model
@attributes = attributes
@select_scope = select_scope
@connection = connection
end
def into
... | 17.641026 | 71 | 0.648256 |
ac47fea7372e9a01e7867800e8f1e8cd605cdf52 | 1,275 | #
# Be sure to run `pod spec lint LaravelEchoIOS.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://git... | 33.552632 | 111 | 0.661176 |
5da1bed22952ec9b2e590d4ca23fa18d27937e28 | 345 | # frozen_string_literal: true
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
true
end
def create?
true
end
def new?
create?
end
def update?
true
end
def edit?
update?
end
def des... | 9.857143 | 30 | 0.614493 |
ed395dd5df8497a5e2937568a0f958f8c41e7234 | 643 | require 'spec_helper'
RSpec.describe SuapApi do
it 'should return correct "BASE_URL"' do
expect(SuapApi::BASE_URL).to eq('https://suap.ifms.edu.br')
expect(SuapApi::BASE_URL).not_to be nil
end
it 'should return correct uri "FREQUENCY_OF_DAY"' do
uri = '/api/v2/minhas-informacoes/minhas-frequencias/?... | 30.619048 | 70 | 0.720062 |
0132a7999995d7770f280ae581ef6beb3a958ee2 | 319 | require 'test_helper'
class MainControllerTest < ActionController::TestCase
test "should get create" do
get :create
assert_response :success
end
test "should get list" do
get :list
assert_response :success
end
test "should get view" do
get :view
assert_response :success
end
end
| 15.95 | 53 | 0.705329 |
01570f93c127a3c71e6e5555187313b4fbecd058 | 440 | module Twitter
module Endpoints
module CustomToken
def request
@request
end
def call(env)
@request = Rack::Request.new(env)
response = Simple::OAuth2::Generators::Token.generate_for(env, &:unsupported_grant_type!)
status = response.status
headers = resp... | 20 | 97 | 0.613636 |
91228004e2e7a5c12a9aa1653cf215c6e39e653d | 1,986 | # Unlight
# Copyright(c)2019 CPA
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
module Unlight
# パーツのインベントリクラス
class ItemInventory < Sequel::Model
# 他クラスのアソシエーション
many_to_one :avatar # アバターを持つ
many_to_one :avatar_item # アバターアイテムを持つ
p... | 25.139241 | 134 | 0.633938 |
629d3301f03951017626b3d9579c6ed321b61643 | 52 | class MessageController < ApplicationController
end
| 17.333333 | 47 | 0.884615 |
8748e3c6cd5802e000a65bf1f1fa7162ef89f500 | 141 | module Types
class ReferencesType < BaseObject
field :users, [UserType], null: true
field :votes, [VoteType], null: true
end
end
| 20.142857 | 40 | 0.695035 |
1a663cf9afa911558c258872792f5e6dc4a6c3f1 | 174 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
# test "should get new" do
# get users_new_url
# assert_response :success
# end
end
| 19.333333 | 59 | 0.764368 |
2809f192767619f316d996070cfcba167499375c | 767 | require 'common'
module Sykus; module Hosts
# Gets client host info (printers + roomctl screenlock).
class GetCliInfo < ServiceBase
# @param [IPAddr] ip Client IP.
# @return [Hash] Hash of client info.
def run(ip)
host = Host.first(ip: ip)
raise Exceptions::Input, 'Host not found' if hos... | 22.558824 | 72 | 0.569752 |
bf2f912e884f82debf181a8a9f8cd4afa4913dcf | 1,814 | require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
describe Astrails::Safe::Archive do
def def_config
{
:options => "OPTS",
:files => "apples",
:exclude => "oranges"
}
end
def archive(id = :foo, config = def_config)
Astrails::Safe::Archive.new(id, Astrails::... | 27.074627 | 114 | 0.599228 |
6ae557e508c53beb472dafa6b8e71313811a736a | 693 | require 'rails/generators'
module NeditorRails
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
desc "This generator installs neditor custom config"
def add_custom_config
if File.exist?("app/assets/javascripts/... | 31.5 | 117 | 0.707071 |
8783099728cf9183603d042ed72c3e02bea8c69f | 272 | # frozen_string_literal: true
# Copyright 2015-2017, the Linux Foundation, IDA, and the
# CII Best Practices badge contributors
# SPDX-License-Identifier: MIT
%w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
].each { |path| Spring.watch(path) }
| 20.923077 | 57 | 0.731618 |
11284145690367c02a5b4d7b5ca8f75b803c3026 | 1,483 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe Api::V1::LightCompanySerializer, type: :serializer do
before(:all) {
@company = create :full_company
}
after(:all) {
@company.destroy!
}
before {
@company.reload
}
let(:serializer) { Api::V1::LightCompanySerializer.new(@com... | 31.553191 | 106 | 0.66352 |
1d0cedc36213138da8cecd2b9462d98cd1f40563 | 582 | require 'bundler/setup'
require 'minitest/autorun'
require 'minitest/reporters'
require 'minitest/reporters/mean_time_reporter'
Minitest::Reporters.use! Minitest::Reporters::MeanTimeReporter.new
class TestClass < Minitest::Test
def test_assertion
assert true
end
def test_fail
fail
end
... | 15.72973 | 67 | 0.701031 |
ff1ab14ad9c585f3202b3801d153226528b213f9 | 310 | class JobsController < ApplicationController
def fake
num = params[:num] || 200
num.to_i.times { FakeJob.perform_async }
render text: "#{num} jobs created"
end
def log
num = params[:num] || 200
num.to_i.times { LogJob.perform_async }
render text: "#{num} jobs created"
end
end
| 22.142857 | 44 | 0.654839 |
ab37c282fe57af1eaa62cdc6ad350393fdd54946 | 1,050 | # frozen_string_literal: true
module Types
module PermissionTypes
class Project < BasePermissionType
graphql_name 'ProjectPermissions'
abilities :change_namespace, :change_visibility_level, :rename_project,
:remove_project, :archive_project, :remove_fork_project,
:rem... | 45.652174 | 81 | 0.680952 |
5d592a947bae83d1b176365dfc02fb9e10fcef5f | 239 | # frozen_string_literal: true
require_relative '../options_helper'
describe OctocatalogDiff::Cli::Options do
describe '#opt_truncate_details' do
include_examples 'true/false option', 'truncate-details', :truncate_details
end
end
| 23.9 | 79 | 0.786611 |
ede4fef7e6f48b7eac86adee43dc6aa3e7a10794 | 865 | require_relative '../lib/named_proc'
describe "proc" do
it "creates a new proc as usual when called with a block" do
a = proc{}
expect( a ).to be_instance_of Proc
expect( a ).not_to be_lambda
end
it "creates a named proc when a method gets called on it" do
a = proc.brawl{}
expect( a ).to b... | 25.441176 | 64 | 0.660116 |
f7bd6949145abbfc7b836adc12aa0f8532dd9a6c | 1,155 | Pod::Spec.new do |s|
s.name = "ISOLogger"
s.version = "0.1"
s.summary = "ISOLogger hides the existing log entries for your app. So you can focus on the ones you just added."
s.description = <<-DESC
Why ISOLogger?
--------------
Other people add log en... | 41.25 | 182 | 0.593939 |
b96ba76ef1e922f7bbfbd5ad75108de617bc7395 | 1,619 | # 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::CognitiveServices::ContentModerator::V1_0
module Models
#
# Model object.
#
#
class CreateVideoReviewsBodyItemVideoFrame... | 26.540984 | 95 | 0.56084 |
18714a4909baf212e5bdd58d97e21601e291a020 | 2,611 | ##
# $Id: gom_openurl.rb 9262 2010-05-09 17:45:00Z jduck $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framewo... | 26.917526 | 88 | 0.595174 |
01d58c45ca1b92f77efb12d1b18da14812cbbb93 | 1,365 | require "spec_helper"
describe OpenXml::DrawingML::Properties::ColorSystemColor do
include PropertyTestMacros
it_should_use tag: :sysClr, name: "color_system_color", value: :activeBorder
it_should_have_value_properties :tint_transform, :shade_transform, :complement,
:inverse, ... | 44.032258 | 100 | 0.649084 |
bb4a16c3fcda20e09a77cfbe64e874715e971d85 | 654 | require_relative '../dr.rb'
describe DigitalRoot do
it 'can find the digital root of 16' do
expect(DigitalRoot.calculate(16)).to eq(7)
end
it 'can find the digital root of 123' do
expect(DigitalRoot.calculate(123)).to eq(6)
end
it 'can find the digital root of 999' do
expect(DigitalRoot.calcul... | 21.8 | 52 | 0.69419 |
ab54e72cc10ecc819804bb6b3796ebedc415b751 | 94 | module EadIndexer
class Engine < ::Rails::Engine
isolate_namespace EadIndexer
end
end
| 15.666667 | 32 | 0.755319 |
bb4cc27cc29fe47ccfa6c1e5ec570431c8b9891e | 124 | TotalProfiler::Config.profile_all = true
TotalProfiler::Config.add_class String, [:split]
TotalProfiler::Base.monkeypatch!
| 24.8 | 48 | 0.814516 |
61a20d7a5c324f335453281fd15c1276f5810813 | 460 | cask 'keychaincheck' do
version '1.3'
sha256 '00da69cc12330a4f2b60e4e05714be5e51c48dde1727540cb9f5c523669ebed7'
# eclecticlightdotcom.files.wordpress.com was verified as official when first introduced to the cask
url 'https://eclecticlightdotcom.files.wordpress.com/2017/09/keychaincheck13a.zip'
name 'Keychai... | 32.857143 | 102 | 0.797826 |
038139b489c2e953032f2ac65598db2299719a66 | 2,105 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Vote, type: :model do
before :each do
text = 'The Teams page contains a listing of the various Community Teams,
their responsibilities, links to their Wiki Home Pages and leaders,
communication tools, and a quick referen... | 46.777778 | 91 | 0.675534 |
f78ef801d15bbb1b25c5f3ac5be0b8f09bd05853 | 1,874 | # encoding: UTF-8
require "net/http"
require "nokogiri"
class NicknameResponder < Bitbot::Responder
include Bitbot::Responder::Wit
WORLDS = {
pirate: {
uri: "http://mess.be/pirate-names-male.php",
response: "Arrr! Yer pirate name be {{nick}}",
selector: ".normalText font b"
},
wutang... | 31.762712 | 99 | 0.622732 |
28066c52773865f051113027edf9a9e7ab01f385 | 1,480 | require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class DiceSet
attr_reader :values
def roll(n)
@values = (1..n).map { rand(6) + 1 }
end
end
class AboutDiceSet < EdgeCase::Koan
def test_can_create_a_dice_set
dice = DiceSet.new
assert_not_nil dice
end
def test_rolling_the_dice_ret... | 22.769231 | 79 | 0.700676 |
ff1e08b6950dc46ce029aacf68978f549b3e4b36 | 1,225 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 27.840909 | 63 | 0.721633 |
61c10d47434bf7c6a74b51279bf136474f23e6a7 | 6,543 | require 'spec_helper'
describe Gitlab::HealthChecks::FsShardsCheck do
def command_exists?(command)
_, status = Gitlab::Popen.popen(%W{ #{command} 1 echo })
status == 0
rescue Errno::ENOENT
false
end
def timeout_command
@timeout_command ||=
if command_exists?('timeout')
'timeout'
... | 35.754098 | 116 | 0.678282 |
e99e7cf4a3fe9e21ba184f8498bf422335e13170 | 1,614 | #
# Be sure to run `pod lib lint XMX_NetWorking.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'XMX_... | 37.534884 | 108 | 0.648079 |
ab443c264110cf251d2ce1d2d9d9e0ca38307603 | 375 | class NodeClassMembership < ApplicationRecord
validates_presence_of :node_id, :node_class_id
include NodeGroupGraph
has_parameters
belongs_to :node
belongs_to :node_class
fires :added_to, :on => :create, :subject => :node_class, :secondary_subject => :node
fires :removed_from, :on => :destroy, :s... | 26.785714 | 92 | 0.738667 |
1a91180b87779c5efd5cdd4f7fa87c18d18b81f4 | 3,450 | module HQMF1
# Represents a data criteria specification
class DataCriteria
include HQMF1::Utilities
attr_accessor :code_list_id, :derived_from, :definition, :status, :negation, :specific_occurrence
# Create a new instance based on the supplied HQMF entry
# @param [Nokogiri::XML::Element] ... | 37.5 | 139 | 0.656522 |
210f32424336439c98b9a08d225817322c904f08 | 4,621 | # frozen_string_literal: true
require 'redis'
class RedisCluster
module Function
# Hash implement redis hashes commands. There will be some adjustment for cluster.
# see https://redis.io/commands#hash. Most of the code are copied from
# https://github.com/redis/redis-rb/blob/master/lib/redis.rb.
#
... | 30.401316 | 95 | 0.571521 |
6aaf12058f406175c1bfdd04a3cebce243e2e71b | 1,824 | # Copyright (c) 2018 Public Library of Science
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | 41.454545 | 99 | 0.774123 |
613067776b182dfa874138899fb3e8d73a958f13 | 315 | # frozen_string_literal: true
class SummariesController < ApplicationController
before_action :authenticate_user!
# Render the summary dashboard for a patron
#
# GET /summaries
# GET /summaries.json
def index
@patron = patron
end
private
def item_details
{ all: true }
end
end
| 15.75 | 49 | 0.701587 |
7ab8a80819f894564f69bb7bb0744f2574272d7f | 517 | require "did_you_mean/version"
require "did_you_mean/core_ext/name_error"
require "did_you_mean/spell_checkable"
require 'did_you_mean/spell_checkers/name_error_checkers'
require 'did_you_mean/spell_checkers/method_name_checker'
require 'did_you_mean/spell_checkers/null_checker'
require "did_you_mean/formatter"
modu... | 25.85 | 57 | 0.802708 |
5dc810076a3b528795d025780e959b1b1089922a | 1,388 | class Fonttools < Formula
include Language::Python::Virtualenv
desc "Library for manipulating fonts"
homepage "https://github.com/fonttools/fonttools"
url "https://files.pythonhosted.org/packages/47/7c/dd9dc174842a9bc6fdae89045e820acd8a53a2251b4a8e6d22c97e1c7d75/fonttools-4.25.2.zip"
sha256 "507f8e027967fe4e... | 39.657143 | 135 | 0.791066 |
bf8e1a776a408567f05cc05a71d7ec0e4db588c2 | 5,919 |
require 'rspec'
require 'json'
require 'yajl'
require 'oj'
require 'drjson'
describe DrJson do
def doctor
DrJson.new(:debug => true)
end
describe "completion" do
it "works" do
doctor.repair("{").should == "{}"
end
it "insert the object value if absent" do
doctor.repair('{"foo": ').should... | 33.822857 | 107 | 0.531002 |
879ce1d6993e7b4a0e8ad1404b07e4c1ace23d83 | 570 | cask "artisan" do
version "2.4.2"
sha256 "3abdc8dc2f4db568da5405be0de36e138bb5d11ee13abac801b3c28bf29b9c45"
# github.com/artisan-roaster-scope/artisan/ was verified as official when first introduced to the cask
url "https://github.com/artisan-roaster-scope/artisan/releases/download/v#{version}/artisan-mac-#{ve... | 35.625 | 113 | 0.764912 |
0891ed63d8bc9e80c3c83c21eddca947aff7fffa | 1,967 | class NatsServer < Formula
desc "Lightweight cloud messaging system"
homepage "https://nats.io"
url "https://github.com/nats-io/nats-server/archive/v2.1.2.tar.gz"
sha256 "2fdbda70191ba02f3e065b0d2d503236865c60e88fa4a7c7e0eae691e7e32b2d"
head "https://github.com/nats-io/nats-server.git"
bottle do
cellar... | 30.261538 | 106 | 0.661413 |
e26f0868caf07c22ec59862870e094d5495d5eb6 | 12,860 | class PeopleController < ApplicationController
include ApplicationHelper
include ErrorBubble
include VlpDoc
def new
@person = Person.new
build_nested_models
# render action: "new", layout: "form"
end
def check_qle_marriage_date
date_married = Date.parse(params[:date_val])
start_date = ... | 32.890026 | 147 | 0.689658 |
d592dc52256aa2cbb21ff1c118286a186559db9e | 8,343 | require 'test_helper'
module SharedRememberableTest
extend ActiveSupport::Testing::Declarative
test 'should respond to remember_me attribute' do
assert resource_class.new.respond_to?(:remember_me)
assert resource_class.new.respond_to?(:remember_me=)
end
test 'forget_me should clear remember_created_a... | 30.672794 | 129 | 0.730792 |
edb93ecf4b6cc5ad283ef3791874f4d128419f82 | 45,441 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Issue do
include ExternalAuthorizationServiceHelpers
using RSpec::Parameterized::TableSyntax
let_it_be(:user) { create(:user) }
let_it_be(:reusable_project) { create(:project) }
describe "Associations" do
it { is_expected.to belong_to... | 33 | 202 | 0.664576 |
bb678b40adeca630c58427998f95547fd477c474 | 5,267 | # encoding: utf-8
require 'spec_helper'
describe 'Formtastic::FormBuilder#fields_for' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
@new_post.stub(:author).and_return(::Author.new)
end
context 'outside a form_for block' do
it 'yields an instance of FormHelper.... | 36.832168 | 100 | 0.677046 |
3327bcdbedf7ce6c43b06e40660247fddf8707db | 1,334 | require 'test_helper'
require 'simple_cqrs/events'
require 'uba/event_store/memory_store'
module Uba
module EventStore
class MemoryStoreTest < Minitest::Test
def test_save
store = MemoryStore.new
event = InventoryItemCreated.coerce! id: SecureRandom.uuid,
... | 35.105263 | 91 | 0.602699 |
013bb5429de9b6058d795d79094a65bca44db790 | 3,962 | class Dnsmasq < Formula
desc "Lightweight DNS forwarder and DHCP server"
homepage "http://www.thekelleys.org.uk/dnsmasq/doc.html"
url "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.78.tar.gz"
sha256 "c92e5d78aa6353354d02aabf74590d08980bb1385d8a00b80ef9bc80430aa1dc"
bottle do
rebuild 1
sha256 "29b9a8... | 33.863248 | 115 | 0.65371 |
1ad978d521fd17aeb35a65a492d5e7aa4013fe38 | 850 | # frozen_string_literal: true
Rails.application.routes.draw do
resources(:scheduled_tasks, concerns: active_scaffold) do
collection do
get :status
get :status_content
end
member do
get :log
put :run_now
end
end
get '/tasks_scheduler_daemon', to: 'tasks_scheduler_daemon#ind... | 38.636364 | 97 | 0.684706 |
1886edf566fee8e1384f445c433e0a25757c515d | 248 | class AddInstallmentsFieldToSpreePayment < ActiveRecord::Migration
def change
add_column :spree_payments, :installments, :integer, default: 1
add_column :spree_payments, :interest, :decimal, precision: 10, scale: 4, default: 0.0
end
end | 41.333333 | 90 | 0.770161 |
21c3038458bb31a2fc9a2fa1ee962f4bd50853f3 | 1,155 | class CargoC < Formula
desc "Helper program to build and install c-like libraries"
homepage "https://github.com/lu-zero/cargo-c"
url "https://github.com/lu-zero/cargo-c/archive/v0.6.12.tar.gz"
sha256 "42f6c26039d24b0fa684c36417de6e43e7861e6acf3a3accf52de5548bf57ec3"
license "MIT"
bottle do
cellar :any
... | 31.216216 | 93 | 0.743723 |
ff25cd8ae89e1a5fa880b48655987db16ad913b7 | 2,116 | require 'spec_helper'
describe 'couchbase_server', :type => :class do
let :params do
{
:version => '5.0.0'
}
end
context 'on an ubuntu system' do
let :facts do
{
:os => {
:family => 'Debian',
:name => 'Ubuntu',
:release => {
:full => '16.... | 21.16 | 82 | 0.495747 |
bf92e13394211f1dd69433adbc78d24e0757e203 | 1,098 | require "spec_helper"
require "autotest/rails_rspec2"
describe Autotest::RailsRspec2 do
let(:rails_rspec2_autotest) { Autotest::RailsRspec2.new }
describe 'exceptions' do
let(:exceptions_regexp) { rails_rspec2_autotest.exceptions }
it "should match './log/test.log'" do
exceptions_regexp.should mat... | 26.142857 | 80 | 0.693989 |
7acd4e1c8b1c8d07cf345fcabaf3cc04b7743e8f | 10,334 | # encoding: UTF-8
# frozen_string_literal: true
describe APIv2::Orders, type: :request do
let(:member) { create(:member, :level_3) }
let(:level_0_member) { create(:member, :level_0) }
let(:token) { jwt_for(member) }
let(:level_0_member_token) { jwt_for(level_0_member) }
describe 'GET /api/v2/orders' do
... | 39.143939 | 183 | 0.628314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.