text stringlengths 10 2.61M |
|---|
class SurrendersController < ApplicationController
before_action :authenticate_user!
before_action :set_surrender, only: [:show, :edit, :update, :destroy]
before_action :set_insurance
# GET /surrenders
# GET /surrenders.json
def index
@surrenders = @insurance.surrenders.all
end
# GET /surrenders/1... |
class ChangesToTour < ActiveRecord::Migration[5.1]
def change
remove_column :tours, :province
end
end
|
# == Schema Information
#
# Table name: web_search_results
#
# id :integer not null, primary key
# position :string(255)
# domain :string(255)
# link :text
# title :string(255)
# snippet :text
# created_at :datetime
# u... |
class FontPodkovaVfBeta < Formula
head "https://github.com/google/fonts/raw/main/ofl/podkovavfbeta/PodkovaVFBeta.ttf", verified: "github.com/google/fonts/"
desc "Podkova VF Beta"
homepage "https://fonts.google.com/earlyaccess"
def install
(share/"fonts").install "PodkovaVFBeta.ttf"
end
test do
end
end... |
require 'spec_helper'
feature 'User watches the current phase of a challenge' do
# scenario 'when the current phase is the ideas phase' do
# challenge = create :challenge,
# starts_on: 3.days.ago,
# ideas_phase_due_on: 7.days.from_now.to_date
#
# visit challeng... |
class AddDefaultImageUrlToUser < ActiveRecord::Migration[5.0]
def change
change_column_default :users, :image_url, 'https://d30y9cdsu7xlg0.cloudfront.net/png/15724-200.png'
end
end
|
class CreateBookTags < ActiveRecord::Migration
def self.up
create_table :book_tags do |t|
t.integer :book_id
t.integer :tag_id
t.timestamps
end
add_index :book_tags, [:book_id, :tag_id]
add_index :book_tags, :tag_id
end
def self.down
drop_table :book_tags
end
end
|
# frozen_string_literal: true
class UsersController < ApplicationController
before_action :authenticate_person!
before_action :set_param_user, only: [:show]
before_action :user_recipient_tickets, only: [:show]
def new
@user = User.new
end
def create
@user = User.new(set_params)
@user[:person_... |
Rails.application.routes.draw do
devise_for :users
authenticated :user do
root to: 'user_works#index'
end
root to: 'about#index', as: :unauthenticated_root
resources :users, only: :show do
resources :creators, controller: :user_creators, only: [:index, :new, :create]
resources :works, control... |
name 'bcs_ruby'
maintainer 'BCS Ltd'
maintainer_email 'richard.wigley@github'
license 'MIT'
description 'Installs/Configures bcs_ruby'
long_description 'Installs/Configures bcs_ruby'
version '3.0.0'
source_url 'git@github.com:BCS-io-provision/bcs_ruby' if respond_to?(:sou... |
=begin
#API v1.0.2
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.0.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.1
=end
require "uri"
module PipelinePublisher
class MessagesApi
... |
module Newly
class Selector
def initialize(selector)
@selector = selector
end
def all(args)
args[:max] ?
@selector.css(args[:container]).first(args[:max]) :
@selector.css(args[:container])
end
def title
@selector.at_css("title").text
end
end
end |
require "spec_helper"
describe FormationOfCompetencesController do
describe "routing" do
it "routes to #index" do
get("/formation_of_competences").should route_to("formation_of_competences#index")
end
it "routes to #new" do
get("/formation_of_competences/new").should route_to("formation_of_... |
# Responsible for loading the players and performing some check to ensure they are valid
class PlayerLoader
# After loading, gives a list of errors (if any) for the players that it tried to load
attr_reader :errors
# For a given folder, load the player files. Check that each player has implemented the correct ... |
# You need RubyUnit and MS Excel and MSI to run this test script
require 'runit/testcase'
require 'runit/cui/testrunner'
require 'win32ole'
require 'oleserver'
module EXCEL_CONST
end
module CONST1
end
module CONST2
end
module CONST3
end
class TestWin32OLE < RUNIT::TestCase
include OLESERVER
def setup
@e... |
class Employee < ActiveRecord::Base
enum role: { graphic_designer: 1, illustrator: 2, writer: 3, composer: 4, developer: 5 }
end
|
require_relative '../excel/formula_peg'
class ReplaceIndirectsWithReferencesAst
attr_accessor :replacements_made_in_the_last_pass
def initialize
@replacements_made_in_the_last_pass = 0
end
def map(ast)
return ast unless ast.is_a?(Array)
operator = ast[0]
if respond_to?(operator)
s... |
class AddDrawPileToGames < ActiveRecord::Migration
def change
add_column :games, :draw_pile_ids, :string, index: true
end
end
|
class Widget < ActiveRecord::Base
belongs_to :user
serialize :serialized_settings, Hash
serialize :serialized_current_data, Hash
def after_initialize
self.serialized_settings ||= {}
self.serialized_current_data ||= {}
end
def view
raise NonImplementedError
end
def available_settings... |
input = File.open("#{File.dirname(__FILE__)}/input", 'rb').read
class Tower
attr_reader :name, :weight, :subtower_names
def initialize(name, weight, subtower_names)
@name = name
@weight = weight
@subtower_names = subtower_names || []
end
def total_weight(towers)
@total_weigh... |
class PlanTask < ActiveRecord::Base
attr_accessible :maintenance_plan_id, :task_id, :task_type, :interval, :task_name
belongs_to :maintenance_plan
attr_accessor :task_name
end
|
class Triangle
attr_accessor :equilateral, :isosceles, :scalene
def initialize(side1, side2, side3)
@side1 = side1
@side2 = side2
@side3 = side3
self.kind
end
def kind
if @side1 <= 0 || @side2 <= 0 || @side3 <= 0
raise TriangleError
end
if (@side1 + @side2) <= @side3 || (@side2 + @side3) <= @side... |
class Category < ApplicationRecord
has_many :categorizations
has_many :products, through: :categorizations
end
|
require_relative './models/user'
require_relative './models/order'
require_relative './models/location'
require_relative './models/driver'
require_relative './view'
module GoCLI
# Controller is a class that call corresponding models
# and methods for every action
class Controller
# This is an example how to ... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root to: 'toppage#index'
get 'login', to: 'sessions#new'
post 'login', to: 'sessions#create'
delete 'logout', to: 'sessions#destroy'
concern :csv_importable do
collecti... |
class AdminController < ApplicationController
layout 'admin'
before_action :authentication_admin!
def dashboard
@products=Product.all
end
end |
# calc.rb
# Chapter 2 - starts on page 9
# 2.2 Intro to puts
puts 1 + 2
# 2.4 Simple Arithmetic
# floats
puts 1.0 + 2.0
puts 2.0 * 3.0
puts 5.0 - 8.0
puts 9.0 / 2.0
# integers
puts 1 + 2
puts 2 * 3
puts 5 - 8
puts 9 / 2
# 'puts 9 / 2' will output '4' -- rounding down from 4.5 answer
# final complex expressions
put... |
class Job < ApplicationRecord
has_many :characters
@class_file = File.read('/Users/flatironschool/Desktop/My_Code/char_maker/lib/5e-database/5e-SRD-Classes.json')
@class_hashes = JSON.parse(@class_file)
def self.make_all_jobs
@class_hashes.each{|job|
name = job["n... |
class UsersController < ApplicationController
skip_before_filter :log_in, :only => [:new, :create, :forgot_pw, :retrieve_pw]
before_filter :current_user?, :only => [:update, :edit, :destroy]
# GET /users
# GET /users.json
def index
@users = User.all
respond_to do |format|
format.html # index.h... |
require 'spec_helper'
describe "after option" do
before :all do
AddColumnAfterToGoodsTable.change
end
it "insert 'added_after_name' column after 'name' column" do
name_num = added_after_name_num = 0
Goods.columns.each_with_index do |column, i|
name_num = i if column.name == "name"
added... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe V1::BalancesController, type: :routing do
let(:base_uri) { 'http://api.example.com/v1/balances' }
describe 'routing' do
it 'routes to #index' do
expect(get: base_uri).to route_to(
controller: 'v1/balances',
action: 'inde... |
FactoryBot.define do
factory :content do
title {Faker::Lorem.word}
from_date {Faker::Date.between(from: '2021-05-01', to: '2021-05-03')}
return_date {Faker::Date.between(from: '2021-05-04', to: '2021-05-06')}
end
end
|
module Types
module Input
class PostInput < Types::BaseInputObject
argument :title, String, required: true
# argument :comments [Types::CommentType], required: false
end
end
end |
class Middleware
attr_reader :app
def initialize(app)
@app = app
end
end |
class Notify < ActionMailer::Base
default from: "howismyschooldoing@gmail.com",
cc: "howismyschooldoing@gmail.com"
def welcome(user)
@user = user
mail(
to: @user.email
)
end
def schedule_added(schedule_id)
@schedule = Schedule.find schedule_id
emails = @schedule.notific... |
require "spec_helper"
describe Server, '/' do
before do
get '/'
end
it "should be a success" do
last_response.should be_success
end
it "should respond with HTML content type" do
last_response.headers['Content-Type'].should == "text/html;charset=utf-8"
end
end
describe Server, '/characters/:i... |
require 'spec_helper'
describe Users::MerchantsController do
let(:merchant) { mock_model(Merchant) }
let(:user) { create(:user) }
let(:params) { {'hi' => 'mate'} }
describe "for anonymous users" do
it "GET :new redirects" do
get :new
response.should redirect_to(user_session_path)
end
... |
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rcov/rcovtask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the IQ::Crud plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for t... |
class CartsController < ApplicationController
before_action :set_cart
# before_action = :set_user
def new
@cart = Cart.new
end
def create
# @cart = @user.carts.new
# # @cart.user_id = session[:user_id]
# respond_to do |format|
# if @cart.save
# format.html { redirect_to @cart, no... |
# frozen_string_literal: true
require "test_helper"
class NoHTTPRuleTest < Minitest::Test
def test_it_detects_invalid_ip_add_binding_class
code = "class test::service (
$insecure_addr = 'http://fe.up.pt',
$secure_addr = 'https://fe.up.pt'
)"
expected_result = [
Sin.new(SinTyp... |
require 'spec_helper'
require 'vagrant-dsc/provisioner'
require 'vagrant-dsc/config'
require 'base'
describe VagrantPlugins::DSC::Config do
include_context "unit"
let(:instance) { described_class.new }
let(:machine) { double("machine") }
def valid_defaults
# subject.prop = value
end
describe "default... |
module Barometer
class Yahoo
class Response
class ForecastedWeather
def initialize(payload, timezone, current_sun)
@payload = payload
@timezone = timezone
@current_sun = current_sun
@predictions = Barometer::Response::PredictionCollection.new
end
... |
require 'rails_helper'
RSpec.describe ApplicationHelper, type: :helper do
describe '#header' do
let(:title) { 'test' }
subject! { helper.header(title) }
it 'sets the content for :header' do
expect(helper.content_for(:header)).to eq(
"<div class=\"row wrapper border-bottom white-bg page-hea... |
module CsvUploads
class CsvUploader
def self.identifier
"CsvUploader"
end
def self.label
:body
end
def self.run(begin_destroy: false)
if begin_destroy.to_s == 'true'
identifier.classify.constantize.all.each do |record|
puts "destroying #{record.send(label)}"
... |
class UpdatePartnerIndexWorker
include Sidekiq::Worker
sidekiq_options queue: :default, backtrace: true
sidekiq_options retry: 1
def perform(partner_id)
partner = Partner.where(id: partner_id).first
return if partner.nil?
es = ElasticsearchServices::PartnerIndex.new
es.insert_document(partner)
... |
require 'rails_helper'
describe Business do
it 'creates a new user' do
user = User.create
expect(user.id).to match(UUID)
end
end |
class AddOtherNameToMuscleName < ActiveRecord::Migration
def self.up
add_column :muscle_names, :other_name, :string
end
def self.down
remove_column :muscle_names, :other_name
end
end
|
class FinanceTransactionReceiptRecord < ActiveRecord::Base
belongs_to :finance_transaction
belongs_to :transaction_receipt
belongs_to :fee_account
belongs_to :fee_receipt_template
before_create :set_initial_data
after_create :set_receipt_data, :if => Proc.new { |ftrr|
fee_... |
class LessonsSchedulesController < ApplicationController
before_action :set_lessons_schedule, only: [:destroy]
def create
@lessons_schedule = LessonsSchedule.new(lessons_schedule_params)
authorize @lessons_schedule
@lessons_schedule.course_id = params[:course_id]
@course = Course.find(params[:cou... |
class ImageSerializer
include JSONAPI::Serializer
set_type :image
set_id :id
attributes :image
end
|
require 'spec_helper'
describe 'jenkins::plugin' do
describe file('/var/lib/jenkins/plugins/ssh-agent.hpi') do
it { should be_file }
it { should be_owned_by 'jenkins' }
end
describe file('/var/lib/jenkins/plugins/git-client.hpi') do
it { should be_file }
it { should be_owned_by 'jenkins' }
en... |
module CTA
class Instance
attr_accessor :image, :url, :id
def initialize(attributes = {})
attributes.each do |key, value|
self.public_send("#{ key }=", value)
end
end
def url_for(sitemap)
uri = URI(url)
return url if uri.absolute?
sitemap.find_resource_by_path(... |
module Topographer
class Importer
module Strategy
class ImportNewRecord < Topographer::Importer::Strategy::Base
def import_record (source_data)
mapping_result = mapper.map_input(source_data)
new_model = mapper.model_class.new(mapping_result.data)
new_model.valid?
... |
require 'spec_helper'
describe Specinfra::Command::Redhat::V7::Service do
let(:klass) { Specinfra::Command::Redhat::V7::Service }
it { expect(klass.check_is_enabled('httpd')).to eq "systemctl --plain list-dependencies multi-user.target | grep '\\(^\\| \\)httpd.service$'" }
it { expect(klass.check_is_enabled('htt... |
class Enemy < Sprite
#initializeで番号を指定
def initialize(x, y, image, number)
@number = number
@font = Font.new(20)
super
end
def draw #敵の描画。円の上に番号を表示する。
super
Window.draw_font(self.x + 10, self.y + 6, @number.to_s, @font)
end
def hit #ballが当たったら消える
self.vanish
end
end
|
require 'spec_helper'
describe ConsultManagement::ConsultCategory do
describe "バリデーション" do
it { should validate_presence_of :name }
it { should validate_presence_of :description }
end
end
|
# Participate: class for participation of user in event.
class Participate < ActiveRecord::Base
belongs_to :event
belongs_to :user
end
|
class Hangout < ActiveRecord::Base
attr_accessible :description, :end_date_time, :event, :location, :name, :start_date_time
validates :description, :presence => true, length: {maximum: 100}
validates_presence_of :name, :event, :location, :start_date_time, :end_date_time
end
|
class Student < ActiveRecord::Base
belongs_to :classroom
has_one :permission
def student_full_name
[student_first_name, student_last_name].join(' ')
end
def student_full_name=(name)
split = name.split(' ', 2)
self.student_first_name = split.first
self.student_last_name = split.last
end... |
class StateDaysSerializer
include FastJsonapi::ObjectSerializer
belongs_to :state
attributes :date, :cases, :state_id
end
|
RSpec.describe AuthToken::Encoder do
describe '.call' do
let(:payload) { { user_id: 3 } }
it 'returns encoded payload' do
with_env({ 'AUTH_TOKEN_SECRET' => 'token' }) do
expect(AuthToken::Encoder.call(payload)).to_not be_empty
end
end
end
end |
# Preview all emails at http://localhost:3000/rails/mailers/comment_mailer
class CommentMailerPreview < ActionMailer::Preview
def new_comment_notifier_preview
@comment = Employee.where(first_name: 'Asmaa').first.id
CommentMailer.new_comment_notifier(@comment)
end
end
|
require 'spec_helper'
RSpec.describe 'log parser' do
describe 'creation' do
it 'raises exception if log file is nil' do
expect{ SmartLogParser::LogParser.new(nil, []) }.to raise_exception(SmartLogParser::SmartLogParserException, 'No log file given!')
end
it 'raises exception if log file is an empt... |
require "rubii/events/linux"
require "rubii/config/linux"
require "rubii/controller/wiimote"
module Rubii
module Linux
def self.shell cmd
p cmd
system cmd
end
module XDoTool
class Input < Rubii::Input
def key_press key
Linux.shell "xdotool keydown #{key}"
... |
module Tephue
module Handler
class Result
def initialize(success, data)
@success = success
@data = data
end
def success?
@success
end
def data
@data
end
end
end
end |
class AddColumnsFavoritesAndListsToTwitter < ActiveRecord::Migration
def up
add_column :twitter_data, :favorites, :integer, default: 0
add_column :twitter_data, :lists, :integer, default: 0
end
def down
remove_column :twitter_data, :favorites
remove_column :twitter_data, :lists
end
end
|
require "test_helper"
class UserCanLoginTest < ActionDispatch::IntegrationTest
test "unauthorized user is directed to login on visit to root" do
user = User.create(email_address: "John", password: "Password")
visit root_path
assert_equal root_path, current_path
end
test "logged in user is directed... |
require 'checkout'
require 'product'
require 'multiple_product_promotion'
require 'percentage_discount_promotion'
describe 'Checkout integration test' do
let(:checkout) { Checkout.new(promotional_rules) }
let(:promotional_rules) { [MultipleProductPromotion.new, PercentageDiscountPromotion.new] }
describe 'baske... |
class CommentsController < ApplicationController
def create
@comment = current_user.comments.build(comment_params)
@comments = @comment.topic
respond_to do |format|
if @comment.save
format.html{redirect_to topic_path(@topic), notice: "コメントを投稿しました"}
format.json{render :show, status:... |
# frozen_string_literal: true
require 'test_helper'
class LikeInterfaceTest < ActionDispatch::IntegrationTest
include ActiveJob::TestHelper
setup do
@user = users(:maymie)
@friend = users(:ronny)
@not_friend = users(:cole)
@status_update = @user.status_updates.first
@image = @user.images.firs... |
# BardBot
# Author:: R. Scott Reis (https://github.com/EvilScott)
# Copyright:: Copyright (c) 2014 R. Scott Reis
# License:: MIT (http://opensource.org/licenses/MIT)
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'bard_bot'))
%w( config dictionary ).each { |klass| require klass }
require 'english'
$FIELD_... |
class AddPasswordDigestToUsers < ActiveRecord::Migration[6.1]
def change #add column to users table, column name, column type
add_column :users, :password_digest, :string
end
end
|
class AlterTableUsersAddAvatar < ActiveRecord::Migration
def change
add_column :users, :avatar, :string, default: "http://community.bhf.org.uk/sites/default/files/profile_images/bhf_generic-avatar_01.png"
end
end
|
class AddToMediaCollection
attr_reader :user, :url, :visibility
def initialize(options)
@user = options.fetch(:user)
@url = options.fetch(:url)
@visibility = options.fetch(:public)
end
def execute!
MediaRepository.add(user: user, url: url, public: visibility).tap do |item|
if item.valid... |
class Tubekit < Formula
desc "Tool that helps you to operate Kubernetes clusters more effectively"
homepage "https://github.com/reconquest/tubekit"
url "https://github.com/reconquest/tubekit/releases/download/v3/tubekit_3_Darwin_x86_64.tar.gz"
sha256 "b966e7b014e0d16e22f0d15dbd7c80a084160c6851bf7ad767d0085ac3ac... |
RSpec.describe "User sign-in handling", type: :system, js: true do
subject { new_user_session_path }
before do
visit subject
end
context "when users are invalid" do
it "shows invalid credentials alert" do
fill_in "Email", with: 'invalid_username'
fill_in "Password", with: 'invalid_password... |
require_relative 'db_connection'
require_relative 'searchable'
require_relative 'associatable'
require 'active_support/inflector'
class SQLObject
extend Searchable
extend Associatable
def self.table_name=(table_name)
@table_name = table_name
end
def self.table_name
@table_name ||= self.to_s.tablei... |
# frozen_string_literal: true
class LegacyDatum < ApplicationRecord
belongs_to :user, optional: true
belongs_to :character, optional: true
has_one :legacy_xp, -> { where(reason: 'Legacy 2.0 Build') },
class_name: 'CharacterExtraBuild',
foreign_key: :character_id,
primary_key: :chara... |
class Arcanist < Formula
homepage "http://phabricator.org/"
# To upgrade:
# 1. update the SHAs to point at the new versions of arc and libphutil we use
# 2. increment the 'version'
url "https://github.com/phacility/arcanist.git", :revision => "7bb8dbabce83a3cd3c26fc5413a9a3429b97863b"
version "2017.29"
... |
require('minitest/autorun')
require('minitest/rg')
require_relative('../bear')
require_relative('../fish')
require_relative('../river')
class TestBear < MiniTest::Test
def setup
@bear = Bear.new("Bearasaurus", "Super Grizzly")
end
def test_bear_has_name()
assert_equal("Bearasaurus", @bear.bear_name)
end
d... |
require 'rails_helper'
RSpec.feature 'Show user on show page' do
before do
@contact = Contact.create(name: 'Example', surname: 'User', phone_number: '0720000000', email: 'user@example.com', date_of_birth: '25-02-1993', home_address: '12 Muircourt Lavender Hill')
end
scenario "Showing all contact credential... |
class BusinessesController < ApplicationController
before_action :authenticate
def index
@businesses = Business.all
json_response(@businesses)
end
def show
@business = Business.find(params.fetch(:id))
json_response(@business)
end
def random
@business = Business.order("random()").first... |
# == Schema Information
#
# Table name: posts # 视频模型
#
# id :integer not null, primary key
# title :string # 视频标题
# url :string # 视频链接
# des :string # 视频描述
# published_at :dat... |
class EventsController < ApplicationController
respond_to :json
def index
echo_response = echo_client.get_availability_events
respond_with(echo_response.body, status: echo_response.status)
end
end
|
class FontMiriamLibre < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/miriamlibre"
desc "Miriam Libre"
homepage "https://fonts.google.com/specimen/Miriam+Libre"
def install
(share/"fonts").install "MiriamLibre-Bold.ttf"
(share/"f... |
namespace :rates do
desc "populate test rates"
task :populate => :environment do
currencies = %w[EUR USD AUD CAD JPY]
factors = {'buy' => {'low' => 1.005, 'high' => 1.02}, 'sell' => {'low' => 0.98, 'high' => 0.9905}}
benchmark_rates = Chain.where(name: 'Debenhams').first.rates
benchmark = {}
... |
require File.dirname(__FILE__) + '/setup'
require 'javaclass/classfile/java_class_header'
module TestJavaClass
module TestClassFile
class TestClassAccessFlags < Test::Unit::TestCase
def setup
%w[Public Package Abstract Interface Final Enum Annotation
Public$InnerInterface Enum$1 Anonym... |
require 'delegate'
require 'javaclass/classscanner/scanners'
require 'javaclass/dsl/loader'
module JavaClass
module Dsl
# A delegator Classpath that loads and parses classes.
# Author:: Peter Kofler
class LoadingClasspath < SimpleDelegator
# Create a lading instance of the _classpa... |
module Pliny::Extensions
module Instruments
def self.registered(app)
app.before do
@request_start = Time.now
Pliny.log(
instrumentation: true,
at: "start",
method: request.request_method,
path: request.path_info,
... |
class Users::BlogsController < ApplicationController
def index
@blogs = Blog.page(params[:page]).per(6)
@genres = Genre.where(genre_status: true)
end
def show
@blog = Blog.find(params[:id])
@comment = Comment.new
@comments = @blog.comments.page(params[:page]).per(5)
if user_signed_in?
... |
require 'bigdecimal'
require_relative 'item'
class ItemRepo
attr_accessor :items
def initialize(items)
@items = items
change_item_hash_to_object
end
def change_item_hash_to_object
item_array = []
@items.each do |item|
item_array << Item.new(item)
end
@items = item_array
end... |
class EventsController < ApplicationController
before_action :init_session, only: :search
def search
@events = Event.search(session[:where])
@total_pages = Event.total_pages(session[:where])
custom_render
end
def page
@events = Event.page_data(session[:where], params[:page_num].to_i)
custom_... |
# frozen_string_literal: true
## --- BEGIN LICENSE BLOCK ---
# Copyright (c) 2016-present WeWantToKnow AS
#
# 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 wit... |
class AlgorithmsController < ApplicationController
before_action :set_algorithm, only: [:show, :edit, :update, :destroy]
# GET /algorithms
# GET /algorithms.json
def index
@algorithms = Algorithm.all
end
# GET /algorithms/1
# GET /algorithms/1.json
def show
@projects = @algorithm.experiments.c... |
class TermAgreementsController < ApplicationController
before_action :set_term_agreement, only: [:show, :edit, :update, :destroy]
def index
@search = TermAgreement.ransack(params[:q])
@term_agreements = @search.result(distinct: true).page(params[:page]).per(15)
end
def show
end
def new
@term_... |
module Eshealth
class ClusterConfig < Checkfactory
attr_accessor :url, :configbody, :type, :lastmsg
attr_reader :requestfactory
def initialize(options={})
self.type = "ClusterConfig"
self.url = options[:url] || "http://localhost:9200"
self.requestfactory = options[:requestfactory] || ... |
class MusicsController < ApplicationController
def index
end
def create
uploaded_file = fileupload_param[:file]
output_path = Rails.root.join('public', uploaded_file.original_filename)
File.open(output_path, 'w+b') do |fp|
fp.write uploaded_file.read
end
redirect_to action: 'index'... |
class Api::V1::UsersController < ApplicationController
def index
@users = User.all
render json: @users
end
def show
@user = User.find(params[:id])
render json: @user
end
def create
@user = User.create(user_params)
if @user.valid?
token = JWT.encode({user_id: @user.id}, ... |
class Travelport::Model::FareInfo < Travelport::Model::Base
include Extensions::Collection
attr_accessor :fare_ticket_designator,
:baggage_allowance,
:fare_rule_key,
:key,
:fare_basis,
:passenger_type_code,
:origin,
... |
words = ['I', 'am', 'sitting', 'at', 'The', 'mall', 'in', 'the', 'food',
'court', 'waiting', 'Waiting', 'for', 'my', 'girlfriend']
def sort(array_to_sort)
sorted_array = []
unsorted_array = array_to_sort.dup
while unsorted_array.size > 0
largest_item = 0
(0..unsorted_array.size-1).each do |ind... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.