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 |
|---|---|---|---|---|---|
d582614b3990537f921aae112b2dae1dc8a2330c | 1,614 | class AuthorsController < ApplicationController
respond_to :html
def index
ordered_users = User.order(:name).text_search(params[:search])
authors = params[:all] ? ordered_users.all : ordered_users.active
@authors = AuthorDecorator.decorate_collection authors
end
def show
@author = AuthorDecora... | 24.089552 | 80 | 0.671623 |
7916e0e71cb0eba4998ee8649dcf910cf97bc05d | 1,002 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mikrotik-backup/version'
Gem::Specification.new do |spec|
spec.name = "mikrotik-backup"
spec.version = MikrotikBackup::VERSION
spec.authors = ["POS_troi"]
spec.email ... | 40.08 | 76 | 0.652695 |
ff3cc0493611e6dba5bea3778bb74678d68e4ff8 | 444 | require File.join(Rails.root, "app", "data_migrations", "add_coverage_household_member")
# This rake task is to add coverage household member to the primary applicant
# RAILS_ENV=production bundle exec rake migrations:add_coverage_household_member hbx_id=1234 family_member_id=543245
namespace :migrations do
desc "add... | 55.5 | 116 | 0.837838 |
012d843cdaa9d3f35d53493cfba2d0ad1bd750e2 | 120 | class AddFosIdToPlans < ActiveRecord::Migration[5.2]
def change
add_reference :plans, :fos, index: true
end
end
| 20 | 52 | 0.733333 |
f73ee648fcde7b911550dc42d0cd10b49c52c6aa | 449 | # Given a product returns the 'params' parameter to completely build a dynamic attribute from the method option_types_and_values_from_params
def params_for_dynamic_attribute(product)
context_params = {}
context_params['product_type'] = product.product_type.name
prefix = context_params['product_type']
product.c... | 37.416667 | 140 | 0.799555 |
e9b70a1e6af2d78fcbdf6edabad9b5513c54d674 | 1,461 | require 'fileutils'
# Simulate generating the fixtures.
FileUtils.mkdir_p File.expand_path('../../../tmp/files', __FILE__)
template_path = File.expand_path(
'../../../lib/file_blobs_rails/generators/templates/file_blobs.yml.erb',
__FILE__)
output = Erubis::Eruby.new(File.read(template_path)).result(
file... | 34.785714 | 77 | 0.71937 |
21c127680e87fd9d5305c0304c8c9629791064e2 | 1,210 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 28.809524 | 107 | 0.72562 |
bff1e09f617faca20cde39550098532c9b3c977c | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | 62 | 171 | 0.832661 |
e92aba2d97c0f31e6df2519ce494f63610252049 | 7,163 | =begin
#Topological Inventory Ingress API
#Topological Inventory Ingress API
The version of the OpenAPI document: 0.0.2
Contact: support@redhat.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.2.1
=end
require 'date'
module TopologicalInventoryIngressApiClient
class ServiceOfferingSe... | 31.69469 | 253 | 0.647215 |
33bd7597a20348e41ae7eaa272e97aea43096250 | 1,143 | require "spec_helper"
describe Spree::BitkassaReturnsController do
let(:order) { double(:order, number: "R1234", complete?: true) }
before do
allow(Spree::Order).to receive(:find_by_number!).and_return(order)
end
describe "order is complete" do
before do
allow(order).to receive(:complete?).and... | 27.214286 | 78 | 0.678915 |
6282146e2916ec12bd11729672ac57b517238d74 | 1,758 | class Crc32c < Formula
desc "CRC32C implementation with CPU-specific acceleration"
homepage "https://github.com/google/crc32c"
url "https://github.com/google/crc32c/archive/1.1.1.tar.gz"
sha256 "a6533f45b1670b5d59b38a514d82b09c6fb70cc1050467220216335e873074e8"
head "https://github.com/google/crc32c.git"
bo... | 34.470588 | 98 | 0.654721 |
ac1c3f3e95042aa49047c8f53dc1e5ffcabf6ae9 | 79 | class Detail < ActiveRecord::Base
belongs_to :product
belongs_to :sell
end
| 15.8 | 33 | 0.772152 |
79423ca0c645692b0fb2dd4c2d5f348e5b621921 | 3,716 | namespace :search do
include ResqueSupport::Basic
namespace :rebuild do
desc 'Reindex all the searchable classes'
task :all => :environment do
klasses = [Team, Protip, Opportunity]
klasses.each do |klass|
reindex_class(klass)
end
end
desc 'Reindex teams'
task :teams =... | 33.477477 | 270 | 0.654198 |
910e2aa0c48962c04b956401955fd939602b6406 | 356 | cask 'font-antic-slab' do
version :latest
sha256 :no_check
# github.com/google/fonts was verified as official when first introduced to the cask
url 'https://github.com/google/fonts/raw/master/ofl/anticslab/AnticSlab-Regular.ttf'
name 'Antic Slab'
homepage 'https://www.google.com/fonts/specimen/Antic+Slab'
... | 29.666667 | 86 | 0.755618 |
1ae643b7331522830fa58b54008c675cb8df4bd1 | 85 | # typed: true
proc {_1; _9 = nil} # error: cannot assign to numbered parameter `_9`
| 21.25 | 69 | 0.682353 |
ff314fc4a2215d1fe3e73622ce17fd868ffa9e56 | 572 | class CreateRestrictionsUsersTable < ActiveRecord::Migration
def up
create_table :restrictions_users, id: false do |t|
t.belongs_to :restriction
t.belongs_to :user
end
create_table :locations_restrictions, id: false do |t|
t.belongs_to :restriction
t.belongs_to :location
end
create_tabl... | 24.869565 | 60 | 0.744755 |
e2410e6dc5bc95c52e05b2361ab49cb7fae72bfb | 6,197 | describe Spaceship::Tunes::IAPDetail do
before { Spaceship::Tunes.login }
let(:client) { Spaceship::Application.client }
let(:app) { Spaceship::Application.all.first }
let(:detailed) { app.in_app_purchases.find("go.find.me").edit }
describe "Details of an IAP" do
it "Loads full details of a single iap" d... | 37.786585 | 172 | 0.632403 |
1d7100b48224c2d19a527a0e9101f53f5108c963 | 378 | require 'prometheus/client'
class MetricsRecorder
def self.instance
@__instance__ ||= new
end
attr_reader :revisions_submitted
def initialize
@prometheus = Prometheus::Client.registry
@revisions_submitted = Prometheus::Client::Counter.new(:revisions_submitted, 'A counter of revisions submitted')... | 22.235294 | 116 | 0.761905 |
f7d67d0245b6cdaee0ea4185064ac9722d557c43 | 58 | class Course < ActiveRecord::Base
belongs_to :users
end
| 14.5 | 33 | 0.775862 |
bb84b3a3e981327974b12d2c8da541f2d6240883 | 1,465 | java_import "com.netflix.hystrix.HystrixObservableCommand"
java_import "com.netflix.hystrix.HystrixCommandGroupKey"
java_import "com.netflix.hystrix.HystrixCommandKey"
java_import "ratpack.rx.RxRatpack"
java_import "ratpack.exec.Blocking"
java_import "ratpack.http.client.HttpClient"
java_import "rx.Observable"
class I... | 30.520833 | 76 | 0.681911 |
ff26733fcaf9978835aef88172265cea9ff77b88 | 638 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe FacilitiesHelper do
describe "#product_list_title" do
let(:products) { %i(instrument item service).map { |type| build(type) } }
let(:result) { product_list_title(products, extra) }
context "when extra is falsy" do
let(:extra) { n... | 25.52 | 77 | 0.636364 |
bf852182dea37783eda701f827670af4fd599681 | 4,474 | #
# Author:: Christopher Webber (<cwebber@chef.io>)
# Copyright:: Copyright (c) 2015 Chef Software, 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 a... | 32.42029 | 97 | 0.667188 |
79e8c3a6dd277c84f161887cb7093dee934d3f05 | 3,904 | # encoding: UTF-8
# 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 authoritativ... | 36.830189 | 111 | 0.662141 |
e964d28c6476e9d809c162adc699f99477d32b3f | 616 | require 'spec_helper'
describe 'puppet_url_without_modules' do
let(:msg) { 'puppet:// URL without modules/ found' }
context 'puppet:// url with modules' do
let(:code) { "'puppet:///modules/foo'" }
it 'should not detect any problems' do
expect(problems).to have(0).problems
end
end
context '... | 23.692308 | 70 | 0.654221 |
e994903a30f028f228e8f85bf00cb941d032d199 | 142 | class AddFavoriteFoodToArtists < ActiveRecord::Migration[5.2]
def change
add_column :artists, :favorite_food, :string
end
end | 28.4 | 61 | 0.725352 |
b93fc46259e46b49720f3ca57bcb98df2e07c3c9 | 3,256 | VimPastebin::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 thread web ... | 39.707317 | 104 | 0.756757 |
bbcbd67f107b49b3159af50b948cf908be34327b | 950 | # frozen_string_literal: true
describe Sinatra::FrontendService::Helpers do
class HelpersStub
include Sinatra::FrontendService::Helpers
end
context "given valid number" do
it "returns single digit formatted currency" do
expect(HelpersStub.new.number_to_currency(0.50)).to eq("£0.50")
end
i... | 27.941176 | 79 | 0.691579 |
1c7255c3b6b802c858c9de2e52f9c645f642e0c7 | 3,113 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Recipe:: _lustre_install
#
# Copyright 2013-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy... | 29.932692 | 131 | 0.697077 |
acb5411df4b8f681751444b60858930098d6d1ab | 1,251 |
Object.class_eval do
def to_flat() [to_s] end
end
module Enumerable
alias_method :to_flat, :to_a
end
Struct.class_eval do
#
# The last portion of the class in underscored form
# note memoization
#
def self.resource_name
@resource_name ||= self.to_s.gsub(%r{.*::}, '').underscore.to_sym
end
#
#... | 18.671642 | 69 | 0.667466 |
b9672add9ded59a8cb02f4aa8ee5c1ea1814d04e | 760 | class AddRebateToApplication < ActiveRecord::Migration[5.1]
def change
add_column :rebate_forms, :rebate, :decimal, precision: 8, scale: 2
rename_column :rates_bills, :total_rates, :old_total_rates
rename_column :rates_bills, :total_water_rates, :old_total_water_rates
add_column :rates_bills, :total_... | 42.222222 | 128 | 0.772368 |
acd1d5145a51dc78ac4501a7389a175bf35a1416 | 3,008 | module ThreeScaleToolbox
module CLI
class ErrorHandler
def self.error_watchdog
new.error_watchdog { yield }
end
# Catches errors and prints nice diagnostic messages
def error_watchdog
# Run
yield
rescue StandardError, ScriptError => e
handle_error e
... | 24.655738 | 86 | 0.599734 |
e9073b17d17cdd5009a61e8f931ea30c5e4c262d | 375 | class PreferencesCreateJob < ActiveJob::Base
queue_as :default
def perform(user)
# Do something later
if user.partner && user.profile
prefer_users = user.prefer_users
if prefer_users.count > 0
prefer_users.each do |prefer_matching_user|
user.prefer(prefer_matchi... | 23.4375 | 55 | 0.634667 |
abc2f357d16f104242b8a873a710f28a5a1976ef | 156 | class User < ApplicationRecord
has_many :posts
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
end
| 22.285714 | 50 | 0.75641 |
6a28bec1903d7b61ec17446d6d3e16f22f2b7e22 | 20,669 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.20.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
require 'date'
require 'time'
module Plaid
# Used to configure Sandbox test... | 36.453263 | 429 | 0.661038 |
1a0c097636e26afc700d84f847b2eb465194fe58 | 12,100 | require 'time'
require 'date'
require 'active_merchant/billing/model'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# A +CreditCard+ object represents a physical credit card, and is capable of validating the various
# data associated with these.
#
# At the moment, the following credit card t... | 30.024814 | 163 | 0.598843 |
b919397d40bfcb95b6dd32efb428af3caa306916 | 124 | # frozen_string_literal: true
module Namespaced
class Person
class UserEdited < Namespaced::Person
end
end
end
| 13.777778 | 41 | 0.741935 |
113e0a7b06dfecdff02896318a74c306b84f1f19 | 1,645 | require 'spec_helper'
describe TrelloTasks do
it "should store right values in metrics API", :vcr do
Timecop.freeze
time = DateTime.now
allow(TrelloTasks).to receive(:board_ids).and_return({
2014 => {
:q1 => "B5MnBDfR"
}
})
outstanding = [
{:id => "5343c1155004... | 32.9 | 142 | 0.629179 |
e92281c67eeaa0d820243c98e8450f7f4bd25162 | 1,539 | require 'test_helper'
require 'minitest/rails/capybara'
class CfpPersonProfileTest < Capybara::Rails::TestCase
setup do
@conference = create(:conference)
@admin = create(:user, person: create(:person), role: 'admin')
@user = create(:user, person: create(:person), role: 'submitter')
ActionMailer::Bas... | 28.5 | 96 | 0.712151 |
285a3f342ea4b050177997d714089d010dd52805 | 4,639 | require 'opal/path_reader'
require 'opal/builder_processors'
require 'opal/paths'
require 'opal/config'
require 'set'
module Opal
class Builder
include BuilderProcessors
class MissingRequire < LoadError
end
def initialize(options = nil)
(options || {}).each_pair do |k,v|
public_send("... | 28.460123 | 127 | 0.636775 |
26fece33a4b44ac1c939173bde5ea603a05169c6 | 1,319 | class Datamash < Formula
desc "Tool to perform numerical, textual & statistical operations"
homepage "https://www.gnu.org/software/datamash"
url "https://ftp.gnu.org/gnu/datamash/datamash-1.7.tar.gz"
mirror "https://ftpmirror.gnu.org/datamash/datamash-1.7.tar.gz"
sha256 "574a592bb90c5ae702ffaed1b59498d5e3e746... | 33.820513 | 94 | 0.714177 |
ffdec14e2b502071479f72a7abda2e21cdf52795 | 745 | require "forwardable"
module NumbersInWords
class LanguageWriter
extend Forwardable
attr_reader :that
def_delegators :language, :exceptional_numbers, :powers_of_ten
def initialize that
@that = that
end
def language
if @language.is_a? Module
@language
else
... | 21.285714 | 66 | 0.656376 |
1a138be8ef4c6771e9b2f9d74c0bcab41da8c6f0 | 15,190 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | 48.685897 | 154 | 0.752535 |
4a3bf2f4c9adbffda85f0bbfb3fbac79627d77e3 | 3,170 | FactoryGirl.define do
factory :permission do
modify_family true
modify_employer true
revert_application true
list_enrollments true
send_broker_agency_message true
approve_broker true
approve_ga true
modify_admin_tabs true
view_admin_tabs true
can_lock_unlock false
can_rese... | 26.198347 | 44 | 0.730915 |
bffd58ec915ffb3e344fc534b0cba20456e8ec3f | 230 | module CortexReaver
class ConfigController < Ramaze::Controller
map '/config'
layout(:text_layout)
alias_view :edit, :form
engine :Erubis
helper :error,
:auth,
:form,
:workflow
end
end
| 14.375 | 45 | 0.626087 |
1ccfeb6efb5687ccba732e5ad044416f7e7aac30 | 1,355 | =begin
#Selling Partner API for A+ Content Management
#With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decis... | 32.261905 | 365 | 0.766052 |
aca430e548d56d9f79852693183ef3c30b492fd8 | 3,087 | # encoding: utf-8
require 'label/description_formatter'
def format input_string, prepend_string = "#"
Label::DescriptionFormatter.format input_string, prepend_string
end
describe Label::DescriptionFormatter do
describe '.format' do
it 'does not change descriptions that are not that long' do
descriptio... | 46.772727 | 112 | 0.641075 |
f71525467bd44f898ece13ca1566b371844af7d6 | 232 | unless (RUBY_VERSION[0,3] == '1.9')
class NilClass
# Allows <tt>nil</tt> to respond to #to_f.
# Always returns <tt>0</tt>.
#
# nil.to_f #=> 0.0
#
# CREDIT: Matz
def to_f; 0.0; end
end
end
| 12.888889 | 46 | 0.508621 |
61fc6dbeacd22dd61eb8ca8e7eea835be55ade48 | 207 | class CreateAppointments < ActiveRecord::Migration[5.2]
def change
create_table :appointments do |t|
t.string :reason_for_visit
t.datetime :date_time
t.timestamps
end
end
end | 20.7 | 55 | 0.690821 |
87e0329dc90291bd2a41225f3863a54bc50448f1 | 62 |
class Object
def in?(arr)
arr.include?(self)
end
end
| 8.857143 | 22 | 0.629032 |
b9e111abe088e4e79dcbecb3021729acf8caba2e | 885 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/indirector/node/plain'
describe Puppet::Node::Plain do
let(:nodename) { "mynode" }
let(:fact_values) { {:afact => "a value"} }
let(:facts) { Puppet::Node::Facts.new(nodename, fact_values) }
let(:environment) { Puppet::Node::Environment.create(:myenv, ... | 32.777778 | 109 | 0.712994 |
3313021f8ec7ce4ca8d84c9280bb43e10b30cfba | 9,048 | # frozen_string_literal: true
# Phusion Passenger - https://www.phusionpassenger.com/
# Copyright (c) 2017 Phusion Holding B.V.
#
# "Passenger", "Phusion Passenger" and "Union Station" are registered
# trademarks of Phusion Holding B.V.
#
# Permission is hereby granted, free of charge, to any person obtaining a co... | 30.77551 | 96 | 0.559019 |
f8d0f29738c8ba643408d4cef0d2c670e2d9931d | 151 | puts "You've just installed Capistrano Bells."
puts "Now run rake bells:generate_capfile to generate a new Capfile template and you'll be on your way." | 75.5 | 104 | 0.794702 |
6a52d63c98a40f51c1bf73ef0b92bfeedf195786 | 3,563 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::Udp
def initialize(info = {})
super(update_info(info,
'Name' ... | 39.588889 | 106 | 0.516138 |
08ac24ed535f01c6a863d3a79a415dd81c4cc2a2 | 10,626 | #
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the ... | 31.252941 | 118 | 0.703087 |
f7e51cb1aec2c8eb11ad8d7dd986d99926173ebb | 198 | def fizzbuzz(num)
if num % 3 == 0 && num % 5 != 0
return "Fizz"
elsif num % 3 != 0 && num % 5 == 0
return "Buzz"
elsif num % 3 == 0 && num % 5 == 0
return "FizzBuzz"
end
end
| 14.142857 | 36 | 0.484848 |
288d8514d790f92b254227553ff930e130c152e1 | 1,285 | class LitCreateLitIncommingLocalizations < Rails::VERSION::MAJOR >= 5 ?
ActiveRecord::Migration[4.2] :
ActiveRecord::Migration
def up
return if table_exists?(:lit_incomming_localizations)
create_table :lit_incomming_localizat... | 36.714286 | 72 | 0.726848 |
aba36d130f9199917bc04943d3675c3ae7be7e6a | 33,432 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 42.15889 | 129 | 0.707556 |
791d95b37b81539ba388a89857589b34f8fa0a3b | 76 | require 'test_helper'
class CompaniesHelperTest < ActionView::TestCase
end
| 15.2 | 48 | 0.828947 |
7a1adc30b4e08a4c9818557484f378a5e62161a4 | 92 | # frozen_string_literal: true
say "It works from file!"
say "With ARGV! #{ARGV.join(" ")}"
| 18.4 | 34 | 0.673913 |
018ea6072ffdce2afc3e4cac9407537a5bd8b48f | 1,779 | Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'rides#index'
#Static pages
get 'about' => 'static_pages#about'
get 'gea... | 26.954545 | 84 | 0.642496 |
79068d4416bc899a9223268f5195859e05fdd0aa | 1,165 | class Stripe::SubscriptionsController < ApplicationController
before_action :set_subscription, only: [:show, :edit, :update, :destroy, :cancel, :resume]
def index
@subscriptions = Pay::Subscription.where(processor: :stripe).order(created_at: :desc)
end
def show
end
def new
end
def create
cur... | 21.981132 | 92 | 0.732189 |
6a5818a0dcae4d4a87f357b305f1238ffde607f5 | 139 | (func uint fact(uint n) (
(if (== n 1) (
(return 1)))
(return (* n (fact (- n 1))))))
(func main() (
(var result (fact 6))))
| 17.375 | 35 | 0.453237 |
790b20867779fc280e99c52d16f7e4d78d1179cf | 1,661 | #
# Be sure to run `pod lib lint LHFCocoapodsTest.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'LH... | 38.627907 | 109 | 0.650211 |
216c9158e0ff7f2f318b24817fc79a3785ad6ee5 | 1,287 | class SurveysController < ApplicationController
def create
if !params.include?(:responses)
return render :json => {success: false}
end
@responses = JSON.parse(params['responses'])
first_name = @responses['First Name']
last_name = @responses['Last Name']
classroom_id = @responses['Class... | 30.642857 | 90 | 0.607615 |
6271d1e0854ad2c0cb13f092b48b129749e64124 | 4,978 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
def web_apps_list_backups(*args)
header_params = {}
argstring = args[0].delete('\\')
arg_hash = JSON.parse(argstring)
# Remove task name from arguments - should contain all necessary parameters for URI
arg_hash.delete('_task')
operation_ve... | 31.910256 | 177 | 0.663519 |
d5847b828256bcabd91bd92622f36ecd0ab9229d | 1,477 | class User < ApplicationRecord
attr_accessor :remember_token
has_many :tasks, as: :taskable
has_many :categories, as: :categoryable
has_and_belongs_to_many :teams
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.... | 34.348837 | 78 | 0.686527 |
ab5bd35500d61da8828b3af8f50121223643b26f | 557 | require 'test_helper'
class UsersProfileTest < ActionDispatch::IntegrationTest
include ApplicationHelper
def setup
@user = users(:michael)
end
test "profile display" do
get user_path(@user)
assert_template 'users/show'
assert_select 'title', full_title(@user.name)
assert_select 'h1', text... | 25.318182 | 59 | 0.728905 |
f84b06458857ce0a07dc5c10f2b4bf83f8ab380f | 4,997 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe SurveyorController do
let!(:survey) { FactoryGirl.create(:survey, :title => "Alphabet", :access_code => "alpha", :survey_version => 0)}
let!(:survey_beta) { FactoryGirl.create(:survey, :title => "Alphabet", :access_code =... | 36.210145 | 142 | 0.655793 |
bbef70d0a2f9db7fa8b5f8691c5c819c55c02c02 | 4,238 | require 'spec_helper'
describe Micropost do
let(:user) { FactoryGirl.create(:user) }
before { @micropost = user.microposts.build(content: "Lorem ipsum") }
subject { @micropost }
# Respond to Attributes
it { should respond_to(:content) }
it { should respond_to(:user_id) }
it { should respond_to(:user) ... | 24.929412 | 73 | 0.715904 |
873eb0c9bc2b13e64a9f8a317c280b82438d035e | 1,100 | # frozen_string_literal: true
class OrganizationOnHoldTasksTab < QueueTab
validate :assignee_is_organization
def label
COPY::QUEUE_PAGE_ON_HOLD_TAB_TITLE
end
def self.tab_name
Constants.QUEUE_CONFIG.ON_HOLD_TASKS_TAB_NAME
end
def description
format(COPY::ORGANIZATIONAL_QUEUE_PAGE_ON_HOLD_TAS... | 25.581395 | 94 | 0.784545 |
7a61e4d36cc1a190cc6fae8ba73efe937c74e899 | 1,983 | module Api
module V1
class AlternativesController < ApplicationController
def create
alternative = Alternative.new(alternative_params)
alternative.save!
render json: alternative, status: :created
rescue StandardError => e
render json: {
error: 'Bad request',
... | 25.101266 | 81 | 0.546142 |
e98498ea56888ea9cb7e50a3fae073781f2c7081 | 4,408 | class HorariosController < ApplicationController
layout 'default'
# GET /horarios
# GET /horarios.xml
def index
@programaciones = Programacion.find(:all)
@tab = :inicio
@nav = :horarios
end
# GET /horarios/new
# GET /horarios/new.xml
def new
@programaciones = Programa.find(:all)
... | 23.698925 | 92 | 0.594828 |
5d8f8685d5749870ceb1ff8b35d7a039f2e31765 | 249 | require 'puppet/util/feature'
require 'puppet/util/libuser'
Puppet.features.add(:libuser) {
File.executable?("/usr/sbin/lgroupadd") and
File.executable?("/usr/sbin/luseradd") and
Puppet::FileSystem.exist?(Puppet::Util::Libuser.getconf)
}
| 27.666667 | 59 | 0.730924 |
1d4c09ffb6beb2991a91d28d61dc196c1d21f7d5 | 1,975 | # encoding: UTF-8
require 'helper'
class TestKramdown < Test::Unit::TestCase
context "kramdown" do
setup do
@config = {
'markdown' => 'kramdown',
'kramdown' => {
'auto_ids' => false,
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_level... | 31.349206 | 105 | 0.586329 |
219f49252f72573c44a11305701a6608df1bc358 | 253 | module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "SressShredder App"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end
| 21.083333 | 49 | 0.656126 |
f79d193015a5036a229e924561d57cda1bbba61a | 2,147 | # 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
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-iam/types'
require_relative 'aws-sdk-iam/c... | 30.671429 | 102 | 0.785748 |
6afa1347ce58fccc7f2978e84a499543484f2b13 | 33,952 | # Copyright 2017, Google Inc. All rights reserved.
#
# 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 ... | 33.952 | 220 | 0.56409 |
6ac5037e7533c64688f4ae1b044c62ce1cc6019d | 946 | require 'spec_helper'
describe SiteComponent do
describe "バリデーション" do
it { should validate_uniqueness_of(:name) }
end
describe "メソッド" do
describe ".[]" do
let(:name){"theme"}
let(:value){"blue"}
before do
create(:site_component, name: name, value: value)
end
it ... | 23.073171 | 103 | 0.622622 |
08b95a44e2ec11e34b21ecb3d7efe8c7939ce4c6 | 1,123 | class Fizsh < Formula
desc "Fish-like front end for ZSH"
homepage "https://github.com/zsh-users/fizsh"
url "https://downloads.sourceforge.net/project/fizsh/fizsh-1.0.9.tar.gz"
sha256 "dbbbe03101f82e62f1dfe1f8af7cde23bc043833679bc74601a0a3d58a117b07"
head "https://github.com/zsh-users/fizsh", :using => :git
... | 37.433333 | 107 | 0.705254 |
b9da92ad096557ce96edd0e65f497713fa3da984 | 1,936 | require 'foundation/version'
# Foundation for SASS
# Cribbed by Bootstrap-sass
# This gem makes Foundation assets available to rails, sprockets or compass
# projects without requiring npm or bower.
module Foundation
class << self
# Inspired by Kaminari
def load!
register_compass_extension if compass?
... | 22 | 75 | 0.643595 |
f7b63db488f53bff93fd03028518ccd777d2fddf | 1,471 | class LiquidDsp < Formula
desc "Digital signal processing library for software-defined radios"
homepage "https://liquidsdr.org/"
url "https://github.com/jgaeddert/liquid-dsp/archive/v1.3.2.tar.gz"
sha256 "85093624ef9cb90ead64c836d2f42690197edace1a86257d6524c4e4dc870483"
license "MIT"
bottle do
cellar :... | 35.02381 | 95 | 0.733515 |
38a77fed0d0c69b13b45e94d9aae87e2e5cfb634 | 557 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'CapacitorCommunityKeepAwake'
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.homepage = package['repository']['url']
s.author = package['auth... | 30.944444 | 77 | 0.664273 |
4a8a3712c98367e09523afbeda778d1cd9151667 | 1,294 | class RepliesController < ApplicationController
load_and_authorize_resource :reply
before_action :set_topic
before_action :set_reply, only: [:edit, :update, :destroy]
def create
@reply = Reply.new(reply_params)
@reply.topic_id = @topic.id
@reply.user_id = current_user.id
if @reply.save
... | 19.907692 | 97 | 0.659196 |
bb6db350d07538d8a52971d092a444796b3b1826 | 960 | # RADAR: The order makes a difference, and globbing Dir produces different results on different machines.
# We can .sort the glob, but still the order would be wrong, and we'd need to have repeated requires in
# Individual files. Michael and I think it's easier to statically call them all in one place in the right orde... | 41.73913 | 112 | 0.78125 |
e2320fa79d6628059bfd1b232ccd04f5636b6e0c | 1,021 | require "ruby_1/version"
module Ruby1
class Error < StandardError; end
puts "Welcome to 'Get My Number!'"
#get name
print "What's your name?"
input = gets
name = gets.chomp
puts "Welcome, #{name}!"
#store random number for player to guess
puts "I've got a random number between 1 and 100"
p... | 21.723404 | 59 | 0.650343 |
4a35f456515919ba1340d923346b012f16796345 | 1,406 | require 'rails_helper'
RSpec.describe "StockSymbols", type: :request do
describe "GET /index" do
let!(:wallet) {FactoryBot.create(:wallet)}
let!(:symbols) { FactoryBot.create(:stock_symbol, wallet_id: wallet.id, name: 'MSFT') }
it "return stock_symbols index page" do
get "/stock_symbols"
... | 29.914894 | 91 | 0.651494 |
39e08d71b0ccefbb02f82aaa14d6a65fd8e34fc9 | 9,126 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Expl... | 32.021053 | 114 | 0.642012 |
1dd0f002499054dc01e17451a2894c5876410b7b | 97 | class HealthcheckController < ApplicationController
def check
render plain: 'OK'
end
end
| 16.166667 | 51 | 0.762887 |
6a62ef456c18feb479f2927af32b18b44b3e424c | 5,551 | # frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Quality::KubernetesClient do
let(:namespace) { 'review-apps-ee' }
let(:release_name) { 'my-release' }
let(:pod_for_release) { "pod-my-release-abcd" }
let(:raw_resource_names_str) { "NAME\nfoo\n#{pod_for_release}\nbar" }
let(:raw_resourc... | 49.5625 | 183 | 0.666366 |
ab38af067a0085706291b12b17e5ad8c64439e34 | 960 | # encoding: utf-8
#
# THINK Does it also remove diacritics, like べ to へ?
#
module Picky
module CharacterSubstituters
# Substitutes Umlauts like
# ä, ö, ü => ae, oe, ue.
# (and more, see specs)
#
class WestEuropean < Base
# Substitutes occurrences of certain characters
# (like Umlaut... | 20 | 58 | 0.515625 |
6229f35f6747f532a14cdf564b2e31b62c5092c2 | 6,137 | # frozen_string_literal: true
module Stupidedi
using Refinements
class Either
# @return [Boolean]
abstract :defined?
###########################################################################
# @group Filtering the Value
# @return [Either]
abstract :select, :args => %w(reason='select' ... | 21.017123 | 79 | 0.429689 |
391b10dd0a2303a68eb1d41ec3cb65a091008f36 | 507 | class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
log_in @user
flash[:success] = "Welcome to the Sample App!"
redirect_to @user
else
re... | 17.482759 | 60 | 0.585799 |
f8bfcdad1a50ffad9c88d76c08757c8687ebeee4 | 466 | module ActiveModelSerializersVuetables
class Adapter < ActiveModelSerializers::Adapter::Json
def serializable_hash(options = nil)
data = {}
collection = serializer.object
if collection.respond_to?(:total_count)
data[:count] = collection.total_count
end
super.merge(data)
... | 21.181818 | 94 | 0.706009 |
f7cb28c9876b967c3d2e2a29c73cd8dfd6350ae9 | 5,756 | unless ENV['RAILS_ENV'] == 'test'
begin
require 'daemons'
rescue LoadError
raise "You need to add gem 'daemons' to your Gemfile if you wish to use it."
end
end
require 'optparse'
require 'pathname'
module Delayed
class Command # rubocop:disable ClassLength
attr_accessor :worker_count, :worker_pools... | 33.660819 | 173 | 0.605629 |
870ad2608dcc97ef0459fba4981b29a178b1209d | 4,937 | require 'spec_helper'
describe Sufia::GenericFile::Actor do
include ActionDispatch::TestProcess # for fixture_file_upload
let(:user) { FactoryGirl.create(:user) }
let(:generic_file) { FactoryGirl.create(:generic_file) }
let(:actor) { Sufia::GenericFile::Actor.new(generic_file, user) }
let(:uploaded_file) { ... | 41.487395 | 220 | 0.6905 |
e8005418e6630efa7bf63d8ca2597c50b5af0776 | 2,432 | #
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# rubocop:disable Layout/LineLength
def include_react_native!(react_native:, target_platform:, project_root:, flipper_versions:)
... | 51.744681 | 101 | 0.724507 |
d5ceb984fef0e36523d2b77917b5b9dcb794a9e4 | 3,585 | 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... | 41.206897 | 102 | 0.758438 |
0830f1f99a4c8f005e05caa65282bebe58c47ff2 | 183 | Facter.add(:first) do
setcode do
Facter::Core::Execution.exec("echo foo 1>&2 && echo bar")
end
end
Facter.add(:second) do
setcode 'echo foo 1>&2 && echo bar'
end
| 18.3 | 65 | 0.617486 |
1802579c69fed28a5a9cc8bd1b7cef8a004291ec | 889 | class Notifier < ActionMailer::Base
default_url_options[:host] = APP_CONFIG['domain_name']
def password_reset_instructions(user)
subject "Password Reset Instructions"
from APP_CONFIG['app_email']
recipients user.email
sent_on Time.now
body :edit_password_reset_u... | 31.75 | 92 | 0.634421 |
21ad0803f396b54d011efa0e08d280cfd1224be2 | 3,940 | require 'rkelly/lexeme'
module RKelly
class Tokenizer
KEYWORDS = %w{
break case catch continue default delete do else finally for function
if in instanceof new return switch this throw try typeof var void while
with
const true false null debugger
}
RESERVED = %w{
abstrac... | 28.759124 | 122 | 0.50736 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.