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 |
|---|---|---|---|---|---|
21c1f6343c8d3dc23d7ebd118d152ba028933c58 | 7,254 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Monitor::Mgmt::V2015_05_01
module Models
#
# An Application Insights workbook definition.
#
class Workbook < WorkbookResourc... | 31.676856 | 79 | 0.462917 |
187d91b6bd1251aeb1b5f4a23606ae1a062fa94f | 1,105 | # Helper to determine the version of Puppet
require 'fileutils'
require 'open3'
require 'shellwords'
module OctocatalogDiff
module Util
# This is a utility class to determine the version of Puppet.
class PuppetVersion
# Determine the version of Puppet.
# @param puppet [String] Path to Puppet bin... | 34.53125 | 98 | 0.630769 |
e85e0f609e3941b906d573a70b3b3ccfd3612341 | 3,577 | #!/usr/bin/ruby
require_relative 'runscripts'
include RunScripts
module RunScripts
def rerun
gem5home = Dir.new(Dir.pwd)
%w[
run_2tc_tp_4cpus_hhn
run_2tc_tp_4cpus_hhnr
run_2tc_tp_4cpus_hmd
run_2tc_tp_4cpus_hmdr
run_2tc_tp_4cpus_lld
run_2tc_tp_4cpus_mmi
ru... | 32.816514 | 83 | 0.729382 |
01efdb37d4acc190873a293e1b6333f095215bf4 | 1,818 | # encoding: UTF-8
control 'VCPG-70-000011' do
title 'VMware Postgres must be configured to use TLS.'
desc "The DoD standard for authentication is DoD-approved PKI certificates.
Authentication based on User ID and Password may be used only when it is not
possible to employ a PKI certificate.
In such cases, pa... | 30.813559 | 109 | 0.707371 |
ff45da3f58028c56299a3e22fa75a1b4ed9198cb | 1,114 | class Ec2AmiTools < Formula
desc "Amazon EC2 AMI Tools (helps bundle Amazon Machine Images)"
homepage "https://aws.amazon.com/developertools/368"
url "https://ec2-downloads.s3.amazonaws.com/ec2-ami-tools-1.5.7.zip"
sha256 "5a45d9f393d2e144124d23d2312b3a8918c5a3f7463b48d55f8db3d56a3fb29f"
bottle :unneeded
... | 30.944444 | 83 | 0.701077 |
ac1b0a9da04182f91260cb691f7ba0591c824ba9 | 96 | # desc "Explaining what the task does"
# task :json_autocompleter do
# # Task goes here
# end
| 19.2 | 38 | 0.708333 |
b924924c34325efd7a4bd8c0f5d643714736c47a | 663 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
sequence(:uri) { |n| "#file:///#{intellectual_object.identifier}/data/#{n}filename.xml" }
factory :generic_file_tech_metadata, :class => 'GenericFileMetadata' do
file_format { 'application/xml' }
identifier { "virg... | 28.826087 | 94 | 0.639517 |
6119ed37d87c4c0ce9136040611f54bd5ab84418 | 94 | require "rose/test/version"
module Rose
module Test
# Your code goes here...
end
end
| 11.75 | 28 | 0.680851 |
f80337a5e072c694e3b6ab94722d22499584bc1b | 521 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::WgEncodeUwHistoneHct116H3k4me3StdPkRep1" do
describe "#find_by_interval" do
context "given range chr1:1-800,000" do
it 'returns a record (r.chrom == "chr1")' do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
... | 30.647059 | 88 | 0.669866 |
79f27af91a86ae5393dff53774f76eadbf2d74dc | 707 | module ApplicationHelper
include Pagy::Frontend
def crud_label(key)
case key
when 'create'
"<i class='fa fa-plus'></i>".html_safe
when 'update'
"<i class='fa fa-pen'></i>".html_safe
when 'destroy'
"<i class='fa fa-trash'></i>".html_safe
else
# type code here
en... | 21.424242 | 56 | 0.575672 |
b9c28f623803f35c4809e361937f6776e06d34f6 | 2,707 | # frozen_string_literal: true
require 'spec_helper'
describe NamespaceStatistics do
it { is_expected.to belong_to(:namespace) }
it { is_expected.to validate_presence_of(:namespace) }
describe '#shared_runners_minutes' do
let(:namespace_statistics) { build(:namespace_statistics, shared_runners_seconds: 120... | 27.907216 | 92 | 0.667159 |
6aab6f73efb2581e794bb3f7724c6ba981030916 | 3,619 | # frozen_string_literal: true
# This example shows has_one and has_many working together
require 'spec_helper'
require 'csv'
# Examples
# ========
RSpec.describe 'Fluxor', type: :model do
before(:each) do
Widget.destroy_all
end
it 'should be able to import from CSV data' do
csv_in = <<~CSV
Name... | 46.397436 | 213 | 0.610666 |
7a11eab908e67759c4ae569681dde69bd8f66b5b | 137 | class CurrentPhone < ActiveRecord::Migration[6.0]
def change
add_column :companies, :current_phone, :integer, default: 0
end
end
| 22.833333 | 63 | 0.744526 |
ab5ef3196182e995f791a66463441a8c6e99cd41 | 677 | class CreateCiBuildTraceSections < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
create_table :ci_build_trace_sections do |t|
t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }
t.datetime_with_timezone :date_star... | 33.85 | 91 | 0.722304 |
bbd1280857626643f345cc7a4b0e550e5cd0ce84 | 1,200 | require 'csv'
require 'faker'
require 'json'
require 'yaml'
module Fake
def self.data
collection_data = {}
['.csv', '.json', '.yml'].each do |i|
name = slug(Faker::RuPaul.unique.queen)
data = generate_data(name, i, collection_data)
path = '_data/' + name + i
case i
when '.csv' t... | 27.906977 | 75 | 0.5775 |
ed90ebb6107df32742c6d3cae9d79a277911977a | 8,934 | =begin
#Argo Workflows API
#Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/
The version of the OpenAPI document: VERSION
Generated by: https://openapi-generator.tech
OpenAPI Ge... | 31.347368 | 234 | 0.636109 |
ab7f88fc3f2ffd0b55af3fbf495380538be59723 | 5,711 | module Statsample
# Class to create crosstab of data
# With this, you can create reports and do chi square test
# The first vector will be at rows and the second will the the columns
#
class Crosstab
include Summarizable
attr_reader :v_rows, :v_cols
attr_accessor :row_label, :column_label, :name, :per... | 30.540107 | 143 | 0.531255 |
e8a37452f198afe85cfc88f5ed82cdbd2bb131b3 | 1,868 | #
# Be sure to run `pod lib lint Repository.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 = 'SwiftR... | 56.606061 | 851 | 0.688437 |
ed1918d42d564dd09107192d1493aebeb45fbdef | 306 | # frozen_string_literal: true
require_relative '../../g_1846/step/track_and_token'
require_relative 'tracker'
module Engine
module Game
module G18LosAngeles
module Step
class TrackAndToken < G1846::Step::TrackAndToken
include Tracker
end
end
end
end
end
| 18 | 56 | 0.683007 |
7aa9d61c7e1ee3e435649dd729d683fa04079d8b | 1,808 | module DatabaseRewinder
module Compatibility
def clean_with(*args)
cleaners.each {|c| c.clean_with(*args)}
end
def cleaning
yield
ensure
clean
end
def start; end
def strategy=(args)
options = args.is_a?(Array) ? args.extract_options! : {}
@only, @except = o... | 25.111111 | 110 | 0.606748 |
b94a835b581915405c4d74d197c9d640b8be9387 | 57 | def remove_duplicates(str)
str.split("").uniq.join
end
| 14.25 | 26 | 0.736842 |
ac71894116916ddc31b367855d00e78f46beeaa3 | 161 | class CreateGames < ActiveRecord::Migration
def change
create_table :games do |t|
t.string :name, null: false
t.timestamps
end
end
end
| 14.636364 | 43 | 0.658385 |
f786e5ab20052fbef69cd3e6daa8a9597320259b | 8,211 | #-- copyright
# OpenProject Meeting Plugin
#
# Copyright (C) 2011-2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# This program is distributed in the hope that it will be useful,
# but WIT... | 27.833898 | 113 | 0.70162 |
0125153fdcc2b82f77d0353eaa0118973d66783a | 2,023 | class CategoriesController < ApplicationController
get '/categories' do
if logged_in?
erb :'categories/index'
else
redirect 'users/login'
end
end
get '/categories/new' do
if logged_in?
erb :'categories/new'
else
redir... | 25.607595 | 76 | 0.514582 |
6a55c0587b6350d148e94ed6c3ca7bd898318131 | 1,870 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "major_tom/version"
Gem::Specification.new do |spec|
spec.name = "major_tom"
spec.version = MajorTom::VERSION
spec.authors = ["Andrew Cantino"]
spec.email = ["cantino@users.n... | 41.555556 | 96 | 0.675401 |
1d82b5ade740f4f8c113b3f48e2d8257f7fbba2d | 861 | module Spree
class Subscription < Spree::Base
include RoleSubscriber
include RestrictiveDestroyer
include ApiHandler
acts_as_restrictive_destroyer column: :unsubscribed_at
attr_accessor :token
self.whitelisted_ransackable_attributes = %w[email subscribed_at]
belongs_to :plan
belongs... | 25.323529 | 75 | 0.713124 |
acc93350d606b60a806370279d858569ad2b8076 | 711 | namespace :redis do
desc 'Start redis'
base_exec = File.exists?("../local/bin/redis-server") ? "../local/bin/" : ""
conf = File.exists?("../cdl/conf/redis.conf") ? "../local/bin/redis.conf" : File.exists?("#{Dir.pwd}/conf/redis.conf") ? "#{Dir.pwd}/conf/redis.conf" : "../shortcake-cdl/conf/redis.conf"
tas... | 35.55 | 188 | 0.649789 |
bff727f5fffb83a252eb50a7945c0d9a2f150315 | 1,345 | class NavigationController < ApplicationController
# caches_page :flash_tree_view
def show_tree_view
# set the users default hierarchy if they haven't done so already
@selected_hierarchy_entry = HierarchyEntry.find_by_id(params[:selected_hierarchy_entry_id].to_i)
@taxon_page = TaxonPage.new(@taxon_con... | 28.617021 | 100 | 0.727138 |
333efe80b283510a3c58d0eb206b0743f3a5de3c | 409 | require_relative '../../automated_init'
context "Schema" do
context "Transform Write" do
data_structure = Schema::Controls::DataStructure::ReadAndWrite.example
refute(data_structure.some_attribute == 'some written value')
data = data_structure.to_h
test "The output data has been intercepted and mo... | 25.5625 | 74 | 0.726161 |
ac71e5ee335f262d449b1128055e8a2bf02e5f69 | 77 | require "landrover/version"
module Landrover
# Your code goes here...
end
| 12.833333 | 27 | 0.74026 |
08716e09863e77d78086755ff39a4d306559df75 | 2,921 | require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_template_host type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_template_host resources' do
it 'runs successfully' do
# Th... | 41.728571 | 500 | 0.584047 |
5dab41d3ed92b8134a19e4bf5ebfd39dc5c3f504 | 632 | require 'rails_helper'
describe 'models/submitted.html.erb' do
context 'for submitted models' do
it "should show the correct number of models" do
user = create(:user)
3.times do
create(:accepted_model, submitting_author: user)
end
create(:model, state: "submitted", submitting_au... | 27.478261 | 87 | 0.681962 |
f8e661d825fe29ff0348dd6dbd0e569c82388c99 | 2,616 | require 'rails_helper'
describe ApplicationHelper do
before(:each) do
@user = create(:user)
allow(helper).to receive(:current_user) {
@user
}
allow(@user).to receive(:organizations) {
[
OpenStruct.new(
organization: OpenStruct.new({
login: "org1",
... | 26.16 | 128 | 0.511086 |
4ac33ff4a458aa97fb04b713d2688a385fbf8090 | 10,339 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.1-SNAPSHOT
=en... | 37.596364 | 157 | 0.669794 |
33fb6a4e8500bcb9c970f49e5aa9d2ae04dafad3 | 197 | class CreateAdministrations < ActiveRecord::Migration[5.2]
def change
create_table :administrations do |t|
t.string :name
t.references :city
t.timestamps
end
end
end
| 17.909091 | 58 | 0.680203 |
79d8834ca6a87b4f211a8ac4405b275e7de2b220 | 157 | class AwesomeExplain::PgSeqScan < ActiveRecord::Base
establish_connection AwesomeExplain::Config.instance.db_config
self.table_name = 'pg_seq_scans'
end
| 31.4 | 64 | 0.828025 |
6a2270b0ab32e4c736adc2b6d5b3b2f48e3e9929 | 2,555 | require File.expand_path("../../Strategies/cache-download", Pathname.new(__FILE__).realpath)
ECWJP2_SDK = "/Hexagon/ERDASEcwJpeg2000SDK5.4.0/Desktop_Read-Only".freeze
class EcwJpeg2000SDK < Requirement
fatal true
satisfy(:build_env => false) { File.exist? ECWJP2_SDK }
def message; <<~EOS
ERDAS ECW/JP2 SDK ... | 33.181818 | 104 | 0.678669 |
01ac5673e565a034d2c5741a53f92f9c2b9a9f91 | 6,584 | # frozen_string_literal: true
require 'ipaddr'
module Facter
module Resolvers
class Networking < BaseResolver
@log = Facter::Log.new
@semaphore = Mutex.new
@fact_list ||= {}
class << self
def resolve(fact_name)
@semaphore.synchronize do
result ||= @fact_list... | 36.375691 | 114 | 0.618773 |
ac4fa280e42e1f0b5f310bc6fc1afa04ece2674e | 67 | require "snag/version"
module Snag
# Your code goes here...
end
| 11.166667 | 26 | 0.701493 |
6af8ec3aacb8c3520726dafafea899b573efc9a3 | 750 | # -*- mode: ruby -*-
# vi: set ft=ruby :
# Docker specific configurations go here
def config_docker(config, i, total, name, version)
if version == "Local"
config.vm.synced_folder "../../", "/tachyon"
end
config.vm.synced_folder "./", "/vagrant"
config.ssh.username = "root"
config.ssh.password = "vagrant... | 26.785714 | 70 | 0.653333 |
18e69e0d920d00a80c91e7d8f1ea0b6cf51d0bed | 364 | require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'open-uri'
require 'yaml'
begin; require 'turn'; rescue LoadError; end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'pismo'
class Test::Unit::TestCase
include Pismo
HTML_DIRECT... | 24.266667 | 66 | 0.744505 |
4aa42cbb5694c73287737f4dc64e46d9f8b2712c | 262 | class Twindocs < Cask
url 'https://www.twindocs.com/plugins/es/tools_mac/Twindocs%20tools.pkg.zip'
homepage 'https://www.twindocs.com'
version 'latest'
sha256 :no_check
install 'Twindocs tools.pkg'
uninstall :pkgutil => 'com.twindocs.ambassador'
end
| 29.111111 | 78 | 0.744275 |
281e74d9bf0cf3706a07be5bf5dda0dfc7b4f101 | 476 | module Prototok
module Formatters
class Default < Base
def encode(*args)
raise Errors::FormatError if args.size != 2
args.map { |part| RbNaCl::Util.bin2hex(part) }
.join(Prototok.config[:token_delimiter])
end
def decode(str)
parts = str.split(Prototok.config[... | 26.444444 | 60 | 0.615546 |
38496757e80dba2d3fe611d0eee48a098b91919c | 510 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def verify_token
if(cookies[:session_token])
begin
x = JWT.verify(cookies[:session_token],"secret")
... | 22.173913 | 56 | 0.694118 |
5ddfc7330774eb86ecb3414a8ece388db82d52bd | 35,614 | # coding: utf-8
# 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 app... | 31.826631 | 98 | 0.663475 |
26f871e0a2c1cfe1e0b7f568026e05198c70d525 | 4,265 | # -----------------------------------------------------------------------------
#
# Various Geos-related internal utilities
#
# -----------------------------------------------------------------------------
# Copyright 2010-2012 Daniel Azuma
#
# All rights reserved.
#
# Redistribution and use in source and binary forms,... | 35.541667 | 113 | 0.624619 |
b9d665e9356611e9296a7d191fbde21a301b7d61 | 4,916 | # encoding: utf-8
# frozen_string_literal: true
module RuboCop
# The CLI is a class responsible of handling all the command line interface
# logic.
class CLI
include Formatter::TextUtil
class Finished < Exception; end
attr_reader :options, :config_store
def initialize
@options = {}
... | 29.793939 | 79 | 0.650122 |
08fb1ad3b4ddc948e75395571aeb686222e02836 | 3,796 | require 'open-uri'
module Lipsiadmin
module View
module Helpers
module FrontendHelper
# Set the title of the page and append at the end the name of the project
# Usefull for google & c.
def title(text)
content_for(:title) { text + " - #{AppConfig.project}" }
end
... | 42.177778 | 130 | 0.538462 |
1d46adf0662d672b6d4328cea9c3fd35483d7c63 | 99 | class Setting < ApplicationRecord
has_one_attached :avatar
def self.get
find(1)
end
end
| 12.375 | 33 | 0.727273 |
61003c2dd604b638dd8c29f0e4b5b0beaf5e8979 | 448 | def log_in_as(user, password: 'password', remember_me: true)
visit login_path
fill_in 'Email', with: user.email
fill_in 'Password', with: password
check 'session_remember_me' if remember_me
click_button 'Log in'
end
def logout
click_link 'Log out'
end
def force_logout
page.driver.submit :delete, logout_... | 22.4 | 82 | 0.772321 |
0872b1c59092d1bcd8a34b285f565a56e2150ce1 | 1,660 | Rails.application.routes.draw do
mount EffectiveMemberships::Engine => '/', as: 'effective_memberships'
end
EffectiveMemberships::Engine.routes.draw do
# Public routes
scope module: 'effective' do
resources :applicants, only: [:new, :show, :destroy] do
resources :build, controller: :applicants, only: [... | 28.135593 | 77 | 0.678916 |
874c2570bc3c0af7e637f4ead2d790b81d2123f2 | 2,923 | require 'pact/mock_service/app'
require 'rack/test'
describe Pact::Consumer::MockService do
include Rack::Test::Methods
let(:log) { StringIO.new }
let(:app) do
Pact::MockService.new(log_file: log)
end
# NOTE: the admin_headers are Rack headers, they will be converted
# to X-Pact-Mock-Service and Co... | 32.477778 | 121 | 0.632569 |
2883a000749b460c18a697f5eea9c0847fecb9af | 1,734 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction PMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result
PMULDQ = Instruction.new("PMULDQ", [
# pmuldq: xmm, xmm
Form.new([
OPERAND_TYPES[23],
OPERAND_TYPES[24],
].freeze, [
... | 28.9 | 94 | 0.502307 |
28ac045b78c4429ac8dd146af055bd88fb4afbd2 | 662 | include_recipe 'datadog::dd-agent'
# Integrate rabbitmq metrics into Datadog
#
# Set up attributes following this example.
# If you are running multiple rabbitmq instances on the same machine
# list them all as hashes.
#
# node.datadog.rabbitmq.instances = [
# {
# ... | 33.1 | 82 | 0.471299 |
edaf4eafc065c4c2e0947497c3a7cb548866f0be | 1,987 | # frozen_string_literal: true
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
devise :omniauthable, omniauth_providers: [:facebook]
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum... | 36.796296 | 103 | 0.700554 |
616809d972fdc9678e3135100474add7570ce38c | 276 | require "bundler/setup"
require "hangman/version"
module Hangman
# Your code goes here...
end
require_relative "hangman/cell.rb"
require_relative "hangman/word.rb"
require_relative "hangman/row.rb"
require_relative "hangman/game.rb"
require_relative "hangman/game_json.rb" | 23 | 39 | 0.800725 |
ffb5306916e2ba9057a367494a68d86052b692ed | 1,723 | class Libxlsxwriter < Formula
desc "C library for creating Excel XLSX files"
homepage "https://libxlsxwriter.github.io/"
url "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.0.6.tar.gz"
sha256 "6217d2940a44c2eac3b48942e83e1320a871e47aabdb4047484426539e45e930"
license "BSD-2-Clause"
head "https:... | 39.159091 | 122 | 0.687754 |
339b1f456e78e6e488e2e62172445049d5a4deee | 565 | # typed: false
# frozen_string_literal: true
# This file was generated by GoReleaser. DO NOT EDIT.
class Lporg < Formula
desc "Organize Your macOS Launchpad Apps"
homepage "https://github.com/blacktop/lporg"
version "20.4.7"
depends_on :macos
on_macos do
url "https://github.com/blacktop/lporg/releases/d... | 23.541667 | 105 | 0.732743 |
38b2103d5bcb6d56e0a49712accc99f6da6e7e6b | 9,631 | module Braintree
# See http://www.braintreepayments.com/docs/ruby
class CreditCard
include BaseModule # :nodoc:
module CardType
AmEx = "American Express"
CarteBlanche = "Carte Blanche"
ChinaUnionPay = "China UnionPay"
DinersClubInternational = "Diners Club"
Discover = "Discove... | 37.042308 | 130 | 0.718098 |
088bc6dafb79ec2d036dd2daf09510485f757ed4 | 27,086 | # frozen_string_literal: true
# == Schema Information
#
# Table name: courses
#
# id :integer not null, primary key
# title :string(255)
# created_at :datetime
# updated_at :datetime
# start :datetime
# end :dateti... | 32.322196 | 117 | 0.607694 |
1c4907abc0d0436426e931883f493967c4a2ffe9 | 531 | class BusinessPartnerDrop < Liquid::Drop
def initialize(business_partner)
@business_partner = business_partner
end
def title
@business_partner.partner_title
end
def url
@business_partner.partner_url
end
def full_url
@business_partner.link_url
end
def description
@busine... | 18.310345 | 72 | 0.728814 |
1db82957d95e4220641bcd52d9a478080cdeb89d | 498 | class RelationshipsController < ApplicationController
before_action :logged_in_user, only: %i[create destroy]
def create
@user = User.find params[:followed_id]
current_user.follow(@user)
respond_to do |format|
format.html { redirect_to @user }
format.js
end
end
def destroy
@use... | 22.636364 | 57 | 0.684739 |
7989628b69d7c448fae5833f1d63d527d2cf4f05 | 20,027 | # HTTPClient - HTTP client library.
# Copyright (C) 2000-2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
#
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.... | 23.396028 | 104 | 0.588256 |
5dc071ebbcdfb539c684684a0e2c30cd6a55f749 | 3,028 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Spree::Promotion::Rules::FirstOrder, type: :model do
let(:rule) { Spree::Promotion::Rules::FirstOrder.new }
let(:order) { mock_model(Spree::Order, user: nil, email: nil) }
let(:user) { mock_model(Spree::LegacyUser) }
context "withou... | 34.409091 | 105 | 0.606671 |
91e01078a312fd3af8eac711894bbc9ec87e6f83 | 459 | # Should contain an app that responds to call
# and returns a rack-compliant response: an array with the response code, hash of header key-value pairs and a response body that responds to .each
# app = proc do |env|
# [ 200, { 'Content-Type' => 'text/plain' }, ['I wish you nirvana']]
# end
# run app
class Something... | 27 | 147 | 0.673203 |
214e0059d018859478ac88eb61ba4ef8d7774608 | 2,630 | # frozen_string_literal: true
require_dependency "renalware/letters"
module Renalware
module HD
module SessionForms
# Given a Batch object representing a request to 'print' (ie compile) a PDF of multiple
# HD Session Forms (aka protocols), where each batch.item points to the patient we want to
... | 30.581395 | 96 | 0.604563 |
6207f9668ae2df83017cecd5042fc54c4f11ca6f | 1,137 | class PdftkJava < Formula
desc "Port of pdftk in java"
homepage "https://gitlab.com/pdftk-java/pdftk"
url "https://gitlab.com/pdftk-java/pdftk/-/archive/v3.1.3/pdftk-v3.1.3.tar.gz"
sha256 "d9145976adf2dd5f8cd70e1e2345262e46790be6bfb2da1728a2ad4f6e4b2021"
license "GPL-2.0"
revision 1
head "https://gitlab.c... | 34.454545 | 93 | 0.736148 |
62ff5aec217674c820c66ce5888011c9a9baeb76 | 1,038 | Pod::Spec.new do |s|
s.name = "EPSReactiveTableViewController"
s.version = "1.0.0"
s.summary = "A table view controller that automatically populates a table view, and animates the insertion and deletion of rows."
s.description = "EPSReactiveTableViewController is a subclass of... | 49.428571 | 238 | 0.684008 |
79360e3708f40be7150c837173e033f55d916d10 | 331 | cask "butter" do
version "0.3.0"
sha256 "4255b581368e88ee3c802811f0824093f64bce73fb323d77b49a25700154ad84"
url "https://github.com/harukasan/butter/releases/download/v#{version}/Butter_#{version}.dmg"
name "Butter"
desc "Melted idobata.io client"
homepage "https://github.com/harukasan/butter"
app "Butte... | 27.583333 | 95 | 0.761329 |
18cc757ad49f6b91ccc0d458f12f3f124c1c8ba4 | 445 | class SessionsController < ApplicationController
def create
logger.info('here')
user = User.from_omniauth(env["omniauth.auth"], request.env["omniauth.params"]["runner"])
session[:user_id] = user.id
redirect_to request.env['omniauth.origin'] || '/'
end
def destroy
session[:user_id] = nil
red... | 24.722222 | 92 | 0.705618 |
1a93eced4424715367c785aff6395608f7eb7d61 | 408 | require 'rails_helper'
RSpec.describe EntourageScore, type: :model do
it { expect(FactoryBot.build(:entourage_score).save).to be true }
it { should belong_to :entourage }
it { should belong_to :user }
it { should validate_presence_of :entourage_id }
it { should validate_presence_of :user_id }
it { should v... | 34 | 67 | 0.757353 |
917174c0810b4ef1442d8abd12d440350be66fce | 3,047 | require 'test_helper'
class Aviator::Test
describe 'aviator/openstack/identity/v3/public/get_projects_by_user_id' do
def create_request(session_data = get_session_data, &block)
block ||= lambda do |params|
params.id = get_session_id
end
klass.new(session_data, &block)
end
d... | 23.804688 | 124 | 0.663604 |
4a70f35a068d3c55646504ad48bd391c07287d1c | 1,126 | class Pokemon # object class- anything having to do with object
attr_accessor :name, :id, :base_attack, :base_defense, :base_stamina
@@all = []
def initialize(pokemon) # instance method
@name = pokemon[:pokemon_name]
@id = pokemon[:pokemon_id]
@base_attack = poke... | 30.432432 | 96 | 0.549734 |
e2254f53da0e0c39ac6028fd6c1f9e8c88c1127f | 85 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'capybara/guides'
| 28.333333 | 58 | 0.741176 |
ed1a0a6386059693d0a180c6e541dd60300c97b5 | 1,393 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name = 'tp-collect-2'
transcripts_dir = File.join(fixtures_dir, 'tp_collect_project_temp')
tp_collect_wi... | 63.318182 | 461 | 0.801866 |
338ab5b7db78248fcb45350486cd868651e041fe | 9,372 | namespace :cartodb do
# This rake retrieves all sync tables that should get synchronized, and puts the synchronization tasks at Resque
# NOTE: This version does not mark the tables as "enqueued", should be done if planning to run multiple instances
desc 'Runs the sync tables process'
task :sync_tables, [:force_... | 40.396552 | 118 | 0.654823 |
ff99c0a8fbe7a4963aed94aef95c4f57c3afcd53 | 1,774 | require "rack"
require "rack/auth/basic"
require "rack/contrib/not_found"
require "rack/contrib/response_headers"
require "rack/contrib/static_cache"
require "rack/contrib/try_static"
require "rack/protection"
require File.expand_path("../lib/redirect_to_latest", __FILE__)
require File.expand_path("../lib/redirect_v1_... | 31.678571 | 73 | 0.764938 |
4ad21501bd22be51debe82a548c4a44bc56f5f32 | 3,653 | # 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... | 37.27551 | 126 | 0.710101 |
08eaf4a2d6952921240fc628c05d70f809fbdbaf | 297 | cask :v1 => 'spotifybeta' do
version '1.0.0.588.g5dffdc66-3237'
sha256 '918101254dd8177dc66e2642edf65500ce3f13ef4ce089925fef5f77529979ab'
url "http://download.spotify.com/beta/spotify-app-#{version}.dmg"
homepage 'https://www.spotify.com/'
license :unknown
app 'SpotifyBeta.app'
end
| 27 | 75 | 0.754209 |
ffe60da97ff7b99a4d9f7c39b1abb60ba840f4b6 | 1,470 | # MIT License
#
# Copyright (c) 2019 Nanotify
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | 40.833333 | 80 | 0.772789 |
38712614916087b2a14d3c0cc7ef9759bebc523e | 8,407 | module ThinkingSphinx
# This class both keeps track of the configuration settings for Sphinx and
# also generates the resulting file for Sphinx to use.
#
# Here are the default settings, relative to RAILS_ROOT where relevant:
#
# config file:: config/#{environment}.sphinx.conf
# searchd log file:: l... | 31.965779 | 118 | 0.5995 |
1d629a68c3961ff5937d930faa0c3b3d7d85c19d | 704 | # frozen_string_literal: true
# Copyright 2018 Bryan Knouse, Magus Pereira, Charlie Evans, Taraqur Rahman,
# Nick Feuer
#
# 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.apach... | 35.2 | 76 | 0.771307 |
f86cea8e04b89b6edd0deea49b30d6f63a4609ca | 2,389 | # frozen_string_literal: true
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------... | 31.434211 | 96 | 0.673085 |
e8bd6ca9756610fd4b844c4ecad3fa284992262f | 1,824 | # encoding: utf-8
require 'logstash/namespace'
require 'logstash/filters/base'
# This filter automatically extracts all numbers found inside a string
#
# This is useful when you have lines that don't match a grok pattern
# or use json but you still need to extract numbers.
#
# Each numbers is returned in a @fields.i... | 21.209302 | 78 | 0.633772 |
e29ceb5e8725154556ada39c2a526f42359ea627 | 6,134 | class ReplaceProjectDetailsAndDropOldImgFunction < ActiveRecord::Migration
def up
execute <<-SQL
CREATE OR REPLACE VIEW "1".project_details AS
SELECT p.id AS project_id,
p.id,
p.user_id,
p.name,
p.headline,
p.budget,
p.goal,
p.abo... | 46.824427 | 233 | 0.611673 |
e8ef034f8ab55352a95e77dbca38b78c5e1b0eea | 1,232 | module HBW
module Common
class YMLAPI
attr_accessor :responses
class << self
def build(yml_api_file_path)
new(YAML.load_file(yml_api_file_path))
end
end
def initialize(responses)
@responses = responses
end
%w(get put patch post delete).each ... | 23.245283 | 88 | 0.574675 |
1a98156fa19681f35f40c08d54c68fb3be88b9c7 | 1,564 | require 'spec_helper'
describe 'page_object.open_xxx' do
context "browser is closed" do
it "raises PageObjectWrapper::BrowserNotFound" do
gp = PageObjectWrapper.receive_page(:google_pagination)
expect{ gp.pagination_open 1 }.to raise_error(PageObjectWrapper::BrowserNotFound)
end
end
context ... | 34.755556 | 100 | 0.717391 |
1aae56e83d919fd2fe5c56cc9ddfdc74bb44d869 | 559 | define Theme do
has_many :theme_files, :_as => :files, :find => stub_theme_file
has_one :comments_counter, stub_counter
instance :theme,
:id => 'theme-1',
:name => 'Theme 1',
:version => '1',
:author => 'author',
:author_link => 'author_link',
... | 26.619048 | 65 | 0.488372 |
91b24bbd9a523274c54d835d90e089c1bc4de737 | 59 | require 'rspec'
require 'skemata/version'
include Skemata
| 11.8 | 25 | 0.79661 |
61f56f46ee5120aa2e39276065fa13758d2c7003 | 855 | # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
#
# 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... | 40.714286 | 84 | 0.774269 |
e2d5d16a274021c35a0151bfd0184221e6eadce4 | 5,964 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_eSign... | 29.37931 | 123 | 0.630449 |
03f84b488b7f0d4b4d134351ea2c6987832e2698 | 19 | move 'climb rubble' | 19 | 19 | 0.789474 |
e2933dbb4c5a8dae0aa1ac0e423a609ca89b68e0 | 9,612 | module Steep
class Source
class LocatedAnnotation
attr_reader :line
attr_reader :annotation
attr_reader :source
def initialize(line:, source:, annotation:)
@line = line
@source = source
@annotation = annotation
end
def ==(other)
other.is_a?(Loc... | 32.805461 | 129 | 0.55077 |
08a9c7d40c2fd954f9747857f3f6b8acf11b5590 | 6,672 | # Copyright 2020 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, ... | 49.058824 | 94 | 0.667416 |
337f8713ecaa7e50f96fa42481a28f748a12bb53 | 450 | require 'rake'
require 'active_record'
require 'yaml/store'
require 'ostruct'
require 'date'
require 'bundler/setup'
Bundler.require
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "db/artists.sqlite"
)
sql = <<-SQL
CREATE TABLE IF NOT EXISTS artists (
id INTEGER PRIMARY KEY,
name ... | 14.0625 | 42 | 0.742222 |
334f7a5b3744cc85690da362511639b9463710ba | 237 | module ReceiptParser
class ReceiptsService
def initialize(params)
@params = params
end
def parse
@parser = ReceiptParser.default_parser.constantize.new(@params).parse
end
def search
end
end
end
| 14.8125 | 75 | 0.675105 |
1a1677544297b54e43d82e6f66609bff5175e3e1 | 2,037 | class IgnitionMsgs9 < Formula
desc "Middleware protobuf messages for robotics"
homepage "https://github.com/ignitionrobotics/ign-msgs"
url "https://github.com/ignitionrobotics/ign-msgs.git", branch: "main"
version "8.999.999~0~20211227"
license "Apache-2.0"
depends_on "protobuf-c" => :build
depends_on "c... | 30.402985 | 75 | 0.641139 |
e8a269d97d1cddfea5f37dc7efccbd1123479921 | 4,988 | =begin
#TextMagic API
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.8
=end
require 'date'
module TextMagic
class GetMessagingStatResponse... | 28.502857 | 107 | 0.622294 |
62883b3daa397fda3593cd9f17c57b6a58ca5d77 | 1,978 | #
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: python
# Attribute:: default
#
# Copyright 2011, Opscode, 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
#
# h... | 30.430769 | 74 | 0.705763 |
e9271b61e7af8fb7f569502c1c85edeb35bb1452 | 5,453 | module ManageIQ::Providers::Vmware::InfraManager::EventParser
def self.event_to_hash(event, ems_id = nil)
log_header = "ems_id: [#{ems_id}] " unless ems_id.nil?
_log.debug { "#{log_header}event: [#{event.inspect}]" }
event_type = event['eventType']
if event_type.nil?
_log.error("#{log_header}ev... | 35.409091 | 153 | 0.626444 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.