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 |
|---|---|---|---|---|---|
ed28dec2bc2b3a7a8ffa1abd7dd99418bf13b36a | 1,382 | class Geoserver < Formula
desc "Java server to share and edit geospatial data"
homepage "https://geoserver.org/"
url "https://downloads.sourceforge.net/project/geoserver/GeoServer/2.20.4/geoserver-2.20.4-bin.zip"
sha256 "418ef109c051d997d75d86a6fe51ee5280b87fabdb73cd96d3210f2d43a79b64"
# GeoServer releases c... | 31.409091 | 112 | 0.686686 |
08dc9c47cc1b2d52fd2808bdbc0cc12aefa5fb7b | 6,052 | #!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License... | 39.555556 | 78 | 0.553866 |
e2002818e3337380bf5ed889a259b58173808a88 | 209 | def open_user_file
print "File to open: "
filename = gets.chomp
begin
fh = File.open(filename)
rescue
puts "Couldn't open your file!"
return
end
yield fh
fh.close
end
open_user_file
| 13.933333 | 35 | 0.674641 |
bf768fa3d1485486b6a85151daf191c290238269 | 1,006 | require 'spec_helper'
describe 'keystone::db::postgresql' do
shared_examples 'keystone::db::postgresql' do
let :req_params do
{
:password => 'keystonepass',
}
end
let :pre_condition do
'include postgresql::server'
end
context 'with only required parameters' do
le... | 21.869565 | 80 | 0.578529 |
b96d9b33b83fd02c0a35cdbed4e3b9539faf575f | 412 | # frozen_string_literal: true
$LOAD_PATH << File.expand_path('../lib', __dir__)
require 'mongoid'
require 'mongoid/rspec'
require 'mongoid/enum'
ENV['MONGOID_ENV'] = 'test'
RSpec.configure do |config|
config.include Mongoid::Matchers
config.before(:each) do
Mongoid.purge!
end
end
Mongoid.load!(File.expa... | 19.619048 | 70 | 0.728155 |
38087996d52e10776e73ff763bf0ff55d7f78674 | 279 | require 'test_helper'
class NoteTest < ActiveSupport::TestCase
def test_for_person
assert_equal 4, Note.for_person(people(:mary)).size
assert_equal 4, Note.count_for_person(people(:mary))
assert_equal 2, Note.for_person(people(:mary), :limit => 2).size
end
end
| 25.363636 | 68 | 0.741935 |
e807be1dc4646d5d7fc6bbb7430fc5b7fdda0f4b | 2,101 | class Team < ApplicationRecord
has_many :players, dependent: :destroy
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_rel... | 33.887097 | 78 | 0.66397 |
ab4b06a33023c5b59e8791302aa61642db82b31b | 548 | Rails.application.routes.draw do
get "/", to: "application#homepage", as: "homepage"
get "/login", to: "sessions#login"
post "/login", to: "sessions#process_login"
get "/logout", to: "sessions#logout"
get "/about", to: "sessions#about", as: "about"
resources :states
resources :park_states
resources :p... | 28.842105 | 102 | 0.686131 |
bb282798ca43cc76fe3502fee11c4bec1d493ec4 | 372 | Puppet::Type.newtype(:rvm_alias) do
@doc = 'Manage RVM Aliases.'
ensurable
autorequire(:rvm_system_ruby) do
[self[:target_ruby]]
end
newparam(:name) do
desc 'The name of the alias to be managed.'
isnamevar
end
newparam(:target_ruby) do
desc "The ruby version that is the target of our a... | 18.6 | 59 | 0.674731 |
f868ac2685fa08167d08f38bc90127d46b1fb79f | 443 | # == Schema Information
#
# Table name: reviews
#
# id :integer not null, primary key
# idUsuario :integer
# idViaje :integer
# idAsiento :integer
# asunto :string(255)
# desc :text
# puntaje :integer
# created_at :datetime not null
# updated_at :datetime not ... | 23.315789 | 76 | 0.629797 |
ab5d545db15af011905bce70771b65f76adc797f | 2,602 | require File.expand_path(File.dirname(__FILE__) + '/neo')
class AboutSandwichCode < Neo::Koan
def count_lines(file_name)
file = open(file_name)
count = 0
while file.gets
count += 1
end
count
ensure
file.close if file
end
def test_counting_lines
assert_equal 4, count_lines("e... | 23.441441 | 70 | 0.602229 |
7a4885edd32d2d011ba4e88918324f274e834e89 | 579 | class CreateAudioEvents < ActiveRecord::Migration
def change
create_table :audio_events do |t|
t.references :audio_recording, :null => false
t.decimal :start_time_seconds, :null => false, :scale => 6
t.decimal :end_time_seconds, :scale => 6
t.decimal :low_frequency_hertz, :null => false, :... | 34.058824 | 65 | 0.680484 |
08a4cbf8469429c125a9796e22a51b92b422809b | 64 | FactoryGirl.define do
factory :resident do
user
end
end | 10.666667 | 22 | 0.71875 |
33074c790c7d65bd78e8dee22bddd6ff5d433add | 241 | class Spree::Admin::PromeseSettingsController < Spree::Admin::ResourceController
def index
redirect_to edit_admin_promese_setting_path(model_class.instance.id)
end
def model_class
@model_class ||= ::PromeseSetting
end
end
| 20.083333 | 80 | 0.775934 |
1a76ccd8add327af3110c55ed2c5618c8c29ce68 | 754 | ENV["RAILS_ENV"] = "test"
require File.expand_path("../../../../config/environment")
require "spec"
require "spec/rails"
require "ruby-debug"
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ":memory:"}}
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["test... | 25.133333 | 96 | 0.704244 |
79791e6db4f56d2b361cbe1f8ef6ec2cc5cabe3b | 6,921 | #!/usr/bin/env ruby
require_relative '../lib/typed_array'
# Base - base_class
# Dire - direct_class
# BD - base_class direct_class
# Limit - size
# Strict - index_strict
# ISL - size index_strict
class TypedBaseArray < TypedArray; end
class TypedDireArray < TypedArray; end
class TypedBDArray < TypedArray;... | 32.341121 | 114 | 0.655108 |
26bc9f3c1a32709c580abbf37a34bb0ab153ff02 | 1,014 | =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
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Dat... | 28.971429 | 102 | 0.774162 |
267668a815e89c314b7248345c53b4b576b8e160 | 134 | class AddCirleToVolunteer < ActiveRecord::Migration
def change
add_column :volunteers, :circle_id, :integer, limit: 8
end
end
| 22.333333 | 58 | 0.761194 |
33c892f96c96b77a8e2a1fcd7d3097a5681d5dd5 | 735 | require "faraday"
require "faraday_middleware"
module Vismasign
class Client
BASE_URL = "https://vismasign.frakt.io/"
attr_reader :identifier, :api_key, :adapter
def initialize(identifier:, api_key:, adapter: Faraday.default_adapter)
@identifier = identifier
@api_key = api_key
@adapter... | 22.272727 | 75 | 0.653061 |
b97d41b358a392b48d4f83f8d275ce56e47a55bf | 1,512 | class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
t.string :reset_password_token
t.... | 30.857143 | 91 | 0.648148 |
11594f4f25340ba5c4241199b31b0c7c0bfd0335 | 437 | require 'avalara'
module SpreeAvatax
class Config
class << self
[:username, :username=, :password, :password=, :endpoint, :endpoint=].each do |config|
delegate config, to: ::Avalara
end
attr_accessor :company_code
# the "use_production_account" config will replace the "endpoint... | 21.85 | 92 | 0.686499 |
39a458b91cc9a99f09e889d58867a210335c7a86 | 350 | class AddMinLinesForConsensusToCollection < ActiveRecord::Migration[5.2]
def change
add_column :collections, :max_line_edits, :integer
add_column :collections, :min_lines_for_consensus, :integer
add_column :collections, :min_lines_for_consensus_no_edits, :integer
add_column :collections, :min_percent_... | 38.888889 | 72 | 0.8 |
acb86a7ffdb1edf9933bb6ea284886bbeab93eb6 | 2,024 | # NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
task :set_annotation_options do
# You can override any of these by set... | 41.306122 | 79 | 0.460968 |
213b1b29abc6a2847aaa5c33b9beb08bb647f617 | 3,006 | module Plaid
module Client
module Logins
include Plaid::Client::Configurations
#connects to the plaid api.
#this can be used to retrieve information, get the access token, and initialize a user.
#sets the access token on the {Plaid::Client::Base}
#@return {PlaidResponse}
def c... | 34.159091 | 144 | 0.654691 |
ac570d6439db6bdcdba9b212cdce43a1012f5fcf | 102 | module ClinicsHelper
def clinic_params
params.require(:clinic).permit(:name, :addr)
end
end
| 12.75 | 48 | 0.72549 |
ff217f69d95170a541807ab3036ffd754d0f10e5 | 304 | class CreateTranslationPages < ActiveRecord::Migration[6.1]
def change
create_table :translation_pages do |t|
t.text :filename
t.references :translation, null: false, foreign_key: true
t.references :translation_chapter
t.integer :order
t.timestamps
end
end
end
| 23.384615 | 63 | 0.700658 |
d591291726de164f532ff037ebac70c7dc5f5447 | 2,098 | require "topological_inventory/providers/common/operations/topology_api_client"
require "topological_inventory/providers/common/operations/sources_api_client"
module TopologicalInventory
module Providers
module Common
module Operations
class EndpointClient
include TopologyApiClient
... | 33.301587 | 95 | 0.659676 |
e82ebb488b069ace384a40dbda2eef52ee7540e6 | 250 | class DataCopySolutionProposalNewColumn < ActiveRecord::Migration[5.2]
def change
SolutionProposal.all.each do |solution_proposal|
solution_proposal.update!(
decision_was_made: solution_proposal.solution
)
end
end
end
| 25 | 70 | 0.744 |
6a9485855b4c16965d9b3ee215d06a505007ea8e | 224 | class Representation::ItemRepresenter
attr_reader :model_object
def initialize(model_object)
@model_object = model_object
end
def to_h
model_object.attributes
end
def to_json
to_h.to_json
end
end | 14.933333 | 37 | 0.75 |
1818008eee70992b9b67b071d28f8451d7309ac4 | 334 | module Queries
class Article < Queries::BaseQuery
type Types::ArticleType, null: false
argument :id, String, required: true
def resolve(**args)
_, data_id = SoulsApiSchema.from_global_id(args[:id])
::Article.find(data_id)
rescue StandardError => e
GraphQL::ExecutionError.new(e)
... | 23.857143 | 59 | 0.676647 |
9116c25ed08ed6a3116389022d25fe009349388e | 3,839 | # Copyright © 2011 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of c... | 47.395062 | 156 | 0.719979 |
bf01aa7c84cdd4ad922f747c7b1a0914ad25740c | 18,918 | # -------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 29.28483 | 97 | 0.498731 |
ac0fcfc28b367617071fa01a8ce52285ede4e9db | 2,824 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'msf/core/auxiliary/report'
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Registry
include Msf::Auxiliary::Report
def initialize(i... | 29.113402 | 112 | 0.582861 |
21821a0637ff737508f13251b40cbed3a35301da | 946 | require 'test_helper'
class ShepherdMailerTest < ActionMailer::TestCase
test "account_activation" do
shepherd = shepherds(:michael)
shepherd.activation_token = Shepherd.new_token
mail = ShepherdMailer.account_activation(shepherd)
assert_equal "Account activation", mail.subject
assert_equal [shepherd.... | 33.785714 | 62 | 0.773784 |
1c4f8988fcb305732a7c5892a028505398206b64 | 5,048 | # frozen_string_literal: true
# Copyright 2020 Matthew B. Gray
#
# 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 applica... | 26.429319 | 123 | 0.71038 |
0353eed8e0d0044c29a9d8e8c0e2acd9c48180d6 | 249 | module AgaApiFactory
module Model
class Creative
attr_accessor :source_id,:title,:description1,:description2,:se_id,:se_status,:adgroup_se_id,:destination_url,:display_url,:status,:black_word,:trademark,:competing_word
end
end
end
| 31.125 | 175 | 0.783133 |
7998209b7b00e7a759eade60dfa2e42ed37e7990 | 3,719 | require 'spec_helper'
describe MembersHelper do
describe '#action_member_permission' do
let(:project_member) { build(:project_member) }
let(:group_member) { build(:group_member) }
it { expect(action_member_permission(:admin, project_member)).to eq :admin_project_member }
it { expect(action_member_pe... | 65.245614 | 212 | 0.736488 |
5d53b4d6531287f4ed17a4b7227f8b831e0df6cd | 242 | module AccountsHelper
def calculate_balance(account)
if account.transactions != nil
account.balance -= account.credit_limit - account.transaction.amount
else
account.balance = account.credit_limit
end
end
end
| 20.166667 | 74 | 0.719008 |
1a5ef5e38be296f6e1a60f15d6262e3289251f39 | 634 | # frozen_string_literal: true
require 'spec_helper'
support :input_helpers,
:operation_shared_examples,
:quickbooks_online_helpers
RSpec.describe LedgerSync::Adaptors::QuickBooksOnline::Vendor::Operations::Update do
include InputHelpers
include QuickBooksOnlineHelpers
let(:resource) do
Led... | 25.36 | 84 | 0.684543 |
798e031b7f16d74566efecb03711ff27a6297567 | 274 | lib_dir = File.expand_path('../../lib', __FILE__)
$:.unshift lib_dir
require 'chef'
require 'chef/knife'
require 'chef/knife/reporter_base'
require 'chef/knife/reporter_helpers'
require 'chef/knife/reporter_nodes_cli_report'
require 'chef/knife/reporter_roles_cli_report'
| 24.909091 | 49 | 0.791971 |
ed5c8365968e8c692202ed8f27936321ea444131 | 433 | cask 'lightworks' do
version '14.5.0'
sha256 '8b7d5890f7c0f2ede05d4de16a7a09e5bfc5b322690e70cbd2e481e3638e738c'
url "https://downloads.lwks.com/v#{version.major_minor.dots_to_hyphens}-new/lightworks_v#{version}.dmg"
name 'Lightworks'
homepage 'https://www.lwks.com/'
depends_on macos: '>= :mountain_lion'
... | 28.866667 | 105 | 0.766744 |
386307802a6fa8f187f7b204519087edd827e7c2 | 1,154 | # 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.793103 | 86 | 0.750433 |
5d3b791afc402ae9fe54431838a079636a765fec | 141 | require 'mxx_ru/cpp'
MxxRu::Cpp::exe_target {
required_prj 'so_5/prj.rb'
target 'sample.so_5.svc.exceptions'
cpp_source 'main.cpp'
}
| 11.75 | 36 | 0.716312 |
ff594d357d90b875bf0b1831242eda57fc728e08 | 77,478 | # encoding: utf-8
# vim:ts=4:sw=4:et:smartindent:nowrap
# Classes to manage various KML objects. See
# http://code.google.com/apis/kml/documentation/kmlreference.html for a
# description of KML
module Kamelopard
require 'singleton'
require 'kamelopard/pointlist'
require 'xml'
require 'yaml'
requir... | 31.662444 | 226 | 0.502478 |
03588e6bb480484e2ea944c0f85f030f96feca57 | 1,006 | def town_names(num = "", optional = "")
starts = ['Bed', 'Brunn', 'Dun', 'Far', 'Glen', 'Tarn']
middles = ['ding', 'fing', 'ly', 'ston']
ends = ['borough', 'burg', 'ditch', 'hall', 'pool', 'ville', 'way', 'worth']
waternames = ['-on-sea', ' Falls']
output = 3
if num == 5
output = 5
end
output.times do
... | 17.344828 | 77 | 0.592445 |
eda9d7c2d7ee0ea069490dba42934c082e918d50 | 12,190 | # Copyright 2019 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 applicable law or agreed to in writing, ... | 44.98155 | 131 | 0.609844 |
18e8ef4cefad50b4863faf29f371a20493036071 | 2,901 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
devise_for :admin_users
authenticate :admin_user do
match "/delayed_job" => DelayedJobWeb, anchor: false, via: %i(get post)
namespace :admin do
resources :snap_appl... | 29.602041 | 101 | 0.638056 |
bf043f3f0137189ed47b29292fe76c8684fead30 | 4,122 | # frozen_string_literal: true
require 'spec_helper'
describe GitlabRoutingHelper do
let(:project) { build_stubbed(:project) }
let(:group) { build_stubbed(:group) }
describe 'Project URL helpers' do
describe '#project_member_path' do
let(:project_member) { create(:project_member) }
it { expect(... | 37.472727 | 175 | 0.747695 |
bba856e7dbab4030d8f254510f758e0ab61f6620 | 2,669 | require 'rails_helper'
describe 'Editor', js: true do
let(:exercise) { FactoryBot.create(:audio_video, description: Forgery(:lorem_ipsum).sentence) }
let(:user) { FactoryBot.create(:teacher) }
before(:each) do
visit(sign_in_path)
fill_in('email', with: user.email)
fill_in('password', with: FactoryBo... | 32.156627 | 114 | 0.665043 |
61df8fd8e1d53d6278428faa21589c94806149fb | 1,121 |
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'coincheck-api'
Gem::Specification.new do |spec|
spec.name = 'coincheck-api'
spec.version = Coincheck::API::VERSION
spec.authors = ['Masayuki Higashino']
spec.email = ["mh.on... | 36.16129 | 74 | 0.647636 |
036346dc6c643cbf7bc8bf9cbd504896b4425f72 | 809 | module BasecampNinja; module Classic; module Modules; module CalendarEntry
def get_calendar_entry(project_id, id)
object = Hash.from_xml(connection["/projects/#{project_id}/calendar_entries/#{id}.xml"].get)["calendar_entry"]
BasecampNinja::Classic::CalendarEntry.new.extend(BasecampNinja::Classic::Renderer::Ca... | 47.588235 | 147 | 0.746601 |
e273d0034dc07665216a1c24f2e0088fcfd869f8 | 1,443 | # encoding: utf-8
class CampusImageUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploa... | 27.75 | 104 | 0.70894 |
6aa24e63553ca7c12d2d021ebba76795676c0b57 | 1,560 | # Cookbook Name:: oc-opsworks-recipes
# Recipe:: install-opencast-job-metrics
::Chef::Recipe.send(:include, MhOpsworksRecipes::RecipeHelpers)
include_recipe "oc-opsworks-recipes::update-python"
rest_auth_info = get_rest_auth_info
aws_instance_id = node[:opsworks][:instance][:aws_instance_id]
(private_admin_hostname, ... | 34.666667 | 212 | 0.728205 |
e9e81f96d297513342057de768a70ab49e9fef8f | 1,430 | # frozen_string_literal: true
require 'vk/api/objects'
require 'vk/schema/namespace'
module Vk
module API
class Notifications < Vk::Schema::Namespace
# @see https://github.com/VKCOM/vk-api-schema/blob/master/objects.json
class Notification < Vk::Schema::Object
# @return [String] Notification ... | 59.583333 | 236 | 0.705594 |
5d5f06979f222e3a13e6f8537c1093b98e90ceb6 | 2,277 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cloud_crowd/version'
Gem::Specification.new do |s|
s.name = 'cloud-crowd'
s.version = CloudCrowd::VERSION
s.date = CloudCrowd::VERSION_RELEASED
s.homepage = "http://wiki.github.com/docume... | 33.485294 | 97 | 0.597716 |
7a57ca5b99667adf334a9b76527d446b73e17577 | 421 | module Pione
module Lang
# DocumentParser is a parser for PIONE document.
class DocumentParser < Parslet::Parser
include Util::ParsletParserExtension
include CommonParser
include LiteralParser
include ExprParser
include ContextParser
include ConditionalBranchParser
in... | 21.05 | 52 | 0.68171 |
d588623b9a2976815ff6d77fa29ca9b905e248e4 | 493 | module Resources::Discounts
class Actions::Create < ::Actions::Save
private
def model
@model ||= Model.new(model_params)
end
# Indirect mapping
def model_params
{
name: params['discount']['name'],
description: params['discount']['description'],
code: ... | 23.47619 | 58 | 0.574037 |
b9e5acb539077b870320746eb6a92e740cc7a7f8 | 8,873 | =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.31.1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
module Plaid
class Configuration
# Plaid Environment mapping
# prod... | 29.576667 | 163 | 0.628987 |
7ae7e98dd8b989d9964486f6d4d9408bae584746 | 1,547 | module DotMailer
class CampaignSummary
%w(
numUniqueOpens
numUniqueTextOpens
numTotalUniqueOpens
numOpens
numTextOpens
numTotalOpens
numClicks
numTextClicks
numTotalClicks
numPageViews
numTotalPageViews
numTextPageViews
numForwards
numTextForwardsge
numE... | 19.833333 | 66 | 0.714932 |
ac40c7ed62b07dd4a7b07fc4c0456ea13691e685 | 1,744 | class XcbProto < Formula
desc "X.Org: XML-XCB protocol descriptions for libxcb code generation"
homepage "https://www.x.org/"
url "https://xcb.freedesktop.org/dist/xcb-proto-1.14.tar.gz"
sha256 "1c3fa23d091fb5e4f1e9bf145a902161cec00d260fabf880a7a248b02ab27031"
license "MIT"
revision OS.mac? ? 2 : 6
bottl... | 37.913043 | 122 | 0.747133 |
38460a2512bd730b7c032ad84e68a93acf10a40d | 1,791 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
# GET /posts.json
def index
@posts = Post.all
end
# GET /posts/1
# GET /posts/1.json
def show
end
# GET /posts/new
def new
@post = Post.new
end
# GET /posts/1... | 23.88 | 88 | 0.637633 |
9121babeeddca1402956421552cb143b72b618ef | 7,437 | #
# Author:: Steven Danna (steve@opscode.com)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | 29.050781 | 143 | 0.641926 |
26e18bf75f03cd711c1a41633abb23db8cc24fb3 | 575 | require 'digest/md5'
require 'tempfile'
module Chuckle
module Util
module_function
def hash_to_query(hash)
q = hash.map do |key, value|
key = CGI.escape(key.to_s)
value = CGI.escape(value.to_s)
"#{key}=#{value}"
end
q.sort.join('&')
end
def md5(s)
Dig... | 16.911765 | 44 | 0.563478 |
18512c69780ff8a042a0265f3e698db7ca7c17e7 | 1,220 | # == Schema Information
#
# Table name: activities
#
# id :bigint(8) not null, primary key
# description :text
# difficulty :integer
# name :string
# schedule :text
# created_at :datetime not null
# updated_at :datetime not null
# venue_id :bigint(8)
#
# Indexes
#... | 23.461538 | 61 | 0.705738 |
d53abcdd1a9ce221903a61632136ae4d7e4fcb2a | 596 | Pod::Spec.new do |s|
s.name = 'CommonKeyboard'
s.version = '1.0.6'
s.license = { :type => "MIT", :file => "LICENSE.md" }
s.summary = 'An elegant Keyboard library for iOS.'
s.homepage = 'https://github.com/kaweerutk/CommonKeyboard'
s.author = { "Kaweerut Kanthawong" => "iamkevinjoon@gmail.com" }
s.source ... | 25.913043 | 93 | 0.637584 |
334a00187c6de0a36fd493c75815f959cadbe77f | 663 | require 'spec_helper'
describe 'nrpe::service' do
on_supported_os(facterversion: '3.6').each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context 'by default' do
let(:pre_condition) { 'include nrpe' }
service_name = case facts[:osfamily]
... | 22.862069 | 60 | 0.46003 |
ab9585920d2496686b0edc51239359fccfbcaeb5 | 2,005 | # frozen_string_literal: true
require "json"
module BeyondApi
class Request
class << self
[:get, :delete].each do |method|
define_method(method) do |session, path, params = {}|
response = BeyondApi::Connection.default.send(method) do |request|
request.url(session.api_url + pa... | 35.803571 | 114 | 0.641397 |
acd988f1b901279db46f86eed1a86da9f41ff90c | 2,180 | require "addressable/uri"
require "socket"
require "openssl"
class CarrierPigeon
def initialize(options={})
[:host, :port, :nick, :channel].each do |option|
raise "You must provide an IRC #{option}" unless options.has_key?(option)
end
tcp_socket = TCPSocket.new(options[:host], options[:port])
... | 28.311688 | 79 | 0.637156 |
1dfebe1e616a72433f54d742a9dc94e965da11e5 | 3,944 | require 'datadog/instrumentation/hook_point'
require 'datadog/instrumentation/hook_point_error'
require 'datadog/instrumentation/strategy/prepend'
require 'datadog/instrumentation/strategy/chain'
module Datadog
module Instrumentation
# Represents a target in which to inject a hook
class HookPoint
DEFAU... | 27.2 | 98 | 0.617647 |
18db03a5e4fcc0ca26905a5e527c3bb210a02ecf | 208 | require 'faker'
FactoryGirl.define do
factory :rating do
logline_id { Faker::Number.between(1, 50) }
user_id { Faker::Number.between(1, 20) }
rating { Faker::Number.between(1, 100) }
end
end
| 20.8 | 47 | 0.668269 |
91192b0f93487ea6d616dd76320a44874cbf5fd3 | 4,165 | require 'spec_helper'
RSpec.describe NgrokAPI::Services::TCPEdgeBackendModuleClient do
let(:base_url) { 'https://api.ngrok.com' }
let(:path) { '/edges/tcp/%{id}/backend' }
let(:not_found) do
NgrokAPI::Errors::NotFoundError.new(response: endpoint_backend_result)
end
before(:each) do
@client = class_d... | 33.58871 | 105 | 0.646579 |
5df9bc83bea089cb83720879cb66fd18f11f93ea | 1,623 | # Add GPO records
# cluster with existing Registry Records
# create new Registry Records if no match can be found
#
# run once. use this as lessons for weekly update
#
require 'registry_record'
require 'source_record'
require 'normalize'
require 'json'
require 'dotenv'
require 'pp'
begin
Mongoid.load!(File.expand_pa... | 19.094118 | 80 | 0.677757 |
ed633604696eca311171b76011c6c168abeb6eed | 17,196 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.7
=end
require 'date'
module NSXT
# Contains the summary of the results of an application discovery session
class AppDiscovery... | 34.95122 | 508 | 0.642824 |
d5f107641e3ee36f3342152e15181171d26f68da | 855 | # generated by 'rake generate'
require 'cocoa/bindings/NSIndexSet'
module Cocoa
class NSMutableIndexSet < Cocoa::NSIndexSet
attach_method :addIndex, :args=>1, :names=>[], :types=>["Q"], :retval=>"v"
attach_method :addIndexes, :args=>1, :names=>[], :types=>["@"], :retval=>"v"
attach_method :addIndexesInRan... | 57 | 105 | 0.625731 |
e95883a02f714356e25611e7da8595e705d6d08a | 13,561 | =begin
#Ahello REST API documentation
#На данной странице вы можете выполнять запросы к API, для этого необходимо указать 'appId', который был передан вам сотрудниками тех. поддержки в поле api_key. Укажите также PartnerUserId (это CRM Id пользователя или его email ), partnerUserId передается в заголовке запроса. Важ... | 32.598558 | 568 | 0.710788 |
f7d3458ff51b897b4857e0daf9896d62aafcc5b3 | 181 | Deface::Override.new(
virtual_path: 'spree/shared/_footer',
name: 'pages_in_footer',
insert_bottom: '#footer-right',
partial: 'spree/static_content/static_content_footer'
)
| 25.857143 | 55 | 0.756906 |
bb32d690684531b38c29bcaf8596fad6f8f980a8 | 535 | require 'tzinfo/timezone_definition'
module TZInfo
module Definitions
module Africa
module Mogadishu
include TimezoneDefinition
timezone 'Africa/Mogadishu' do |tz|
tz.offset :o0, 10888, 0, :LMT
tz.offset :o1, 10800, 0, :EAT
tz.offset :o2, 9000, 0, :BEA... | 24.318182 | 57 | 0.575701 |
b93382e56c11872a565f842a44b493258d05f0fe | 749 | require 'fintoc/errors'
RSpec.describe Fintoc::Errors do
let(:error) { {
message: 'Missing required param: link_token',
doc_url: 'https://fintoc.com/docs#invalid-request-error'
} }
it 'raises a Invalid Request Error' do
expect { raise Fintoc::Errors::InvalidRequestError.new(error[:message], error[... | 37.45 | 94 | 0.715621 |
4a8b70c6ae22ffda877dc8ef7be8376a79ee7dfb | 21 | module Exceptions
end | 10.5 | 17 | 0.904762 |
18f6dd31879ac7b549078c6c06b12b8f2117e736 | 23,608 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Chris Read <chris.read@gmail.com>
# Copyright:: Copyright (c) 2008-2016 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.
#... | 39.346667 | 259 | 0.603143 |
611255214f47736f8b1c9f08c1e239aabf44ae2b | 1,663 | #
# Be sure to run `pod lib lint BlinkingLabel.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'Blinki... | 40.560976 | 118 | 0.662658 |
6223446decdba9eb94707db20fadacd953562739 | 1,484 | module HisAdapter
module Soap
class Client
class ApiNotFoundError < StandardError; end
attr_accessor :client, :adapter
def initialize(adapter:, **options)
@adapter = adapter.to_s
@client = Savon.client(wsdl: wsdl, **options)
end
def request(api, params = nil, **opt... | 29.098039 | 78 | 0.433962 |
18c7cf22dbc085e1b3cd9713b34b805a9991a8c2 | 585 | cask 'remembear' do
version '0.4.2'
sha256 '6f07a01e4b9f22c0a6359c81ee5ad0fec8266ae8d99ba6ae326b79ff123d08fa'
# amazonaws.com/tunnelbear/downloads/mac/remembear was verified as official when first introduced to the cask
url "https://s3.amazonaws.com/tunnelbear/downloads/mac/remembear/RememBear-#{version}.zip"
... | 41.785714 | 111 | 0.791453 |
ffc91dda117fee4031bb3639b4c849966d19be92 | 5,829 | # 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... | 38.602649 | 126 | 0.715389 |
d55455475f232f1f19d19c1cb8dca3fd0cf163ea | 1,442 | require 'test_helper'
include Scrivito::ControllerHelper
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
login = LoginPage.instance
@login_path = "/#{login.slug + login.id}"
end
test "SSL login with invalid information" do
https!
get @login_path
assert_template 'login_page/i... | 27.730769 | 72 | 0.685853 |
1cbc7cb4a669b6eefa9efbe7cbed348f9447e13e | 4,944 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 29.783133 | 78 | 0.632888 |
87e975a076f0efc5477dbf7cd3734a41b0e755e4 | 395 | LatoPages::Engine.routes.draw do
root 'back/pages#index'
resources :pages, module: 'back'
scope '/api/v1/' do
get 'fields', to: 'api/v1/fields#index'
get 'fields/:page', to: 'api/v1/fields#index'
get 'fields/:page/:lang', to: 'api/v1/fields#index'
get 'field/:name/:page', to: 'api/v1/fields#sh... | 23.235294 | 59 | 0.632911 |
6a1bf6735f071d71725782d385f2cdd842385eb3 | 288 | FactoryGirl.define do
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
#
# Example adding this to your spec_helper will load these Factories for use:
# require 'spree_historical_report/factories'
end
| 41.142857 | 130 | 0.795139 |
21efdb4f9933418cb12c38f974092c5c5881ecf9 | 1,278 | # frozen_string_literal: true
module ElasticAPM
# @api private
module Spies
# @api private
class MongoSpy
def install
::Mongo::Monitoring::Global.subscribe(
::Mongo::Monitoring::COMMAND,
Subscriber.new
)
end
# @api private
class Subscriber
... | 20.612903 | 72 | 0.550078 |
871934d96774cbf8302ee19aaec50608821a8e21 | 1,003 | require "language/node"
class GatsbyCli < Formula
desc "Gatsby command-line interface"
homepage "https://www.gatsbyjs.org/docs/gatsby-cli/"
url "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-2.11.1.tgz"
sha256 "9ed953e5195cfdcd7d7ce55c22dff2c10f02627abd95b7accdea8947dc40e824"
bottle do
cellar :any_... | 35.821429 | 103 | 0.768694 |
ac3e386953fcea36a96d0792caaf3825caafb8b9 | 1,054 | module Blobsterix
module Jsonizer
def json_var(*var_names)
@json_vars = (@json_vars||[])+var_names.flatten
end
def json_vars
@json_vars||= []
end
module Methods
def render_json(obj=nil)
Http.OK (obj||self).to_json, "json"
end
def render_xml(obj=nil)
... | 23.422222 | 72 | 0.553131 |
bba06c3dd47c6f25e68c4938ed83ad8633fbc602 | 55 | module RadiantCommentsExtension
VERSION = '1.0.2'
end | 18.333333 | 31 | 0.781818 |
4ad233e4b68193e3832ce3f4a7333923eb7eecd4 | 1,124 |
default['dev-stack']['app']['root_dir'] = '/vagrant'
default['dev-stack']['app']['fqdn'] = 'rails.dev'
# This is used in the upstream in the nginx config. It assumes the default Rails port of 4000
default['dev-stack']['nginx']['rails_upstream'] = 'localhost:3000'
# If you are using unicorn, then you need to set it t... | 46.833333 | 93 | 0.685053 |
e28c9de56ce674e7c62bf33e4887fd925c95f005 | 4,485 | module ActsAsTaggableOn::Taggable
module Ownership
def self.included(base)
base.extend ActsAsTaggableOn::Taggable::Ownership::ClassMethods
base.class_eval do
after_save :save_owned_tags
end
base.initialize_acts_as_taggable_on_ownership
end
module ClassMethods
def a... | 35.595238 | 148 | 0.626979 |
4a5b914835dd441b2e8513e05697439fd85f0c3f | 238 | require 'fileutils'
# copies js file into public/javascripts folder
FileUtils.cp File.join(File.dirname(__FILE__), 'javascripts/js_mouse_keyboard_interaction.js'), File.join(File.dirname(__FILE__), '../../../../../../public/javascripts') | 79.333333 | 169 | 0.752101 |
6a9b02712ffce8efd465eb1f87fe48bd696b818c | 689 | #!/usr/bin/env ruby
require 'tempfile'
def build(input, out)
File.readlines(input).each do |line|
if relative_path = line[/^require_relative\s+(["'])(\S+)\1$/, 2]
path = File.join(File.dirname(input), relative_path)
path += ".rb"
build(path, out)
out.puts
else
out.print line
... | 19.138889 | 68 | 0.629898 |
1117225759e088c90b40345ebaa37498c6ef264c | 7,144 | =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 TagReferenceRefer... | 29.766667 | 237 | 0.6229 |
62e4c19eb856766aec8b492f6065af14060e9fc2 | 244 | cask "desktoputility" do
version :latest
sha256 :no_check
url "https://sweetpproductions.com/products/desktoputility/DesktopUtility.dmg"
name "DesktopUtility"
homepage "https://sweetpproductions.com/"
app "DesktopUtility.app"
end
| 22.181818 | 80 | 0.770492 |
aceed2eacde7286c876edb5f3c0009688b89162f | 3,469 | module LandingPageVersion::Section
class Listings < Base
ATTRIBUTES = [
:id,
:kind,
:title,
:paragraph,
:button_color,
:button_color_hover,
:button_title,
:button_path,
:price_color,
:no_listing_image_background_color,
:no_listing_image_text,
... | 21.955696 | 89 | 0.595849 |
f7988a61893133774798ba847201e696c3109c4a | 1,633 | # frozen_string_literal: true
require 'sidekiq'
module VBADocuments
class UploadScanner
include Sidekiq::Worker
def perform
return unless Settings.vba_documents.s3.enabled
VBADocuments::UploadSubmission.where(status: 'pending').find_each do |upload|
processed = process(upload)
... | 29.160714 | 102 | 0.679731 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.