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 |
|---|---|---|---|---|---|
38ac7423934e73913880971d57f3886d8738d0bc | 1,613 | # -*- encoding: utf-8 -*-
# stub: state_machines 0.5.0 ruby lib
Gem::Specification.new do |s|
s.name = "state_machines".freeze
s.version = "0.5.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Abd... | 40.325 | 112 | 0.67142 |
3300757862627c1f7c96f226bd7d3782e2c548dc | 304 | class Password < ActiveRecord::Base
include CryptKey
acts_as_paranoid
belongs_to :user
before_create :create_reset_key
private
def create_reset_key
while reset_key.blank? || Password.with_deleted.find_by_reset_key(reset_key)
self.reset_key = crypt_key[0..15]
end
end
end
| 16.888889 | 80 | 0.75 |
21961dee40fa0bbe0a1b94f463f4a90ae30ef724 | 2,857 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataShare::Mgmt::V2018_11_01_preview
module Models
#
# List response for get ShareSubscription.
#
class ProviderShareSubscriptionList
i... | 28.858586 | 80 | 0.540777 |
21dd29e95c797749723f34f04180807aae42f81b | 2,083 | require "language/node"
class AtomistCli < Formula
desc "Unified command-line tool for interacting with Atomist services"
homepage "https://github.com/atomist/cli#readme"
url "https://registry.npmjs.org/@atomist/cli/-/cli-1.8.0.tgz"
sha256 "64bcc7484fa2f1b7172984c278ae928450149fb02b750f79454b1a6683d17f62"
li... | 44.319149 | 139 | 0.719635 |
1d476cc31f2b1fe0ac95b0f85f9fdd62ca9d436c | 357 | # frozen_string_literal: true
class RenameDocumentJoinTables < ActiveRecord::Migration
def change
rename_table :documents_alignments, :document_alignments
rename_table :documents_keywords, :document_keywords
rename_table :documents_languages, :document_languages
rename_table :documents_resource_types... | 32.454545 | 68 | 0.829132 |
18126f340cc3413e2fc16400500919a99f26f355 | 9,772 | require 'puppet/face'
require 'puppet/settings/ini_file'
Puppet::Face.define(:config, '0.0.1') do
extend Puppet::Util::Colors
copyright "Puppet Inc.", 2011
license _("Apache 2 license; see COPYING")
summary _("Interact with Puppet's settings.")
description "This subcommand can inspect and modify settings... | 36.736842 | 127 | 0.670078 |
e23039d87b3a8a6990eed68404a9ee732e828355 | 7,075 | class V8 < Formula
desc "Google's JavaScript engine"
homepage "https://github.com/v8/v8/wiki"
# Track V8 version from Chrome stable: https://omahaproxy.appspot.com
# revert back to GitHub mirror tar.gz archives once it's synced again
url "https://chromium.googlesource.com/v8/v8.git",
tag: "9.5.172.... | 40.428571 | 122 | 0.682968 |
87ce930a2a0af28129d12271ed1f7eccca5a550c | 98 | module Rails3JQueryAutocomplete
module Rails
class Engine < ::Rails::Engine ; end
end
end
| 16.333333 | 40 | 0.734694 |
18379b8419249bd2a6307254911e02b5510607b3 | 3,634 | # -*- encoding: utf-8 -*-
require 'benchmark'
require 'json'
require 'thor'
require 'flacky'
require 'flacky/flac_metadata_importer'
require 'flacky/flac_track_zero_pad_stripper'
require 'flacky/metadata_generator'
require 'flacky/mp3_convertor'
module Flacky
class CLI < Thor
include Thor::Actions
desc ... | 30.537815 | 96 | 0.608696 |
b9abf33e2771453a44ea84ebf5b91c00ef0de2df | 869 | # frozen_string_literal: true
# Even Fibonacci numbers
# https://projecteuler.net/problem=2
# Store history in each number to calculate the next, and
# generate a lazy stream of numbers to pick from
class FibonacciNumber
attr_reader :value
def initialize(previous_value, value)
@previous_value = previous_valu... | 17.734694 | 57 | 0.629459 |
386f910a77421acd3e0a1e27cacbce3f6d2ac1a4 | 153 | edition = Publication.unscoped.find(489_925)
edition.update!(state: "draft")
edition.document.update!(slug: edition.document.slug.gsub(/^deleted-/, ""))
| 38.25 | 75 | 0.751634 |
798f16316e710fe8f9246c71599e061f6010b650 | 116 | RSpec.describe Interfacer do
it 'has a version number' do
expect(Interfacer::VERSION).not_to be nil
end
end
| 19.333333 | 45 | 0.741379 |
1c37be712e9edb1d42455331c8ece1524c2fe3d6 | 955 | class TokyoMetro::App::Renderer::PassengerSurvey::Table::Year::Row < TokyoMetro::App::Renderer::PassengerSurvey::Table::MetaClass::Row
def initialize(
request ,
passenger_survey_info , n , max_passenger_journey_in_graph , make_graph ,
passenger_survey_infos_all_in_the_same_year
)
super( request , p... | 38.2 | 143 | 0.781152 |
ed56b5cf86898a2d2ad16090bea62f3e4a2bb93a | 400 | cask "solvespace" do
version "2.3"
sha256 "2e93301bbfef9253b5ef614862d891e2ab84e18c6a1e4e36225c5d47cacabc2d"
url "https://github.com/solvespace/solvespace/releases/download/v#{version}/solvespace.dmg",
verified: "github.com/"
appcast "https://github.com/solvespace/solvespace/releases.atom"
name "SolveS... | 30.769231 | 94 | 0.7625 |
bf7f2e4b1ceac3d9c21f47174a19a9f98e868cc1 | 2,583 | class Remarshal < Formula
include Language::Python::Virtualenv
desc "Convert between TOML, YAML and JSON"
homepage "https://github.com/dbohdan/remarshal"
url "https://github.com/dbohdan/remarshal/archive/v0.8.0.tar.gz"
sha256 "ab2ab978aaf20e97719680f8f242ea3407090b562d747205486a02cdbf14d17f"
revision 1
h... | 36.380282 | 145 | 0.753388 |
f8b87f0f5d199ea0bf93955761e76d0b0cf970f9 | 4,064 | require(File.expand_path('report/cell', File.dirname(__FILE__)))
require(File.expand_path('report/row', File.dirname(__FILE__)))
# require_relative './report/cell'
# require_relative './report/row'
module XeroGateway
class Report
include Money
include Dates
attr_reader :errors
attr_accessor :repo... | 34.151261 | 101 | 0.578494 |
38dfa63e8402bd24b744c2e0179880912d339df8 | 787 | # frozen_string_literal: true
module Admin
class AdminPolicy
attr_accessor :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
user.has_role?(:admin)
end
def show?
user.has_role?(:admin)
end
def create?
user.has_r... | 13.116667 | 40 | 0.551461 |
08918217919153b52819400f0757769f389c2bca | 23,000 | # frozen_string_literal: true
require 'sidekiq'
module Sidekiq
module RedisScanner
def sscan(conn, key)
cursor = '0'
result = []
loop do
cursor, values = conn.sscan(key, cursor)
result.push(*values)
break if cursor == '0'
end
result
end
end
class St... | 24.442083 | 118 | 0.556304 |
1a1302bdeb519ac871a4a7f519b13bcbfffb13d9 | 220 | $:.unshift(File.expand_path("../", __FILE__))
require "configset/version"
require "rainbow/ext/string"
require "configset/autoloader"
Configset::Autoloader.setup
module Configset
class Error < StandardError; end
end
| 20 | 45 | 0.772727 |
0875afbc663517a28343289aa62349e5b6d97d7f | 3,285 | # coding: utf-8
require "rails_helper"
class DummyController < ActionController::Base
include ContextualizedLogs::ContextualizedController
def show
Model.last
render json: {}
end
end
class ContextualizedModelDummyController < ActionController::Base
include ContextualizedLogs::ContextualizedCont... | 34.21875 | 122 | 0.734551 |
d539724bb3c65ff850dd1dd9424ce0559ad73432 | 594 | # == Schema Information
#
# Table name: publications
#
# id :bigint(8) not null, primary key
# stock_number :integer
# isbn :string
# year :integer
# price :decimal(, )
# publisher_id :bigint(8)
# novel_id :bigint(8)
# created_at :datetime not null
# update... | 22 | 55 | 0.653199 |
4a93697a1b5281f2f8538147636a49a235726bb5 | 20,506 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Christopher Brown (<cb@opscode.com>)
# Copyright:: Copyright (c) 2009 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | 35.113014 | 155 | 0.675022 |
ed4c63e62ea000772ed94934c56e041382c56c39 | 440 | class ManualPublishTaskAssociationMarshaller
def initialize(dependencies = {})
@decorator = dependencies.fetch(:decorator)
@collection = dependencies.fetch(:collection)
end
def load(manual, _record)
tasks = collection.for_manual(manual)
decorator.call(manual, publish_tasks: tasks)
end
def d... | 20.952381 | 49 | 0.736364 |
7a9c5dab5575db1f04d05de1628c199208d97751 | 702 | cask 'controlplane' do
if MacOS.release <= :snow_leopard
version '1.2.3'
sha256 '37f93d3a3a17a6e2f24447f0bc74c7e89ec1581ca52e5970960544858c86f909'
else
version '1.6.1'
sha256 '945ae102b81b838df65edf6f83292d33399218113e67bdfdaaa088c0f219ea47'
appcast 'http://www.controlplaneapp.com/appcast.xml',... | 29.25 | 90 | 0.759259 |
f7149b68b5cdbf32f36899f39d14e6acc2dfdb6d | 7,099 | require 'spec_helper'
describe 'fail2ban', type: :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_anchor('fail2ban::begin') }
it { is_expected.to contain_clas... | 28.170635 | 92 | 0.461473 |
2682868bda0579bf727ea3a0e670af421932c198 | 3,590 | # encoding: utf-8
require 'spec_helper'
describe Github::Client::Repos, '#list' do
let(:user) { 'peter-murach' }
let(:repo) { 'github' }
let(:request_path) { "/user/repos?access_token=#{OAUTH_TOKEN}" }
let(:body) { fixture('repos/repos.json') }
let(:status) { 200 }
after { reset_authentication_for subj... | 30.168067 | 154 | 0.64039 |
4a7cd8e3f5d68faa3f547e67711e78ff4452c7c5 | 526 | module Qernel::Plugins
class ResettableSlots
include Plugin
after :calculation, :reset_slots_to_zero
def reset_slots_to_zero
@graph.nodes.each do |node|
node.slots.each do |slot|
if slot.reset_to_zero == true
slot.conversion = 0.0
slot.edges.each do |edge... | 22.869565 | 44 | 0.572243 |
bb87bd843072d41e726a4f5524e0655c03234e83 | 510 | class EsiFundViewAdapter < DocumentViewAdapter
attributes = [
:title,
:summary,
:body,
:fund_state,
:fund_type,
:location,
:funding_source,
:closing_date,
]
attributes.each do |attribute_name|
define_method(attribute_name) do
delegate_if_document_exists(attribute_name)
... | 17 | 58 | 0.701961 |
9106c5023f2f00020594ac6399d950bd4a9b8c2b | 942 | # frozen_string_literal: true
module Babik
module QuerySet
# select_related functionality of QuerySet
module RelatedSelector
# Load the related objects of each model object specified by the association_paths
#
# e.g.
# - User.objects.filter(first_name: 'Julius').select_related(:grou... | 33.642857 | 88 | 0.674098 |
03e5c6a5eff67e1abe5c84d6ab9471fb2f460b84 | 460 | # encoding: utf-8
# frozen_string_literal: true
require 'active_support/all'
module ViaCep
# Utils module
class Utils
class << self
def handle_whitespaces(string)
string.split(' ').join('%20')
end
def handle_accents(string)
ActiveSupport::Inflector.transliterate(string)
... | 19.166667 | 54 | 0.652174 |
b98892ecc1649682f8dd4b6f0169307d9eae2735 | 825 | #
# Cookbook Name:: kernel-modules
# Author:: Jeremy MAURO <j.mauro@criteo.com>
#
# Copyright 2016, Criteo.
#
# 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/licen... | 29.464286 | 74 | 0.738182 |
79ec3de2f084e678db285e383cd2d03aa8254648 | 619 | Pod::Spec.new do |s|
s.name = "PPDBLUtils"
s.version = "1.0.1"
s.summary = "测试pod生成PPDBLUtils的framework"
s.description = "测试用的,用了测试使用pod lib create 生产的framework工程"
s.homepage = "https://github.com/liu521227/PPDBLUtils.git"
s.license = 'MIT'
s.author ... | 41.266667 | 104 | 0.575121 |
619e5de25bd668ddc8a316894d91e79d6bc7af60 | 3,825 |
require 'socket'
require 'thread'
require 'discordrb'
require_relative 'reudy_common'
module Gimite
class DiscordBot
include Gimite
SILENT_SECOND = 20.0 #沈黙が続いたと判断する秒数。
def initialize(user, logOut = STDOUT)
@user = user #Reudyオブジェクトを設定
@token = @user.settings[:disc_token] #BO... | 26.93662 | 206 | 0.511634 |
e9e2d01ed64efdf7370e50547e87eb6d3d47a012 | 232 | class CreateBookListInfos < ActiveRecord::Migration[6.0]
def change
create_table :book_list_infos, id: :uuid do |t|
t.string :book_id
t.string :user_id
t.string :list_id
t.timestamps
end
end
end
| 19.333333 | 56 | 0.663793 |
79bacb486b928cd18329cfe00a52cd997153e3f2 | 571 | cask 'freesmug-chromium' do
version '54.0.2840.71'
sha256 'f64cf586d017d737288e29556ccbf6c69d8002fcfdf96e0d48a3a981111e4f59'
# sourceforge.net/osxportableapps was verified as official when first introduced to the cask
url "https://downloads.sourceforge.net/osxportableapps/Chromium_OSX_#{version}.dmg"
appcast... | 40.785714 | 94 | 0.798599 |
b9a275bb5d6c52be392a3f05beac25d2c01587d3 | 566 | module Less2Sass
module Less
module Tree
class MixinDefinitionNode < Node
attr_accessor :name
attr_accessor :selectors
attr_accessor :params
attr_accessor :condition
attr_accessor :variadic
attr_accessor :arity
attr_accessor :rules
attr_accesso... | 22.64 | 41 | 0.634276 |
ffe0a75ee973ec9ebf58324bbee9ce08360f1721 | 3,473 | # This code was ported from the java version available here:
# http://grepcode.com/file/repo1.maven.org/maven2/com.ibm.icu/icu4j/51.2/com/ibm/icu/text/RBNFChinesePostProcessor.java
# This code is incomplete, untested, and unused. It should remain here until
# I can figure out why it's necessary in ICU and wether to ma... | 28.235772 | 119 | 0.514829 |
01219b856d3e5a64896a5ba7736926247db16c3d | 710 | module MoneyRails
module ActiveRecord
module MigrationExtensions
class OptionsExtractor
def self.extract(attribute, table_name, accessor, options = {})
default = MoneyRails::Configuration.send("#{attribute}_column").merge(options[attribute] || {})
default[:column_name] ||= [defa... | 35.5 | 109 | 0.657746 |
e866257b0d30b56e05df4b03708aea2a1ceb14a1 | 353 | class AddFieldsToSpreeLoyaltyPointsTransaction < ActiveRecord::Migration[4.2]
def change
add_column :spree_loyalty_points_transactions, :source_type, :string
rename_column :spree_loyalty_points_transactions, :order_id, :source_id
add_column :spree_loyalty_points_transactions, :updated_balance, :integer, d... | 44.125 | 102 | 0.815864 |
f78ee48c1dc4e52ba8d27b1e27dec9430b8fa9fb | 259 | require "test_helper"
class HomeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get home_index_url
assert_response :success
end
test "should get show" do
get home_show_url
assert_response :success
end
end
| 18.5 | 58 | 0.752896 |
7aad3e5ca52ff2343f1591065efd8d24c525f657 | 32,039 | # 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::V2018_01_01
#
# ApiManagement Client
#
class ProductPolicy
include MsRestAzure
#
# Creates and initi... | 55.049828 | 233 | 0.700272 |
084642dbe05c19697e70a7e1e7bdbf36a4d478c0 | 1,267 | # encoding: utf-8
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "coupler"
gem.homepage = "http://github.com/coupler/coupler"
gem.license = "MIT"
gem.summary = %Q{Coupler is a desktop application for link... | 28.795455 | 99 | 0.681137 |
33c669befb1477b27ae144a1c3068176f9ae09cd | 4,741 | require 'spec_helper'
describe Icalendar::Calendar do
context 'values' do
let(:property) { 'my-value' }
%w(prodid version calscale ip_method).each do |prop|
it "##{prop} sets and gets" do
subject.send("#{prop}=", property)
expect(subject.send prop).to eq property
end
end
... | 28.220238 | 105 | 0.64691 |
91eb5508a1efbeb4ea2c0f67c2bae603a8e8c46d | 1,028 | data = File.readlines("#{__dir__}/data.txt").map(&:strip)
def check_row s, r
return r[0] if s.empty?
mid = (r.size / 2).floor
char = s.first
if char == "F"
crange = (r.first..r[mid]).to_a
return check_row s.drop(1), crange
elsif char == "B"
crange = (r[mid]..r.last).to_a
... | 21.87234 | 57 | 0.564202 |
61b0da88f910aad578622a29000e5aae660cc4a5 | 601 | # frozen_string_literal: true
module ActsAsMessageable
autoload :Model, 'acts_as_messageable/model'
autoload :Scopes, 'acts_as_messageable/scopes'
autoload :Message, 'acts_as_messageable/message'
autoload :Relation, 'acts_as_messageable/relation'
autoload :Rails3, 'acts_as_messageable/rails3'
autoload :Rai... | 25.041667 | 52 | 0.745424 |
f8b4eebb7a8ac8d5123eeb4210c62a07f7f1f820 | 5,783 | # 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::Resources::Mgmt::V2018_02_01
#
# A service client - single point of access to the REST API.
#
class ResourceManagementClient < MsRestA... | 38.046053 | 154 | 0.693412 |
01d309bc3cb25c61354d379b05a4ee63de3bf3a6 | 169 | module Erlash
class ArrayFormatter < TemplateFormatter
def format
elems = object.map{ |e| format_elem(e) }
"[ #{elems.join(", ")} ]"
end
end
end
| 18.777778 | 46 | 0.60355 |
91e6b64338fd5999ca4cc3f50f328db1168a6024 | 112 | class UpdateJobs < ActiveRecord::Migration[5.2]
def change
add_column :jobs, :location, :string
end
end
| 18.666667 | 47 | 0.723214 |
03dbd0a24c96e93efdd80e8fea25d95137b89379 | 342 | Merb.logger.info("Loaded DEVELOPMENT Environment...")
Merb::Config.use { |c|
c[:exception_details] = true
c[:reload_templates] = true
c[:reload_classes] = true
c[:reload_time] = 0.5
c[:log_auto_flush ] = true
c[:ignore_tampered_cookies] = true
c[:log_level] = :debug
}
class Merb::Mailer
self.delivery_m... | 24.428571 | 53 | 0.701754 |
bb02be7c7e256bde8e7654bbdeaa2851c11f996a | 2,201 | RSpec.describe Guide, type: :model do
let(:id) { 'the_test_guide' }
let(:locale) { 'en' }
let(:content_type) { :govspeak }
let(:content) { '/examples/test.md' }
let(:label) { 'Tested' }
let(:concise_label) { 'Test' }
let(:description) { 'A test description' }
let(:tags) { [] }
let(:metadata) do
{... | 23.923913 | 101 | 0.629259 |
385a0efcc4ac233ed8098c0e848b7f7b982e19f1 | 4,594 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# 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 ... | 39.603448 | 111 | 0.659338 |
e9e56b257c74882ab225bd3240c22ed4a8ac1f7c | 341 | # frozen_string_literal: true
public def chars_count(word)
counter = {}
counter.default = 0
word.chars.each { |x| counter[x] = counter[x] + 1 }
counter
end
public def anagrams(word, words)
word_hash = chars_count(word)
word_length = word.length
words.select { |w| word_length == w.length && word_hash == ... | 22.733333 | 77 | 0.695015 |
ac59a25cc1090e6620489e6e7f77823434e1ec55 | 35,675 | # frozen_string_literal: true
# encoding: utf-8
# Copyright (C) 2014-2020 MongoDB 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
#
# Un... | 34.907045 | 125 | 0.649362 |
e9cfb444c181b2961a6310e660baf4010473cf38 | 3,049 | require 'rails_helper'
describe Assessment do
subject { build(:assessment) }
it('belongs to Fund') { assoc(:fund, :belongs_to) }
it('belongs to Proposal') { assoc(:proposal, :belongs_to) }
it('belongs to Recipient') { assoc(:recipient, :belongs_to) }
it { is_expected.to be_valid }
it 'requires associa... | 24.198413 | 73 | 0.667104 |
b9c3f2d4309eb4f016a41df64b2b93ba9c18676b | 858 | # frozen_string_literal: true
require 'httparty'
module Zoom
class Client
include HTTParty
include Actions::Account
include Actions::Data
include Actions::Group
include Actions::M323Device
include Actions::User
include Actions::Meeting
include Actions::Metrics
include Actions::Ph... | 22.578947 | 51 | 0.671329 |
1cc66df59c3792b9079eced1fb4862cb1ebfc540 | 731 | require 'test_helper'
class MessageTest < Minitest::Test
def private_key(path)
OpenSSL::PKey.read File.read(path)
end
def public_key(path)
OpenSSL::X509::Certificate.new File.read(path)
end
def test_base64_encoded_messages
server_key = private_key('test/certificates/server.key')
server_crt ... | 33.227273 | 96 | 0.756498 |
9173144426f1a65f5c9e7bb7a27c497783317a4c | 402 | class SearchCountController < ApplicationController
def new
if UsageCount.exists?
count = UsageCount.get
SetUsageCountWorker.perform_async if UsageCount.ttl < 5.minutes
else
logger.warn 'UsageCount is not found'
count = User.all.size
SetUsageCountWorker.perform_async
end
... | 23.647059 | 69 | 0.691542 |
e99fb02173be651a0b792cc55cd70b505c938360 | 3,145 | class Economic::Entity
class Handle
def self.build(options)
return options if options.is_a?(Handle)
return nil if options.nil?
new(options)
end
def self.id_properties
{
:code => 'Code',
:id => 'Id',
:id1 => 'Id1',
:id2 => 'Id2',
:name => 'Na... | 30.240385 | 109 | 0.606677 |
b96d3b4dea73f57b73a1138eae221e7ae8b458fb | 1,225 | assert("slop - parse - option - nothing") do
argv = ["path"]
options = Slop.parse(argv) do |parser|
end
assert_equal(["path"], options.arguments)
end
assert("slop - parse - option - processed") do
argv = ["--log", "/tmp/log", "path"]
options = Slop.parse(argv) do |parser|
parser.string("--log", "Log to... | 24.019608 | 46 | 0.456327 |
62e41792f2fe55f604c4bfde6d75deb56b2e5e42 | 1,755 | class TopBox::CLI
def call
puts 'Current Top Box Office Movies by imdb.com'
TopBox::Movie.new_from_collection(Scraper.scrape_movie_list)
list_movies
menu
end
def list_movies
#parse array of movie objects to output list
TopBox::Movie.all.each do |m|
puts "#{m.num}. #{m.title}"
... | 24.375 | 129 | 0.565242 |
1cec2edad2d8eb68fe8efc55df02f1af2630d0dd | 4,745 | #
# Cookbook Name:: cookbook-openshift3
# Recipe:: master_standalone
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
helper = OpenShiftHelper::NodeHelper.new(node)
ose_major_version = node['cookbook-openshift3']['deploy_containerized'] == true ? node['cookbook-openshift3']['openshift_docker_image_version'] :... | 46.980198 | 210 | 0.772181 |
112b095d922817be1554a80583a1544e326b3a47 | 200 | class NitrousDesktop < Cask
version :latest
sha256 :no_check
url 'https://www.nitrous.io/mac/NitrousDesktop-latest.zip'
homepage 'https://www.nitrous.io/mac'
app 'Nitrous Desktop.app'
end
| 20 | 60 | 0.735 |
213d0b7f4940d1eb2e60541221909b1d7c58914c | 5,525 | #
# Author:: Daniel DeLeo (<dan@opscode.com>)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | 33.689024 | 129 | 0.648507 |
396140c25cf7f21b7ceae0bf693e48451a13b586 | 1,833 | # 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::Security::Mgmt::V2019_01_01
module Models
#
# Represents a security setting in Azure Security Center.
#
class Setting < Sett... | 25.816901 | 70 | 0.443535 |
38818efc6c69a0ea69cb9e921ba77fac41d2d37e | 420 | cask :v1 => 'teleport' do
version :latest
sha256 :no_check
url 'http://www.abyssoft.com/software/teleport/downloads/teleport.zip'
name 'teleport'
appcast 'http://www.abyssoft.com/software/teleport/versions.xml',
:sha256 => 'c56815ad8028891f56f8ae5643e9e68b6ca59f2c31c49064e32f9822cc111533'
homepag... | 30 | 87 | 0.747619 |
bb3ffb60ca5660102e25e138d27d68740b44ff47 | 792 | require 'formula'
class Lighttpd < Formula
homepage 'http://www.lighttpd.net/'
url 'http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.32.tar.bz2'
sha256 '60691b2dcf3ad2472c06b23d75eb0c164bf48a08a630ed3f308f61319104701f'
option 'with-lua', 'Include Lua scripting support for mod_magnet'
depen... | 24 | 84 | 0.655303 |
5d011813853bf28a9336d096d0d20fb2e542ef49 | 751 | require 'roku-packager/key_gen'
require 'roku-packager/uploader'
require 'roku-packager/packager'
module RokuPackager
class Client
def initialize(development_roku_ip, logger = NullLogger.new)
@host = development_roku_ip
@logger = logger
end
attr_reader :password, :dev_id, :download_url
... | 22.757576 | 64 | 0.687084 |
795d45e0ebeaf96a886d1ae3ea59d3eb8a2fd416 | 1,026 | # Copyright 2017 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, ... | 31.090909 | 101 | 0.758285 |
f72bf1be778ac19032c0fa1f77f33af1530ee336 | 438 | # Be sure to restart your server when you modify this file.
MelbourneStatus::Application.config.session_store :cookie_store, key: '_melbourne_status_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session ta... | 48.666667 | 97 | 0.821918 |
f7a813723ed389601df9385153711e1a962ab776 | 842 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Verleng
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails v... | 32.384615 | 83 | 0.744656 |
33dfb52403176c06ef590072dfc48e3c9728873f | 9,061 | #
# Author:: Stephen Delano (<stephen@opscode.com>)
# Author:: Seth Falcon (<seth@opscode.com>)
# Author:: John Keiser (<jkeiser@ospcode.com>)
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
# Copyright:: Copyright 2010-2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache Licen... | 28.583596 | 136 | 0.650701 |
386553857f578539b8e1b9cf1594f792816d6461 | 675 | require 'spec_helper'
require 'generator_spec/test_case'
require 'generators/refinery/core/core_generator'
module Refinery
describe CoreGenerator do
include GeneratorSpec::TestCase
destination File.expand_path("../../../../../tmp", __FILE__)
before do
prepare_destination
run_generator
en... | 22.5 | 64 | 0.61037 |
1d675a775252010a5bcead34b761128db249b870 | 16,444 | # frozen_string_literal: true
#
# This class implements a pretty printing algorithm. It finds line breaks and
# nice indentations for grouped structure.
#
# By default, the class assumes that primitive elements are strings and each
# byte in the strings have single column in width. But it can be used for
# other situat... | 29.104425 | 456 | 0.639686 |
f8be2baf0b6da66b34eb08029014b3f71d3777c2 | 1,443 | module Vagrant
module Util
autoload :Busy, 'vagrant/util/busy'
autoload :CheckpointClient, 'vagrant/util/checkpoint_client'
autoload :CommandDeprecation, 'vagrant/util/command_deprecation'
autoload :Counter, 'vagrant/util/counter'
autoload :Cr... | 57.72 | 84 | 0.638254 |
4a98c9fc971bb193a699759dbe1bae0f65398191 | 4,388 | module Rubinius
module FFI
module Generators
##
# Constants turns C constants into ruby values.
class Constants
class Constant
attr_reader :name, :format, :cast
attr_accessor :value
def initialize(name, format, cast, ruby_name=nil, converter=nil)
@name = name
... | 24.243094 | 91 | 0.559253 |
ff47c5620f7587bf665f30cc0dfc478f15e692ca | 105 | # frozen_string_literal: true
module Firebug
# The current version of Firebug
VERSION = '1.4.2'
end
| 15 | 34 | 0.733333 |
e2930ece038da26d5c595d6bb9b1903533953845 | 1,953 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mutations::ComplianceManagement::Frameworks::Update do
include GraphqlHelpers
let_it_be(:framework) { create(:compliance_framework) }
let(:user) { framework.namespace.owner }
let(:mutation) { described_class.new(object: nil, context: { curre... | 27.9 | 140 | 0.642089 |
18da06bdf09295b9395de32713d6adfbdff01db9 | 1,613 | require 'puppet'
require 'puppet/type/tempest_config'
describe 'Puppet::Type.type(:tempest_config)' do
before :each do
@tempest_config = Puppet::Type.type(:tempest_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
Puppet::Type.type(:tempest_config).new... | 29.87037 | 101 | 0.6677 |
ff327eb77384e3b05a344c14136d1ddb2eef606f | 10,095 | # frozen_string_literal: true
# == Schema Information
#
# Table name: projects
#
# bugfix_fork_criteria :string default([]), not null, is an Array
# bugfix_fork_of :string
# description :text
# description_tsvector :tsvector
# github_repo_path :citext
# is_bugfix_fork :boolean ... | 33.762542 | 119 | 0.666667 |
01b9a6c9cd92e1de364c635d1444810bafe32dbd | 1,133 | # 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-lex'
spec.version = File.read(File.exp... | 37.766667 | 120 | 0.663725 |
0355fa49c5dab848369a90c6da0e419343f6e640 | 473 | require "openssl"
class String
def encrypt(key)
cipher = OpenSSL::Cipher::AES.new(256, :CBC).encrypt
cipher.key = key
cipher.update(self) + cipher.final
end
def decrypt(key)
cipher = OpenSSL::Cipher::AES.new(256, :CBC).decrypt
cipher.key = key
cipher.update(self) + cipher.final
end
end... | 18.92 | 56 | 0.693446 |
bf4f613e82e5d96e7a46998e7edc70b4f61d3689 | 38 | class Device < ActiveRecord::Base
end
| 12.666667 | 33 | 0.789474 |
031584802ac0df7b1e66104085782b1d34f9ff30 | 207 | require 'adhearsion'
require 'amequp'
RSpec.configure do |config|
config.color_enabled = true
config.tty = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
| 17.25 | 48 | 0.763285 |
4aaf7eca9d300922192124e2df5d78ee8e32f52c | 16,220 | require 'abstract_unit'
require 'controller/fake_models'
require 'pathname'
class TestControllerWithExtraEtags < ActionController::Base
etag { nil }
etag { 'ab' }
etag { :cde }
etag { [:f] }
etag { nil }
def fresh
render text: "stale" if stale?(etag: '123', template: false)
end
def array
re... | 27.445008 | 101 | 0.737608 |
ed1dbe15d65b41e432d42b973ffa8602ceba5c6b | 23,388 | # frozen_string_literal: true
require 'spec_helper'
describe "Internal Project Access" do
include AccessMatchers
set(:project) { create(:project, :internal, :repository) }
describe "Project should be internal" do
describe '#internal?' do
subject { project.internal? }
it { is_expected.to be_tr... | 42.064748 | 84 | 0.702583 |
38af436d4d48cc432b4db0d2c0c9d0de2df11aab | 120 | default['sls_utils']['yum_install']['epel_release'] = '8'
default['sls_utils']['yum_install']['ius_release'] = '1.0-14'
| 40 | 61 | 0.683333 |
f72082e69676a9294a82e1c0eef87f9801293ef4 | 7,160 | enable :sessions
set :session_secret, (ENV['SESSION_SECRET'] || 'superSecret!1!')
DataMapper.auto_upgrade!
get '/' do
SUBMISSION_COUNT = 20
if session['user_id']
@logged_in = true
# Submission name format: Problem Name + File Name
user = User.get(session['user_id'])
# If the user is on a team... | 27.328244 | 130 | 0.571648 |
388bee023d9054811cbdfa2f9dd2f7dc5ff39ae3 | 1,249 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module GoogleSpeechToTextDemo
class Application < Rails::Application
# Initialize configuration defaults for originally ge... | 29.738095 | 82 | 0.713371 |
87acfd267267d08720c031b4778e28014b1a1e4c | 717 | class CreatePapers < ActiveRecord::Migration[5.2]
def up
create_table :papers do |t|
t.string :paper_id
t.string :title
t.text :abstract
t.tsvector :search_vector
t.timestamps
end
execute "CREATE INDEX abstracts_search_idx ON papers USING gin(search_vector);"
execu... | 34.142857 | 200 | 0.739191 |
bf3b0aa13eb34ead1b7c439afcf97f3418f9bacb | 1,408 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'etfc/version'
Gem::Specification.new do |spec|
spec.name = 'etfc'
spec.version = ETFC::VERSION
spec.authors = ['Maximilian Haack']
spec.email = ['mxhaack@gmai... | 38.054054 | 74 | 0.647017 |
e2aaa5dc3d4312079b0735131e65e81a7cf0acce | 370 | class User < ActiveRecord::Base
include Adauth::Rails::ModelBridge
AdauthMappings = {
:login => :login,
:group_strings => :cn_groups
}
AdauthSearchField = [ :login, :login ]
#validates :first_name, :last_name, :login, :email, :active, presence: true
validates :first_name, :last_name, :login, :email, presence: t... | 23.125 | 75 | 0.72973 |
e2715f2458df71243ca728143ddd793300b31683 | 9,900 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 32.352941 | 839 | 0.618586 |
4a96e141a31742f4e621434b763be52118b68452 | 74 | module Rack
module AcceptDefaultVersion
VERSION = '0.0.1'
end
end
| 12.333333 | 29 | 0.702703 |
f86209e3c79b390eec0d7e55278b9a6f39335e50 | 5,048 | # encoding: utf-8
require_relative './relocator'
module CartoDB
module Relocator
class Worker
def self.perform(args = {})
puts args
job = CartoDB::Relocator::Job.find(args["id"])
dump(job) if job.type == "dump"
load(job) if job.type == "load"
end #work
def sel... | 39.4375 | 106 | 0.587361 |
ed4ebf5b5bc1bb45656570ccc27ff11ecf8df097 | 586 | class User
include Dynamoid::Document
field :name
field :email
field :password
field :admin, :boolean
field :last_logged_in_at, :datetime
field :favorite_colors, :serialized
field :todo_list, :array
has_and_belongs_to_many :subscriptions
has_many :books, class_name: 'Magazine', inverse_of: :owne... | 24.416667 | 80 | 0.766212 |
bf5ee4369a613723c6c4ec2a177b5a69e5022a86 | 256 | Given(/^a story "(.*?)"$/) do |title|
account(name: "Story Account") do |account|
@story = sample_entry(account: account, title: title)
end
end
When(/^I publish the story$/) do
click_on "Publish"
choose "indefinitely"
click_on "Publish"
end
| 21.333333 | 57 | 0.664063 |
62ef93f8c5019fdc34bfc7b920f5a0f76aa10623 | 8,947 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
class CollectionUseRegularUuids < ActiveRecord::Migration[4.2]
def up
add_column :collections, :name, :string
add_column :collections, :description, :string
add_column :collections, :properties, :text
add_... | 48.362162 | 173 | 0.765061 |
8770ebb6fe7ebd2ec9f5f1506826bdcb08371d06 | 238 | # frozen_string_literal: true
require 'solidus_core'
require 'solidus_support'
require 'deface'
require 'spree_multi_domain/engine'
require 'spree_multi_domain/create_line_item_support'
require 'spree_multi_domain/show_product_support'
| 23.8 | 53 | 0.857143 |
e95242e8aff83db55584cd1d4086109ebb6ea33b | 3,630 | # frozen_string_literal: true
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 29.754098 | 74 | 0.654821 |
5d78f212cd4c234b64a056b7642270fe403bff7c | 17,589 | # Base Ruboto stuff and dependencies
require 'ruboto'
# Command-specific dependencies
require 'ruboto/sdk_versions'
require 'ruboto/util/asset_copier'
require 'ruboto/util/log_action'
require 'ruboto/util/xml_element'
require 'ruboto/util/code_formatting'
require 'ruboto/util/build'
require 'ruboto/util/verify'
requir... | 38.827815 | 272 | 0.530104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.