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 |
|---|---|---|---|---|---|
21b1578f168f5df6a6d8a3a6c5779de63ef94a55 | 5,043 | # frozen_string_literal: true
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, a... | 43.852174 | 114 | 0.763038 |
f8705f37e977ae0fb3eca49c8b6260f98f5e4b7f | 210 | json.array!(@accommodation_charges) do |accommodation_charge|
json.extract! accommodation_charge, :id, :company_id, :name, :amount
json.url accommodation_charge_url(accommodation_charge, format: :json)
end
| 42 | 72 | 0.804762 |
e86b2235278a0a8eb69dc74f1dbd35dee59776f3 | 1,561 | class Tcpflow < Formula
desc "TCP/IP packet demultiplexer"
homepage "https://github.com/simsong/tcpflow"
url "https://downloads.digitalcorpora.org/downloads/tcpflow/tcpflow-1.6.1.tar.gz"
sha256 "436f93b1141be0abe593710947307d8f91129a5353c3a8c3c29e2ba0355e171e"
license "GPL-3.0"
livecheck do
url "https:... | 33.212766 | 122 | 0.66688 |
e962b2025c6b6afda42e2ac1634df211db0c469d | 1,417 | class Hugo < Formula
desc "Configurable static site generator"
homepage "https://gohugo.io/"
url "https://github.com/gohugoio/hugo/archive/v0.57.2.tar.gz"
sha256 "435267c639ce58daea14c1f7d1f64bdd9176d20bd5719457e11051b88a6fffe6"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_rel... | 32.953488 | 93 | 0.704305 |
397a068bafe971c4274b0767df1e5fe916248f00 | 168 | class AddCoordinatorIdToEvent < ActiveRecord::Migration
def change
add_column :events, :coordinator_id, :integer
add_index :events, :coordinator_id
end
end
| 24 | 55 | 0.77381 |
012e31b907adc6b794b2f39af5b8c20a50c174af | 1,329 | #
# Cookbook:: net_snmp
# Resource:: package
#
# Copyright:: Ben Hughes <bmhughes@bmhughes.co.uk>
#
# 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/LICENS... | 23.732143 | 74 | 0.708804 |
26e734fb5b7775e75d40b5639e37fcc44a3068f4 | 1,409 | require 'rails_helper'
require 'cancan/matchers'
describe Ability do
let(:ability) { Ability.new(user) }
subject { ability }
let(:admin_set) { create(:admin_set) }
context 'for a user who is not logged in' do
let(:user) { User.new }
it 'has general ability' do
expect(subject).to be_able_to(:rea... | 32.022727 | 85 | 0.683463 |
28c8e74a4e5bed6a0d14a12b65ebd3b36d7b459d | 242 | FactoryBot.define do
factory :education, class: Candidates::Registrations::Education do
urn { 11_048 }
degree_stage { "Other" }
degree_stage_explaination { "Khan academy, level 3" }
degree_subject { "Bioscience" }
end
end
| 26.888889 | 68 | 0.706612 |
875bc7c14cfd64d8c7d4d27ec0a0cf7e738d375d | 211 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'send_nsca'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
| 21.1 | 66 | 0.739336 |
b9134b8d6abcc0d7e44da5e4444afe38ccd2f31a | 2,834 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Checks::DiffCheck do
include_context 'change access checks context'
describe '#validate!' do
let(:owner) { create(:user) }
let!(:lock) { create(:lfs_file_lock, user: owner, project: project, path: 'README') }
before do
allow(... | 31.842697 | 154 | 0.676076 |
0816013b3eabb89f85c9ce5b371332d6cde6def2 | 1,558 | Shindo.tests('AWS::Glacier | glacier archive tests', ['aws']) do
pending if Fog.mocking?
Fog::AWS[:glacier].create_vault('Fog-Test-Vault-upload')
tests('initiate and abort') do
id = Fog::AWS[:glacier].initiate_multipart_upload('Fog-Test-Vault-upload', 1024*1024).headers['x-amz-multipart-upload-id']
retu... | 51.933333 | 159 | 0.716945 |
6a7e28f2f6f59aeea88ef82c6393fc61e420763e | 636 | class Object
##
# call-seq:
# obj.tap{|x|...} -> obj
#
# Yields <code>x</code> to the block, and then returns <code>x</code>.
# The primary purpose of this method is to "tap into" a method chain,
# in order to perform operations on intermediate results within the chain.
#
# (1..10... | 31.8 | 78 | 0.512579 |
bbdcc102dc741742412c0a904b30866b69ec5b91 | 2,722 | # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
#
# This file is part of Maruku.
#
# Maruku is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at y... | 30.244444 | 81 | 0.648053 |
ed37f28821d51f4603e4f7b5ec9cfa2c431dddf8 | 4,478 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe V2::ProfileSerializer do
subject(:serializer) { described_class.new(profile, adapter_options) }
let(:profile) { create(:profile) }
let(:adapter_options) { {} }
let(:result) { JSON.parse(serializer.serializable_hash.to_json).deep_symbolize_ke... | 28.705128 | 115 | 0.591335 |
08030c6a414acf343c5263710b2b3079b549d676 | 1,044 | require 'spec_helper'
describe Tapyrus::Message::HeaderAndShortIDs do
describe '#short_id' do
subject {
Tapyrus::Message::HeaderAndShortIDs.parse_from_payload('0100000006d1d602bae800102d3a615fb1d546599308435762d03a8d59e4a7bb35bb7e2abfdb311f857e830878fbb88e1f8dbde23c384db591ceb0c622aa252e2a56a7f6f1f4c8a0b9... | 69.6 | 612 | 0.894636 |
e8962777b790f5ebd763968e2737d46706f2c140 | 563 | # frozen_string_literal: true
describe Facts::Debian::Os::Selinux do
describe '#call_the_resolver' do
it 'returns a fact' do
expected_fact = double(Facter::ResolvedFact, name: 'os.selinux', value: { enabled: 'value' })
allow(Facter::Resolvers::SELinux).to receive(:resolve).with(:enabled).and_return('... | 37.533333 | 113 | 0.705151 |
1db397b1b9c1fff39f183923adeb799e69785aad | 5,951 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 32.167568 | 839 | 0.615527 |
f82002d855d64f7f5bec1ab1c048f231712d8bd3 | 1,825 | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook Name:: homebrew
# Providers:: tap
#
# Copyright 2011-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | 30.932203 | 93 | 0.703562 |
5d5a7ef0aa64a778c8e5bc5e8cfe026faaed6120 | 1,724 | module Api
class LogosController < ApplicationController
before_action :set_logo, only: [:show, :update, :destroy]
# GET /logos
# def index
# @logos = Logo.all
# render json: @logos
# end
# GET /logos_full
def index_full
query = 'SELECT l.id, l.text, l.image_id, i.location... | 23.944444 | 75 | 0.593387 |
4abc5898e20113739ae7dfe1015bede49f96d9ee | 2,273 | class Ortp < Formula
desc "Real-time transport protocol (RTP, RFC3550) library"
homepage "https://www.linphone.org/technical-corner/ortp"
url "https://gitlab.linphone.org/BC/public/ortp/-/archive/4.4.26/ortp-4.4.26.tar.bz2"
sha256 "8c50f7fef2b2d7ab9549ebc4108a49656b62e134575a73c3a875ac682be95648"
license "GPL... | 33.925373 | 99 | 0.688517 |
87c85413f07cbf19ace67647836ba398066a2524 | 4,054 | require_relative './operation'
require 'bigdecimal'
require 'bigdecimal/util'
module Dentaku
module AST
class Arithmetic < Operation
def initialize(*)
super
unless valid_left?
raise NodeError.new(:numeric, left.type, :left),
"#{self.class} requires numeric operand... | 20.474747 | 105 | 0.540207 |
79a492a7b3d1b8915dffaed9041157f056b41d03 | 582 | require 'sinatra'
require 'net/ftp'
require 'uri'
get '/' do
'Use /download?uri=ftp://127.0.0.1:2121/&file=/path/to/file.txt to download a ftp file.'
end
get '/download' do
content_type 'application/octet-stream'
begin
uri = URI.parse(params['uri'])
ftp = Net::FTP.new
ftp.connec... | 21.555556 | 92 | 0.592784 |
b91811d5327e665dfe0db7d9734ebb35180896c9 | 332 | module Rails # :nodoc:
class Initializer # :nodoc:
WarpDrive::RAILS_INIT_METHODS.each do |meth|
alias_method "#{meth}_without_warp_drive", meth
define_method("#{meth}_with_warp_drive", WarpDrive::Procs.send(meth))
alias_method meth, "#{meth}_with_warp_drive"
end
end # Initializer... | 30.181818 | 75 | 0.689759 |
1c9ff1f6111bbb1dff9a2d937fec47fd5126b502 | 784 | # Include it in your workers to enable progress monitoring and stopping jobs.
module BackgroundFu::WorkerMonitoring
# In most cases you will have some loop which will execute known (m) times.
# Every time the loop iterates you increment a counter (n).
# The formula to get progress in percents is: 100 * n / m... | 39.2 | 84 | 0.735969 |
7a66044c5b69a30ce788738a27befc89fafa2fb1 | 9,210 | # frozen_string_literal: true
module API
class ProjectImport < ::API::Base
include PaginationParams
helpers Helpers::ProjectsHelpers
helpers Helpers::FileUploadHelpers
feature_category :importers
urgency :low
before { authenticate! unless route.settings[:skip_authentication] }
helpers... | 43.443396 | 164 | 0.666992 |
3951106dd227f4b1927c3ffa8d2bf1b3cbfdd954 | 140 | class WorkflowsProjectIdNotNull < ActiveRecord::Migration[5.1]
def change
change_column_null :workflows, :project_id, false
end
end
| 23.333333 | 62 | 0.785714 |
33233ec6e3fcbf9d319396290f4c8da6dffdde70 | 17,206 | # encoding: utf-8
#
# This file is machine generated. DO NOT EDIT!
#
if Kernel.respond_to?(:require_relative)
require_relative("./helper")
else
$:.unshift(File.dirname(__FILE__))
require 'helper'
end
#
# == Purpose
#
# Tests for the #{UTF8::Validator} implementation.
#
# Test data pulled and generated from:
#
# ... | 95.588889 | 538 | 0.597989 |
3964cf8d689fbefa6f2170527e56d11ab5452dce | 1,282 | # encoding: utf-8
require 'spec_helper'
describe Yardstick::MeasurementSet, '#puts' do
let(:document) { DocumentMock.new }
let(:set) do
described_class.new([failed.new, successful.new, successful.new])
end
let(:failed) do
Class.new do
def ok?
false
end
def puts(io)
... | 18.57971 | 69 | 0.562402 |
9122b5e31ea56c6c94a9e548003704c3b3ff1c01 | 80 | require 'spec_helper'
module ChiliPepper
describe ItemDecorator do
end
end
| 11.428571 | 27 | 0.8 |
332ee1b98c0f5f05b5e2bcc695bc6c40278b6dc3 | 97 | # desc "Explaining what the task does"
# task :postload_google_ads do
# # Task goes here
# end
| 19.4 | 38 | 0.71134 |
e289f8ce36662545306a8a39392c3bdf10f8bae2 | 164 | require File.expand_path('../../../spec_helper', __FILE__)
require 'date'
describe "DateTime#to_datetime" do
it "needs to be reviewed for spec completeness"
end
| 23.428571 | 58 | 0.743902 |
e80a3d70c8425f101aa7fc3551286f8f1773091d | 2,482 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::FlowCustomTransactionPKArg... | 40.688525 | 408 | 0.686543 |
01de4cd40e5c50aa9f44f256cd7961c61ef6f7eb | 2,674 | class Libantlr3c < Formula
desc "ANTLRv3 parsing library for C"
homepage "https://www.antlr3.org/"
url "https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz"
sha256 "ca914a97f1a2d2f2c8e1fca12d3df65310ff0286d35c48b7ae5f11dcc8b2eb52"
license "BSD-3-Clause"
revision 1
bottle do
sha256 cellar: :any, ... | 45.322034 | 154 | 0.686986 |
39e0f5afd8e401b09b7b1b68df2f96d43da9670d | 734 | cask 'electron' do
version '6.0.9'
sha256 '635cb3a6915fde5e859ed5f4a0641051c1ffd690c468313f339d5654ecdab65a'
# github.com/electron/electron was verified as official when first introduced to the cask
url "https://github.com/electron/electron/releases/download/v#{version}/electron-v#{version}-darwin-x64.zip"
a... | 36.7 | 110 | 0.689373 |
21ce1aa78974a54e785fe93d36bfb9209c56ba81 | 1,941 | # Use this setup block to configure all options available in Bootsy.
Bootsy.setup do |config|
# Default editor options
# You can also override them locally by passing an
# editor_options hash to bootsy_area
config.editor_options = {
font_styles: true,
emphasis: true,
lists: true,
html: true,... | 27.728571 | 75 | 0.685729 |
4ac7c7df38de4a3b0dcdc342f1c11d687125f94e | 3,064 | # config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"
set :application, "in_the_eyes"
set :repo_url, "https://github.com/tuliang/in-the-eyes.git"
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set... | 26.643478 | 113 | 0.680483 |
790b5a9bad0309b1f8c9a77b093cec2e5ca5c535 | 1,646 | class Fetch < Formula
desc "Download assets from a commit, branch, or tag of GitHub repositories"
homepage "https://www.gruntwork.io/"
url "https://github.com/gruntwork-io/fetch/archive/v0.4.2.tar.gz"
sha256 "b8ba80823e961fd2761ef2d855d308b69313930e0ffd445e34840a2ef9b4c6fb"
license "MIT"
head "https://githu... | 51.4375 | 123 | 0.776428 |
21d5741ae86989069cbc9299a7d63f98d90a6d9a | 26,989 | require 'active_merchant/billing/gateways/braintree/braintree_common'
begin
require 'braintree'
rescue LoadError
raise 'Could not load the braintree gem. Use `gem install braintree` to install it.'
end
unless Braintree::Version::Major == 2 && Braintree::Version::Minor >= 78
raise "Need braintree gem >= 2.78.0.... | 39.573314 | 156 | 0.614547 |
e9d3770834ac6490cba051b42993820953ba6fe1 | 334 | Deface::Override.new(:virtual_path => "products/_cart_form",
:name => "converted_product_price_331970321",
:insert_after => "[data-hook='product_price'], #product_price[data-hook]",
:partial => "products/pricing",
:disab... | 55.666667 | 99 | 0.517964 |
7a7931a86583889448cfcacfcfb2002a610892cf | 145 | class RemoveSectionGroupsFromJourneys < ActiveRecord::Migration[6.1]
def change
remove_column :journeys, :section_groups, :jsonb
end
end
| 24.166667 | 68 | 0.786207 |
1ae5ab7d08e855427e2525eb77e59c52fcf541e5 | 4,410 | module CurationConcern
module Model
extend ActiveSupport::Autoload
extend ActiveSupport::Concern
included do
include Sufia::ModelMethods
include Hydra::ModelMethods
include Curate::ActiveModelAdaptor
#after_solrize << :index_collection_pids
has_many :collections, property:... | 39.375 | 144 | 0.728118 |
08adbd848d0e40a9da6ede35983075feef283676 | 1,219 | require "spec_helper"
describe CacheHelper do
describe "#cache_keys_for_all" do
it "returns an array of cache keys" do
create(:project)
create(:category)
expect(helper).to receive(:current_subdomain).
and_return("some_subdomain").twice
expect(helper.cache_keys_for_all(:projects,... | 32.945946 | 77 | 0.73831 |
d5c136e79c4fd4a17495a4cbf975b663f3aaad26 | 1,398 | # 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 authoritative sou... | 33.285714 | 86 | 0.722461 |
03939b25651c5206a6c9657a34956cc7997f6567 | 1,357 | require 'rake'
require 'rake/clean'
namespace(:dependencies) do
namespace(:glib) do
# glib needs mingw and downloads
package = Shoes::Glib
directory package.target
CLEAN.include(package.target)
# Put files for the :download task
dt = checkpoint(:glib, :download)
package.files.each do |f|... | 25.603774 | 68 | 0.649226 |
1c446ab1da1bae595f29473203f687d6e1a8657a | 1,319 | require 'rails_helper'
RSpec.describe EventsController, type: :controller do
describe 'GET #index' do
it 'response 200 when visiting' do
get :index
expect(response).to have_http_status(200)
end
it 'renders index.html template' do
get :index
expect(response).to render_template(:ind... | 30.674419 | 102 | 0.658074 |
0189b8255916e0484c24ef80f54a22f2fe321cbc | 393 | class CreateNotifications < ActiveRecord::Migration[5.2]
def change
create_table :notifications do |t|
t.references :apartment, index: true, foreign_key: true, null: false
t.references :user, index: true, foreign_key: true
t.string :title, null: false
t.string :message, null: false
... | 28.071429 | 74 | 0.692112 |
111e609e1ef650a0f0bcc5cf6d163107ef4b8d50 | 1,734 | # coding: utf-8
#
# Be sure to run `pod lib lint SDGPostMan.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouragedSDGPostMan
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.nam... | 35.387755 | 106 | 0.647059 |
1dd56d1cb4716246e5454c757dd462b58c7a8713 | 42 | module NxtSchema
module Node
end
end
| 7 | 16 | 0.738095 |
01c77dedbbf6b9ec2cb87dd6050215d90af20727 | 3,133 | # This migration comes from gatherin_auth (originally 20191225033339)
class CreateDoorkeeperTables < ActiveRecord::Migration[6.0]
def change
create_table :oauth_applications do |t|
t.string :name, null: false
t.string :uid, null: false
t.string :secret, null: false
# Remove `nu... | 38.679012 | 98 | 0.675391 |
62628daf24da4c2683b053130793bb3205e4fd35 | 1,695 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::SlashCommands::IssueShow do
describe '#execute' do
let(:issue) { create(:issue, project: project) }
let(:project) { create(:project) }
let(:user) { issue.author }
let(:chat_name) { double(:chat_name, user: user) }
let(:re... | 26.904762 | 87 | 0.641888 |
26fbeb5445bb4fd93b1fab82a57a2ab421548fde | 1,565 | # frozen_string_literal: true
# Copyright (c) 2018 Robert Haines.
#
# 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 a... | 25.655738 | 80 | 0.644728 |
385e0fa4f7e0737a18e7442d7df88857d1562b1e | 2,423 | # frozen_string_literal: true
module QA
module Resource
##
# Ensure we're in our sandbox namespace, either by navigating to it or by
# creating it if it doesn't yet exist.
#
class Sandbox < GroupBase
class << self
# Force top level group creation via UI if test is executed on dot_co... | 27.534091 | 110 | 0.605861 |
614eae5320a8fc6d883ab922d96d16a9a7ff0d2e | 911 | require 'spec_helper_acceptance'
describe 'unique function' do
describe 'success' do
pp1 = <<-DOC
$a = ["wallless", "wallless", "brrr", "goddessship"]
$o = unique($a)
notice(inline_template('unique is <%= @o.inspect %>'))
DOC
it 'uniques arrays' do
apply_manifest(pp1, :catch_failu... | 28.46875 | 86 | 0.616905 |
f8b44e177ae99f3b5433865060f14fcb585e09de | 6,061 | # == Schema Information
#
# Table name: builds
#
# id :integer not null, primary key
# project_id :integer
# ref :string(255)
# status :string(255)
# finished_at :datetime
# trace :text
# created_at :datetime
# updated_at :datetime
# sha :string(255)
# started_a... | 23.045627 | 110 | 0.626629 |
183a6a4f6920cd3e0544e0df4b3f98e5e02740e6 | 12,587 | require_relative '../../../../environments/rspec_env'
RSpec.describe CukeLinter do
let(:test_model_tree) { generate_lintable_model }
let(:test_linters) { [generate_fake_linter] }
let(:test_formatters) { [[generate_fake_formatter, "#{create_directory}/junk_output_file.txt"]] }
let(:linting_options) { { model_t... | 44.320423 | 201 | 0.558433 |
4afc5837d3a7f73fa71604257f0e9f51db718fda | 998 | Pod::Spec.new do |s|
s.name = 'Layout-Swift'
s.module_name = 'Layout'
s.version = '1.0.0'
s.summary = 'Swift Autolayout DSL for iOS & macOS'
s.description = <<-DESC
Swift Autolayout DSL for iOS & macOS.
DESC
s.homepage = 'https://github.com/mitchtreece... | 24.341463 | 102 | 0.572144 |
ed1b94b845362a85536646cd1e33f4bfdfabe002 | 295 | class TranslateCategories < ActiveRecord::Migration
def self.up
Category.create_translation_table!({
:name => :string,
:shortname => :string
}, {
:migrate_data => true
})
end
def self.down
Category.drop_translation_table! :migrate_data => true
end
end
| 19.666667 | 58 | 0.654237 |
2674069613840cb720162c1b220286d3ed8a912f | 1,143 | require 'spec_helper'
describe Machined::Sprocket do
describe '#initialize' do
it 'keeps a reference to the Machined environment' do
sprocket = create_sprocket
sprocket.machined.should be(machined)
end
it 'sets the root path' do
sprocket = create_sprocket
sprocket.root.should == ... | 30.891892 | 76 | 0.700787 |
33b185b5af6c108045b054be20025bc1b854bda6 | 836 | require "pry"
public_keys = open("./25-input.txt").read.split("\n").map { |str| str.to_i }
DIVISOR = 20201227
def self.encryption_loop(multiplier, loops, divisor, seeking, start = 1)
num = start
(1..loops).each do |i|
num = multiplier * num % divisor
if num == seeking
puts "Encrypted to #{num} af... | 36.347826 | 107 | 0.696172 |
913eab462b5f06721e3702eaf3a8dc2a8cd6c7fb | 293 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
private
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in"
redirect_to login_url
end
end
end
| 19.533333 | 52 | 0.696246 |
4a22a4e6ff5563d2a794aedf9e3784c9445931d5 | 66,108 | # Copyright 2015 Google Inc.
#
# 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 agreed to in writing,... | 38.864198 | 202 | 0.643992 |
f8f57842e82d3183e10afa00cc6381b427062fd7 | 60 | class DisabledImplementation
implements TestInterface
end
| 15 | 28 | 0.883333 |
28385cc3317907346d6698c690c822ccaef5fe62 | 191 | VCR.configure do |c|
c.cassette_library_dir = Rails.root.join("spec", "vcr")
c.hook_into :faraday
c.default_cassette_options = { record: :new_episodes }
c.ignore_localhost = true
end
| 27.285714 | 57 | 0.732984 |
e261caa5c812c87b42f4eb6b310e22ca753699d4 | 1,795 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'devise-security/version'
Gem::Specification.new do |s|
s.name = 'devise-security'
s.version = DeviseSecurity::VERSION.dup
s.platform = Gem::Platform::RUBY
s.licenses = ['MIT']... | 36.632653 | 129 | 0.71922 |
bbde6f1c4fdb07b0259c158add09e5fd20ed33b4 | 1,560 | module Views
class Base < Fortitude::Widget
include Views::Widgets::Helpers
doctype :html5
def fa_icon(fa_icon_name, *classes)
i(class: "fa fa-#{fa_icon_name} #{classes.join(' ')}")
end
private
def set_progress_bar!(index:)
content_for :progress_bar do
div class: "progr... | 25.16129 | 103 | 0.586538 |
18e954a02ce2ac40c1d306591c4a786a0160ad64 | 1,031 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'refile/s3/version'
Gem::Specification.new do |spec|
spec.name = "refile-s3"
spec.version = Refile::S3::VERSION
spec.authors = ["Jonas Nicklas"]
spec.email = [... | 35.551724 | 74 | 0.645005 |
acd1973fce01965cd9f7999e8a653490e5b9bdbf | 920 | Pod::Spec.new do |s|
s.name = "TTVideoEditor"
s.version = "7.9.0.30-D"
s.summary = "TTVideoEditor"
s.license = "MIT"
s.authors = {"zhouyi.ysj"=>"zhouyi.ysj@bytedance.com"}
s.homepage = "https://github.com/volcengine"
s.description = "ttvideoeditor"
s.frameworks = ["AVFoundation", "Foundation", "UIKit", ... | 46 | 218 | 0.679348 |
ed8770569b258fc06ac1a01d5bc43e0d89379828 | 680 | require 'formula'
class Arm < Formula
desc "Terminal status monitor for Tor"
homepage 'http://www.atagar.com/arm/'
url 'http://www.atagar.com/arm/resources/static/arm-1.4.5.0.tar.bz2'
sha256 'fc0e771585dde3803873b4807578060f0556cf1cac6c38840a714ffada3b28fa'
def install
(share+"arm").install Dir["*"]
... | 28.333333 | 75 | 0.717647 |
6274c7b3c9e8bd2ea42fa078e971d1a1e63ae7e9 | 1,208 | require 'model/project_build_log'
require 'model/project_build'
module Bamboo
class ProjectBuildLogParser
def parse(plan, result)
ProjectBuild.new(ProjectBuildResult.new(plan, result).to_hash)
end
private
class ProjectBuildResult
def initialize(plan, result)
@plan = plan
... | 19.174603 | 68 | 0.558775 |
0323a8d222a3b53356c2ba9027012bdb3332bd89 | 484 | # frozen_string_literal: true
class ForkNetwork < ApplicationRecord
belongs_to :root_project, class_name: 'Project'
has_many :fork_network_members
has_many :projects, through: :fork_network_members
after_create :add_root_as_member, if: :root_project
def add_root_as_member
projects << root_project
end... | 22 | 53 | 0.785124 |
2870531d0d893f5c1fa6aa89de033f154277d079 | 1,366 | class UsersController < ApplicationController
before_action :get_user, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource
def new
redirect_to root_path if logged_in?
@user = User.new
end
def create
redirect_to root_path if logged_in?
@user = User.new(user_params)
@user.na... | 21.34375 | 100 | 0.651537 |
bbdf5ffafbd18a1c86dca51d741294189a50c218 | 1,780 | # frozen_string_literal: true
class Checkpoint::Credential
# Credential Resolver that supports a basic role map model.
#
# The role map should be a hash containing all of the roles and each key
# should be an array of the permissions that role would grant. For example:
#
# ```
# {
# admin: [:read, :c... | 26.969697 | 78 | 0.654494 |
62ff52915d51314f1fbc949c14412c39931e3dfc | 270 | module Moonshot
module Commands
class Push < Moonshot::Command
self.usage = 'push [options]'
self.description = 'Build and deploy a development artifact from the working directory'
def execute
controller.push
end
end
end
end
| 20.769231 | 93 | 0.666667 |
21625ed436e68355e0a7d99d3a1c94b331f5545f | 377 | require 'spec_helper'
module Refinery
module CountyPages
describe CountyPage do
describe "validations" do
subject do
FactoryGirl.create(:county_page,
:name => "Refinery CMS")
end
it { should be_valid }
its(:errors) { should be_empty }
its(:name) ... | 19.842105 | 47 | 0.583554 |
1dcdb4dd9f3560dc190d53ac6be2d0171db18500 | 121 | # frozen_string_literal: true
class UsersController < BussinessController
def info
@user = current_user
end
end
| 15.125 | 43 | 0.768595 |
ff60405fdce6d36759d7ba2266a3665eaa0eb61a | 43 | module Hyperclient
VERSION = "0.0.1"
end
| 10.75 | 19 | 0.697674 |
d5e7b052338ae889fad717c5a735fcc86f3e28a0 | 228 | # frozen_string_literal: true
Sequel.migration do
change do
alter_table SC::Billing.user_model.table_name do
add_foreign_key :default_stripe_payment_source_id, :stripe_payment_sources, index: true
end
end
end
| 22.8 | 93 | 0.785088 |
e986eabcb650aeaf2c8f7a12134349ca97a4cc2d | 156 | Airbrake.configure do |config|
config.project_id = ENV['AIRBRAKE_PROJECT_ID']
config.project_key = ENV['AIRBRAKE_API_KEY']
end if Rails.env.production?
| 31.2 | 48 | 0.782051 |
ffa85f2b11ddab1d3eb631dfb23369f5a26e3f55 | 4,319 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 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.
#
# OpenProject is a fork of ChiliProject,... | 35.991667 | 92 | 0.624682 |
877568bfe4bfbba2b54f4ba8a0ddd583202741ce | 439 | require "spec_helper"
require 'benchmark'
require 'matrix'
RSpec.describe "Hello world sample" do
it "prints hello world" do
# Simple hello world using TensorStream
# Create a Constant op
hello = TensorStream.constant('Hello, TensorStream!')
# Start the TensorStream session
sess = TensorStream.... | 24.388889 | 57 | 0.71754 |
4a7b14f3427e293f92d4d8c12692e5d112a87258 | 3,508 | #------------------------------------------------------------------------------
describe 'api' do
#------------------------------------------------------------------------------
it 'renderer' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'spoiler',
{ render: lambda {|token... | 41.761905 | 106 | 0.446123 |
26aa12d92d666ec2c106d0d1164042cbdad79273 | 480 | cask 'consul@1.4.5' do
version '1.4.5'
sha256 '7a5e2aff2e1d64a97eafc63d36aa561e5d44a036912b359c3e34d1e1e7f2ec91'
# releases.hashicorp.com was verified as official when first introduced to the cask
url 'https://releases.hashicorp.com/consul/1.4.5/consul_1.4.5_darwin_amd64.zip'
appcast 'https://github.com/hash... | 30 | 85 | 0.766667 |
bfb4d9358f09c5c24617621a2e919c82ac33b1a0 | 173 | # frozen_string_literal: true
class ChargeOrderJob < ApplicationJob
queue_as :default
def perform(order, pay_type_params)
order.charge!(pay_type_params)
end
end
| 17.3 | 37 | 0.780347 |
61c4700784826bde649361f4adf6e6d9b7628c16 | 730 | # frozen_string_literal: true
module Idnow
module API
module AutomatedTesting
HOST = 'https://api.test.idnow.de'
def testing_start(transaction_number:)
path = full_path_for("identifications/#{transaction_number}/start")
request = Idnow::PostJsonRequest.new(path, {})
execute(r... | 33.181818 | 93 | 0.70274 |
1144ee9369db095a8c5ddd4fa062a5f972f0f565 | 6,198 | # frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Quality::Helm3Client do
let(:namespace) { 'review-apps-ee' }
let(:release_name) { 'my-release' }
let(:raw_helm_list_page1) do
<<~OUTPUT
[
{"name":"review-qa-60-reor-1mugd1","namespace":"#{namespace}","revision":1,"updated":"20... | 46.253731 | 197 | 0.632785 |
791b4c4fd18e8339852a96dae2ec82942e190ef7 | 394 | class SessionsController < ApplicationController
def new
end
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
log_in user
redirect_to user
else
flash[:danger] = 'Invalid email/password combination' # N... | 20.736842 | 78 | 0.675127 |
ac751d6e468275b866fb4e49e0b3fd31fbf15a3c | 137 | # frozen_string_literal: true
json.array!(@events) do |event|
json.extract! event, :id
json.url event_url(event, format: :json)
end
| 19.571429 | 42 | 0.722628 |
bf15321ebbe8a99fff70d590aee0eb4dc3d2e541 | 5,608 | ##########################GO-LICENSE-START################################
# Copyright 2014 ThoughtWorks, Inc.
#
# 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/li... | 42.484848 | 168 | 0.669044 |
33e721ea45750d7cfd57546c76dc7a5241c81e63 | 1,012 | require 'spec_helper'
describe Omnivault::AbstractVault do
before do
# Override parent class initialization exception in tests
described_class.send(:define_method, :initialize) {}
end
describe '#configure_aws!' do
before do
allow(subject).to receive(:entries) do
{
'AWS_ACCESS... | 27.351351 | 65 | 0.678854 |
ab0af2cf60c886eec67a3b4bc48a7c78ae068cec | 1,269 | require 'pbl/models/concerns/base'
module Pbl
module Models
module Projects
class Project
include Pbl::Models::Users::Base
include ActiveModel::Validations::Callbacks
include ActiveModel::Serializers::JSON
# attribute :id, String
# attribute :name, String
#... | 27.586957 | 107 | 0.608353 |
7ab6c166533787218c7069148e5d309cea9ac11a | 1,137 | Pod::Spec.new do |s|
s.name = 'TDSwipeSheet'
s.version = '1.1'
s.summary = 'TDSwipeSheet is a simple and easy to integrate solution for presenting UIViewController or any view in bottom or top sheet'
s.description = <<-DESC
TDSwipeSheet is a simple and easy to int... | 51.681818 | 347 | 0.620932 |
33c7e084aa29568b7247d8fddbf135f813bb5c9f | 2,445 | class Gazebo2 < Formula
desc "Gazebo robot simulator"
homepage "http://gazebosim.org"
url "https://osrf-distributions.s3.amazonaws.com/gazebo/releases/gazebo-2.2.6.tar.bz2"
sha256 "c5e886a9d43a99865d3393dab643493c906c106781ea2ee50555bb8dcf03bd81"
license "Apache-2.0"
head "https://github.com/osrf/gazebo.git... | 34.928571 | 128 | 0.754601 |
9161f2a0038f7fafb115a179cb777b99f2b4c13a | 181 | class TestImageDefinitionFactory
def create(image_name, image_dir = nil)
KuberKit::Core::ImageDefinition
.new(image_name, image_dir || "/images/#{image_name}")
end
end | 30.166667 | 60 | 0.734807 |
7abc310adb2e9a296ffd11114a7fbdf05576ca06 | 2,361 | # encoding: utf-8
require 'spec_helper'
describe 'url input' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
end
describe "when object is provided" do
before do
concat(semantic_form... | 26.829545 | 86 | 0.707751 |
39c9b8f22ea1d7f4277ede725af17202af7cc7f8 | 13,087 | module Archimate
module Examples
module Factories
def build_any_attribute(attribute: nil, prefix: "", value: nil)
DataModel::AnyAttribute.new(
attribute: attribute || Faker::Company.buzzword.downcase,
value: value || Faker::Company.buzzword,
prefix: prefix
)
... | 36.454039 | 131 | 0.593184 |
01e6fdb2d3e3797ac3c246e956494c21f58327cf | 4,221 | # frozen_string_literal: true
module ObjectStorage
class MigrateUploadsWorker
include ApplicationWorker
include ObjectStorageQueue
feature_category_not_owned!
SanityCheckError = Class.new(StandardError)
class MigrationResult
attr_reader :upload
attr_accessor :error
def initi... | 30.15 | 168 | 0.669983 |
083626b22d3b9c96e04d8e7198c958d17505fe9a | 26 | puts "Hello World".reverse | 26 | 26 | 0.807692 |
9109e1c58e700d2ba3a07356afa6505aebf0e690 | 3,338 | cask "font-ysabeau" do
version "0.003"
sha256 "70b0a1041c81b1e37fb80951a84616ed40668293f872f47b97fb87a88d4c1c62"
url "https://github.com/CatharsisFonts/EauDeGaramond/releases/download/v#{version}/Ysabeau_Install_v#{version}.zip"
appcast "https://github.com/CatharsisFonts/EauDeGaramond/releases.atom"
name "Ys... | 56.576271 | 117 | 0.804074 |
e89f6dab0a067ea9c2e6f84c75b39477e9c33c12 | 79 | require 'refinery/core_ext/uri/generic'
require 'refinery/core_ext/uri/module'
| 26.333333 | 39 | 0.822785 |
d55c771bb1bb03574a6104295a18e3e87cf45d75 | 1,507 | # frozen_string_literal: true
module SolidusYotpo
module ProductDecorator
YOTPO_ENDPOINT = {
index: 'v1/widget/%{app_key}/products/%{product_id}/reviews.json',
create: "apps/%{app_key}/products/mass_create",
update: "apps/%{app_key}/products/mass_update",
}.freeze
def self.prepended(ba... | 27.4 | 129 | 0.651626 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.