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 |
|---|---|---|---|---|---|
01960b8fa7f7373860466315b126d7283e568ad3 | 1,908 | =begin
#Phone.com API
#This is a Phone.com api PhoneCom definition
OpenAPI spec version: 1.0.0
Contact: apisupport@phone.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
PhoneCom Codegen version: 2.4.4
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for PhoneComClient::Lis... | 26.5 | 102 | 0.719078 |
ffe017f5738d7398c4730acee9e0972155e2df48 | 308 | #!/usr/bin/env ruby
file_path = File.expand_path("../day-02-input.txt", __FILE__)
input = File.read(file_path)
valid = input.split("\n").select do |i|
pos1, pos2, ch, pwd = i.match(/(\d+)-(\d+)\s(\w):\s(\w+)/i).captures
( pwd[pos1.to_i-1] == ch ) ^ ( pwd[pos2.to_i-1] == ch )
end
puts valid.count
| 25.666667 | 70 | 0.597403 |
acaa12fedc7656fbb880f89cb5652761c24316b0 | 238 | require 'support/helpers/bootstrap_modal_helpers'
require 'support/helpers/session_helpers'
RSpec.configure do |config|
config.include BootstrapModalHelpers, type: :feature
config.include Features::SessionHelpers, type: :feature
end
| 29.75 | 57 | 0.823529 |
e8a8eeef0b09688b373499a5287c15a82ba3d93e | 735 | def maximum_gap(nums)
return 0 if nums.size<2||nums.max==nums.min
bucketLen=[1, (nums.max-nums.min)/nums.size].max
lowest=nums.min ## necessary!
buckets=[]
bucketMin=[]
bucketMax=[]
((nums.max-nums.min+1)/bucketLen + 1).times { buckets<<[] }
nums.each do |n|
i=(n-lowest)/bucketLen ## If not declar... | 27.222222 | 102 | 0.629932 |
ed897ff8a68a8005086c480ac66cd238387df22b | 31 | require "reflexive/application" | 31 | 31 | 0.870968 |
216c32aff32df6ae01cecb38db6905a00e481ffe | 131 | require 'test_helper'
class TechnologyCountryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16.375 | 53 | 0.725191 |
61e19b043bf2d81fc94cb2c739ec6a700b45ad10 | 980 | cask "plistedit-pro" do
version "1.9.2"
sha256 "5db33711689cc911a33af8f5140e27436df392e13f0fece3de0ba11ac4e0f839"
url "https://www.fatcatsoftware.com/plisteditpro/PlistEditPro.zip"
appcast "https://www.fatcatsoftware.com/plisteditpro/plisteditpro_appcast.xml"
name "PlistEdit Pro"
homepage "https://www.fatc... | 39.2 | 147 | 0.771429 |
e20352684b271f6553435e6d109513113805e6f0 | 886 | Pod::Spec.new do |s|
s.name = 'CDYelpFusionKit'
s.version = '3.0.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'An extensive Swift wrapper for the Yelp Fusion API.'
s.description = <<-DESC
This Swift wrapper covers all possible network endpoints and responses for the Yelp Fusion API.
... | 35.44 | 100 | 0.656885 |
62ed4d53bb75acdacbb1bdc9ebf9719dd636777a | 308 | class AddPrimaryLocaleToEditions < ActiveRecord::Migration
def up
add_column :editions, :primary_locale, :string, default: "en", null: false
Edition.reset_column_information
Edition.update_all("primary_locale = locale")
end
def down
remove_column :editions, :primary_locale
end
end
| 23.692308 | 78 | 0.753247 |
28bf5b7fa9d69e791fcec7c408c74863bf25358d | 2,771 | require 'test_helper'
class CollectionPointTest < ActiveSupport::TestCase
# tests for validation
test "should not create new local without name" do
local = CollectionPoint.new
local.state = "State"
local.city = "City"
local.address = "Address"
assert_not local.save, "Tried to save local witho... | 36.460526 | 84 | 0.712378 |
33b57e82b7c8ce833cc6c479a52f1630df4044a5 | 10,677 | class AppPerfAgentWorker < ActiveJob::Base
queue_as :app_perf
attr_accessor :license_key,
:name,
:host,
:hostname,
:data,
:user,
:application,
:protocol_version
def perform(params, body)
#AppPerfR... | 30.681034 | 119 | 0.621523 |
ff12b8f0a442490edecf4e650cb1c1a93b66c402 | 2,823 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2015-2016 the original author or authors.
#
# 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/... | 33.607143 | 109 | 0.691817 |
87dffa1bd026a759c7bbd8771f94a1d231be6c6a | 115 | class ChangeUsersToPlayers < ActiveRecord::Migration[5.2]
def change
rename_table :users, :players
end
end
| 19.166667 | 57 | 0.756522 |
ac728443964aed850ebb80da00de003c805934f7 | 2,572 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../dummy/config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
r... | 47.62963 | 86 | 0.747278 |
f82283397338ff62311641c2df35871317f08f60 | 2,353 | require 'spec_helper'
describe 'collectd::plugin::filter::target', type: :define do
let :facts do
{
osfamily: 'Debian',
concat_basedir: tmpfilename('collectd-filter'),
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_v... | 37.951613 | 105 | 0.658309 |
114e2adfd508b897d2f204add676b32b4010972e | 2,153 | class HelmAT2 < Formula
desc "Kubernetes package manager"
homepage "https://helm.sh/"
url "https://github.com/helm/helm.git",
tag: "v2.17.0",
revision: "a690bad98af45b015bd3da1a41f6218b1a451dbe"
license "Apache-2.0"
bottle do
cellar :any_skip_relocation
sha256 "432e81bffefbb026bd5005... | 34.174603 | 117 | 0.704598 |
ffb27e252abcd991a06e96c5006798e74e98da6d | 523 | # HTMLページを作成します。
class Page
require 'erb'
require 'fileutils'
# インデックスページを作成します。
def self.create_index(output_path, price, programs)
# ERBファイルを読み込む
erb = ERB.new(File.read(File.expand_path("../../template/index.html.erb", __FILE__)))
File.write("#{output_path}/index.html", erb.result(binding))
... | 27.526316 | 116 | 0.692161 |
399ef3765aa854c9f8b848591d7935869675cb46 | 1,496 | require File.expand_path("../base", __FILE__)
require "acceptance/support/matchers/have_color"
describe "vagrant and color output" do
include_context "acceptance"
# This is a check to see if the `expect` program is installed on this
# computer. Some tests require this and if this doesn't exist then the
# test... | 31.166667 | 94 | 0.696524 |
1ccc569eba51bc41bd0242f6b04d8f582eb72d03 | 1,147 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rspec/its/version'
Gem::Specification.new do |spec|
spec.name = "rspec-its"
spec.version = RSpec::Its::VERSION
spec.authors = ["Peter Alfvin"]
spec.email = ["... | 39.551724 | 76 | 0.655623 |
01473a7ba85908e3d103239a62353d5242b2b7c1 | 543 | require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start { add_filter "/spec/" }
require "lita-doubler"
require "lit... | 36.2 | 93 | 0.697974 |
91d1c0b85079a25833904ebd5c0d4290e3c0199a | 4,101 | # encoding: utf-8
module DateAndTimeFormatting
def self.included(base)
base.class_eval do
include DateAndTimeFormatting::InstanceMethods
include OrdinalizedFormatting
extend DateAndTimeFormatting::ClassMethods
end
end
module InstanceMethods
# Formats a date/time instance using a... | 25.792453 | 88 | 0.582297 |
ed9a227d7c344163139f18e34bc8a1d086eb49e7 | 790 | require 'kubeclient'
describe NOVAHawk::Providers::Kubernetes::ContainerManager::RefresherMixin do
let(:client) { double("client") }
let(:dummy) { (Class.new { include NOVAHawk::Providers::Kubernetes::ContainerManager::RefresherMixin }).new }
context 'when an exception is thrown' do
before { allow(client).... | 34.347826 | 111 | 0.656962 |
bb6ee4b63b39b5fbc5acabbef260a03afbd992ae | 117 | class AddSshLoginToUsers < ActiveRecord::Migration
def change
add_column :users, :ssh_login, :string
end
end
| 19.5 | 50 | 0.760684 |
1c27d817fc4b83e34f6d80fe2035384fec3fe216 | 1,113 | require 'optparse'
require "vagrant"
require Vagrant.source_root.join("plugins/commands/up/start_mixins")
module VagrantPlugins
module CommandReload
class Command < Vagrant.plugin("2", :command)
# We assume that the `up` plugin exists and that we'll have access
# to this.
include VagrantPlugi... | 24.195652 | 72 | 0.625337 |
33e6a0911b46442be8eb5de9adfecbb6a8ee19c1 | 1,463 | module Spree
module Marketing
class List
class FavourableProducts < Spree::Marketing::List
include Spree::Marketing::ActsAsMultiList
# Constants
NAME_TEXT = 'Most Selling Products'
ENTITY_KEY = 'entity_id'
ENTITY_TYPE = 'Spree::Product'
TIME_FRAME = 1.month
... | 36.575 | 99 | 0.574163 |
1c9291e384384cc997c7634ccdb2e19f0db6dc7e | 5,617 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 39.27972 | 126 | 0.716753 |
874d866cff13e7f246bbc3321130147567e18069 | 485 | class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
flash[:notice] = "You've successfully signed up!"
session[:user_id] = @user.id
redirect_to "/"
else
flash[:alert] = "There was a problem signi... | 20.208333 | 75 | 0.649485 |
d5cb85896ee7b4464a16bb14543c46b18943010f | 7,325 | require File.expand_path("spec_helper", File.dirname(__FILE__))
describe RandomWord, "enumerator" do
subject {RandomWord.enumerator(["aaa", "bbb", "ccc"])}
it "can get you the next word in its list" do
expect(subject.next).to be_one_of(["aaa", "bbb", "ccc"])
end
it "raises error when it runs out of word... | 28.173077 | 112 | 0.668942 |
f7b3758b376f3a60295b02ea993d11c2f48eb3c1 | 5,015 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 44.380531 | 114 | 0.762512 |
d500329c8e15d2f8c8bd62b1dd4b0742635f8cc9 | 101 | class Review < ApplicationRecord
belongs_to :reviewer, class_name: 'User'
belongs_to :talk
end
| 14.428571 | 42 | 0.762376 |
337a1e169fed070e0f128b2f6c2abcbe0ca7395b | 1,595 | module Xcodeproj
class Command
class ProjectDiff < Command
def self.banner
%{Shows the difference between two projects:
$ project-diff PROJECT_1 PROJECT_2
It shows the difference in a UUID agnostic fashion.
To reduce the noise (and to simplify implementation) differences in the
orde... | 28.482143 | 113 | 0.627586 |
1d0ebc9cdddb0ffd0d7ba37da0082ddaa59bf85e | 2,689 | require "test_helper"
module AppUp
module Hooks
class DummyShell
attr_reader :history
def initialize
@history = {
enqueue: [],
notify: [],
}
end
def enqueue(*args)
history[:enqueue] << args
end
def notify(*args)
history[:n... | 34.474359 | 152 | 0.600595 |
6a9e1e33fe5f16a944fff2cb9612299c9b3be43b | 882 | require 'spec_helper'
describe 'HSS script' do
before :all do
ENV['HSS_CONFIG'] = './spec/test/config.yml'
end
it 'prints the version' do
expect(`hss version`.strip).to match(/\d+\.\d+\.\d+/)
end
it 'prints a list of examples' do
expect(`hss`.split("\n").first).to eql 'How to use:'
end
it 's... | 27.5625 | 73 | 0.639456 |
bf9ec39a3ede758ab4a74b04b506295064e35fb3 | 3,369 | # -*- coding: binary -*-
# Copyright (c) 2010, patrickHVE@googlemail.com
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# ... | 60.160714 | 113 | 0.78688 |
edeafe259dba50a51f5dc5779483c31e7bfd99c1 | 2,750 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe UpdateDailyEmailActiveUserRollups, type: :model, freeze_time: true do
before do
# Because EmailActiveUserRollup are not in primary db they are not rolled
# back; so we do it manually here instead.
EmailActiveUserRollup.destroy_all
en... | 25.943396 | 84 | 0.618545 |
ab548ae972abd77f124deaed40aacfcad84d4e48 | 586 | require 'spec_helper'
describe Ducktrap::Node::Key::Evaluator, '#output' do
subject { object.key }
let(:object) { class_under_test.new(context, input) }
let(:class_under_test) do
Class.new(described_class) do
public :key
end
end
let(:key) { double('Key') }
let(:value) { double('Valu... | 21.703704 | 71 | 0.627986 |
d5a356246b9165e1131a9a42d84a784388fe64ca | 8,824 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Delorean" do
let(:engine) {
Delorean::Engine.new("ZZZ")
}
it "should handle MAX as a node name" do
engine.parse defn("MAX:",
" a = [1, 2, 3, 0, -10].max()",
)
r = engine.evalu... | 30.745645 | 99 | 0.3784 |
ffb084d6a238376067b62661abbd1159a553307e | 40 | module Sedatabi
VERSION = "1.0.0"
end
| 10 | 19 | 0.675 |
e8aadc3faf6fa0154045f5aed538171e324c02b8 | 64 | module Material
module Jekyll
VERSION = "0.1.0"
end
end
| 10.666667 | 21 | 0.65625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.