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 |
|---|---|---|---|---|---|
1abd4920cf854c270bff3abfddd8f1eb8fd317d4 | 2,333 | #!/usr/bin/env ruby
require "pry"
# Question URL: https://www.interviewcake.com/question/merging-ranges
class ProductOfOtherNumbers
def self.condense_meeting_times(meeting_time_ranges)
sorted_meetings = meeting_time_ranges.sort
start_meeting_time = sorted_meetings.first.first
end_meeting_time = sorted_... | 40.929825 | 100 | 0.710673 |
edc5ba9dec1f9d4c4a4139200c983deb3ea22a72 | 2,081 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
end
test "should get new" do
get signup_... | 28.121622 | 88 | 0.644882 |
e96f459186df9b331f2e072adb84e9ea557e3120 | 1,534 | class OpenlibertyMicroprofile4 < Formula
desc "Lightweight open framework for Java (Micro Profile 4)"
homepage "https://openliberty.io"
url "https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/2021-09-20_1900/openliberty-microProfile4-21.0.0.10.zip"
sha256 "f808b2ae3bb27c988e34cfb75... | 31.306122 | 144 | 0.698175 |
03a5cec58f26c91a44bde0278dc7e48c852421cd | 3,723 | require_relative '../../advent';
input = @load_input[__FILE__]
class Screen
def initialize(width, height)
@width = width
@height = height
@grid = height.times.map do
width.times.map do
"."
end
end
end
attr_reader :width, :height, :grid
def toggle(x, y)
value = at(x... | 20.91573 | 78 | 0.611604 |
7a0c4369e2ebbd4a145397b43ce4cb77bc0b83d0 | 1,637 | require "helper"
require "inspec/resource"
require "inspec/resources/ssh_config"
describe "Inspec::Resources::SshConfig" do
describe "ssh_config" do
it "check ssh config parsing" do
resource = load_resource("ssh_config")
_(resource.Host).must_equal "*"
_(resource.Tunnel).must_be_nil
_(re... | 31.480769 | 110 | 0.697618 |
1c9881167fcac3d8bf89f1f212e000170839dbf7 | 20,818 | # encoding: utf-8
require 'sequel'
require 'rack/test'
require 'json'
require_relative '../../spec_helper'
require_relative '../../support/factories/organizations'
require_relative '../../../app/models/visualization/migrator'
require_relative '../../../app/controllers/admin/visualizations_controller'
def app
CartoDB... | 35.404762 | 123 | 0.671486 |
f7765f0fb491c2ed9bf9fdb1d179f155c605efa9 | 2,327 | class OsrmBackend < Formula
desc "High performance routing engine"
homepage "http://project-osrm.org/"
url "https://github.com/Project-OSRM/osrm-backend/archive/v5.4.3.tar.gz"
sha256 "501b9302d4ae622f04305debacd2f59941409c6345056ebb272779ac375f874d"
head "https://github.com/Project-OSRM/osrm-backend.git"
b... | 38.147541 | 153 | 0.682424 |
ab42999a17a0c8a5ef2ed3ac0a3302a18a0e4563 | 65 | class Table2::Arg < ApplicationRecord
has_many :abundances
end
| 16.25 | 37 | 0.8 |
bb5bb988d72d0f406fc6bd94d22ada3e479a5237 | 1,352 | class PerlAT518 < Formula
desc "Highly capable, feature-rich programming language"
homepage "https://www.perl.org/"
url "https://www.cpan.org/src/5.0/perl-5.18.4.tar.gz"
sha256 "01a4e11a9a34616396c4a77b3cef51f76a297e1a2c2c490ae6138bf0351eb29f"
revision 1
bottle do
sha256 "45b388773570fd4ef892caa7a0bb03... | 28.166667 | 94 | 0.701923 |
b9ff639acdf9ef4572a8e9eaff585c27bbc56c87 | 232 | require_relative '../spec_helper'
describe 'rails_part::default' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
it 'include setup' do
expect(chef_run).to include_recipe 'rails_part::setup'
end
end
| 23.2 | 68 | 0.75 |
91c267b16866fccbef79f0caabeb405a0ce8b7b8 | 124 | require "qc_dev_view_tool/version"
require "qc_dev_view_tool/renderer"
module QcDevViewTool
# Your code goes here...
end
| 17.714286 | 35 | 0.798387 |
f8d6dcae235bfb82f0f4ab689485fbded65dcf47 | 1,054 | require 'rubocop'
require 'rubocop/rspec/support'
require 'pry'
module SpecHelper
ROOT = Pathname.new(__FILE__).parent.freeze
end
# Load in Rubocop cops
require File.expand_path('lib/rubocop-airbnb')
spec_helper_glob = File.expand_path('{support,shared}/*.rb', SpecHelper::ROOT)
Dir.glob(spec_helper_glob).map(&meth... | 27.736842 | 78 | 0.740987 |
e8d9fb0a59f3f4543acdc14e0c9b365882014472 | 7,747 | ENV['RACK_ENV'] = 'test'
require 'minitest/autorun'
require 'rack/test'
require 'fileutils'
require_relative '../cms'
class CMSTest < Minitest::Test
include Rack::Test::Methods
def app
Sinatra::Application
end
def setup
FileUtils.mkdir_p(data_path)
end
def teardown
FileUtils.rm_rf(data_pat... | 27.569395 | 106 | 0.731896 |
4a11c0dad8222a3cb465748a24ebcde29e8bd392 | 1,307 | # -*- encoding: utf-8 -*-
=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 v... | 32.675 | 176 | 0.659526 |
01aabb314350ed6ec5862e2c028daf37982147b1 | 327 | module DynamoDbFramework
class MigrationScript
attr_accessor :timestamp
attr_accessor :namespace
def apply
raise 'Not implemented.'
end
def undo
raise 'Not implemented.'
end
def self.descendants
ObjectSpace.each_object(Class).select { |klass| klass < self }
end
e... | 17.210526 | 68 | 0.672783 |
21fd7152c959767d59ed7fae6b70583d7c4d2a38 | 511 | # frozen_string_literal: true
class PrefixConnectionWithTotalType < BaseConnection
edge_type(PrefixEdgeType)
field_class GraphQL::Cache::Field
field :total_count, Integer, null: false, cache: true
field :states, [FacetType], null: false, cache: true
field :years, [FacetType], null: false, cache: true
def... | 22.217391 | 55 | 0.755382 |
bf4e1ab3e40b60f5e104686efb192ad4a0e41aa8 | 9,925 | require 'test_helper'
class IntegrationTest < Minitest::Test
def setup
Project.destroy_all
@project = Project.new
@state = {
name: "Clean House",
owner_id: 1,
detail: {
description: "I need to clean the house"
},
todo_lists: [{
todos: [{
text:... | 28.684971 | 95 | 0.68665 |
ac52e232b51d762bfabb4138e5fca673b946cb23 | 1,445 | Rails.application.routes.draw do
resources :genders
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :users
root 'static_pages#index'
# resources :payments
resources :applications
resources :lodgings
resources :workshops
resources :application_settings
ge... | 35.243902 | 101 | 0.750173 |
abb46e52f19413a16cd758c21b864015b16ef18b | 320 | class CreateCameras < ActiveRecord::Migration
def change
create_table :cameras do |t|
t.integer :sucursal
t.integer :numcamera, default: 0
t.string :ipaddress
t.string :user
t.string :pass
t.string :tags
t.integer :status, default: 0
t.timestamps
end
end
end
| 20 | 45 | 0.63125 |
ac382594b706e6f3dd602960835fe44ef0c0c131 | 125 | require 'test_helper'
class FermentableTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.625 | 47 | 0.712 |
f81a2814736cab5c1fdc44182dd7683f9ecec705 | 416 | cask 'moneymoney' do
version '2.3.3'
sha256 '67c8f64a237eea684553efbe2537912e3e1de44659e304566b42436272fff646'
url 'https://service.moneymoney-app.com/1/MoneyMoney.zip'
appcast 'https://service.moneymoney-app.com/1/Appcast.xml',
checkpoint: '7b6ca7ecbff8c4fdbdc1648b7acb578980543b77801c93a65533b4bf512... | 32 | 88 | 0.776442 |
01dd3aa36d40152e89f1eaf0f26e889d784d1428 | 2,548 | module ActiveRecord::Turntable
module ActiveRecordExt
module QueryCache
def self.prepended(klass)
class << klass
prepend ClassMethods.compatible_module
end
end
module ClassMethods
extend Compatibility
module V6_0
end
module V5_2
... | 24.737864 | 85 | 0.561224 |
013d55b713de7bb6f0f2f8a632fc25f74c038115 | 5,323 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe NamespaceLimit do
let(:namespace_limit) { build(:namespace_limit) }
let(:usage_ratio) { 0.5 }
let(:namespace_storage_limit_enabled) { true }
subject { namespace_limit }
before do
stub_feature_flags(namespace_storage_limit: namespace_st... | 29.572222 | 134 | 0.676498 |
2135f1625304180905778951efc4de4d89b6d979 | 5,255 | class Gdal < Formula
desc "Geospatial Data Abstraction Library"
homepage "https://www.gdal.org/"
url "https://download.osgeo.org/gdal/2.3.2/gdal-2.3.2.tar.xz"
sha256 "3f6d78fe8807d1d6afb7bed27394f19467840a82bc36d65e66316fa0aa9d32a4"
revision 1
bottle do
rebuild 2
sha256 "1ebee988a01554396a808874423... | 30.911765 | 93 | 0.626832 |
d56d459402cf14de60bc3df7a9cebfb1c6ddf1ee | 4,331 | require 'yaml'
class CiDeployment
attr_reader :base_path
attr_accessor :content
def initialize(path)
@base_path = path
@content = {}
end
# ci-deployment:
# ops-depls:
# target_name: concourse-ops
# pipelines:
# ops-depls-generated:
# team: my-team
# confi... | 37.017094 | 138 | 0.734472 |
6a7354f33ecbb5a92786fc32686b0fc606a41b98 | 1,398 | module ActiveRecord
module ConnectionAdapters
module SQLServer
module Type
class Time < ActiveRecord::Type::Time
# Default fractional scale for 'time' (See https://docs.microsoft.com/en-us/sql/t-sql/data-types/time-transact-sql)
DEFAULT_FRACTIONAL_SCALE = 7
include Ti... | 24.964286 | 125 | 0.550787 |
e2505ef295d07c407368ec98fa345ff33956b1a7 | 110 | require_relative "<%= name %>/version"
require_relative "<%= name %>/generator"
module <%= moduleName %>
end
| 18.333333 | 40 | 0.681818 |
0133b275cbfbdf7902add323dbb5e094fdf0a83f | 156 | actions :create, :delete
default_action :create
attribute :hint_name, kind_of: String, name_attribute: true
attribute :content, kind_of: Hash, default: {}
| 26 | 59 | 0.782051 |
6118aa06ca400747b9d320110a5ea2be1c9780bd | 1,185 | # frozen_string_literal: true
module Feedjira
class Feed
class << self
def add_common_feed_element(element_tag, options = {})
Feedjira.parsers.each do |k|
k.element(element_tag, options)
end
end
def add_common_feed_elements(element_tag, options = {})
Feedjira.... | 26.931818 | 68 | 0.627004 |
39b56866a48521fd6f96fba2a89986b87cac4151 | 7,110 | require 'yaml'
module EY
module Serverside
class RailsAssets
module Strategy
def self.all
{
'shared' => Shared,
'cleaning' => Cleaning,
'private' => Private,
'shifting' => Shifting,
}
end
def self.fetch(name, *a... | 35.909091 | 213 | 0.595499 |
61681f85265b71f070229eb73d6a397189cad200 | 48 | module CocoapodsArchive
VERSION = "0.0.2"
end
| 12 | 23 | 0.729167 |
e852dfc502232d9d8d8cd4a3370d817e0fad8c2e | 988 | Refinery::Core::Engine.routes.draw do
root to: 'pages#home', via: :get
get '/pages/:id', to: 'pages#show', as: :page
namespace :pages, path: '' do
namespace :admin, path: Refinery::Core.backend_route do
scope path: :pages do
post 'preview', to: 'preview#show', as: :preview_pages
patch '... | 29.939394 | 74 | 0.635628 |
e28085b132f4b5a4acf6a11a2a86251cd9f63a78 | 6,958 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 49.7 | 100 | 0.732251 |
01cddfc582a44caae5455dede3b3144bfbb7433a | 242 | # frozen_string_literal: true
DB_CONNECTION_INFO = {
user: ENV['DB_USERNAME'],
password: ENV['DB_PASSWORD'],
host: ENV['DB_HOST'] || 'localhost',
port: ENV['DB_PORT'],
database: ENV['DB_DATABASE'] || 'valkyrie_sequel_test'
}.freeze
| 26.888889 | 56 | 0.694215 |
116547e883237f7494fdb3b5bd58d4f3b2814302 | 2,635 | #
# Copyright 2014-2021 Chef Software, 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 ... | 34.671053 | 115 | 0.746869 |
6ae797b434985f7e413c0f3ee12f0a852f593e10 | 621 | class CreatePartners < ActiveRecord::Migration
def change
create_table :contacts do |t|
t.string :name
t.belongs_to :donor_account
t.belongs_to :account_list
t.timestamps
end
add_index :contacts, [:donor_account_id, :account_list_id], unique: true
add_index :contacts, :account... | 29.571429 | 92 | 0.731079 |
bb847c9d0ed7fc2af6cb7d905066a0056d720f8b | 3,272 | require 'spaceship/test_flight/build'
require_relative 'ui/ui'
module FastlaneCore
class BuildWatcher
class << self
# @return The build we waited for. This method will always return a build
def wait_for_build_processing_to_be_complete(app_id: nil, platform: nil, train_version: nil, build_version: ni... | 48.117647 | 164 | 0.702934 |
1a96a81ad66708f8e45c032737a821d3a5d12ebc | 2,512 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
Disable_update_jobs_api_method_list = {"jobs.create"=>{},
"pipeline_instances.create"=>{},
"pipeline_templates.create"=>{},
"jo... | 49.254902 | 81 | 0.419188 |
1de84309d15e2386c31b4eeebf98359add9ff555 | 3,762 | module Gitlab
module Satellite
class Satellite
include Gitlab::Popen
PARKING_BRANCH = "__parking_branch"
attr_accessor :project
def initialize(project)
@project = project
end
def log(message)
Gitlab::Satellite::Logger.error(message)
end
def clea... | 26.125 | 93 | 0.600213 |
79e6426330aa586b7a77314b4c829ccf2dda3099 | 308 | # coding: utf-8
require 'numeric_with_unit/unit_definition/base'
Unit['cal'] = "4.184".to_r, 'J'
Unit['Gal'] = 'cm/s2'
Unit['dyn'] = 'g.cm/s2'
Unit['erg'] = 'g.cm2/s2'
Unit['Ba'] = 'g/(cm.s2)'
Unit['P'] = 'g/(cm.s)'
Unit['poise'] = 'g/(cm.s)'
Unit['St'] = 'cm2/s'
Unit['dyn'] = "1/100000".to_r, 'N'
| 14.666667 | 48 | 0.542208 |
261832d8299b4a5ec5e6318cd290bddaa00e44d7 | 260 | describe Issue::Error do
it "has a status and a message" do
error = Issue::Error.new(403, "Forbidden action. Request not accepted.")
expect(error.status).to eq(403)
expect(error.message).to eq("Forbidden action. Request not accepted.")
end
end
| 32.5 | 76 | 0.707692 |
ab0211352fee8ce1e34ecabb0e3c64010f33c789 | 414 | module SCSSLint
# Checks for spaces following the name of a property and before the colon
# separating the property's name from its value.
class Linter::SpaceAfterPropertyName < Linter
include LinterRegistry
def visit_prop(node)
if character_at(node.name_source_range.end_pos) != ':'
add_lin... | 29.571429 | 80 | 0.727053 |
1a103f3f8ce385c644684d5108b9b84b42ad2fc6 | 732 | #
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Cookbook Name:: php
# Libraries:: helpers
#
# Copyright 2013, Opscode, 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
#
# htt... | 30.5 | 74 | 0.730874 |
1d039ff505be5b35215827ffbc4b078edab25d89 | 813 | module Dickens
class FindItem
attr_accessor :article, :dictionary, :word, :matching
def initialize(array, word)
extract = /-->(?<dic>.*)\n-->(?<w>.*)\n\n(?<a>[\W|\w|.]*)/.match(array)
@dictionary= extract[:dic]
@word= extract[:w]
@article= extract[:a].strip
@matching= (@word == ... | 28.034483 | 93 | 0.578106 |
6ab0a35822ae294b25c9ac97bdb263c177274f91 | 640 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: 'trips#index'
get '/welcome', to: 'static#welcome'
get '/auth/github/callback', to: 'sessions#create_from_github'
resources :trip_entries, only: [:show]
resources :... | 25.6 | 101 | 0.685938 |
915f5439db509e537f89d8180776b65df944f945 | 172 | # frozen_string_literal: true
module CoreExtensions
module Kafka
module BrokerPool
module AttrReaders
attr_reader :brokers
end
end
end
end
| 14.333333 | 29 | 0.69186 |
1c50ef255b87844143a3f314b08f559d4e0a3879 | 3,721 | # encoding: utf-8
require 'sinatra'
require 'sprockets'
require 'sinatra/content_for'
require 'rufus/scheduler'
require 'coffee-script'
require 'sass'
require 'json'
require 'yaml'
SCHEDULER = Rufus::Scheduler.start_new
set :root, Dir.pwd
set :sprockets, Sprockets::Environment.new(settings.root)
set :assets_pref... | 25.312925 | 153 | 0.708949 |
79c89025c423ccd7fb5ad230983255c6a93407e6 | 96 | Rails.application.routes.draw do
devise_for :users
root 'home#index'
resources :tasks
end
| 16 | 32 | 0.760417 |
d57344e8ef103ed3e6ff77e471b4a682d898bcc5 | 909 | # frozen_string_literal: true
module SpecSupport
module Login
def mock_logged_in_user(super_admin: false)
controller.session[::Login::SESSION_KEY] =
create(:person, ditsso_user_id: '007', super_admin: super_admin).id
end
def current_user
Person.find_by(ditsso_user_id: '007')
end
... | 24.567568 | 75 | 0.651265 |
bb5ba78ff21d755e9ac199f0c0a02e23b54438ca | 337 | Rails.application.routes.draw do
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/... | 33.7 | 101 | 0.688427 |
ff4826fded1aff5d1e833dcf3fbb14f15e2c9fbe | 329 | ##
# Delivers the UserMailer.deliver_mimi_welcome to the requested User by +id+
# as an asynchronous process.
#
class DeliverWelcomeJob
def initialize(user_id)
@user_id = user_id
end
def perform
if user = User.find_by_id(@user_id)
BlueLightSpecialMailer.deliver_mimi_welcome(user)
end
en... | 18.277778 | 76 | 0.720365 |
876b3a91783f879f7a25b0ca476e19c8f2883daf | 198 | class ApplicationController < ActionController::API
include ActionController::ImplicitRender
include ActionController::Serialization
include Acl9::ControllerExtensions
respond_to :json
end
| 24.75 | 51 | 0.838384 |
bb93e6ad65bf232614891b7d6f097dbf955666d2 | 5,994 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: devise-i18n 1.7.0 ruby lib
Gem::Specification.new do |s|
s.name = "devise-i18n".freeze
s.version = "1.7.0"
s.required_rubygems_version = Gem::Requirement.n... | 38.423077 | 112 | 0.655322 |
ff39089fad569b3f6f79831da4ebdeeaafdb6f86 | 71,155 | # -*- coding: binary -*-
#
# Rex
#
#
# Project
#
require 'msf/core/opt_condition'
require 'optparse'
module Msf
module Ui
module Console
module CommandDispatcher
###
#
# Command dispatcher for core framework commands, such as module loading,
# session interaction, and other general things.
#
###
class Core
i... | 30.356229 | 192 | 0.598862 |
28261815845a4b6b7e8a14138db5d41387f04fcf | 44 | class Legacyteacher < ApplicationRecord
end
| 14.666667 | 39 | 0.863636 |
7916db960a2037aca3547f324028fb16ae3247e4 | 4,079 | # frozen_string_literal: true
RSpec.describe "bundle add" do
before :each do
build_repo2 do
build_gem "foo", "1.1"
build_gem "foo", "2.0"
build_gem "baz", "1.2.3"
build_gem "bar", "0.12.3"
build_gem "cat", "0.12.3.pre"
build_gem "dog", "1.1.3.pre"
end
install_gemfile ... | 37.422018 | 133 | 0.632018 |
26805b2bb8b4967fb3d63bbea009fb53677f9339 | 364 | # Custom Type: Razor - Tag
Puppet::Type.newtype(:razor_tag) do
@doc = "Razor Tag"
ensurable
newparam(:name, :namevar => true) do
desc "The tag name"
end
newproperty(:rule, :array_matching => :all) do
desc "The tag rule (Array)"
end
# This is not support by Puppet (<= 3.7)...
# au... | 18.2 | 48 | 0.601648 |
bf0069f57659109e0d111b49c22878050c27eb66 | 978 | require 'yaml'
module JCov::Commands
# the check command
class Check
def initialize(args, options)
config = JCov::Configuration.new(options)
if config.filename
puts "Using configuration file: #{config.filename}"
else
puts "No configuration file! Using defaults."
end
... | 20.375 | 69 | 0.643149 |
6292b2217322d8ca85ba1996abc6dfc404750315 | 4,192 | require('capybara/rspec')
require('./app')
Capybara.app = Sinatra::Application
set(:show_exceptions, false)
require('launchy')
describe('home page path', {:type => :feature}) do
it('allows a user to view the homepage') do
visit('/')
expect(page).to have_content('Welcome to Survey Galore')
end
end
describ... | 30.823529 | 68 | 0.650048 |
7982b841e35d45c3c81d47b676995a54c58f0728 | 5,698 | require 'dependency'
require 'dependencies'
require 'requirement'
require 'requirements'
require 'requirements/ld64_dependency'
require 'set'
## A dependency is a formula that another formula needs to install.
## A requirement is something other than a formula that another formula
## needs to be present. This includes... | 28.348259 | 75 | 0.675325 |
7978f93cb5e03959fcf1d3b9d82d9c9bd8a6f156 | 429 | class ProtoJ::Utils
def self.to_sorted_hash(hash)
if hash.is_a? Hash
hash = Hash[hash.sort]
hash.each_pair do |k,v|
hash[k] = to_sorted_hash(v)
end
return hash
elsif hash.is_a? Array
return hash.collect do |item|
to_sorted_hash(item)
end
else
retur... | 19.5 | 44 | 0.624709 |
6210b0570c32d71d28f03eed45692ee402c348ac | 57 | module Net
module SSHD
VERSION = '0.0.1'
end
end
| 9.5 | 21 | 0.614035 |
086bf3cbe13ef7674071750c0a02542480452a64 | 4,806 | require 'pathname'
Puppet::Type.newtype(:dsc_xscsrserverupdate) 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 xSCSRServerUpdate resource type.
Automatically generated... | 31.618421 | 180 | 0.674573 |
e9ee81ccb3e192e5a4cec4aad56b3482640c7f60 | 319 | class Item < ActiveRecord::Base
belongs_to :category
has_many :purchase_items
has_many :purchases, through: :purchase_items
validates :name, :price, :category_id, presence: true
validates :name, uniqueness: true
validates :name, uniqueness: { scope: :category, message: "unique name within category" }
end
| 35.444444 | 91 | 0.755486 |
5d8a08e8aee20708ddbdc0f1ac0f423e9a4048f3 | 1,044 | require 'rubygems'
Gem::Specification.new do |spec|
spec.name = 'win32-api'
spec.version = '1.10.1'
spec.authors = ['Daniel J. Berger', 'Park Heesob', 'Hiroshi Hatake']
spec.license = 'Artistic-2.0'
spec.email = 'djberg96@gmail.com'
spec.homepage = 'http://github.com/cosmo0920/win32-a... | 37.285714 | 75 | 0.679119 |
91442c2d4cfdba546b70019cc759845d3aa6e8b4 | 2,041 | # Reader - fgdc to internal data structure
# unpack fgdc map projection - general vertical near-side perspective projection
# History:
# Stan Smith 2018-10-03 refactor mdJson projection object
# Stan Smith 2017-10-16 original script
require 'nokogiri'
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
requ... | 35.189655 | 121 | 0.603136 |
1d05337980d3accfeee207311474c3c45fe21b69 | 254,597 | # Copyright 2015 Google 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 writing,... | 39.974407 | 133 | 0.602513 |
bb3bdf7c215e43711925eafb4282de461c365b2d | 706 | require 'spec_helper'
describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, :repository, namespace: namespace, path... | 24.344828 | 97 | 0.720963 |
bb0cdb2eae54edb7de3170311154ddb2dcfd3967 | 129 | require 'rails_helper'
RSpec.describe ClearVideoJob, type: :job do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21.5 | 56 | 0.751938 |
7a85e250e7faac6183dd16e56f5ce6a6ff113c13 | 632 | require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "posts/edit.html.haml" do
before(:each) do
@post = assign(:post, stub_model(Post,
:new_record? => false,
:title => "MyString",
:body => "MyText"
))
end
it "renders the edit post form" do
render
# ... | 28.727273 | 96 | 0.640823 |
fff762be5b511fb1bd2c6334d65e6d680f0f156b | 539 | cask 'trufont' do
version '0.4.0'
sha256 '05a3b3b9b9188dfe7af9fc7c3d19dc301e7c877ec249dce7f01ac183e7a8af27'
# github.com/trufont/trufont was verified as official when first introduced to the cask
url "https://github.com/trufont/trufont/releases/download/#{version}/TruFont.app.zip"
appcast 'https://github.com... | 35.933333 | 89 | 0.77551 |
395c50b5cc600dd8afd868e869144d5a65337424 | 1,365 | #
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/data_object'
module Ingenico::Connect::SDK
module Domain
module Payment
# @attr [String] display_name
# @attr [String] integration_type
#... | 29.042553 | 103 | 0.649817 |
bb2e217de18329bfc4b3c60c56743674344e7373 | 291 | class UseTextDatatypeForTitleAndEntryId < ActiveRecord::Migration[5.1]
def up
change_column :stories, :title, :text
change_column :stories, :entry_id, :text
end
def self.down
change_column :stories, :title, :string
change_column :stories, :entry_id, :string
end
end
| 24.25 | 70 | 0.728522 |
087e344154222f9f846e3193780e6ba5114526a3 | 727 | module WWW
class Mechanize
class Util
class << self
def build_query_string(parameters)
parameters.map { |k,v|
k &&
[WEBrick::HTTPUtils.escape_form(k.to_s),
WEBrick::HTTPUtils.escape_form(v.to_s)].join("=")
}.compact.join('&')
end
... | 24.233333 | 65 | 0.456671 |
218b8f4cbc06fc7e837a6905c6ba75c7027014d0 | 1,341 | require_relative 'lib/rentdynamics/version'
Gem::Specification.new do |spec|
spec.name = "rentdynamics"
spec.version = RentDynamics::VERSION
spec.authors = ["Levicus"]
spec.email = ["levi@rentdynamics.com"]
spec.summary = "Used to interact with the rentdynamics api"
spec... | 41.90625 | 97 | 0.674124 |
ab6491dd1f56b88b86903c027c317373a140b451 | 848 | require File.join(Rails.root, "script", "migrations", "policy_hbx_enrollment_creator")
require File.join(Rails.root, "app", "models", "queries", "policies_with_no_hbx_enrollment")
require File.join(Rails.root, "app", "models", "queries", "family_with_given_policy")
@@logger = Logger.new("#{Rails.root}/log/policy_hbx_e... | 33.92 | 106 | 0.721698 |
f8c1532bbb5454c0f1f8d4a19af3249725d58d6b | 2,154 | require 'veewee/provider/core/helper/ssh'
module Veewee
module Provider
module Core
module BoxCommand
def ssh_command_string
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p #{ssh_options[:port]} -l #{definition.ssh_user} #{self.ip_address}"
end
def win... | 39.888889 | 144 | 0.593779 |
3898277f6563b9e08504006851066111b8ec0e51 | 208 | module Epiphany
class Entity
attr_accessor :type, :phrase, :metadata
def initialize(type, phrase, **metadata)
@type = type
@phrase = phrase
@metadata = metadata
end
end
end
| 17.333333 | 44 | 0.634615 |
018975382aea13df7db4d78603bcfc8e44aad72c | 128 | class VisitOccurrence < ApplicationRecord
self.table_name = 'visit_occurrence'
self.primary_key = 'visit_occurrence_id'
end
| 25.6 | 42 | 0.8125 |
6a4be1fa072cc3e4709a0e16ed4c3d60c15abd3a | 13,367 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
using RSpec::Parameterized::TableSyntax
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') }
where(:default_branch) do
%w[master main]
end
with_them do
describe 'the creat... | 44.408638 | 147 | 0.543652 |
38e491a4eddc130b6fdb9e93f704951ac05278f6 | 2,653 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10
module Models
#
# The properties of an add vCenter request.
#
class AddVCenterRequestPropertie... | 28.836957 | 76 | 0.51602 |
e9651a9b8cee056e3a3bf6dd6867093ccf0ff8da | 489 | require 'alertlogic_tmc/base_api'
module AlertlogicTmc
class PolicyApi < AlertlogicTmc::BaseApi
def find(id)
get("/api/tm/v1/policies/#{id}")
end
def list(options = {})
get("/api/tm/v1/policies", options)
end
def create(options={})
post("/api/tm/v1/policies", options)
end
... | 19.56 | 48 | 0.601227 |
f86ccd293b5f35123f159c9601a31715964982f3 | 1,264 | require File.dirname(__FILE__)
Puppet::Type.type(:property_list).provide(:defaults,
parent: Puppet::Provider::PropertyList) do
commands defaults: '/usr/bin/defaults'
mk_resource_methods
class << self
# Override the write_plist method
# In order to get preferen... | 33.263158 | 84 | 0.619462 |
1cfa587d913381134d1e1fbbc7891e6749b391df | 1,778 | module Contribution::PaymentEngineHandler
extend ActiveSupport::Concern
included do
delegate :can_do_refund?, to: :payment_engine
def payment_engine
PaymentEngines.find_engine(self.payment_method) || PaymentEngines::Interface.new
end
def review_path
payment_engine.review_path(self)
... | 31.75 | 92 | 0.73622 |
33ed59094d01e5a7467f62f0a266da165fdcc4f7 | 1,142 | require "test_helper"
class I18nTest < ActionDispatch::IntegrationTest
def collect_combined_keys(hash, namespace = nil)
hash.collect do |k, v|
keys = []
keys << collect_combined_keys(v, "#{namespace}.#{k}") if v.is_a?(Hash)
keys << "#{namespace}.#{k}"
end.flatten
end
test "translation ... | 30.864865 | 81 | 0.648862 |
1a9a8c49de0fad1f4d685847c813c6f77ce6396b | 623 | cask :v1 => 'adobe-dng-converter' do
version '8.6'
sha256 '3bb43ca608b7e62727512c813b395ea46aad545f68f9323cc78c9c5f47145650'
url "http://download.adobe.com/pub/adobe/dng/mac/DNGConverter_#{version.gsub('.', '_')}.dmg"
name 'Adobe Camera Raw and DNG Converter'
homepage 'http://www.adobe.com/support/downloads/... | 41.533333 | 115 | 0.733547 |
8760036f7972466a573d32ddbb34ce91f2b32352 | 244 | class CreateNpcModelArmor < ActiveRecord::Migration[5.2]
def change
create_table :npc_model_armors do |t|
t.references :npc_model, foreign_key: true
t.references :armor, foreign_key: true
t.timestamps
end
end
end
| 22.181818 | 56 | 0.709016 |
1ca28bcc7b1a7877a016ae8803d4cde671b070b7 | 1,958 | class Wolfmqtt < Formula
desc "Small, fast, portable MQTT client C implementation"
homepage "https://github.com/wolfSSL/wolfMQTT"
url "https://github.com/wolfSSL/wolfMQTT/archive/refs/tags/v1.11.0.tar.gz"
sha256 "5d0c14ff0c5c571907802f51b91990e1528f7a586df4b6d796cf157b470f5712"
license "GPL-2.0-or-later"
he... | 34.964286 | 123 | 0.66905 |
6aae27e7674152b61f6a5ebab36a13fa47c0e57e | 2,378 | module PublishingApi
class LinksPresenter
LINK_NAMES_TO_METHODS_MAP = {
organisations: :organisation_ids,
primary_publishing_organisation: :primary_publishing_organisation_id,
original_primary_publishing_organisation: :original_primary_publishing_organisation_id,
policy_areas: :policy_area... | 29.358025 | 113 | 0.711943 |
399254f89e91fa93a524530e52d851dacd2d3a55 | 449 | module Bazaar
class Cart < ApplicationRecord
include Bazaar::CartSearchable if (Bazaar::CartSearchable rescue nil)
include Bazaar::ApplicationCartConcern if (Bazaar::ApplicationCartConcern rescue nil)
enum status: { 'active' => 1, 'init_checkout' => 2, 'success' => 3 }
has_many :cart_offers, dependent: :dest... | 23.631579 | 87 | 0.723831 |
5d299ff1e67c6ac8fd4566576eda7c795ec61cb1 | 143 | class AddDivisions < ActiveRecord::Migration
def change
create_table(:divisions) do |t|
t.column(:name, :string)
end
end
end
| 17.875 | 44 | 0.678322 |
1815218d25a393e919097287ad4cf4ac4028d27b | 184 | path =File.join(File.dirname(__FILE__), '../../', 'lib')
$LOAD_PATH.unshift(path)
require 'pry'
require 'rspec'
require 'capybara_page_object'
World(CapybaraPageObject::PageFactory)
| 20.444444 | 56 | 0.744565 |
bbbda2997480e7e2b37349ff9d8d94f257ddc5b5 | 15,035 | # frozen_string_literal: true
require "hanami/utils/string"
RSpec.shared_examples "a new app" do
let(:app) { Hanami::Utils::String.new(input).underscore.to_s }
it "generates vanilla app" do
project = "bookshelf_generate_app_#{Random.rand(100_000_000)}"
with_project(project) do
app_name = Hanami:... | 30.373737 | 115 | 0.616362 |
6216e3b6c1a66643dc6b63ab8f222720b074eea3 | 3,565 | module Locomotive
class FileInput < ::SimpleForm::Inputs::FileInput
extend Forwardable
def_delegators :template, :link_to, :content_tag
include Locomotive::SimpleForm::BootstrapHelpers
def input(wrapper_options = nil)
row_wrapping(data: { persisted: persisted_file?, persisted_file: persisted... | 30.470085 | 159 | 0.6331 |
d5a68c9ebb833cf67c1abc1f229a281955df15c5 | 1,825 | require_relative 'base_helpers'
require_relative '../../tests/command_runner'
module AcceptanceTests
module CommandHelpers
include BaseHelpers
extend RSpec::Matchers::DSL
def run_command(*args)
Tests::CommandRunner.run(*args) do |runner|
runner.directory = fs.project_directory
yiel... | 26.449275 | 73 | 0.654795 |
ed1a12363d228a7795f18b4f188a865920367a58 | 232 | include RandomNumber
FactoryGirl.define do
factory :message do
u { {:u_id => Random.new.rand, :name => Faker::Name.name} }
mes { Faker::Lorem.sentence }
created_at { rand_time(2.days.ago).to_i }
end
end
| 25.777778 | 63 | 0.633621 |
5d099e97a569b7c890d8c998eabec59099c35120 | 8,742 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject,... | 31.905109 | 222 | 0.65111 |
2105904af6ee5277de7105fe446052823ba46617 | 354 | class Igor < Formula
desc "Opens a shell in your favorite docker container"
homepage "https://github.com/felixb/igor"
version "de4d3fa"
head "https://github.com/felixb/igor.git"
def install
bin_path = buildpath/"igor"
bin_path.install Dir["*"]
cd bin_path do
mv "igor.sh", "igor"
bin... | 19.666667 | 56 | 0.658192 |
089c3643a401b81542251410c7935c695d492898 | 1,439 | require File.dirname(__FILE__) + "/spec_helper"
describe Pivotal::InMemoryEnumeration do
class Ime < Pivotal::InMemoryEnumeration
self.enumerated_values = [
Ime.new(1, "One"),
Ime.new(2, "Two"),
Ime.new(3, "Three")
]
end
describe 'new' do
it "can find by id" do
ime =... | 20.557143 | 47 | 0.555942 |
bf7cac1bed5272964fac9a8e6146a3afd1d9eea4 | 612 | # frozen_string_literal: true
module Pronto
class Punchlist < Runner
# Classify whether files are relevant to punchlist
class FileClassifier
def initialize(source_file_globber: SourceFinder::SourceFileGlobber.new)
@source_file_globber = source_file_globber
end
def non_binary?(path)... | 29.142857 | 78 | 0.660131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.