text stringlengths 10 2.61M |
|---|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class PagesController < ApplicationController
helper_method :has_perms?, :pages_viewed_titles
before_filter :authenticate_user!, :except => [:show]
def show
@page = Page.find params[:id] rescue redirect_to root_path, :alert => "La pagina '#{params[:id]}' no existe"
pages_viewed(@page)
end
def inde... |
# Sending an MT message
class Smpp::Pdu::SubmitSm < Smpp::Pdu::Base
# Note: short_message (the SMS body) must be in iso-8859-1 format
def initialize(source_addr, destination_addr, short_message, options={})
@msg_body = short_message
udh = options[:udh]
service_type = o... |
require 'spec_helper'
describe Filter::Genre do
it "should properly inherit from informal" do
Filter.model_name.human.should == "Filter"
end
describe "#initlialize" do
context "when the genre exists" do
it "should set the genre" do
Factory(:movie, :genre_list => 'parties')
@filter ... |
# Array API - every array type needs to implement these
# attribute name -> (string)
# attribute serial -> (string)
# attribute model -> (string)
# attribute firmware -> (string)
# attribute space_total -> (integer) in GB
# attribute space_available -> (integer) in GB
# attribute space_used -> (integer) in GB
# method ... |
class Credit < ActiveRecord::Base
has_many :fund_credits
end
|
class CreateDoctorWorktimes < ActiveRecord::Migration[5.0]
def change
create_table :doctor_worktimes do |t|
t.integer :doctor_id
t.string :days, default: '[monday, tuesday, wednesday, thurteday, friday]'
t.integer :start_hours, default: 8
t.integer :start_minutes, default: 0
t.intege... |
require "rails_helper"
RSpec.describe GovukDesignSystem::SummaryListHelper, type: :helper do
describe "#govukSummaryList" do
it "returns the correct HTML for the default example" do
html = helper.govukSummaryList({
rows: [
{
key: {
text: "Name"
},
... |
module Models
class Keyboard < ActiveRecord::Base
belongs_to :user
DEFAULT_KEYBOARD_NAME = 'My keyboard'.freeze
VALID_KEYS = ('a'..'z').freeze
def upsert_sound!(key, sound)
return false unless VALID_KEYS.include?(key)
keys[key] = {
sound_id: sound.id,
sound_... |
class SendMailer < ApplicationMailer
default from: "solwish@naver.com"
def sendmail(from, title, content)
@content =content
@from = from
mail(
to: "solwish@naver.com",
subject: title
)
end
end
|
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sygaldry/version'
Gem::Specification.new do |spec|
spec.name = 'sygaldry'
spec.version = Sygaldry::VERSION
spec.authors = ['Samuel Giddins']
spec.email = ['se... |
class SessionsController < ApplicationController
skip_before_action :authorize
def create
@user = User&.find_by(username: params[:username])
if @user&.authenticate(params[:password])
session[:user_id] = @user.id
render json: @user,
status: :created
... |
# Set application root for requires
APP_ROOT = File.expand_path(File.dirname(__FILE__))
# Initialize
require File.join(APP_ROOT, 'config', 'initialize')
require 'json'
# This class represents the actual web application.
class App < Sinatra::Base
configure do
enable :method_override
register Sinatra::Flash
... |
class CreateAnimalInfors < ActiveRecord::Migration
def change
create_table :animal_infors do |t|
t.integer :animal_id
t.string :Name
t.string :Sex
t.string :Type
t.string :Age
t.string :Variety
t.string :Reason
t.boolean :IsSterilization
... |
cask :v1 => 'textwrangler' do
version '4.5.12'
sha256 'f25ce90a54570ee4fe2287cdbe5c8b2a57188423a3693becacfa0533f02e0aa2'
url "http://ven.barebones.com/TextWrangler_#{version}.dmg"
appcast 'https://versioncheck.barebones.com/TextWrangler.xml',
:sha256 => '3cee097b60d3e2b61835886aa980b6987dd9dd08aee4e8... |
require 'rails_helper'
RSpec.describe 'layouts/application.html.erb' do
before do
view.extend(ApplicationHelper)
allow(view).to receive(:user_signed_in?).and_return(false)
controller.singleton_class.class_eval do
def ccs_homepage_url
'https://CCSHOMEPAGE'
end
helper_method :ccs_... |
class Admin::CuponsController < ApplicationController
before_action :set_cupon, only: [:show, :edit, :update, :destroy]
def index
@cupons = Cupon.all
end
def new
@cupon = Cupon.new()
end
def edit
end
def update
respond_to do |format|
if @cupon.update(cupons_params)
format.h... |
# Confidential and proprietary trade secret material of Ribose, Inc.
# (c) 2017 Ribose, Inc. as unpublished work.
#
#
module Digicert
VERSION = "0.1.0".freeze
end
|
class DocumentsController < ApplicationController
def index
@documents = Document.all
respond_to do |format|
format.html #app/view/documents/index.html.erb
format.xml { render xml: @documents}
end
end
def new
end
def create
@document = Document.new(:xmlDoc => request.body.read)... |
class OrdersController < ApplicationController
def index
@orders = policy_scope(Order)
@reviews = Review.all
# @orders = policy_scope(Order).where(user: current_user).or(Order.where(dressmaker: current_user))
# authorize @orders
end
def show
@order = Order.find(params[:id])
order_confirma... |
# frozen_string_literal: true
require 'rails_helper'
include Warden::Test::Helpers
RSpec.feature 'Access an Etd', js: false do
let(:etd) { FactoryGirl.create(:public_etd, pdf: pdf) }
let(:pdf) { FactoryGirl.create(:pdf_upload) }
# Only enqueue the ingest job, not charactarization.
before { ActiveJob::Base.que... |
class Login < ActiveRecord::Base
validates :user_id, presence: true
validates :token, uniqueness: true, presence: true
belongs_to :user
def self.find_all_logins_for_user(user)
Login.where(user_id: user.id)
end
end
|
require "pry"
# # A method to reverse the words in a sentence, in place.
# # Time complexity: O{n} - linear go thru once intial reverse and revist and don't do at the time
# # Space complexity: O(1)
# ## Wave 2 - Reverse Sentence
# In this assignment, you'll design and implement one of the well-known string manipula... |
module Api
module V1
class RecipesController < ::Api::ApplicationController
include JsonResponseHelper
include ActiveModel::Validations
before_action :authorize_request, except: :index
before_action :load_company
before_action :load_recipe, except: %i[create index]
before_actio... |
Rails.application.routes.draw do
get '/dogs/most_dogs', to: "dogs#most_dogs", as: 'most_dogs'
resources :dogs
resources :employees
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
module Statusable
extend ActiveSupport::Concern
DEFAULT_STATUS = {
draft: 'draft',
waiting_approval: 'waiting_approval',
published: 'published',
archived: 'archived'
}
included do
def self.status_configure(options = {})
options = {
default_status: :draft,
status_has... |
Rails.application.routes.draw do
resources :books
# get '/books', to: 'books#index'
# get '/books/:id', to: 'books#show', as: 'show'
# get '/books/new', to: 'book#new', as: 'new'
# get '/books/:id/edit', to: 'book#edit', as: 'edit'
# post '/books', to: 'books#create... |
# CreateFuzzyRecordOperation.rb
# PeepOpen
#
# Created by Martin Hawkins on 26/01/2011.
# Copyright 2011 Topfunky Corporation. All rights reserved.
class CreateFuzzyRecordOperation < NSOperation
def initWithProjectRoot(theProjectRoot, andFilePath:relativeFilename)
init
@projectRoot = theProjectRoot
@rel... |
class ProjectUploadSerializer < UploadSerializerBasic
attributes :id,
:project_id,
:s3_url,
:s3_bucket,
:sort_order,
:created_at,
:updated_at,
:state,
:filename,
:thumbnail_url,
:urls,
... |
require 'rails_helper'
RSpec.describe NotificationConfiguration, type: :model do
let(:notification_config) {FactoryGirl.create(:notification_configuration)}
describe "creation" do
context "with valid attributes" do
it "should be valid" do
expect(notification_config).to be_valid
end
e... |
class CreateHappyHours < ActiveRecord::Migration
def change
create_table :happy_hours do |t|
t.time :beings_at
t.time :ends_at
t.timestamps
end
end
end
# happy.beings_at.strftime("%I:%M%p") |
require 'rails_helper'
describe "show paper details" do
it "should display full name of author" do
@paper = FactoryBot.create :paper
visit paper_path(@paper)
expect(page).to have_text('Alan Turing')
end
end
|
class CreateCustomerProfiles < ActiveRecord::Migration
def change
create_table :customer_profiles do |t|
t.integer :customer_id
t.string :fein
t.string :company_name
t.string :dba
t.string :owner_name
t.text :additional_emails, array: true, default: []
t.string :phone
... |
class Monologue::Post
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paperclip
ROOT_PATH = Monologue::Engine.routes.url_helpers.root_path
has_many :taggings, class_name: 'Monologue::Tagging'
has_and_belongs_to_many :tags,
dependent: :destroy,
... |
require_relative "../dinosaur"
require 'csv'
describe Dinosaur do
let(:bob) { Dinosaur.new({name: "Bob",
weight: 280,
diet: "coffee & doughnuts",
locomotion: "rolling chair",
period: "haven't gone sin... |
require 'test_helper'
class GroupContactsControllerTest < ActionController::TestCase
setup do
@group_contact = group_contacts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:group_contacts)
end
test "should get new" do
get :new
assert... |
module MachO
# Represents a Mach-O file, which contains a header and load commands
# as well as binary executable instructions. Mach-O binaries are
# architecture specific.
# @see https://en.wikipedia.org/wiki/Mach-O
# @see MachO::FatFile
class MachOFile
# @return [String] the filename loaded from, or n... |
require 'rails_helper'
RSpec.describe 'Routes for BI - ItemsRankedRevenue' do
def items_with_revenue
merchant = create(:merchant)
items = create_list(:item, 50, merchant: merchant, unit_price: 10)
items.each_with_index do |item, idx|
invoice = create(:invoice, merchant: merchant, status: 'shipped')... |
class CreateOrderItems < ActiveRecord::Migration
def change
create_table :order_items do |t|
t.references :order, index: true
t.references :orderable, polymorphic: true, index: true
t.string :title, null: false
t.decimal :price, precision: 10, scale: 2
t.integer :quantity, null: fals... |
require File.dirname(__FILE__) + '/setup'
require 'javaclass/dsl/caching_classpath'
require File.dirname(__FILE__) + '/logging_folder_classpath'
require File.dirname(__FILE__) + '/test_folder_classpath'
module TestJavaClass
module TestDsl
class TestCachingClasspath < TestClasspath::TestFolderClasspath
# e... |
require './lib/library.rb'
require 'date'
describe Library do
it 'shows a list of books' do
expect(subject.catalogue).to_not eq nil
end
it 'shows a list of titles and author of books' do
expect(subject.show_title_author).to_not eq nil
end
end
|
require 'slim'
require "active_record"
require "active_record/fixtures"
###
# Page options, layouts, aliases and proxies
###
configure :build do
ignore 'templates/*'
end
# Per-page layout changes:
#
# With no layout
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
# With alt... |
class Feedback < ActiveRecord::Base
attr_accessible :body, :topic
validates :topic, presence: true
validates :body, presence: true, length: {in: 50..500 }
end
|
def series_sum(n)
return "0.00" if n == 0
"%.2f" % (0...n).map { |x| 1.0/(x*3+1)}.reduce(:+)
end
|
class BinarySearch
class Node
attr_accessor :value, :parent_node, :lchild_node, :rchild_node
def initialize(value, lchild_node=nil, rchild_node=nil)
@value = value
@lchild_node = lchild_node
@rchild_node = rchild_node
end
end
def initialize
@root = nil
... |
# == Schema Information
#
# Table name: audio_files
#
# id :integer not null, primary key
# duration :integer
# format :string
# hizb_number :integer
# is_enabled :boolean
# juz_number :integer
# mime_type :string
# page_number :integer
# rub_number :integer
# ... |
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test "adding a user" do
assert User.add("vc1", "pw") == 1
end
test "adding a user that already exists" do
res = User.add("vc2", "pw")
assert User.add("vc2", "hello") == -2
end
te... |
require 'test/unit'
module MatrixProperties
include Test::Unit::Assertions
def get(row, column)
assert(column >= 0 && column < @width, "Column index out of range")
assert(row >= 0 && row < @height, "Row index out of range")
result = @dict[[row, column]] || 0
assert(result.is_... |
ActiveAdmin.register Location do
menu :priority => 3, label: proc{ t("active_admin.locations")}
permit_params :code, :name
config.filters = false
index do
column(t("active_admin.location.code")){ |location| location.code }
column(t("active_admin.location.name")){ |location| location.name }
actions
end
sh... |
class CreateExperimentsImpactsParams < ActiveRecord::Migration
def change
create_table :experiments_impacts_params do |t|
t.integer :experiment_id
t.integer :param_id
t.string :value
t.timestamps
end
end
end
|
class CreateTestsUploads < ActiveRecord::Migration
def self.up
create_table :tests_uploads do |t|
t.column :problem_id, :integer
t.column :filename, :string
t.column :original_filename, :string
t.column :state, :integer
t.column :message, :text
t.column :created_at, :datetime
... |
# Map.
# We're gonna keep it fixed-size at the moment, so it could still
# theoretically fit on a normal 80x24 console.
# A mixin, I suppose. That IS basically what I need.
module Location
attr :x, true
attr :y, true
attr :tile, true
attr :color, true
def initLoc
@x = 0
@y = 0
end
... |
class AlterDescriptionInBusiness < ActiveRecord::Migration
class Business < ActiveRecord::Base
end
def change
change_column :businesses, :description, :text
end
end
|
require "rails_helper"
RSpec.feature "Create a New Page" do
before do
visit root_url
click_link "Create a new page"
end
scenario "display new page form" do
expect(page).to have_content("New page")
expect(page).to have_field("Page title", with: "")
expect(page).to have_field("Page contents"... |
require_relative '../smtp'
Rails.application.configure do
config.cache_classes = true
config.cache_store = :memory_store
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV.fetch('RAILS_SERVE_STATIC_FILE... |
require 'rails_helper'
describe MessagesController do
let(:message) { create(:message) }
let(:group) { create(:group) }
let(:user) { create(:user) }
describe 'GET #new' do
before do
login_user user
end
before do
get :new, params: { group_id: group.id }
end
it "populates a... |
require('spec_helper')
describe(Artist) do
it {should have_many :albums}
it {should have_many :tracks}
it {should have_and_belong_to_many :labels}
it {should have_one :user}
it {should validate_uniqueness_of :name}
end
|
class Helper < User
extend ModelAddOns::TimeConcerns
many :helper_request, :foreign_key => :helper_id, :class_name => "HelperRequest"
many :helper_points, :foreign_key => :user_id, :class_name => "HelperPoint"
many :request, :foreign_key => :request_id, :class_name => "Request"
key :user_level_id, ObjectId
... |
class AddRegistrationColumnToEnrollments < ActiveRecord::Migration[6.1]
def change
add_column :enrollments, :registration, :string, default: "ticket"
end
end
|
require 'rails_helper'
RSpec.describe Room, type: :model do
describe "associations" do
it { should belong_to(:student) }
it { should belong_to(:course) }
end
describe "validations" do
it { should validate_presence_of(:student) }
it { should validate_presence_of(:course) }
it { should validat... |
class Order < ApplicationRecord
include ActiveModel::Validations
include WorkWithDate
has_many :item_orders
has_many :items, :through => :item_orders
belongs_to :user
validate :validate_uniqueness_of_course_type
validates :item_ids, presence: true
def start_time
self.created_at
end
def save_... |
#!/usr/bin/env ruby
require 'relayapi/api/base'
require 'json'
class RelayAPI::API::V1 < RelayAPI::API::Base
get '/' do
content_type :json
pfx = request.fullpath.sub(/\/?(\?.*)?$/,'')
{
'endpoints' => {
"#{pfx}/devices" => { 'methods' => ['GET'] },
"#{pfx}/devices/:id" => { 'metho... |
class NodeWebkit < Cask
url 'https://s3.amazonaws.com/node-webkit/v0.7.2/node-webkit-v0.7.2-osx-ia32.zip'
homepage 'https://github.com/rogerwang/node-webkit'
version '0.7.2'
sha1 '9ec8ff43fd38adea534a1e311c5ec349a38f46b1'
link 'node-webkit.app'
end
|
class MomentumCms::Admin::SnippetsController < MomentumCms::Admin::BaseController
before_action :load_moment_cms_snippet, only: [:edit, :update, :destroy]
before_action :build_moment_cms_snippet, only: [:new, :create]
def index
@momentum_cms_snippets = @current_momentum_cms_site.snippets.all
end
def new... |
class ReportsController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
#def search
# if params[:search].present?
# @reports = Report.search(params[:search])
# else
# @reports = Report.all
# end
#end
def index
@reports = Report.all.order("created_at DESC").paginate(... |
require_relative('engine')
require_relative('utility')
class OrderItem
attr_accessor :item_hash, :name, :freq_count, :freq_type, :last_purchase, :locations
include Utility
def initialize(item_hash)
@item_hash = item_hash
@name = get_name
@freq_count = parse_frequency[0]
@freq_type = parse_freq... |
module FckeditorVersion
MAJOR = 0
MINOR = 5
RELEASE = 0
def self.current
"#{MAJOR}.#{MINOR}.#{RELEASE}"
end
end |
#
# hermeneutics/tags.rb -- Parse HTML code
#
=begin rdoc
:section: Classes definied here
Hermeneutics::Parser Parses HTML source and builds a tree
Hermeneutics::Tags Compiles parsed code to a tag tree
=end
require "hermeneutics/escape"
module Hermeneutics
# Parse a HTML file or string.
#
class Parse... |
describe 'Matchers de Comparacao' do
it '>' do
expect(5).to be > 1
end
it '>=' do
expect(5).to be >= 2
expect(5).to be >= 5
end
it '<' do
expect(5).to be < 6
end
it '<=' do
expect(5).to be <= 6
expect(5).to be <= 5
end
it 'be_between inclusive' do
... |
module Rdomino
class Item
include DomObject
delegate :name, :text, :values, :values=, :valuelength, to: :obj
TYPES = {16 => :actioncd,
17 => :assistantinfo,
1084 => :attachment,
1076 => :authors,
2 => :collation,
1024 => :datetimes,
1090 => :embeddedobject,
256 ... |
json.array!(@dhokebaaz_supports) do |dhokebaaz_support|
json.extract! dhokebaaz_support, :id, :user_id, :ip_address, :message, :post_as_anonymous
json.url dhokebaaz_support_url(dhokebaaz_support, format: :json)
end
|
class PlaceCategoryAssignment < ActiveRecord::Base
validates :place, :place_category, presence: true
validates :place, uniqueness: {scope: :place_category}
belongs_to :place
belongs_to :place_category
end
|
# MiniTest suite for the app model
# This test run by MRI
require 'rubygems'
require 'minitest/spec'
require 'app_model'
MiniTest::Unit.autorun
SECONDS_PER_DAY = 60 * 60 * 24
describe AppModel do
before do
@data = Hash.new
now = Time.now
10.times do |i|
created_on = now - SECONDS_PER_DAY * i # c... |
$:.unshift __dir__
# FIXME: Hacky
$:.unshift File.join(__dir__, '..', '..', '..', 'sumisu', 'lib')
require 'ad_parser'
begin
require 'frequency_comparer'
rescue LoadError
raise 'Need to move sumisu repository to correct location'
end
require 'set'
require 'forwardable'
# This already has a description
class Yuka... |
module ImageUrl
IMAGE_VERSIONS = %w(default icon avatar brand cover preview)
extend ActiveSupport::Concern
included do
attr_accessor :image_object, :ignore_versions
end
def image_object
@image_object ||= :image
end
def ignore_versions
@ignore_versions ||= []
end
module ClassMethods
... |
class MoveTypeFromElementAssignmentsToElements < ActiveRecord::Migration
def change
remove_column :element_assignments, :type, :string
add_column :elements, :category, :string, null: false, default: ''
end
end
|
class SimulationsController < ApplicationController
# GET /simulations
# GET /simulations.json
def index
@simulations = Simulation.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @simulations }
end
end
# GET /simulations/1
# GET /simulations/1.jso... |
class User < ApplicationRecord
before_save {
self.email = email.downcase
}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :name,
presence: true,
length: {maximum: 50}
validates :email,
presence: true,
length: {maximum: 255}... |
require 'spec_helper'
class Vigil
describe Project do
before(:each) do
@sys = double('sys').as_null_object
@env = double('env', system: @sys, run_dir: '/run')
end
describe "#syncronize" do
it "clones the repository on first run" do
git = double('git')
@sys.should_recei... |
class ChangeLockedAngleFromDecks < ActiveRecord::Migration
def up
remove_column :decks, :locked_angle
add_column :decks, :locked_angle, :integer, default: 90
end
def down
remove_column :decks, :locked_angle
add_column :decks, :locked_angle, :text
end
end
|
# 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 StreamWithContentType
#
# A service client - single point of access to the REST API.
#
class CowbellModerator < MsRest::ServiceClient
inc... |
require 'test_helper'
class CompetencyLevelsControllerTest < ActionController::TestCase
setup do
@competency_level = competency_levels(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:competency_levels)
end
test "should get new" do
get :ne... |
class LineItem
include Mongoid::Document
field :quantity, type: Integer
field :product_id, type: Integer
field :cart_id, type: Integer
field :order_id, type: Integer
end
|
class VotesController < ApplicationController
before_action :load_post_and_vote
def up_vote
update_vote!( 1 )
redirect_to :back
end
def down_vote
update_vote!( -1 )
redirect_to :back
end
private
def load_post_and_vote
@post = Post.find( params[ :post_id ] )
@vote = @post.... |
require 'mackerel/client'
module Mackerel
class Client
def put_host(host_id, host)
response = client.put "/api/v0/hosts/#{host_id}" do |req|
req.headers['X-Api-Key'] = @api_key
req.headers['Content-Type'] = 'application/json'
req.body = host.to_json
end
unless response.... |
#Raw Glue - the Ruby OpenGL and Extensions Wrapper
require 'logger'
#external dependencies
%w'
set
ffi
facets/module/module_load
facets/string/camelcase
facets/string/snakecase
facets/platform
method_decorators
'.each { |f| require f }
module Roglew
LOGGER = Logger.new(STDOUT)
PLATFO... |
FactoryGirl.define do
factory :bless do
association :sender, factory: :user
virtual_present nil
message "MyText"
birthday_party nil
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class LeaveDateFinder
attr_reader :leave_dates
def initialize(filters)
filters = {} if filters.nil?
general_filter_list = [:year,:granted,:paid_leave]
@general_filters = filters.slice!(@general_filter_list)
if filters[:user_id]
leave_dates = User.find(filters[:user_id]).leave_dates
@leave_dates = app... |
module ROM
class Reader
include Enumerable
include Equalizer.new(:name, :relation, :mapper)
attr_reader :name, :relation, :header, :mappers, :mapper
def initialize(name, relation, mappers)
@name = name
@relation = relation
@header = relation.header
@mappers = mappers
@... |
# frozen_string_literal: true
module Kafka
module Protocol
class OffsetFetchRequest
def initialize(group_id:, topics:)
@group_id = group_id
@topics = topics
end
def api_key
OFFSET_FETCH_API
end
# setting topics to nil fetches all offsets for a consumer grou... |
Deface::Override.new(:virtual_path => "spree/layouts/spree_application",
:name => "select_locales",
:insert_after => "div#site_search",
:partial => "spree/shared/select_locales") |
require 'rails_helper'
RSpec.describe Notification, type: :model do
it 'has a valid factory' do
expect(create :notification).to be_valid
end
describe 'Validations' do
it { should validate_presence_of :text }
it { should validate_presence_of :action_notification_id }
it { should validate_presence_of :area_n... |
# == Schema Information
#
# Table name: bears_instances
#
# id :integer not null, primary key
# name :string
# comment :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_bears_instances_on_name (name) UNIQUE
#
require 'test_hel... |
class BirthdayDealVouchersController < ApplicationController
# skip_before_filter :login_required
# before_filter :customer_login_required, except: [:print]
# before_filter :user_login_required, only: [:print]
layout 'birthday'
helper_method :birthday_deal_voucher, :party, :number_of_freebies_left, :company, ... |
#
require "dotenv" #
Dotenv.load #
require "google_drive"#
#######################
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
#-------------------- CLASSE POUR FOLLOW GENS DANS LISTE ----------------------
class FollowTwitter
attr_accessor :client
def initialize... |
class AddDefaultPropertiesToOrderItem < ActiveRecord::Migration
def change
change_column :cart_items, :properties, :jsonb, default: {}
change_column :order_items, :properties, :jsonb, default: {}
end
end
|
require 'json'
require 'RMagick'
namespace :mamashai do
desc "生成照片书mv"
task :generate_album_mv => [:environment] do
book = AlbumBook.find(157)
dir = File.join(book.logo1.dir, "..")
json = JSON.parse(book.content)
json['pages'].each_with_index{|page, index|
img = Magick::Image.new(600, 600) #生成白布底图
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
#This file is replica of containernet/Vagrantfile
#
# This Vagrant file create a containernet VM.
#
#
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please do... |
class Task < ActiveRecord::Base
belongs_to :user
belongs_to :project
belongs_to :repeat
has_many :tags, :through => :task_tags
scope :current_user_tasks, -> id {
if id.present?
where('id = ?', id)
end
}
scope :status_filter, -> status {
where('status = ?', status)
}
scope :limit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.