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 |
|---|---|---|---|---|---|
6a10a8b57d13bc5d6958644103669288edccf3ff | 2,731 | require "redis/connection/command_helper"
require "redis/connection/registry"
require "em-synchrony"
require "hiredis/reader"
class Redis
module Connection
class RedisClient < EventMachine::Connection
include EventMachine::Deferrable
def post_init
@req = nil
@connected = false
... | 21.007692 | 75 | 0.572318 |
613d177251626c4e00881d52de48e3e8fd4e7f02 | 482 | module ClippyBot
class Mailer
def self.send(from:, subject:, to:, body:)
from_email = SendGrid::Email.new(email: from)
to_email = SendGrid::Email.new(email: to)
content = SendGrid::Content.new(type: 'text/plain', value: body)
email = SendGrid::Mail.new(from_email, subject, to_email, conte... | 34.428571 | 72 | 0.678423 |
6147b01600ad528f27f877b2edcd60c1837c8a61 | 814 | module Spree
class AssembliesPart < ActiveRecord::Base
belongs_to :assembly, class_name: "Spree::Variant",
foreign_key: "assembly_id",
touch: true
belongs_to :part, class_name: "Spree::Variant", foreign_key: "part_id"
delegate :name, :sku, to: :part
... | 23.941176 | 74 | 0.654791 |
ab10641956ea6c1d7ea2593cc3f77b791168eab0 | 126 | newparam(:bridge_name) do
include EasyType
include EasyType::Validators::Name
isnamevar
desc 'The bridge name'
end
| 12.6 | 36 | 0.746032 |
21548852bd9fa44440d8d6b1828a956c26b17e8e | 658 | version = File.read(File.expand_path('../../VERSION', __FILE__)).strip
Gem::Specification.new do |spec|
spec.name = 'aws-sdk'
spec.version = version
spec.summary = 'AWS SDK for Ruby'
spec.description = 'The official AWS SDK for Ruby. Provides both resource oriented interfaces and API cl... | 32.9 | 132 | 0.645897 |
3970789ce88cef32fd9a6a485b8410c9c5b6365d | 2,287 | require 'spec_helper'
require 'taketo/constructs'
include Taketo
describe "BaseConstruct" do
class TestBaseConstruct < Constructs::BaseConstruct; end
subject(:construct) { TestBaseConstruct.new(:my_node) }
specify "#node_type returns demodulized snake-cased class name" do
construct.node_type.should == :te... | 27.22619 | 82 | 0.721906 |
080d0e51cd59e9c2f31b1ab0d7cb60274961b2c7 | 813 |
Pod::Spec.new do |s|
s.name = "KCUserKit"
s.version = "0.1.5"
s.summary = "A short description of KCUserKit."
s.license = 'MIT'
s.author = { "Emil Wojtaszek" => "emil@appunite.com" }
s.source = { :git => "git@git.appunite.com:newmedia/kingschat-use... | 35.347826 | 113 | 0.581796 |
e8c66014ea448707af6de5a1c59dae5ea9740a79 | 2,122 | # == Schema Information
#
# Table name: follower_relationships
#
# id :integer not null, primary key
# person_id :string(255) not null
# follower_id :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_follower_... | 32.646154 | 92 | 0.732328 |
bbca08310f389a618c72e912d5019532b3ef5d85 | 40 | module Geocoder
VERSION = "1.7.0"
end
| 10 | 19 | 0.675 |
5dd7ba32905c535072d4cf6ba89b9fedb3620d62 | 26 | require 'advanced_search'
| 13 | 25 | 0.846154 |
b934713e4687d7e4ffce780e28a69026fe221065 | 29,510 | require "bio-ucsc"
describe "Bio::Ucsc::MonDom5" do
before(:all) do
Bio::Ucsc::MonDom5::DBConnection.connect
end
describe "Bio::Ucsc::MonDom5::All_est" do
context ".first" do
it 'returns the first records' do
result = Bio::Ucsc::MonDom5::All_est.first
pp result
result.shou... | 23.99187 | 65 | 0.61003 |
bb4a2cbe73a3011ed98a12f85472667843b0e990 | 456 | cask 'eclipse-cpp' do
version '4.5.1'
sha256 'd485444edbd6761da697dd55e974f8a45691f6bce515880eeb4216ea5ef6cbb5'
url 'https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/mars/1/eclipse-cpp-mars-1-macosx-cocoa-x86_64.tar.gz&r=1'
name 'Eclipse IDE for C/C++ Developers'
homepage... | 30.4 | 150 | 0.741228 |
e92e0c0b6fec0c0838836d7b0eddc777235a611f | 6,846 | require 'spec_helper'
describe "Steps API", type: :request do
before(:each) do
admin_user = create_admin_user
post '/login', { email: admin_user.email, password: admin_user.password }
@experiment = create_experiment_with_one_stage("test")
@stage = @experiment.experiment_definition.protocol.s... | 37.005405 | 134 | 0.654835 |
bf2581af5ec3aa16f7df615f2e9aecaa36d78f0a | 656 | # Representación del estado del juego
module Model
module Direction
UP = :up
RIGHT = :right
DOWN = :down
LEFT = :left
end
class Coord < Struct.new(:row, :col)
end
class Food < Coord
end
class Snake < Struct.new(:positions)
end
class Grid < Struct.new(:rows, :cols)
end
class S... | 16.820513 | 81 | 0.588415 |
1a5d77bfd4d3eb16288a702e24845e8adc3a7b36 | 369 | # Load all of the core implementation required to use state_machine. This
# includes:
# * StateMachine::MacroMethods which adds the state_machine DSL to your class
# * A set of initializers for setting state_machine defaults based on the current
# running environment (such as within Rails)
require 'state_machine/mac... | 46.125 | 81 | 0.804878 |
380984c283e5cace3f77e72b63c475df4f493bec | 1,354 | # frozen_string_literal: true
module QA
module Page
module Group
class Menu < Page::Base
include SubMenus::Common
view 'app/views/layouts/nav/sidebar/_group.html.haml' do
element :group_settings_item
element :group_members_item
element :general_settings_link
... | 25.54717 | 74 | 0.6226 |
082857ace4b654eb07fe465246b4a0284f9f9151 | 676 | module SynapseContent
class CustomField < ApplicationRecord
include Tokenable
# audited associated_with: :publishable
self.table_name = "synapse_custom_fields"
belongs_to :publishable, polymorphic: true, touch: true
has_one_attached :image
validates :publishable, presence: true
validat... | 21.125 | 59 | 0.683432 |
5d5651018863c69a1eb069e9f496c6d4477a97c0 | 1,470 | require File.join(__FILE__, '../../base')
module Alchemy
module Generators
class ElementsGenerator < Base
desc "This generator generates your elements view partials."
source_root File.expand_path('templates', File.dirname(__FILE__))
def create_directory
@elements_dir = "#{Rails.root}/a... | 38.684211 | 132 | 0.630612 |
9125eed55335c83cf96ecaac80abfb55af923345 | 5,319 | =begin
#UltraCart Rest API V2
#UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.15-SNAPSHOT
=end
require 'date'
module UltracartClient
class ItemKitDefinition
# Components
... | 28.292553 | 107 | 0.619289 |
79cd068f821613228cd41540da0036a015cc772f | 1,886 | module Gobstones::BatchParser
class << self
def parse(request)
test = parse_test(request)
options = parse_options(test).merge(parse_settings(request))
examples = parse_examples test, options
Gobstones::Batch.new request.content, examples, request.extra, options
end
private
... | 25.486486 | 90 | 0.615058 |
e8edb26dbbb17a2ab1fd338e6c83b0c18d8ffb26 | 960 | cask "sensei" do
version "1.2.10,60"
sha256 "ebc7b3ddcfd49478128d5d135e8ec7998dbbbd6e8c8c6b6c57d8da30eab967d8"
# cindori.s3.amazonaws.com/ was verified as official when first introduced to the cask
url "https://cindori.s3.amazonaws.com/Sensei.dmg"
appcast "https://api.appcenter.ms/v0.1/public/sparkle/apps/51... | 34.285714 | 98 | 0.733333 |
0137e18b9de72199d61d869a219d8855d383d129 | 263 | module SafeRedirection
module Resolvers
class Resolver
attr_accessor :resolver
def initialize(resolver = nil)
@resolver = resolver
end
def recognize_path(*args)
raise NotImplementedError
end
end
end
end
| 16.4375 | 36 | 0.646388 |
f843048830f50f09840699477a5f68f0e53ad4d3 | 978 | default[:drbd][:remote_host] = nil
default[:drbd][:disk] = nil
default[:drbd][:mount] = nil
default[:drbd][:fs_type] = "ext3"
default[:drbd][:dev] = "/dev/drbd0"
default[:drbd][:master] = false
default[:drbd][:port] = 7789
default[:drbd][:configured] = false
default[:drbd][:pacemaker][:agent] = "ocf:linbit:drbd"
defau... | 42.521739 | 68 | 0.662577 |
ac58b67a7ca761b4a91c2c612e5a1c476674a6f7 | 1,815 | class Since < Formula
desc "Stateful tail: show changes to files since last check"
homepage "http://welz.org.za/projects/since"
url "http://welz.org.za/projects/since/since-1.1.tar.gz"
sha256 "739b7f161f8a045c1dff184e0fc319417c5e2deb3c7339d323d4065f7a3d0f45"
license "GPL-3.0"
livecheck do
url :homepage... | 45.375 | 139 | 0.769146 |
4a2e70f0dfc3d556957033165217278a25cd5c52 | 184 | require "aws_cred_vault/version"
require 'aws_cred_vault/account'
require 'aws_cred_vault/bastion'
require 'aws_cred_vault/user'
require 'aws_cred_vault/toml'
module AwsCredVault
end
| 20.444444 | 32 | 0.842391 |
395ef8c384c7fa8416fafbd28a38c57fd79a67bc | 559 | module Refinery
module Events
class Engine < Rails::Engine
extend Refinery::Engine
isolate_namespace Refinery::Events
engine_name :refinery_events
before_inclusion do
Refinery::Plugin.register do |plugin|
plugin.name = "events"
plugin.url = proc { Refinery::Co... | 23.291667 | 98 | 0.645796 |
1cecd0f2ef271b5acd9228c59d2105915a25a1e9 | 14,978 |
#
# A class for creating and manipulating RGB color hashes by name or index.
#
# A default color set is defined in the class, other sets are from included modules.
# The first two keys of a color set hash are the palette name and count, and are
# followed by the color names and RGB array values, for example:
# ... | 35.918465 | 92 | 0.569435 |
1d284e3e26e32d32fab40f2f4cceadb81b625322 | 15,512 | require 'spec_helper'
describe Mongo::Collection::View::Writable do
let(:selector) do
{}
end
let(:options) do
{}
end
let(:view) do
Mongo::Collection::View.new(authorized_collection, selector, options)
end
after do
authorized_collection.delete_many
end
describe '#find_one_and_dele... | 22.811765 | 102 | 0.579229 |
3869c036f3cf36d035765ae06b7b009329b94873 | 1,473 | require 'logger'
require 'json'
require 'csv'
require './page_saver.rb'
require './config_loader.rb'
############## Initialize
conf = ConfigLoader.load('tennis.conf')
JSON_OUTDIR = conf::JSON_OUT_DIR || 'file/json'
CSV_OUTDIR = conf::CSV_OUT_DIR || 'file/csv'
logdir = conf::LOG_DIR || 'log'
#$log = Logger.new("#{logdi... | 32.021739 | 76 | 0.623897 |
013bd4d25ef17a70aae330962ec9f28c8f926dc0 | 219 | class CreateFrequentlyAskedQuestions < ActiveRecord::Migration[5.2]
def change
create_table :frequently_asked_questions do |t|
t.string :question
t.string :answer
t.timestamps
end
end
end
| 19.909091 | 67 | 0.712329 |
bf237e04c14ceb3ce0226a51a9251aaed6453baf | 16,239 | # == Schema Information
#
# Table name: external_users
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# supplier_number :string
# uuid :uuid
# vat_registered :boolean default(TRUE)
# provider_id :integer
# roles ... | 31.716797 | 160 | 0.650533 |
e81548de5abcdfcf1383f3c432f6401e1f80d42c | 211 | # frozen_string_literal: true
class Datadog::MonitorsController < ApplicationController
def index
@stage = Stage.find(params.fetch(:id))
render "samson_datadog/_monitor_list", layout: false
end
end
| 23.444444 | 57 | 0.763033 |
1acf5d5b7b3040b8f5946bb17badf4898cfdada6 | 480 | class Rack::Tracker::FacebookPixel < Rack::Tracker::Handler
self.position = :body
class Event < OpenStruct
def write
options.present? ? type_to_json << options_to_json : type_to_json
end
private
def type_to_json
type.to_json
end
def options_to_json
", #{options.to_json}... | 15 | 71 | 0.629167 |
79f0e155a7aabd0ed78dd8213d0a4b958df7c8e5 | 2,826 | require File.expand_path("../base.rb", __FILE__)
def local_build?
File.exist?(ext_path("appsignal-agent")) &&
File.exist?(ext_path("libappsignal.a")) &&
File.exist?(ext_path("appsignal.h"))
end
def install
library_type = "static"
report["language"]["implementation"] = "ruby"
report["build"]["library_t... | 31.752809 | 87 | 0.731776 |
d548555d3ba82a4ef608e470292ad195d0b19f9a | 1,071 | Gem::Specification.new do |s|
s.name = 'user_trackers'
s.version = '0.0.14'
s.date = '2019-11-20'
s.summary = "Gem for tracking user's activity on a rails app using mixpanel, intercom, slack and database"
s.description = "Gem for tracking user's activity on a rails app using mixpanel, in... | 46.565217 | 112 | 0.631186 |
e9693cfa95cf24868b2c55d4ef0db969b41cf13f | 460 | module StripWhitespace
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def strip_whitespace!(*fields)
before_validation do |record|
fields.each do |field|
setter = "#{field}=".to_sym
value = record.send(field.to_sym)
if value.respond_t... | 24.210526 | 69 | 0.617391 |
f79045a18d59981c430cff9d2a7c9d11d9bbb961 | 4,806 | class GoodsNomenclature < Sequel::Model
extend ActiveModel::Naming
set_dataset order(Sequel.asc(:goods_nomenclatures__goods_nomenclature_item_id))
set_primary_key [:goods_nomenclature_sid]
plugin :time_machine, period_start_column: Sequel.qualify(:goods_nomenclatures, :validity_start_date),
... | 37.255814 | 145 | 0.660633 |
913f2adce38378cdde11ccca75740ead73e2a549 | 896 | class Xsp < Formula
desc "Mono's ASP.NET hosting server"
homepage "https://github.com/mono/xsp"
url "https://github.com/mono/xsp/archive/3.0.11.tar.gz"
sha256 "290e302a03396c5cff7eb53dae008e9f79dd00aca15ad1e62865907220483baa"
bottle do
cellar :any
sha256 "3be0887c819a5823d226b26142b99fc9ceeab6e58a6c1... | 29.866667 | 95 | 0.715402 |
393273d02321da07c1f8587a888ebea91e3fd94b | 925 | Rails.application.routes.draw do
get 'password_resets/new'
get 'password_resets/edit'
get 'sessions/new'
resources :users do
member do
get :following, :followers
end
end
resources :account_activations, only: [:edit]
resources :password_resets, only: [:new, :create, :edit, :update]
resou... | 26.428571 | 101 | 0.683243 |
79d5bf4cf06cc892927234ae43c395978daae4be | 11,321 | require 'spec_helper'
describe "Internal Project Access", feature: true do
include AccessMatchers
let(:project) { create(:project, :internal) }
let(:owner) { project.owner }
let(:master) { create(:user) }
let(:developer) { create(:user) }
let(:reporter) { create(:user) }
let(:guest) { crea... | 38.770548 | 113 | 0.722904 |
91d7284338b8a4c22ecd9e9d0d8b5697c022a739 | 594 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX - License - Identifier: Apache - 2.0
require_relative '../sns-ruby-example-create-subscription'
describe '#subscription_created?' do
let(:sns_client) { Aws::SNS::Client.new(stub_responses: true) }
let(:endpoint) { 'example@server.com' }
... | 34.941176 | 72 | 0.747475 |
61e981a5b19c9986ac78f99b370acc0afe45983e | 968 | # Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is d... | 30.25 | 80 | 0.73657 |
018bc025ffa5eee9b0bff42cf273c7ac083f52b3 | 20,052 | # frozen_string_literal: true
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/hash/keys"
require_relative "asset_url_helper"
require_relative "tag_helper"
module ActionView
# = Action View Asset Tag Helpers
module Helpers #:nodoc:
# This module provides methods for gen... | 50.004988 | 156 | 0.610912 |
3953a3a9cf781acdcbd5d248854d3a50f8847288 | 41 | module Dijkstrar
VERSION = "0.1.0"
end
| 10.25 | 19 | 0.682927 |
bfdc69455ba4ff551c848d98a819a1affb5473c6 | 1,527 | require 'chronicle/etl'
module Chronicle
module Shell
class ShellHistoryTransformer < Chronicle::ETL::Transformer
register_connector do |r|
r.provider = 'shell'
r.description = 'a shell command'
r.identifier = 'shell-history'
end
def transform
@command = @extra... | 25.032787 | 71 | 0.600524 |
f81352fa9e418d321f511ec536c07d7cfd147575 | 10,940 | # frozen_string_literal: true
require_relative '../support/test_case'
require_relative '../support/fixture_config'
require 'jekyll/minibundle/asset_file_registry'
module Jekyll::Minibundle::Test
class AssetFileRegistryTest < TestCase
include FixtureConfig
def setup
AssetFileRegistry.clear_all
end... | 45.966387 | 185 | 0.715631 |
5d59f935224c56eced28aef95949b270fce84d8c | 526 | ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
parallelize_setup do |i|
ActiveStorage::Blob.service.instance_variable_set(:@root, "#{Active... | 29.222222 | 105 | 0.745247 |
91ceaf8970f00dff993133476752fdd412da4aaf | 13,977 | require File.dirname(__FILE__) + '/abstract_unit'
class TestActsAsTaggable < Test::Unit::TestCase
fixtures :tags, :taggings, :posts, :users, :photos, :subscriptions, :magazines, :tags_transitive_hierarchy
def test_find_related_tags_with
assert_equivalent [tags(:good), tags(:bad), tags(:question)], Post.find_r... | 38.293151 | 186 | 0.716892 |
38401199fdf18ba51807ba00bfd3ff6adb476542 | 314 | module CurationConcerns
module NestedWorks
extend ActiveSupport::Concern
included do
class_attribute :valid_child_concerns
self.valid_child_concerns = CurationConcerns::ClassifyConcern.new.all_curation_concern_classes
end
def in_works_ids
in_works.map(&:id)
end
end
end
| 20.933333 | 100 | 0.751592 |
1ce522e87dbe079950a1b776f2eb24e7aa0315f0 | 2,186 | # frozen_string_literal: true
require 'tempfile'
module Geo
class ContainerRepositorySync
include Gitlab::Utils::StrongMemoize
attr_reader :name, :container_repository
def initialize(container_repository)
@container_repository = container_repository
@name = container_repository.path
en... | 23.010526 | 87 | 0.651876 |
338835f6d93e5b140f9a0fb8e4663820365efc11 | 2,032 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Hash.[]" do
it "creates a Hash; values can be provided as the argument list" do
hash_class[:a, 1, :b, 2].should == new_hash(:a => 1, :b => 2)
hash_class[].should == new_hash
hash... | 38.339623 | 112 | 0.60187 |
ed35202b25015b4af759c94494861cbced625f9d | 2,530 | require 'test_helper'
class CampaignFlowTest < ActionDispatch::IntegrationTest
test "can see the list of campaigns" do
get admin_organization_url(organizations(:one))
assert_select "h3", "Campaigns"
end
test "can create a campaign" do
get new_admin_organization_campaign_url(organizations(:one))
... | 40.806452 | 179 | 0.719368 |
ab37808e5f84217d2d38f1466140b1246e505e7d | 98 | class Setting < Settingslogic
source "#{Rails.root}/config/config.yml"
namespace Rails.env
end | 24.5 | 42 | 0.765306 |
1a4851a1071c803edaff470fe085f4d5ae64e8bb | 144 | class Bootstrap::DropdownDividersController < Bootstrap::BaseBootstrapController
def index
redirect_to bootstrap_dropdowns_path
end
end
| 24 | 80 | 0.840278 |
08b8a009e7cf4ab585ae7ceb0644983d26da962f | 822 | require_relative "../canvas_base_mutation"
module LMSGraphQL
module Mutations
module Canvas
class SelectProvisionalGrade < BaseMutation
argument :course_id, ID, required: true
argument :assignment_id, ID, required: true
argument :provisional_grade_id, ID, required: true
... | 29.357143 | 70 | 0.607056 |
b9a1f4e5f413c95529f14138fbe4468260c82e5a | 2,304 | # frozen_string_literal: true
require_relative '../buy_sell_par_shares'
require_relative 'sell_company'
require_relative 'choose_power'
module Engine
module Step
module G18ZOO
class BuySellParShares < BuySellParShares
include SellCompany
include ChoosePower
def actions(entity)
... | 29.538462 | 77 | 0.605469 |
38b54bdc44068c82c778175581e68136dac9d7d4 | 16,122 | # frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems'
class TestGemRequire < Gem::TestCase
class Latch
def initialize(count = 1)
@count = count
@lock = Monitor.new
@cv = @lock.new_cond
end
def release
@lock.synchronize do
@count -= 1 if @coun... | 30.476371 | 117 | 0.644213 |
33e6a4b7f04294d53a23949c29272ac0bc04ce56 | 959 | # 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... | 41.695652 | 86 | 0.766423 |
d57367e931ec798df8156b96f5e101a026f742a7 | 766 | require 'spec_helper'
describe Explore::ProjectsController do
describe 'GET #trending' do
context 'sorting by update date' do
let(:project1) { create(:project, :public, updated_at: 3.days.ago) }
let(:project2) { create(:project, :public, updated_at: 1.day.ago) }
before do
create(:trend... | 27.357143 | 74 | 0.639687 |
bbd99676c35955582339d80fd03013da365912e0 | 2,048 | # frozen_string_literal: true
require "active_model/validations/clusivity"
module ActiveModel
module Validations
class InclusionValidator < EachValidator # :nodoc:
include Clusivity
def validate_each(record, attribute, value)
unless include?(record, value)
record.errors.add(attrib... | 42.666667 | 124 | 0.656738 |
3893e1d0df85aacd41ce57e88890fea50ab86474 | 249 |
module EbayTrading # :nodoc:
module Responses # :nodoc:
# == Attributes
class SellerReverseDispute < Abstract
include XML::Mapping
include Initializer
root_element_name 'SellerReverseDisputeResponse'
end
end
end
| 17.785714 | 54 | 0.698795 |
7aa5b9b97434bf0ea72b19dd295e6683754439ba | 41 | # typed: true
begin; 1; 2; else; 3; end
| 10.25 | 25 | 0.585366 |
286cf7c6bcfb171715f4a75c814eafa3b1bfba99 | 103 | puts '--Lista de Compras--'
file = File.open('shopping-list.txt')
file.each do |line|
puts line
end | 14.714286 | 37 | 0.679612 |
330b9690c750b8bf75440134a115fb6a5cc3fd8d | 550 | require File.dirname(__FILE__) + '/spec_helper'
describe "Benchmarking", :type => :formatter do
version = RedCloth::VERSION.is_a?(Module) ? RedCloth::VERSION::STRING : RedCloth::VERSION
platform = RedCloth.const_defined?(:EXTENSION_LANGUAGE) ? RedCloth::EXTENSION_LANGUAGE : (version < "4.0.0" ? "ruby-regex" : "C")... | 36.666667 | 131 | 0.669091 |
bf1d077cfcfc92142113bf5b8bc5dd4665188337 | 3,158 | # frozen_string_literal: true
module ActiveRecord
module Associations
class Preloader
class Branch #:nodoc:
attr_reader :association, :children, :parent
attr_reader :scope, :associate_by_default
attr_writer :preloaded_records
def initialize(association:, children:, parent:,... | 30.07619 | 115 | 0.582964 |
62b760264881133fe8a715420df80563ef72b143 | 904 | module Omx
class Player
include KeyboardShortcuts
PIPE = '/tmp/omxpipe'
def initialize
mkfifo
end
def open(opts={})
opts = default_options.merge(opts)
system unix_command_with(opts)
start
end
private
def unix_command_with(opts)
['omxplayer'].tap d... | 19.652174 | 57 | 0.514381 |
6a203c80df57f4c5665f31d3e9f4302dd9957079 | 1,094 | #-- copyright
# ReportingEngine
#
# Copyright (C) 2010 - 2014 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT AN... | 28.789474 | 113 | 0.723035 |
ff489147bfadbe00c9ce7a10e34c39737ca5c48d | 287 | class Mobile::CandidaciesController < Mobile::ApplicationController
before_filter :set_election
def create
@candidacies = Candidacy.find params[:candidacies]
redirect_to tags_path @election.namespace, @candidacies.collect { |c| c.namespace }.join(',')
end
end | 26.090909 | 97 | 0.731707 |
0357757c8685f5e9f35b7832561a3f527792ba10 | 727 | # frozen_string_literal: true
require "rails/generators/erb"
require "rails/generators/abstract_generator"
module Erb
module Generators
class ComponentGenerator < Base
include ViewComponent::AbstractGenerator
source_root File.expand_path("templates", __dir__)
class_option :sidecar, type: :boo... | 21.382353 | 60 | 0.662999 |
876b922c10ca94486039138296a317b17db7efd0 | 757 | require 'rx'
# Have staggering intervals
source1 = RX::Observable.interval(0.1)
.map {|i| 'First: ' + i.to_s }
source2 = RX::Observable.interval(0.15)
.map {|i| 'Second: ' + i.to_s }
# Combine latest of source1 and source2 whenever either gives a value
source = source1.combine_latest(source2) {|s1, s2| s1 +... | 22.264706 | 69 | 0.589168 |
21674830fe5c7e951b29dbbc29e280b263e69dd5 | 749 | class PostsController < ApplicationController
def index
@posts = Post.all.order('created_at DESC')
end
def new
@post = Post.new
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to @post
else
render 'new'
end
end
def show
@post = Post.find(param... | 15.285714 | 56 | 0.616822 |
33298bf7d7405c1cc55b677c32b1a8e4fd494c8a | 25 | require "gindex/version"
| 12.5 | 24 | 0.8 |
3802720b04eac20ff84f493e346a322a23130e81 | 9,742 | require 'travis/remote_log'
describe Travis::RemoteLog do
subject { described_class.new(attrs) }
let(:attrs) { { id: 4, content: 'huh', job_id: 5 } }
before :each do
described_class.instance_variable_set(:@client, nil)
described_class.instance_variable_set(:@archive_client, nil)
end
it 'has a defau... | 27.519774 | 78 | 0.628208 |
bf9c2c095e916b89238f38c8134cb36824a91f91 | 1,747 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 38.822222 | 85 | 0.773898 |
ed55df8921ee136a8e68d794ec0a2022cd29fada | 2,804 | # frozen_string_literal: true
require 'spec_helper'
describe RuboCop::Cop::Lint::RequireParentheses do
subject(:cop) { described_class.new }
it 'registers an offense for missing parentheses around expression with ' \
'&& operator' do
inspect_source(cop, ["if day.is? 'monday' && month == :jan",
... | 33.783133 | 78 | 0.615906 |
1d8587f65486926f127c38d2bef8eb7431e6f86f | 2,376 | module Seek
module Ontologies
module Controller
module TypeHandler
extend ActiveSupport::Concern
included do
before_action :find_ontology_type_class, only: [:show]
before_action :find_and_authorize_assays, only: [:show]
end
def show
prepare_show... | 32.108108 | 146 | 0.5867 |
6a3c253041cc03f98fee40c514a1adc81725d489 | 397 | cask 'trilium-notes' do
version '0.42.3'
sha256 'c7ba978f4debd0fb24f0197d312d4def0c9683452272fe9055875478f757a147'
url "https://github.com/zadam/trilium/releases/download/v#{version}/trilium-mac-x64-#{version}.zip"
appcast 'https://github.com/zadam/trilium/releases.atom'
name 'Trilium Notes'
homepage 'http... | 33.083333 | 101 | 0.765743 |
26258c9b57ecff81d947766bb32f7bc0fee10be2 | 331 | class AddOptionsToLabbook < ActiveRecord::Migration
def change
add_column :embeddable_labbooks, :action_type, :integer, null: false, default: 0
add_column :embeddable_labbooks, :name, :string
add_column :embeddable_labbooks, :prompt, :text
add_column :embeddable_labbooks, :custom_action_label, :string... | 36.777778 | 84 | 0.773414 |
0195cfc2edf75ddfcb7733f303f7ea70f4862672 | 4,153 | class AssignmentsController < ApplicationController
before_action :set_assignment, only: [:show, :edit, :update, :destroy]
before_action :set_assignable, only: [:index, :new, :create, :end, :checkin]
before_action :redirect_if_already_assigned, only: [:new, :create]
# GET /assignments/:asset_type/:asset_id
#... | 34.89916 | 167 | 0.717794 |
03d38ec78fdff1cce18734e1e4c151a80e98162f | 358 | # frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm
HELM_VERSION = '2.11.0'.freeze
KUBECTL_VERSION = '1.11.0'.freeze
NAMESPACE = 'gitlab-managed-apps'.freeze
SERVICE_ACCOUNT = 'tiller'.freeze
CLUSTER_ROLE_BINDING = 'tiller-admin'.freeze
CLUSTER_ROLE = 'cl... | 23.866667 | 50 | 0.684358 |
083cb296d5d2ad9e53270aa0ee7af9a57d1ecebe | 1,386 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "var_parser/version"
Gem::Specification.new do |spec|
spec.name = "var_parser"
spec.version = VarParser::VERSION
spec.authors = ["dinesh"]
spec.email = ["dines... | 37.459459 | 96 | 0.668831 |
872daea1dcd0717c641a5c070925fb4ce90e7a8d | 5,991 | require File.expand_path '../xref_test_case', __FILE__
class TestRDocMarkupToHtmlCrossref < XrefTestCase
def setup
super
@options.hyperlink_all = true
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
end
def test_convert_CROSSREF
result = @to.convert 'C1'
assert_equal p... | 26.50885 | 82 | 0.646637 |
338c6ba0e299069f2a38978c3481b30487916195 | 4,000 | require 'pathname'
require 'uri'
module Sass::Tree
# A static node reprenting a CSS rule.
#
# @see Sass::Tree
class RuleNode < Node
# The character used to include the parent selector
PARENT = '&'
# The CSS selector for this rule,
# interspersed with {Sass::Script::Node}s
# representing `#... | 30.769231 | 120 | 0.64675 |
fff34a91ca8f26508c57931bf8da85ccd0730fbd | 870 | cask "tabby" do
arch = Hardware::CPU.intel? ? "x86_64" : "arm64"
version "1.0.170"
if Hardware::CPU.intel?
sha256 "0db486e1a925d7157e528b68e7c150f3b44f629d15c71c100ab827c61eeb4b34"
else
sha256 "d937a3e7c4e5dc2878980533245a30cd1cf6cc4ed366d179e9aecb992f5956dd"
end
url "https://github.com/Eugeny/ta... | 26.363636 | 105 | 0.713793 |
1cb564e1b969014cea985c4c74a1433dc73f1271 | 8,027 | =begin
#ORY Hydra
#Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
The version of the OpenAPI document: v1.11.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.4.0
=end
require 'date'
require 'time'
module OryHydraClient
class Reject... | 30.873077 | 207 | 0.628753 |
5d0123a795b7a1eb418499db70a38b67ded4d60d | 1,367 | class UsersController < ApplicationController
before_action :logged_in_user, only: [:index, :edit, :update]
before_action :correct_user, only: [:edit, :update]
before_action :admin_user, only: [:destroy]
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "please log in."
redirec... | 17.0875 | 82 | 0.669349 |
4a1bde24319c0b70d72d6db790ba5c7d93889754 | 14,584 |
# Circonus v2 API Client Library for chef-solo
#
# Extremely loosely based on code by Adam Jacob
# https://github.com/adamhjk/ruby-circonus/blob/master/lib/circonus.rb
#
# Author: Clinton Wolfe:: Clinton Wolfe (<clinton@omniti.com>)
# Copyright:: Copyright (c) 2012 OmniTI, Inc.
# License:: Apache License, Version 2... | 29.763265 | 406 | 0.61588 |
ff02f5588d17fc62ab30974f6955032bf7d59088 | 27,566 | module API
module Entities
class UserSafe < Grape::Entity
expose :name, :username
end
class UserBasic < UserSafe
expose :id, :state, :avatar_url
expose :web_url do |user, options|
Gitlab::Routing.url_helpers.user_url(user)
end
end
class User < UserBasic
exp... | 31.07779 | 161 | 0.666691 |
bb893157d54a767decab172224ad4498e6a3939a | 2,265 | # 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::MediaServices::Mgmt::V2019_05_01_preview
module Models
#
# Class to specify configurations of PlayReady in Streaming Policy
#
... | 34.846154 | 78 | 0.631347 |
bbaff95c66d23c8d0e5c36e881c62750a358ced5 | 657 | # rubocop:disable all
# File: config/initializers/static_router.rb
module ActionDispatch
module Routing
class StaticResponder < Endpoint
attr_accessor :path, :file_handler
def initialize(path)
self.path = path
self.file_handler = ActionDispatch::FileHandler.new(
Rails.confi... | 19.323529 | 60 | 0.613394 |
18b3828f5409663cca3934dca19fe69848a31746 | 877 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: DataEntry.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "sharepubapi_v1.DataEntry" do
optional :type, :enum, 1, "sharepubapi_v1.DataEntry.Type"
optional :value, :bytes, 2
end
add_e... | 29.233333 | 122 | 0.748005 |
6a31a1ec9fc0eb646c2eefa5a2ec538c103ea013 | 946 | require 'addressable/uri'
require 'nokogiri'
require 'net/http'
module Imggrabber
class HtmlParser
def initialize(url)
@uri = parse_url(url)
@html = get_html(@uri)
end
def images
@images ||= get_images_url_list(@html, @uri)
end
def uri
@uri
end
private
def p... | 19.708333 | 98 | 0.566596 |
337a34d7ce5c02e8bf37651b7cd93f4a3db400e7 | 130 | require 'coveralls'
Coveralls.wear!
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'jsender'
require 'byebug' | 21.666667 | 58 | 0.753846 |
61f314e9bff3a3540231f2941ac07bd728660faa | 728 | class SpeedUpResourcesPage < ActiveRecord::Migration[4.2]
def change
add_column :harvests, :nodes_count, :integer
add_column :harvests, :identifiers_count, :integer
add_column :harvests, :scientific_names_count, :integer
add_column :resources, :root_nodes_count, :integer
Harvest.find_each do |harv... | 42.823529 | 107 | 0.708791 |
1db154487a5dc4124e0eb8faffd41db459af9a30 | 1,397 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe 'SmsGlobal' do
include SmsGlobal
describe 'Sender' do
before do
@sender = Sender.new :user => 'DUMMY', :password => 'DUMMY'
end
it "requires :user and :password" do
lambda { Sender.new }.should raise_error
end
... | 32.488372 | 186 | 0.643522 |
bbd2cb3e5d9232cccb3c9eb97aa5d9bfe61acda7 | 127 | class AddUserIdToCapsules < ActiveRecord::Migration[5.0]
def change
add_column :capsules, :user_id, :integer
end
end
| 21.166667 | 56 | 0.740157 |
085a769a33da692cda2f0e3190e5c354aa5767cc | 1,577 | require 'rails_helper'
RSpec.describe ImportsHelper, type: :helper do
let(:import) { build(:import) }
describe "import_type_list" do
let(:import_types) { [["Generic", "generic"]] }
it { expect(helper.import_type_list).to eq import_types }
end
describe "status_icon_class_for" do
classes = {
... | 30.326923 | 85 | 0.643627 |
330cb1347a9cd89ef78402615a498645c28da4d4 | 1,510 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "transbank/sdk/version"
Gem::Specification.new do |spec|
spec.name = "transbank-sdk"
spec.version = Transbank::Sdk::VERSION
spec.authors = ["Transbank Developers"]
spec.email ... | 41.944444 | 87 | 0.670861 |
e2bbab7da8fb0eed19ef975ed7c3eb56ba9a2ab6 | 2,413 | class UsersController < ApplicationController
get "/users" do
#Only employees can view the users page
if logged_in? && current_user.kind!="user"
@users = User.all.sort { |u1, u2| u1.full_name <=> u2.full_name }
erb :'users/index'
#If you aren't logged in as an admin, you can't view it
else
redirect "... | 24.876289 | 136 | 0.675093 |
01efc8ca437c9799121ed5b3f004dd50581af6ba | 658 | cask :v1 => 'clipmenu' do
version '0.4.3'
sha256 'd0d7ca6c23f51b2dfe78c7bb40bf2f212c21b3304b3eacde86112d8ef3e6bfb9'
# dropbox is the official download host per the vendor homepage
url "https://dl.dropbox.com/u/1140644/clipmenu/ClipMenu_#{version}.dmg"
appcast 'http://feeds.feedburner.com/clipmenu-appcast',
... | 36.555556 | 87 | 0.694529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.