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 |
|---|---|---|---|---|---|
91606ffbfd343361909ad1e2cd3f4469996a688b | 1,471 | require "sinatra"
require "json"
configure do
set(:deploy_config) { JSON.parse(File.read("config.json")) }
end
post '/deploy' do
body = request.body.read
payload = JSON.parse(body)
repo_name = payload["repository"]["full_name"]
halt 404, "Unknown repository" unless settings.deploy_config.has_key?... | 33.431818 | 125 | 0.687967 |
18831ee179e17ac7b50026177cf26a32c6566080 | 499 | cask 'gramps' do
version '5.0.2-3'
sha256 '28e5f457d37f8b4ad738874b92a9edbfb1e92f4d44abc1229f42579b1aa233f1'
# github.com/gramps-project/gramps was verified as official when first introduced to the cask
url "https://github.com/gramps-project/gramps/releases/download/v#{version.major_minor_patch}/Gramps-Intel-#... | 38.384615 | 124 | 0.777555 |
e898bcdd63d8fff0aac37c9a8234aeb066bc2adb | 4,520 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
require 'json'
BUILD_DIR = 'build'
def dotnet_base_path
info = `dotnet --info`
info.match(/Base Path:\s+(.*)\s*/)[1]
end
def cat(filename, content = nil)
name = File.join(BUILD_DIR, filename)
unless content.nil?
File.open(name, 'w') d... | 28.974359 | 78 | 0.543805 |
7a112bf770f10329f8f5dde432313090fa78b0f2 | 727 | require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "react-native-media-picker"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.author... | 30.291667 | 129 | 0.607978 |
4ad740e4ad359206d2805a5f6554fe3cd1659a91 | 2,979 | Pod::Spec.new do |s|
s.name = "React"
s.version = "0.1.0"
s.summary = "Build high quality mobile apps using React."
s.description= <<-DESC
React Native apps are built using the React JS framework,
and render directly to native UIKit elements using a fully
... | 37.708861 | 146 | 0.638469 |
626c8c85e0d3f4a16f66ad8d645a6fda92246875 | 1,541 | require 'yaml'
module LanguageList
class LanguageInfo
attr_reader :name, :iso_639_3, :iso_639_1, :type
def initialize(options)
@name = options[:name]
@iso_639_3 = options[:iso_639_3]
@iso_639_1 = options[:iso_639_1]
@common = options[:common]
@type = options[:type]
end
... | 25.683333 | 115 | 0.625568 |
ed4582aa6feeacb736b034b0ce867406e166df8a | 539 | cask "netgear-switch-discovery-tool" do
version "1.2.102"
sha256 "5d58479d3b32798fedefce7a4b6da220ced1bd20ed5d71ce1d3c04e097721da2"
url "https://www.downloads.netgear.com/files/GDC/NSDT/NetgearSDT-V#{version}-Mac.zip"
appcast "https://www.netgear.com/support/product/netgear-switch-discovery-tool.aspx#download"... | 38.5 | 95 | 0.779221 |
e9d992559ebad2bdff84b20f06f976f28183de1d | 1,730 | class Onedpl < Formula
desc "C++ standard library algorithms with support for execution policies"
homepage "https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html"
url "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2021.4.0-release.tar.gz"
sha256 "74ffc0fab... | 30.350877 | 113 | 0.633526 |
b91357db9839f8429a6f5b4a9790bec0da8e1bf2 | 3,474 | module Grit
class Index
attr_accessor :repo, :tree, :current_tree
def initialize(repo)
self.repo = repo
self.tree = {}
self.current_tree = nil
end
# Add a file to the index
# +path+ is the path (including filename)
# +data+ is the binary contents of the file
... | 28.47541 | 94 | 0.543466 |
381f440f49eef08ff48ad28d89633be68fcac55c | 1,011 | require 'tmpdir'
require 'digest/md5'
require 'fileutils'
# Abstract
class Puppet::Provider::Vcsrepo < Puppet::Provider
private
def set_ownership
owner = @resource.value(:owner) || nil
group = @resource.value(:group) || nil
FileUtils.chown_R(owner, group, @resource.value(:path))
end
... | 23.511628 | 99 | 0.627102 |
d58953657680633ae711778838fcada38fa33af0 | 2,837 | require "assert"
require "undies/root_node"
require 'undies/io'
require 'undies/element'
require 'undies/element_node'
class Undies::RootNode
class UnitTests < Assert::Context
desc 'a root node'
before do
@io = Undies::IO.new(@out = "", :pp => 1)
@rn = Undies::RootNode.new(@io)
@e = Und... | 25.790909 | 75 | 0.654565 |
282a99301f458e390b25a7d5a9cdfc59f4602b41 | 378 | require "hamster/list"
module Hamster
module CoreExt
module Enumerable
def self.included(base)
base.class_eval do
def to_list
list = EmptyList
reverse_each { |item| list = list.cons(item) }
list
end
end
end
end
end
end
mod... | 17.181818 | 58 | 0.587302 |
5d9133f0a933f992a6f22a61a8453f76c6609a5e | 2,158 | # -*- encoding: utf-8 -*-
# stub: commonmarker 0.17.13 ruby lib ext
# stub: ext/commonmarker/extconf.rb
Gem::Specification.new do |s|
s.name = "commonmarker".freeze
s.version = "0.17.13"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_pa... | 44.958333 | 116 | 0.68304 |
3845753cd0e1929cfa39ad92a1c941625094f06d | 77 | # frozen_string_literal: true
module SolidusInvoice
VERSION = '0.1.1'
end
| 12.833333 | 29 | 0.753247 |
61e09f960f14560b2b01787551e92f38c4ea9d47 | 2,063 | # -*- encoding: utf-8 -*-
# stub: socket.io-client-simple 1.2.1 ruby lib
Gem::Specification.new do |s|
s.name = "socket.io-client-simple"
s.version = "1.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Sho Ha... | 40.45098 | 105 | 0.627242 |
39ede870d0977e1db52f297c172ae1eab98e8c85 | 535 | # frozen_string_literal: true
module EightBall::Conditions
# Finds the Condition class based on its name
# @param [String] name The case insensitive name to find the Condition for
# @return [EightBall::Conditions] the Condition class represented by the given name
def self.by_name(name)
mappings = {
a... | 31.470588 | 85 | 0.719626 |
28d991013b59c3cdd33b4a891c4ef55ab7e1928c | 785 | {
matrix_id: '1377',
name: 'rajat28',
group: 'Rajat',
description: 'Rajat/rajat28 circuit simulation matrix',
author: 'Rajat',
editor: 'T. Davis',
date: '2006',
kind: 'circuit simulation problem',
problem_2D_or_3D: '0',
num_rows: '87190',
num_cols: '87190',
nonzeros: '606... | 29.074074 | 111 | 0.663694 |
e914a8f5d8221cc8166f528b8cccb70ae516c417 | 1,616 | class Sqldiff < Formula
desc "Displays the differences between SQLite databases"
homepage "https://www.sqlite.org/sqldiff.html"
url "https://www.sqlite.org/2021/sqlite-src-3360000.zip"
version "3.36.0"
sha256 "25a3b9d08066b3a9003f06a96b2a8d1348994c29cc912535401154501d875324"
license "blessing"
livecheck ... | 38.47619 | 122 | 0.714728 |
268b7156f7c80ea48f3e5e6c6937c057a1a2f0de | 3,816 | # The Nature of Code
# PBox2D example
# An uneven surface boundary
class Surface
include Processing::Proxy
# We'll keep track of all of the surface points
attr_reader :surface, :body, :box2d, :y, :width, :height
def initialize(b2d)
@box2d = b2d
@surface = []
@width = b2d.width
@height = b2d.h... | 27.652174 | 94 | 0.633386 |
084d1d0acf6cc1696134c504bdf540e887554860 | 3,099 | #
# Author:: Doug MacEachern (<dougm@vmware.com>)
# Copyright:: Copyright (c) 2010 VMware, 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
#
# ... | 32.621053 | 107 | 0.709584 |
5d98c953250ebc2c4dc717d71cd75e6db876f2a6 | 203 | require 'parslet'
# SelfML::Engines
#
# An engine is a parslet transformation
module SelfML::Engines; end
require 'selfml/engines/document'
require 'selfml/engines/array'
require 'selfml/engines/hash'
| 18.454545 | 39 | 0.778325 |
626d6bb5208002e77068a0965b75b00e46d8c0e7 | 354 | require 'spec_helper_acceptance'
describe 'cis_hardening_setup_filesystem class' do
context 'default parameters' do
it 'behaves idempotently' do
idempotent_apply(pp)
end
end
# Disable unused Filesystems - Section 1.1.1
describe file('/etc/modprobe.d/CIS.conf') do
it { should be_file }
... | 22.125 | 50 | 0.70904 |
e274ab38b9ef5e4508210d1884f294c9abf0a37d | 1,886 | class LibbitcoinProtocol < Formula
desc "Bitcoin Blockchain Query Protocol"
homepage "https://github.com/libbitcoin/libbitcoin-protocol"
url "https://github.com/libbitcoin/libbitcoin-protocol/archive/v3.6.0.tar.gz"
sha256 "fc41c64f6d3ee78bcccb63fd0879775c62bba5326f38c90b4c6804e2b9e8686e"
license "AGPL-3.0"
... | 34.290909 | 100 | 0.628844 |
387eb247428b6efb12d73cc86c0e2c64be275539 | 2,506 | require 'test_helper'
class MentorshipTest < Minitest::Test
def setup
VCR.use_cassette('airtable/mentorship/successful') do
@successful_response = Airtable::Mentorship.new.mentor_request_data
end
end
def test_mentor_request_data_returns_correct_keys
assert @successful_response.keys.sort == %i[... | 32.545455 | 94 | 0.731445 |
f71d26344e32e3b35da2485933a300c73b776f31 | 3,222 | # 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... | 43.540541 | 210 | 0.681254 |
edd2c1fbd77ef3f063b3f9735fa890ec1613a80d | 1,495 | class ArmLinuxGnueabihfBinutils < Formula
desc "FSF/GNU binutils for cross-compiling to arm-linux"
homepage "https://www.gnu.org/software/binutils/binutils.html"
url "https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gz"
mirror "https://ftpmirror.gnu.org/binutils/binutils-2.35.tar.gz"
sha256 "a3ac62bae4f3398... | 35.595238 | 93 | 0.63612 |
ab4d115003c5bc43498b4d012d096f8af83fbdd4 | 744 | class Api::V1::MessagesController < ApplicationController
before_action :authenticate_with_token!
def index
if chat = Chat.find(chat_id)
render json: {
operation: :index,
status: :success,
data: {
chat: chat,
messages: chat.messages
},
}
else... | 20.108108 | 78 | 0.616935 |
b9b13a11addfa9fb5c45ba471a147ded2340762d | 80 | # frozen_string_literal: true
module RubygemsDownloads
VERSION = '0.1.3'
end
| 13.333333 | 29 | 0.7625 |
2844fb68e9644a93976a358b3e60f759fb008f97 | 509 | # frozen_string_literal: true
# typed: true
# compiled: true
class A < T::Struct
extend T::Sig
# Sorbet will generate a `sig` for the synthetic declaration of this function,
# but the compiler will not emit the actual definition -- that work will be
# done by sorbet-runtime, and therefore we should mimic the ... | 24.238095 | 80 | 0.730845 |
628662415804d2752db4404a84bbe1ad24834911 | 28,109 | # frozen_string_literal: true
require_relative '../base'
require_relative '../cities_plus_towns_route_distance_str'
require_relative '../trainless_shares_half_value'
require_relative 'meta'
require_relative 'entities'
require_relative 'map'
require_relative 'scenarios'
require_relative 'round/operating'
require_relati... | 31.232222 | 128 | 0.524316 |
1cbc3d11a7eff0b0af9e8482e6ca0975b7ed9ffd | 1,063 | require 'spec_helper'
describe Guard::Handlebars::Formatter do
subject { Guard::Handlebars::Formatter }
describe '.info' do
it 'output Guard::UI.info' do
::Guard::UI.should_receive(:info).once.with('a.handlebars', {})
subject.info('a.handlebars')
end
end
describe '.debug' do
it 'outp... | 24.72093 | 86 | 0.638758 |
215702ade7b63c336d12e4e2d56b7a30fecd8ddf | 14,288 | require 'test_helper'
class RubyBbcodeHtmlTest < Minitest::Test
def before_setup
RubyBBCode.reset
end
def test_multiline
assert_equal "line1<br />\nline2", "line1\nline2".bbcode_to_html
assert_equal "line1<br />\nline2", "line1\r\nline2".bbcode_to_html
assert_equal "<ul>\n<li>line1</li>\n<li>lin... | 48.931507 | 188 | 0.672172 |
26dd3830f2d32ef826b9d3764d76dbc777cd25f1 | 1,798 | require 'thread'
require 'timeout'
module Rollbar
module Delay
class Thread
EXIT_SIGNAL = :exit
EXIT_TIMEOUT = 3
Error = Class.new(StandardError)
TimeoutError = Class.new(Error)
class << self
attr_reader :reaper
def call(payload)
spawn_threads_re... | 22.197531 | 93 | 0.521691 |
d576fd8c293951a4314341de809254f56ae1a8f5 | 649 | # == Schema Information
#
# Table name: professors
#
# id :integer not null, primary key
# first :string
# last :string
# university :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Professor < ActiveRecord::Base
has_many :ratings, depen... | 25.96 | 165 | 0.676425 |
e9b9aaa7a78de63cb841c95741a2a07ec509ca7f | 1,809 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "gametracker/version"
Gem::Specification.new do |spec|
spec.name = "gametracker"
spec.version = Gametracker::VERSION
spec.authors = ["'Ali Karimi'"]
spec.email = ["'ajkarimi7... | 43.071429 | 96 | 0.673853 |
e9f8a47886cf618eeec2eb889c897d3d252a0b0d | 420 | class BenchmarkChannel < ApplicationCable::Channel
STREAMS = (1..10).to_a
def subscribed
Rails.logger.info "a client subscribed: #{id}"
stream_from "all#{STREAMS.sample if ENV['SAMPLED']}"
end
def echo(data)
transmit data
end
def broadcast(data)
ActionCable.server.broadcast "all#{STREAMS.... | 22.105263 | 79 | 0.690476 |
f8a61762ca1d1f973528ea27bb1bb9e3a7bdc622 | 4,030 | #encoding: utf-8
class Option
include Comparable
TYPES = ["*", "bool", "float", "[float]", "int", "string", "[string]", "table", "[table]"]
attr_reader :name,
:category,
:default,
:description,
:display,
:enum,
:examples,
:null,
:options,
:partition_key,
:relevant_when,
... | 20.353535 | 108 | 0.572953 |
5d3946f2609f647ef4b70d0de902d1ea13d252ff | 366 | require 'celluloid'
require 'pry'
class File_Access
include Celluloid
def open_file (aFile, bFile)
aFile.lock_file
end
def lock_file
@f1 = File.open('/Users/dilum/Desktop/input.txt', File::RDWR|File::CREAT, 0644)
@f1.flock(File::LOCK_EX)
@f1.close
end
end
a = File_Access.new
b = File_Access.new
a.asyn... | 15.25 | 81 | 0.724044 |
edd16d588cd969ae35643fc59eb43eb4e1f491f7 | 13,589 | module Groonga
module CommandLine
class Grndb
def initialize(argv)
@program_path, *@arguments = argv
@succeeded = true
@database_path = nil
end
def run
command_line_parser = create_command_line_parser
options = nil
begin
options = comman... | 29.997792 | 111 | 0.525204 |
ab5bc90030036b613863148372eebcb0d11e81a1 | 3,007 | require 'fileutils'
require 'pathname'
require_relative 'AppleBackup.rb'
require_relative 'AppleNote.rb'
require_relative 'AppleNoteStore.rb'
##
# This class represents an Apple backup created by iTunes (i.e. hashed files with a Manifest.db).
# This class will abstract away figuring out how to get the right media fil... | 43.57971 | 128 | 0.736282 |
01ebbb76c06a2f2031db7005124ae811b84e3695 | 7,192 | =begin
#Mux API
#Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: ... | 29.842324 | 208 | 0.622219 |
bfecc38f7e4fac1ccd41902a34b3672ceabb1723 | 919 | require 'test_helper'
class CalendarControllerTest < ActionController::TestCase
setup do
@trip = trips(:trip_one)
@user= users(:user_one)
end
test "should get ics" do
assert_recognizes({:controller => 'calendar', :action => 'ics', "user_email"=>"*user_email", "user_token"=>"*user_token", "format"=>"... | 41.772727 | 186 | 0.68988 |
1c51afba9c0a5a88096feb554ca63bcdeaad5fdf | 464 | cask :v1 => 'google-earth' do
version :latest
sha256 :no_check
url 'https://dl.google.com/earth/client/advanced/current/GoogleEarthMac-Intel.dmg'
homepage 'https://www.google.com/earth/'
license :unknown
app 'Google Earth.app'
zap :delete => [
'~/Library/Application Support/Google Ear... | 27.294118 | 84 | 0.609914 |
ab8daa0579f6e1c697215defaed0e20850aca0a0 | 1,282 | #!/usr/bin/ruby
gem 'json'
require 'json'
require 'fileutils'
$tmp = "tmp"
if ARGV.size < 1
puts "Pass the gifspec!"
Process.exit
end
if !File.exist?(ARGV[0])
puts "File '#{ARGV[0]}' does not exist!"
Process.exit
end
# Load and parse gifspec
spec = nil
File.open(ARGV[0], "r") { |f|
spec = JSON.parse(f.r... | 18.57971 | 108 | 0.549142 |
accf540eca58aaa9116d02778ac0c0f6e11dddf4 | 6,557 | require "test_helper"
include CarrierWaveDirect::Test::Helpers
class SettingsControllerTest < ActionController::TestCase
setup do
@user = users(:ben)
end
test "should get settings" do
login_as @user
get :settings
assert_response :success
end
test "should get account" do
login_as @user
... | 28.633188 | 137 | 0.706573 |
08247c716d6a6cd60568174b9258aa8fd77f92d0 | 5,713 | # coding: utf-8
RSpec.shared_examples "hashes" do
context "hget" do
context "when the hash doesn't exist" do
it "returns nil" do
expect(
redis.hget("foo","bar")
).to eql(nil)
end
end
context "when the hash exists with a single field" do
before do
redis.... | 25.968182 | 74 | 0.479783 |
ac36462c53082a9afab9e64567c370b68b29970c | 6,576 | module Gorillib
module Model
# Represents a field for reflection
#
# @example Usage
# Gorillib::Model::Field.new(:name => 'problems', type => Integer, :doc => 'Count of problems')
#
#
class Field
include Gorillib::Model
remove_possible_method(:type)
# [Gorillib::Model... | 38.911243 | 183 | 0.612378 |
ab07461dfbcff032d880a4f33b793f014ed4f351 | 143,308 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 55.567274 | 156 | 0.552663 |
bb7242c1e15e7375fb028403371732906a0e02f2 | 266 | FactoryBot.define do
factory :api_v3_ind_context_property, class: 'Api::V3::IndContextProperty' do
association :ind, factory: :api_v3_ind
association :context, factory: :api_v3_context
tooltip_text { 'Context specific tooltip text for IND' }
end
end
| 33.25 | 79 | 0.759398 |
bb40d5438e7a788eab1966cdcb0c0c0fa8b6f781 | 1,611 | namespace :cache do
desc "Delete all cache files."
task :clean => :require do
pat = SmallCage::CacheFilter::TARGET_PATTERN
list = FileList[pat]
list.each do |path|
to = path.pathmap("%{--latest$,-*}X%x")
outfiles = FileList[to]
outfiles = SmallCage::CacheFilter.outfiles(path, outfiles... | 29.290909 | 83 | 0.624457 |
ffa20b63779cf9430e47cab8a2a6444326805d58 | 700 | # encoding: UTF-8
module TZInfo
module Definitions
module Antarctica
module Davis
include TimezoneDefinition
timezone 'Antarctica/Davis' do |tz|
tz.offset :o0, 0, 0, :zzz
tz.offset :o1, 25200, 0, :DAVT
tz.offset :o2, 18000, 0, :DAVT
... | 26.923077 | 51 | 0.56 |
f8bcadabcaab0115bee569a363a32b3d6b2ea21a | 117 | # frozen_string_literal: true
require_relative 'string_template/handler'
require_relative 'string_template/railtie'
| 23.4 | 42 | 0.863248 |
b9cfc0fa763ea80457037cb461f115468453c24d | 1,284 | require 'spec_helper'
require 'ionoscloud_backupunit_get'
Chef::Knife::IonoscloudBackupunitGet.load_deps
describe Chef::Knife::IonoscloudBackupunitGet do
before :each do
subject { Chef::Knife::IonoscloudBackupunitGet.new }
allow(subject).to receive(:puts)
allow(subject).to receive(:print)
end
desc... | 25.68 | 70 | 0.644081 |
4abde3737637d804f64d7381be807319aef808ff | 3,817 | module ExternalRelationItemsHelper
def relative_app_name
Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')
end
def app_id_to_name(app_id)
if app_id == 1
app_name = relative_app_name()
else
app_name = ExternalRelationApp.find_by_id(app_id).app_name
end
app_name
end
def app_na... | 26.506944 | 92 | 0.674614 |
4a1ed04478acb328e80a89e9769ec3a891856ecd | 5,872 | FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack activejob actionmailer actioncable railties )
root = File.expand_path('../../', __FILE__)
version = File.read("#{root}/RAILS_VERSION").strip
tag = "v#{version}"
directory "pkg"
(FRAMEWORKS + ['rails']).each do |framework|
namespac... | 33.363636 | 123 | 0.561308 |
4a8b4a20d4597880a51ec7d1a9a855d74f131b3d | 4,128 | EMAIL_ADDR = 'yurusu.aikikai@gmail.com'
DEV_EMAIL = 'twilliamsark+yurusu@gmail.com'
EMAIL_PWD = ENV['EMAIL_KEY']
SEND_EMAILS = true
VIDEOS_ONLINE = true
FILTERING = true
ALLOW_SEARCH = true
SHOW_MENU = true
SHOW_DEBUG = false
CHECK_YOUTUBE = false
SHOW_ADMIN_FIELDS = true
Aiki::Application.configure do
# Settings sp... | 38.579439 | 190 | 0.738372 |
e2e811db1bc4d9b53f7a75dafaaa1e462adaff90 | 4,137 | # frozen_string_literal: true
class AutomatedReport < ApplicationRecord
has_many :automated_report_instances, dependent: :destroy
has_many :automated_report_subscriptions, dependent: :destroy
valhammer
validates :interval, inclusion: { in: %w[monthly quarterly yearly] }
validate :target_must_be_valid_for_... | 30.873134 | 80 | 0.773266 |
91dc1fd1d36bfd0424071d16cfb7b36f6548a288 | 296 | # set locale to en_US.UTF-8 (which matches the live server) everywhere ubuntu
# packages might look for it, invcluding the current process
ENV['LANG'] = "en_US.UTF-8"
ENV['LC_ALL'] = "en_US.UTF-8"
template "/etc/default/locale" do
source "locale"
owner "root"
group "root"
mode 0644
end | 24.666667 | 77 | 0.712838 |
bb351e6755870a2693621034065bcfa3fc59a91c | 939 | ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require "authlogic/test_case"
require "webrat"
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
end
class ActionController::TestCase
include Webrat::Matchers... | 22.902439 | 75 | 0.726305 |
03e25019883a0ec6a3e1b2009c965a20f4ddc84a | 3,142 | require 'fileutils'
require "yaarg/version"
module Yaarg
# Main class
# class Yaarg
# Return help instructions.
def self.help
# TODO implement usage instruction for all modules
"============================================================================================================" +
"=====... | 45.536232 | 119 | 0.507638 |
26508203bbf3f4a55bb67032e46112c313df1982 | 214 | class AddSpreeNewslettersTable < SolidusSupport::Migration[4.2]
def change
create_table :spree_newsletters do |t|
t.string :name
t.string :email
t.timestamps null: false
end
end
end
| 19.454545 | 63 | 0.686916 |
61d31b02a2c144e07b612edd86acefb22618f76a | 85,624 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataMigration::Mgmt::V2018_03_15_preview
#
# Data Migration Client
#
class Services
include MsRestAzure
#
# Creates and initializes a new i... | 43.954825 | 160 | 0.700388 |
2831d757a8fcdf1fd5b0a2a33a253c64a3de4890 | 354 | module Sinatra
module DevopsServiceWeb
module Core
module Routing
module Key
def self.registered(app)
add = lambda do
submit { |http| http.post(host + '/v2.0/key', params) }
end
app.post '/key', &add
end
... | 16.090909 | 69 | 0.468927 |
79f5daf1784bb7cb46a3717e0e75a97eeed222f5 | 181 | require 'solidus_core'
require 'solidus_support'
require 'solidus_papertrail/version'
require 'solidus_papertrail/engine'
require 'solidus_papertrail/railtie'
require 'paper_trail'
| 25.857143 | 36 | 0.850829 |
287cdf60ffef3a87afb9c75a65d5e092fc448a73 | 104 | require_relative "./literal"
module Dentaku
module AST
class Logical < Literal
end
end
end
| 11.555556 | 28 | 0.701923 |
d5f9ad9786b9d5840f73d4764b46d1b44ef6d3d9 | 2,227 | # frozen_string_literal: true
require "rom/associations/many_to_many"
require "rom/sql/associations/core"
require "rom/sql/associations/self_ref"
module ROM
module SQL
module Associations
class ManyToMany < ROM::Associations::ManyToMany
include Associations::Core
include Associations::Self... | 25.022472 | 77 | 0.582847 |
33d24c001670334ec5f0d641f29db3090d1d88eb | 780 | require 'spec_helper'
# TODO: is there anything to test?
# describe DeviseAction::New do
# # pending "add some examples to (or delete) #{__FILE__}"
# end
# describe DeviseAction::Confirmed do
# # pending "add some examples to (or delete) #{__FILE__}"
# end
# describe DeviseAction::Login do
# # pending "add so... | 24.375 | 60 | 0.69359 |
4a5206bd0a4a32a3137c8b4ee997e78b9807aab2 | 3,893 | module Obscured
module AptWatcher
module Models
class Configuration
include Mongoid::Document
include Mongoid::Timestamps
store_in collection: 'configuration'
field :instance, type: String, :default => ''
field :setup_completed, type: Boolean, :default =>... | 34.451327 | 117 | 0.614436 |
87b22730eaf076281c09fa8a27d1944e3e8e1295 | 3,396 | require 'rubygems'
require 'tempfile'
require 'spec/expectations'
require 'fileutils'
require 'forwardable'
require 'cucumber/formatter/unicode'
class CucumberWorld
extend Forwardable
def_delegators CucumberWorld, :examples_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
def self.examples_dir(subdir=nil)
... | 24.257143 | 119 | 0.679918 |
bf961204f7bdcd8287aec8a690d1c24eb4eb9b41 | 41 | class Continent < ActiveRecord::Base
end | 13.666667 | 36 | 0.804878 |
f857468d5e444311f619afa5c4411a16d61463f8 | 60 | module Gollum
module Auth
VERSION = '0.0.1'
end
end
| 10 | 21 | 0.633333 |
e2543803c06b432461a4a01c36525d47d1d86d83 | 1,241 | require 'test_helper'
class AlbumTest < ActiveSupport::TestCase
fixtures :albums
# Replace this with your real tests.
test "the truth" do
assert true
end
test "Finds and links parent place" do
album = albums(:columbia)
album.set_places(album.title, album.description)
end
test "Find and l... | 36.5 | 74 | 0.727639 |
0390299efc54b829ceea993249e216780f92f697 | 294 | # frozen_string_literal: true
module LastbillClient
module Error
# @author ciappa_m@modulotech.fr
# 404 error sent by Lastbill server
class NotFound < Generic
def initialize(msg = "404 Not Found")
super(status: :not_found, message: msg)
end
end
end
end
| 21 | 47 | 0.676871 |
bbcc5c6ecb09b4646f9f5f2d2d76f170cbe582bd | 8,628 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
require 'spec_helper.rb'
describe 'Certificate' do
it "can fetch" do
@holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.preview.deployed_devices.fleet... | 36.871795 | 159 | 0.626796 |
e83245e33b10b32a31a87a959c01efe041487410 | 709 | # frozen_string_literal: true
module Vamoos
class PointOfInterest < Api
attr_accessor :id, :country, :country_iso, :created_at, :description, :icon, :icon_id,
:is_default_on, :latitude, :longitude, :meta, :name, :operator_id, :poi_range,
:updated_at
def initialize(params)... | 25.321429 | 96 | 0.603667 |
08e4c619feb595de073da0f7b2950c4edf54fa51 | 3,119 | require 'spec_helper'
require 'support/shared_examples/existing_headers'
require 'support/shared_examples/first_page'
require 'support/shared_examples/middle_page'
require 'support/shared_examples/last_page'
describe NumbersAPI do
describe 'GET #index' do
let(:links) { last_response.headers['Link'].split(', ') }... | 29.990385 | 86 | 0.631613 |
3315471d1e7e899768fd8cbc92a140ddbd370e9e | 12,377 | module GPX
class GPXFile < Base
attr_accessor :tracks,
:routes, :waypoints, :bounds, :lowest_point, :highest_point, :duration, :ns, :time, :name, :version, :creator, :description, :moving_duration
DEFAULT_CREATOR = "GPX RubyGem #{GPX::VERSION} -- http://dougfales.github.io/gpx/".freeze
... | 35.062323 | 180 | 0.580835 |
1aca907eabc3befc1685a17c342eed29d58c0744 | 915 | require "rails_helper"
RSpec.describe V1::ConversationsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/v1/conversations").to route_to("v1/conversations#index")
end
it "routes to #show" do
expect(:get => "/v1/conversations/1").to route_to("v1/conv... | 30.5 | 98 | 0.634973 |
e9fe18a7cea6663eee62975f684f83f55646d19a | 1,424 | require 'test_helper'
class PrinciplesControllerTest < ActionController::TestCase
setup do
@principle = principles(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:principles)
end
test "should get new" do
get :new
assert_response :succ... | 28.48 | 234 | 0.731742 |
d580f94d13afac96929fefa0b2083d965a64c6df | 30,571 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex/zip'
require 'nokogiri'
module ::Nokogiri
module XML
class Builder
#
# Some XML documents don't declare the namespace before referencing, b... | 33.410929 | 149 | 0.572111 |
6296723c0d8668292cda41f2e99400e9a1e33ca0 | 2,541 | cask 'wine-devel' do
version '5.6'
sha256 'ef09426f20a47dce654729dd1f737823776883ab61e897b8fe53c3eb5fe8680a'
url "https://dl.winehq.org/wine-builds/macosx/pool/winehq-devel-#{version}.pkg"
appcast 'https://dl.winehq.org/wine-builds/macosx/download.html'
name 'WineHQ-devel'
homepage 'https://wiki.winehq.org... | 45.375 | 104 | 0.639512 |
e2eb33eabebf1c02ab994fc6ebd65832ba52ca42 | 320 | class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
t.string :email, null: false
t.string :name
t.string :first_name
t.string :last_name
t.string :profile_image_url
t.timestamps
end
add_index :users, :email, unique: true
end
end
| 20 | 49 | 0.65625 |
6a72ffaffa1521d4cd6539701cacf74d327eef74 | 1,457 | require "test_helper"
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:kevin)
end
test "unsuccessful edit" do
log_in_as(@user)
get edit_user_path(@user)
assert_template 'users/edit'
patch user_path(@user), params: { user:
{ name: "", email: "foo... | 26.490909 | 87 | 0.664379 |
1128cbca90ea63cfe09f755af5db56f5c751d6de | 52,754 | class Logger
require 'thread'
LOG_DEPTH_INC_RESC = 1 # Depth increase of method scope for rescue
LOG_DEPTH_INC_LOOP = 2 # Depth increase of method scope for loop
def self.log_error(msg, depth=0)
_methodname = getMethodname(depth)
_message = "[#{_methodname}]:#{msg}"
$log.error... | 47.270609 | 213 | 0.44317 |
2623a9dafb063ce5a6329e223cc4979f615d95c4 | 1,204 | ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
fixtures 'gallery/galleries', 'gallery/photos'
include ActionDispatch::TestProcess
def setup
reset_config
end
# resetting default configuration
def r... | 30.871795 | 114 | 0.687708 |
f8c32c193b80d57c89676382fc62fc5945b40288 | 1,898 | require 'spec_helper'
describe "1:1 (PK subset FK)" do
before(:all) do
class ::Person
include DataMapper::Resource
extend ConstraintSupport
property :id, Serial, :key => true
property :audit_id, Integer, :key => true, :min => 0
property :name, String, :required => true
... | 28.757576 | 90 | 0.603793 |
ac94c67fa5e27372b58a56910ab0ea01948f9277 | 620 | module SpreeUserProfile
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :migrate, type: :boolean, default: true
def add_migrations
run 'bundle exec rake railties:install:migrations FROM=spree_user_profile'
end
def run_migrations
run_migrati... | 29.52381 | 125 | 0.645161 |
7974bd4e86b259c27352e810316524e5b73e8ee1 | 2,044 | require 'rubygems/test_case'
require "rubygems/text"
class TestGemText < Gem::TestCase
include Gem::Text
def test_format_text
assert_equal "text to\nwrap", format_text("text to wrap", 8)
end
def test_format_text_indent
assert_equal " text to\n wrap", format_text("text to wrap", 8, 2)
end
d... | 34.644068 | 294 | 0.744618 |
5debc08d18aaa4222f5d9ac81c1962b763b60b50 | 134 | class AddMultipleToProject < ActiveRecord::Migration
def change
add_column :projects, :multiple, :decimal, default: 1
end
end
| 22.333333 | 57 | 0.761194 |
2847e6f26608ef9f39ae62af24ec75d9327f22f4 | 4,373 | #
# PlatoDevice::XBeeWifi class
#
module PlatoDevice
class XBeeWiFi < Plato::WiFi
include Plato
CR = "\r"
TMO_RESPONSE = 2000
@@wifi = nil
@@resolv = {}
def initialize
super
@wifi = Plato::Serial.open(9600, 8, 1, 1, :none)
end
def self.open
@@wifi = self.new unless ... | 22.425641 | 84 | 0.515436 |
6a198f07333dab3ec0e22175c9adf3963c82e016 | 770 | default['chef']['user'] = 'chef'
default['chef']['group'] = 'chef'
default['chef']['home'] = '/home/chef'
default['chef']['root'] = '/var/chef-solo'
default['chef']['shell'] = '/bin/bash'
default['chef']['repo'] = "#{node['chef']['home']}/repo"
# update every 2 hours.
default['update']['minute'] = '0'
default['up... | 30.8 | 67 | 0.580519 |
e89987df7674ed53abae7294b76ca25192019ea7 | 812 | module JekyllPatternbot
class LayoutsFinder
def base
{
:name => false,
:description => false,
}
end
def info
layouts_dir = File.expand_path Config['layouts_dir']
layouts = []
return layouts unless File.directory? layouts_dir
layout_files = FileHelper.l... | 24.606061 | 68 | 0.58867 |
21bed3f89f68ab96d49f547752d84a8278d1cec6 | 4,748 | # -*- coding: utf-8 -*-
class HomeController < ApplicationController
require 'timeout'
MAIL_TYPES = {
:registration => 0,
:confirmation => 1,
:failure => 2,
:response_pending => 3
}
def index
flash[:error] = nil
flash[:notice] = nil
if user_signed_in?
@user = User.find(curren... | 32.081081 | 152 | 0.628054 |
187eb9bb1681fefd6584fcb2009723bdd636dc6a | 421 | require 'spec_helper'
describe SlackGamebot::Commands::Default do
let!(:team) { Team.first || Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team: team) }
it 'default' do
expect(message: SlackRubyBot.config.user).to respond_with_slack_message(SlackGamebot::ASCII)
end
it 'upcase' do
expect(me... | 32.384615 | 103 | 0.748219 |
5d8b8904502bc80780570ceeaa7c1e933c5c3693 | 424 | # frozen_string_literal: true
class NewMergeRequestWorker
include ApplicationWorker
include NewIssuable
def perform(merge_request_id, user_id)
return unless objects_found?(merge_request_id, user_id)
EventCreateService.new.open_mr(issuable, user)
NotificationService.new.new_merge_request(issuable, u... | 22.315789 | 61 | 0.79717 |
03a47cb050ac5b5fd6a872bc50145e3793c46935 | 6,793 | module Dynflow
class World
module Invalidation
# Invalidate another world, that left some data in the runtime,
# but it's not really running
#
# @param world [Coordinator::ClientWorld, Coordinator::ExecutorWorld] coordinator record
# left behind by the world we're trying to invalid... | 37.738889 | 122 | 0.626086 |
bb9cd4e685804da3c3e1f3839b5e86078b54223a | 1,310 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'spec_helper'
require 'json'
re... | 27.291667 | 123 | 0.755725 |
edc64dfdd2e64d565b8a3c35f77e49190898e809 | 342 | cask 'front' do
version '3.21.7'
sha256 '9089e1faf406e94bc7da27579b994d12681e9ed2ffd937c631282c7f22d72917'
url "https://dl.frontapp.com/desktop/builds/#{version}/Front-#{version}.zip"
appcast 'https://dl.frontapp.com/desktop/updates/latest/mac/latest-mac.yml'
name 'Front'
homepage 'https://frontapp.com/'
... | 28.5 | 78 | 0.745614 |
bf5c01d0db5b2fe0a532c646c68f93a86f60614b | 2,605 | # encoding: utf-8
module Epuber
class Compiler
class CompilationContext
# @return [Epuber::Book]
#
attr_reader :book
# @return [Epuber::Book::Target]
#
attr_reader :target
# @return [Epuber::Compiler::FileResolver]
#
attr_accessor :file_resolver
# T... | 23.053097 | 104 | 0.587332 |
f7d3ac8e222f517af7e067ccbe79660d4ecaeb5e | 591 | module TastesBitter
# Preview all emails at http://localhost:3000/rails/mailers/tastes_bitter_mailer
class TastesBitterMailerPreview < ActionMailer::Preview
def error_message
error_info = {
message: "A message",
file_or_page: "A file or page",
line_number: "A line number",
... | 24.625 | 82 | 0.654822 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.