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 |
|---|---|---|---|---|---|
6125d7fbf1e2d8293e31150336ebe383f2042820 | 199 | class CrudHistoryJob < ApplicationJob
queue_as :default
def perform(user_id,action,content)
CrudHistoryService.new(user_id: user_id, action: action, content: content ).save_action
end
end
| 24.875 | 91 | 0.78392 |
0354396cc0d17fe879bb82ace34083e352cada22 | 95 | # Sample code from Programing Ruby, page 503
prc = lambda { "hello" }
prc.call
| 23.75 | 44 | 0.589474 |
2662c52f52a789db72ea09fc3108d5afae430149 | 599 | module Makoto
class BadMoodResponderTest < TestCase
def setup
@responder = BadMoodResponder.new
end
def test_executable?
@responder.params = {'content' => 'ネギトロ丼', 'account' => test_account}
assert_false(@responder.executable?)
@responder.params = {'content' => 'おちんちん', 'account'... | 23.038462 | 75 | 0.656093 |
394cac839ffbcb87859e6f9ea22a122efddaca12 | 111 | # frozen_string_literal: true
Rails.application.routes.draw do
devise_for :users
root to: "home#index"
end
| 18.5 | 32 | 0.774775 |
ac8e98b6ae55bdefafcb13b7513c90c2d8d014e8 | 1,246 | # -------------------------------------------------------------------------- #
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 62.3 | 78 | 0.407705 |
bf8c7bfc3235251b87f331689ea42adeff604eec | 35 | require 'pp'
require 'gmap_plotter' | 17.5 | 22 | 0.8 |
0898511a246c7eaf79447c11323b60219be65d97 | 1,124 | require 'httparty'
module PostmanMta
class ApiRequest
include ::HTTParty
base_uri PostmanMta.api_endpoint
attr_reader :request_type, :path, :options, :callback
def initialize(request_type, path, options = {})
@callback = PostmanMta.before_request_hook
@request_type = request_type
... | 21.615385 | 110 | 0.681495 |
38c0fe1052030c6f092d9e0f8e3e64de587d9cb9 | 519 | class RefreshMaterializedView
mattr_accessor :current_thread_token
class << self
def call(table_name)
Thread.new do
token = SecureRandom.hex
mutex.synchronize do
self.current_thread_token = token
end
sleep 4
Scenic.database.refresh_materialized_view(table... | 21.625 | 121 | 0.660886 |
d5deef4246a274fb4a475277b3999414ff10590b | 141 | class TrustExistingOrganizations < ActiveRecord::Migration
def up
::Organization.update_all(trusted: true)
end
def down
end
end
| 15.666667 | 58 | 0.751773 |
8710ee79ff457ddf83d709a0c21191bdc589a15e | 221 | module Admin
class ReportsAuditController < BaseController
private
def report_audit_params
# params.permit!
params.require(:report_audit).permit(:editor, :action, :params)
end
end
end
| 20.090909 | 71 | 0.683258 |
87df3294d7aff851186dc07b77d01b4bb3a10b5d | 7,962 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
# This file generated automatically using rdf vocabulary format from http://www.w3.org/ns/auth/acl#
require 'rdf'
module RDF::Vocab
# @!parse
# # Vocabulary for <http://www.w3.org/ns/auth/acl#>
# class ACL < RDF::StrictVocabulary
# end
class ACL < ... | 47.112426 | 117 | 0.681487 |
7a48403e94b295aca7448780143d9fd78d3eab73 | 270 | s = File.read(__dir__ + "/index.html")
s.gsub!(/\n/, "\\n");
s.gsub!(/\"/, '\"');
#s = "#define _INDEX_HTML \"#{s}\""
#s = "static const char* _INDEX_HTML = \"#{s}\";"
s = "const char index_html[] PROGMEM = \"#{s}\";"
File.write(__dir__ + "/../include/index_html.h", s)
| 33.75 | 51 | 0.544444 |
6aab513f07798c35eeac37adf3e3bb57c9ebd9a7 | 616 | module Msf
module RPC
API_VERSION = "1.0"
class Exception < RuntimeError
attr_accessor :code, :message
def initialize(code, message)
self.code = code
self.message = message
end
end
class ServerException < RuntimeError
attr_accessor :code, :error_message, :error_class, :error_backtrace
def initialize(... | 18.117647 | 69 | 0.746753 |
218f5a4de8c47fdd01fbdee5265330bf14f80e85 | 58 | module Enklawa
module Api
VERSION = "0.2"
end
end
| 9.666667 | 19 | 0.637931 |
f818cdc6d81e82416b6fc09f53ce78a70df5b415 | 2,468 | # # Hello, friend!
#
# This lab teaches basic Ruby Object syntax.
#
# ## Watch it fail
#
# Your first real failure should be something like this:
#
# ./friend_spec.rb:3: uninitialized constant Friend (NameError)
#
# Fix this by opening `friend.rb` and creating an empty class:
#
# class Friend
# end
#
# Save... | 22.851852 | 72 | 0.645867 |
39b29076a18139d03ed736a3f0bb5ec79c00a14d | 2,102 | #!/usr/bin/env ruby
#
# stats for May Hachem
#
# an ad-hoc hack by Asaf Bartov <asaf.bartov@gmail.com>
#
# tested on Ruby 2.3.
require 'rubygems'
require 'mediawiki_api'
START_DATE = Date.new(2016,8,11)
#START_DATE = Date.new(2016,7,12)
END_DATE = Date.new(2016,8,12)
def delta_for_article(mw, art)
r = mw.query(pr... | 27.298701 | 141 | 0.641294 |
ab5530f9bd40f72f365a3e611ad7cd40078b736b | 10,658 | require 'digest/sha1'
require 'mysql2'
require 'sinatra/base'
class App < Sinatra::Base
configure do
set :session_secret, 'tonymoris'
set :public_folder, File.expand_path('../../public', __FILE__)
set :avatar_max_size, 1 * 1024 * 1024
enable :sessions
end
configure :development do
require '... | 26.186732 | 138 | 0.615594 |
6a9b767a5ee6c092314741b7d930ac2ecdc5c86f | 2,083 | class Tmux < Formula
desc "Terminal multiplexer"
homepage "https://tmux.github.io/"
url "https://github.com/tmux/tmux/releases/download/3.1c/tmux-3.1c.tar.gz"
sha256 "918f7220447bef33a1902d4faff05317afd9db4ae1c9971bef5c787ac6c88386"
license "ISC"
revision 1
livecheck do
url "https://github.com/tmux/t... | 28.148649 | 132 | 0.712434 |
61372c5c2b3f56fb98f5e3f64e5dc366891b8d36 | 978 | require 'spec_helper'
require 'mocha/api'
describe VagrantWindows::Helper , :unit => true do
class DummyHelper
include VagrantWindows::Helper
end
before(:all) do
@dummy = DummyHelper.new
end
describe "win_friendly_path" do
it "should replace slashes with backslashes" do
@dummy.win_f... | 24.45 | 93 | 0.679959 |
62ae202445b94e6bce05adcc96b1cb48d21dd64f | 945 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.586207 | 74 | 0.733333 |
bb31117c7f039ce0cef71c04113ef7f790dfa477 | 573 | Pod::Spec.new do |spec|
spec.name = "WFStream"
spec.version = "1.0.1"
spec.summary = "WFStream is for doing sequential stream things like JAVA."
spec.homepage = "https://github.com/WindFantasy/WFStream"
spec.license = "MIT"
spec.author = { "Jerry" => "windfant@sina.com" }
... | 35.8125 | 106 | 0.614311 |
ab345e4bb07013387608a60423c8caa03905077e | 928 | module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class PayflowExpressResponse < Response
def email
@params['e_mail']
end
def full_name
"#{@params['name']} #{@params['lastname']}"
end
def token
@params['token']
end
def pay... | 23.794872 | 75 | 0.457974 |
086f2e742ad6290ecfd219c99197ed7b0f59eeaf | 2,653 | module Verify
class AuthenticationsController < BasePublicController
CLAIM_TIMEOUT_LENGTH_IN_MINUTES = 90
include PartOfClaimJourney
skip_before_action :verify_authenticity_token, only: [:create]
# Page where a new Verify authentication request is generated and posted, as
# described here:
... | 35.373333 | 155 | 0.745194 |
21724b183f3dbbe109e3f659730f1fe9e198c0e7 | 2,401 | # frozen_string_literal: true
RSpec.describe 'MeiliSearch::Index - Filtered search' do
include_context 'search books with author, genre, year'
before do
response = index.update_filterable_attributes(['genre', 'year', 'author'])
index.wait_for_pending_update(response['updateId'])
end
it 'does a custom... | 40.016667 | 105 | 0.677218 |
110b92c614007702f184e4834142a01962de06ad | 98 | module Yardmarshal
class GemsController < ApplicationController
def index
end
end
end
| 14 | 46 | 0.755102 |
9144058f7eecaac253959f6b991731f16b70c46e | 2,404 | class Post < ActiveRecord::Base
STATUSES = %w(active pending flagged deleted)
has_many :notes, :order => "id desc"
has_and_belongs_to_many :pools
has_many :flags, :class_name => "PostFlag", :order => "flagged_post_details.id ASC"
has_many :appeals, :class_name => "PostAppeal"
belongs_to :user
belongs_t... | 34.84058 | 218 | 0.71381 |
ff107c61f282111295938a7f2b9248749362baf3 | 10,437 | module Cequel
module Record
#
# Properties on a Cequel record acts as attributes on record instances, and
# are persisted as column values to Cassandra. Properties are declared
# explicitly on a record instance in the body.
#
# Properties can be **key columns**, **data columns**, or **collecti... | 32.212963 | 131 | 0.590974 |
ff9ea83f914858b9ba6d1d5ee83fabca8b2d8e5c | 954 | require_relative 'array_list'
describe ArrayList do
# describe '#initialize' do
# let(:array) { ArrayList.new(FixedArray.new) }
# it 'creates a new ArrayList' do
# expect(array.array).to be_a(FixedArray)
# end
# end
describe '#add' do
let(:array) { ArrayList.new(FixedArray.new) }
it '... | 23.268293 | 55 | 0.629979 |
1d860a608deeef93ea2465af424921fea1dba78a | 1,932 | class StopAreaReferentialSync < ApplicationModel
include SyncSupport
include AASM
belongs_to :stop_area_referential
has_many :stop_area_referential_sync_messages, :dependent => :destroy
after_commit :perform_sync, :on => :create
validate :multiple_process_validation, :on => :create
scope :pending, -> { ... | 26.833333 | 111 | 0.717909 |
391ecaa3de2220f6a668021f33d779dcc8b082b0 | 1,267 | #- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
#- Limelight and all included source files are distributed under terms of the MIT License.
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require 'limelight/string'
describe String do
it "should convert into camel case" do
"cla... | 35.194444 | 90 | 0.705604 |
39a8bdc69b76eb9aeecb4c3e32a3e09d6a2eb4ee | 7,294 | require 'digest/md5'
module SpreeMigrateDB
MappingItem = Struct.new(:current, :export, :options) do
def actions
@actions = []
end
def action
:unknown
end
def as_question
"#{export} -> #{current} :: #{action}"
end
def question_opts
actions
end
def save_a... | 23.155556 | 98 | 0.585001 |
e8e41b223042da5cee2b028de5d1ea13d0d1b91a | 1,231 | require './mathlibs/discrete_math'
# Using rules derived from Chinese Remainder Theorom, Solve a System of congruences
# See, Chinese Remainder Theorem section 3.7 Rosen.
puts "\nHow many congruencies of a system?\n"
number_of_congruencies = gets.to_i
i=0
systems = Array.new
product_of_m = 1
while number_of_congruenc... | 24.62 | 83 | 0.660439 |
f75eaea655aaeff84947ba26fe93401d4e7a9d23 | 379 | module Minicoin
module SyncedFolderSSHFS
class Plugin < Vagrant.plugin("2")
name "SSHFS syncing for darwin guests as a shared_folders plugin"
synced_folder(:sshfs) do # default priority, but only usable where native isn't
require_relative "synced_folder.rb"
... | 31.583333 | 91 | 0.617414 |
4a7ab46db9e83616b3c967f4cda867f38622f5c3 | 14,121 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 42.278443 | 245 | 0.685858 |
abffb265a89e0399aaacf98c4e346e6f1d33034e | 1,481 | class Libsvm < Formula
desc "Library for support vector machines"
homepage "https://www.csie.ntu.edu.tw/~cjlin/libsvm/"
url "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz"
sha256 "0f122480bef44dec4df6dae056f468c208e4e08c00771ec1b6dae2707fd945be"
bottle do
cellar :any
sha1 "9a87d885fd4d... | 34.44186 | 87 | 0.669818 |
2815e840c88ec1e43eae8e92432f8d824d39dde6 | 4,277 | # -*- encoding : utf-8 -*-
=begin
Copyright (C) 2008 Sam Roberts
This library is free software; you can redistribute it and/or modify it
under the same terms as the ruby language itself, see the file COPYING for
details.
=end
require 'enumerator'
require 'plist'
require 'vpim/icalendar'
require 'vpim/durati... | 23.371585 | 76 | 0.580781 |
111ef0529b549c4099e29cfd8a7b110928f2c56d | 1,215 | class GstPython < Formula
desc "Python overrides for gobject-introspection-based pygst bindings"
homepage "https://gstreamer.freedesktop.org/modules/gst-python.html"
url "https://gstreamer.freedesktop.org/src/gst-python/gst-python-1.8.1.tar.xz"
sha256 "76a3bfb72f9cb81d2b2cf8d07e420478e5b3592ea4b8056bb8c8127f738... | 39.193548 | 97 | 0.720165 |
f7538da134fbd418ea09779075869ae3b06f7004 | 1,619 | class PasswordResetsController < ApplicationController
before_action :get_user, only: [:edit, :update]
before_action :valid_user, only: [:edit, :update]
before_action :check_expiration, only:[:edit, :update]
def new
end
def create
@user = User.find_by(email: params[:password_reset][:email].downcas... | 23.808824 | 73 | 0.643607 |
033c19fceddafe1179126d65a76cfda65b1747bf | 4,116 | #frozen_string_literal: true
require 'set'
# rows = y, cols = x
# [y, x]
# https://www.geeksforgeeks.org/number-integral-points-two-points/
require 'minitest/autorun'
# https://adventofcode.com/2019/day/10
class Day10 < MiniTest::Test
ASTEROID_MAP = DATA.read
def test_1
map = <<~EOS
.#..#
.....
... | 24.5 | 92 | 0.406948 |
611e9be02e1d3e88600a7c0ed80e314e02799ae6 | 1,293 | require 'spec_helper'
module Squeel
module Nodes
describe Predicate do
it 'accepts a value on instantiation' do
@p = Predicate.new :name, :eq, 'value'
@p.value.should eq 'value'
end
it 'sets value via accessor' do
@p = Predicate.new :name, :eq
@p.value = 'value... | 25.86 | 49 | 0.567672 |
f8ca4c03158646312ec5c4cd08ed94d0f9a40d12 | 1,326 | # -*- encoding: utf-8 -*-
# stub: strscan 1.0.3 ruby lib
# stub: ext/strscan/extconf.rb
Gem::Specification.new do |s|
s.name = "strscan".freeze
s.version = "1.0.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
... | 37.885714 | 112 | 0.69457 |
e2331c4197f7403238e081537faf4a72fb707313 | 13,711 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | 48.278169 | 150 | 0.749325 |
38d7e8b2a8d59bef90d4cfaa9dc4aed301c913c2 | 5,270 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'openssl'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient
def initialize(info={})
... | 34.671053 | 117 | 0.617268 |
e2628e2908c515f2582b7279989e0c08a14c398e | 270 | # frozen_string_literal: true
module ClickHouse
module Type
class BaseType
def cast(_value, *)
raise NotImplementedError, __method__
end
def serialize(_value, *)
raise NotImplementedError, __method__
end
end
end
end
| 16.875 | 45 | 0.659259 |
acf452847993aa60ff07eb1af3a1986723ccd76b | 1,130 | class AnswersController < ApplicationController
before_filter :find_question
# POST /answers
# POST /answers.json
def create
authorize! :create, Answer
@answer = @question.answers.build(params[:answer])
@answer.user = current_user
if @answer.save
@msg = t("alert.answer.create_success... | 24.042553 | 90 | 0.654867 |
4a2713fee01c1ef47dc8dde4a3e0a3284ccc2df8 | 3,330 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Cosmosdb::Mgmt::V2020_03_01
module Models
#
# Parameters to create and update Cosmos DB Table.
#
class TableCreateUpdateParameters < ARMResour... | 30 | 79 | 0.452252 |
8780f88469940ce1f2f310dc35af46f73efa2804 | 639 | class Reportsheet < ApplicationRecord
belongs_to :user
has_many :positions, dependent: :destroy
def add_geoposition(lats, lons, recdates, uid, rsid)
#position = Position.where("user_id=?", uid).last
#if position != nil
# (0..lats.count-1).each do |i|
# if recdates[i] >= position.recdate
#... | 31.95 | 112 | 0.627543 |
f874875b7eca3bb8ee36c37bafa005b80918a4d8 | 924 | class Gsl114 < Formula
homepage "https://www.gnu.org/software/gsl/"
url "http://ftpmirror.gnu.org/gsl/gsl-1.14.tar.gz"
mirror "https://ftp.gnu.org/gnu/gsl/gsl-1.14.tar.gz"
sha256 "3d4a47afd9a1e7c73b97791b4180d8cc4d5f0e5db6027fe06437f1f3f957fafb"
bottle do
cellar :any
sha256 "e3e5dcf0d83043554296bc8dc... | 31.862069 | 95 | 0.739177 |
180f6963909a6b2805df245777afd39271406f1b | 1,717 |
require 'rubygems'
require 'fog/telefonica' # version >= 1.37
auth_url = "https://example.net:5000/v3/auth/tokens"
username = 'admin@example.net'
password = 'secret'
project = 'admin'
@connection_params = {
:telefonica_auth_url => auth_url,
:telefonica_username => username,
:telefonica_api_key =>... | 22.592105 | 66 | 0.683168 |
edf3c46a03d833cb3e7f386f60430e540b592867 | 137 | class AddWantsParticipationToUser < ActiveRecord::Migration
def change
add_column :users, :wants_participation, :boolean
end
end
| 22.833333 | 59 | 0.79562 |
f84180d47c3bb4e2c322c5df17e0b5fb74a3fa14 | 522 | #! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/indirector/file_content/file'
describe Puppet::Indirector::FileContent::File do
it "should be registered with the file_content indirection" do
Puppet::Indirector::Terminus.terminus_class(:file_content, :file).should equal(Puppet::Indirector::Fi... | 34.8 | 121 | 0.781609 |
e899aabdc60b639c650fe99c677f4129847c887d | 2,833 | module Comet
module Rules
class Build
def initialize(firmware, device)
@firmware = firmware
@device = device
end
def target
@target ||= Comet::Makefile.fingerprint Hash[
dependencies: Set[rules.map(&:target).uniq]
], extension: :phony
end
d... | 23.806723 | 85 | 0.56089 |
4a6aebae0f3b1b0a94cf24239cd71ae02bf7634d | 3,250 | require 'rubygems'
require 'marc' # ruby gem for working with MARC data in Ruby
require 'block_mapper' # the generic mapper class
require 'marc_record_ext.rb' # our custom methods
require 'base64' # so we can base64 encode the marc21 record
class MARCMapper < BlockMapper
def initialize()
super
before_each... | 26.422764 | 88 | 0.615077 |
26a965e622ad453d4f585ac1389795616eb077f3 | 2,290 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include ... | 26.321839 | 114 | 0.675546 |
4ac08556448c255e7c3ab51881a3aa2897fed6f2 | 955 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v3/services/ad_schedule_view_service.proto
require 'google/protobuf'
require 'google/ads/google_ads/v3/resources/ad_schedule_view_pb'
require 'google/api/annotations_pb'
require 'google/api/client_pb'
require 'google/api/field_b... | 31.833333 | 163 | 0.769634 |
b9500033ed6d3f0a521ee642ce9bab2da6ea1d0f | 194 | class RemoveUserLogin < ActiveRecord::Migration
def change
remove_column :repositories, :user_login, :string
change_column :repositories, :user_id, :integer, null: false
end
end | 27.714286 | 64 | 0.747423 |
bb7e8c3cf8261e3b32042b8cd7a8193e9605d064 | 171 | class AddNameToApnApps < ActiveRecord::Migration
def self.up
add_column :apn_apps, :name, :string
end
def self.down
remove_column :apn_apps, :name
end
end | 19 | 48 | 0.725146 |
f85d8254dc62b48dd5b055fdebff6b1e5b142b06 | 365 | cask 'processing2' do
version '2.2.1'
sha256 '8c237b3eb50626e8ffc648bfdeddaa18ceffbd6a48f8fec77a8eab5b774971fc'
url "http://download.processing.org/processing-#{version}-macosx.zip"
name 'Processing'
homepage 'https://processing.org/'
conflicts_with cask: 'processing'
app 'Processing.app'
zap delete... | 24.333333 | 75 | 0.761644 |
9131437d03f782288e3f34c4f0364f2bc54688bb | 642 | require 'forwardable'
require 'ku/ldap'
module KU
module Media
class Group < Sequel::Model
unrestrict_primary_key
extend Forwardable
DIRECTORY = KU::LDAP
def_delegators :entry, :description, :members, :member?
many_to_many :collections, key: :author_id
... | 18.882353 | 72 | 0.573209 |
bbaeb18746793433777a2442a2bc3bfaa3839cb5 | 243 | class AddCurrencyToAccountVersions < ActiveRecord::Migration
def up
add_column :account_versions, :currency, :integer
remove_column :account_versions, :detail
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
| 22.090909 | 60 | 0.777778 |
616e15e1cc8054cd6edf882c9121eb3f490912e1 | 1,006 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 37.259259 | 86 | 0.759443 |
082116d1d77970c8e57ab0a51001118a38e00a91 | 335 | class RegularEventUpdateJob < ApplicationJob
queue_as :default
def perform(*args)
RegularEvents::Daily1UpdateJob.perform_now
RegularEvents::Daily2UpdateJob.perform_now
RegularEvents::Weekly1UpdateJob.perform_now
RegularEvents::Weekly2UpdateJob.perform_now
RegularEvents::MonthlyUpdateJob.perform... | 27.916667 | 47 | 0.814925 |
1d2f5259d3c161fa36df3a0d818d83f39860260a | 1,055 | require "language/node"
class FirebaseCli < Formula
desc "Firebase command-line tools"
homepage "https://firebase.google.com/docs/cli/"
url "https://registry.npmjs.org/firebase-tools/-/firebase-tools-7.8.1.tgz"
sha256 "76cf2d485de8a83294daa8e24568df9b3749a71c81429544ce55dc14aae5dfc2"
head "https://github.com... | 32.96875 | 93 | 0.75545 |
385e1c4bb14a468f387d0c7fbf5a4d5893a5511a | 1,593 | # frozen_string_literal: true
require 'json'
module HttpJson
class Responder
def initialize(requester, exception_class)
@requester = requester
@exception_class = exception_class
end
# - - - - - - - - - - - - - - - - - - - - -
def get(path, args)
response = requester.get(path, ar... | 23.776119 | 73 | 0.587571 |
aba2cf7cdea95a1d33a51fa2aa227b3e9f2604ad | 272 | class AddIndexToEveryIdField < ActiveRecord::Migration
def change
add_index :locations, :topic_id
add_index :references, :reference_type_id
add_index :references, :reference_source_id
add_index :references, :topic_id
add_index :topics, :user_id
end
end
| 27.2 | 54 | 0.779412 |
6224794e3b227e7e0d440902f38dc053b6c88deb | 128 | require 'test_helper'
class UserPoliticianTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16 | 50 | 0.71875 |
082e30bbf36c1d02888e158951aaf2e8b24cb81b | 836 | module Cryptoexchange::Exchanges
module Koinex
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Koinex::Market::API_URL}/ticker"
def fetch
output = super
adapt(output["prices"])
end
def adapt(output)... | 27.866667 | 82 | 0.495215 |
6a3c3a1a7815611cb884cefc48e42b6889177dc0 | 364 | # Copyright (c) Facebook, Inc. and its affiliates.
name 'cpe_powermanagement'
maintainer 'Facebook'
maintainer_email 'noreply@facebook.com'
license 'BSD'
description 'Manages powermanagement settings / profile'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
supports 'mac_os_x'
... | 28 | 72 | 0.791209 |
7acc0cea58106b78e02011163bca2de088f8e41f | 4,622 | # frozen_string_literal: true
require 'spec_helper'
module Alchemy
describe Api::ElementsController do
routes { Alchemy::Engine.routes }
describe '#index' do
let(:page) { create(:alchemy_page, :public) }
before do
2.times { create(:alchemy_element, page: page) }
create(:alchemy... | 31.22973 | 83 | 0.61402 |
bb3c8626d32d5329132d87f59eb3eea26d7d23d8 | 1,692 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter do
include MetricsDashboardHelpers
let(:project) { build_stubbed(:project) }
let(:environment) { build_stubbed(:environment, project: project) }
describe '#transform!' do
subject... | 28.2 | 105 | 0.700946 |
1d63f6a520f93eb652d6c9e5acff5f0dd9872296 | 834 | cask 'refined-github-safari' do
version '2.1.1'
sha256 '4a912c723abd3d49577437e6ec7d1444ec6bdb8082673b95334ff3f28d08b6ec'
url "https://github.com/lautis/refined-github-safari/releases/download/v#{version}/Refined-GitHub-for-Safari.zip"
appcast 'https://github.com/lautis/refined-github-safari/releases.atom'
n... | 39.714286 | 115 | 0.703837 |
1dd32e6402d514b6d31066bddc9dda9b78969681 | 1,420 | class Physfs < Formula
desc "Library to provide abstract access to various archives"
homepage "https://icculus.org/physfs/"
url "https://icculus.org/physfs/downloads/physfs-3.0.2.tar.bz2"
sha256 "304df76206d633df5360e738b138c94e82ccf086e50ba84f456d3f8432f9f863"
head "https://hg.icculus.org/icculus/physfs/", u... | 33.023256 | 93 | 0.707746 |
f7774ea137d0064202fa6867dc3042aa4f329467 | 908 | require File.join( File.dirname(File.expand_path(__FILE__)), '../base')
describe RestClient::Request do
describe "ssl verification" do
it "is successful with the correct ca_file" do
request = RestClient::Request.new(
:method => :get,
:url => 'https://www.mozilla.com',
:verify_ssl =>... | 34.923077 | 86 | 0.640969 |
5d6eed5198346ca3e9e76a7fc9c618439de98bd7 | 3,962 | # frozen_string_literal: true
# Cloud Foundry Java Buildpack
# Copyright 2013-2018 the original author or authors.
#
# 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.... | 37.377358 | 120 | 0.697375 |
8771d29843e3f087fabf4547acf41f1adeb79ebd | 551 | module Pageflow
class Account < ActiveRecord::Base
include FeatureTarget
has_many :users
has_many :entries
has_many :folders
has_many :themings
belongs_to :default_theming, :class_name => 'Theming'
validates :default_theming, :presence => true
accepts_nested_attributes_for :default... | 22.04 | 72 | 0.689655 |
b94460edd165215420690e451183e2f8726552bb | 2,693 | class Libmemcached < Formula
desc "C and C++ client library to the memcached server"
homepage "https://libmemcached.org/"
url "https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz"
sha256 "e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82"
revision 2
bottle do
... | 36.391892 | 102 | 0.658002 |
bb97e1276554217993b5e0b2c8dedee7c07f09cf | 117 | class DropTurnsFromGames < ActiveRecord::Migration[5.1]
def change
remove_column :games, :turn_count
end
end
| 19.5 | 55 | 0.760684 |
6abfd8f6d717e4e2cb08323d25c2c911aa2d9063 | 4,901 | =begin
#Selling Partner API for Direct Fulfillment Inventory Updates
#The Selling Partner API for Direct Fulfillment Inventory Updates provides programmatic access to a direct fulfillment vendor's inventory updates.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Cod... | 44.153153 | 146 | 0.747194 |
1c30180a3c1b6e697010f0ec7b600db1944ee85f | 1,147 | # Copyright 2014 Square 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 ... | 30.184211 | 77 | 0.721883 |
0826ce790248e221792093b89c055f3fd52020ca | 4,839 | module Workflow::Addon
module Branch
extend ActiveSupport::Concern
extend SS::Addon
included do
attr_accessor :in_branch
define_model_callbacks :merge_branch
field :master_id, type: Integer
belongs_to :master, foreign_key: "master_id", class_name: self.to_s
has_many :bran... | 25.335079 | 97 | 0.598884 |
edc5c31d6fc2dd2613fd87c631acaf513d6e046a | 2,998 | require 'rails_helper'
RSpec.describe Api::V1::TourPointsController, :type => :controller do
render_views
describe "POST create" do
let!(:user) { FactoryBot.create :pro_user }
let!(:tour) { FactoryBot.create :tour }
let!(:tour_point) { FactoryBot.build :tour_point }
context "within existing tour"... | 52.596491 | 344 | 0.679787 |
87b4383fa959934e83421341784d3c398513e517 | 1,176 | require 'fog/ecloud/models/compute/template'
module Fog
module Compute
class Ecloud
class Templates < Fog::Ecloud::Collection
identity :href
model Fog::Compute::Ecloud::Template
def all
r_data = []
data = connection.get_templates(href).body[:Families]
... | 28.682927 | 166 | 0.535714 |
3827053c7bd36c28f7f11563559ecd15f58a1c51 | 562 | # frozen_string_literal: false
# = uri/wss.rb
#
# Author:: Matt Muller <mamuller@amazon.com>
# License:: You can redistribute it and/or modify it under the same term as Ruby.
#
# See Bundler::URI for general documentation
#
require_relative 'ws'
module Bundler::URI
# The default port for WSS URIs is 443, and the s... | 24.434783 | 81 | 0.692171 |
7a65cd6d88ecb1456b75a757428b103ab6e8c7b9 | 13,266 | module ActiveHash
class RecordNotFound < StandardError
end
class ReservedFieldError < StandardError
end
class IdError < StandardError
end
class FileTypeMismatchError < StandardError
end
class Base
class_attribute :_data, :dirty, :default_attributes
class WhereChain
def initialize(... | 22.833046 | 149 | 0.566637 |
39dc66ed56005e04433cc0bc017df64d961c25f1 | 910 | module StubApiRequestHelper
class MissingFixtureError < StandardError
end
REQUEST_HEADERS = {
'Accept' =>'application/json',
'Authorization' =>'Basic a2F0YW5hOnNlY3JldA==',
'Content-Type' =>'application/json'
}.freeze
def stub_api_request(verb, path, options = {})
file_name = options... | 35 | 79 | 0.654945 |
2673a066fc429a6dd8e78c361a87a80d37078dbc | 991 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v1/enums/brand_safety_suitability.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.ads.googleads.v1.enums.BrandSafetySuitabilityE... | 43.086957 | 203 | 0.816347 |
5d4cc65157a5fc83f77807070ca3a6232b4f8176 | 8,126 | require 'saml_idp_constants'
## GET /api/saml/auth helper methods
module SamlAuthHelper
def saml_settings
settings = OneLogin::RubySaml::Settings.new
# SP settings
settings.assertion_consumer_service_url = 'http://localhost:3000/test/saml/decode_assertion'
settings.assertion_consumer_logout_service_... | 30.208178 | 105 | 0.733079 |
e21ee06188dd4c00a443ad6f7a4932daf49780fe | 304 | class Rpush260Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
def self.up
add_column :rpush_notifications, :content_available, :boolean, default: false
end
def self.down
remove_column :rpush_notifications, :content_available
end
end
| 27.636364 | 114 | 0.763158 |
f83b4abd1e2f8753cd4ffd9ccb291505884ed6db | 800 | class Profiles::PreferencesController < Profiles::ApplicationController
before_action :user
def show
end
def update
begin
if @user.update_attributes(preferences_params)
flash[:notice] = 'Preferences saved.'
else
flash[:alert] = 'Failed to save preferences.'
end
rescue... | 20 | 71 | 0.65 |
28d5a71bc2b37b62568e4b1a383446ef434f9994 | 2,827 | require 'yaml'
module Readspeed
class Tracker
attr_accessor :file_name
def initialize(title, input: $stdin, output: $stdout)
@input = input
@output = output
@pages = 0
@times = []
@title = title
end
def start
output.puts "#{help_info}\n Starting recording. Press ... | 22.085938 | 98 | 0.558543 |
e9352d5f65e8f1784c9e90cd7147fdc3293228ce | 1,823 | class ConsulTemplate < Formula
desc "Generic template rendering and notifications with Consul"
homepage "https://github.com/hashicorp/consul-template"
url "https://github.com/hashicorp/consul-template.git",
:tag => "v0.19.5",
:revision => "f8c8205caf458dfd0ecab69d029ab112803aa587"
head "https://gith... | 38.787234 | 94 | 0.706528 |
79f419f3897fca804bb77470177aa98e8042a9b9 | 984 | # == Schema Information
#
# Table name: flow_inds
#
# id :integer not null, primary key
# flow_id :integer not null
# ind_id :integer not null
# value(Numeric value) :float not null
#
# Indexes
#
# flow_inds_flow_id_idx (flo... | 23.428571 | 80 | 0.555894 |
216ff9db04fc9b05940a966a02c27a0762d3aef2 | 1,815 | class GraphqlController < ApplicationController
skip_forgery_protection if: :skip_csrf_protection?
def execute
variables = ensure_hash(params[:variables])
query = params[:query]
operation_name = params[:operationName]
context = {
pundit_user: pundit_user,
current_school: current_school... | 27.5 | 124 | 0.707989 |
abaa33208a95458778805fc6bc8357115b4bfc73 | 5,281 | # frozen_string_literal: true
Puppet::Type.newtype(:mysql_grant) do
@doc = <<-PUPPET
@summary
Manage a MySQL user's rights.
PUPPET
ensurable
autorequire(:file) { '/root/.my.cnf' }
autorequire(:mysql_user) { self[:user] }
def initialize(*args)
super
# Forcibly munge any privilege with ... | 43.286885 | 194 | 0.616171 |
3841811cd35a43b08a2ccc7f4be7d19fcf63aad8 | 551 | Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.dig... | 30.611111 | 58 | 0.780399 |
03357d0732d07b283c318b74784e9e4302bd8b6b | 1,591 | # encoding: utf-8
require File.expand_path('../spec_helper.rb', __FILE__)
describe 'Backup::Configuration' do
after do
Backup::Configuration.send(:remove_const, 'Foo')
end
it 'should create modules for missing constants' do
Backup::Configuration::Foo.class.should == Module
end
describe 'a generat... | 25.253968 | 72 | 0.649277 |
f80bd240b65fa842733a13370e5bd9564c5df5ea | 358 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Cosmosdb::Mgmt::V2015_04_08
module Models
#
# Defines values for IndexKind
#
module IndexKind
Hash = "Hash"
Range = "Range"
... | 21.058824 | 70 | 0.670391 |
1a257aa18f87a2ab62d1eb6a4dadc5c79853a714 | 3,326 | class Fbthrift < Formula
desc "Facebook's branch of Apache Thrift, including a new C++ server"
homepage "https://github.com/facebook/fbthrift"
url "https://github.com/facebook/fbthrift/archive/v2022.05.16.00.tar.gz"
sha256 "dfc15d27f25d33e25f23b42a391d45f1c890727a271a4d078e035e374d3c5666"
license "Apache-2.0"... | 37.370787 | 123 | 0.715574 |
5d01823afd380711336fd58fc9b252a8409abcb8 | 1,106 | class Libgeotiff < Formula
desc "Library and tools for dealing with GeoTIFF"
homepage "http://geotiff.osgeo.org/"
url "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz"
sha256 "acfc76ee19b3d41bb9c7e8b780ca55d413893a96c09f3b27bdb9b2573b41fd23"
revision 1
bottle do
sha256 "2d90f234867... | 36.866667 | 95 | 0.740506 |
38fec077b826194731549421a0cd4bc6413372e4 | 9,430 | # 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::Redis::Mgmt::V2017_02_01
module Models
#
# A single Redis item in List or Get Operation.
#
class RedisResource < TrackedReso... | 33.439716 | 358 | 0.468187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.