text stringlengths 10 2.61M |
|---|
Write a method that returns the number of Friday the 13ths in the year given by an argument. You may assume that the year is greater than 1752 (when the United Kingdom adopted the modern Gregorian Calendar) and that it will remain in use for the foreseeable future.
Examples:
friday_13th(2015) == 3
friday_13th(1986) =... |
require 'logger'
module Cosell
def initialize *args
initialize_cosell!
super
end
#
#
# ANNOUNCEMENTS QUEUE
#
#
# Place all announcments in a queue, and make announcements in a background thread.
#
# Arguments:
# :logger => a logger. Where to log e... |
json.array!(@apps) do |app|
json.extract! app, :id, :name, :description, :host_group, :metadata, :repo, :hooks, :created_at, :updated_at
json.url app_url(app, format: :json)
end
|
component "component2" do |pkg, settings, platform|
pkg.ref "1.2.3"
pkg.url "git://git.example.com/my-app/component2.git"
pkg.mirror "https://git.example.com/my-app/component2.git"
pkg.mirror "git@git.example.com:my-app/component2.git"
pkg.build_requires "component1"
pkg.install do
["#{settings[:bindi... |
require "spec_helper"
class DummyPatternMatchable
include Patme::PatternMatching
def foo(arg1='test')
["foo('test')", arg1]
end
def foo(arg1=1)
["foo(1)", arg1]
end
def foo(arg1={a: 1})
['foo({a: 1})', arg1]
end
def foo(arg1=true)
['foo(true)', arg1]
end
def foo
'foo()'
e... |
require_relative '../../test_helper'
describe Vuf::Batch do
subject {
Vuf::Batch.new(50) do |objQ|
objQ.size.must_equal(50) unless objQ.empty?
end
}
it "must respond to push" do
subject.must_respond_to(:push)
1000.times do |i|
subject.push(i)
end
end
it "must respond to... |
class EasyUserAllocationObserver < ActiveRecord::Observer
observe :issue, :time_entry
def after_update(entity)
allocate_entity(entity)
end
def after_create(entity)
allocate_entity(entity)
end
def allocate_entity(entity)
issue = entity if entity.is_a?(Issue)
issue = entity.issue if entity.... |
class BrokerTradeGood < ActiveRecord::Base
belongs_to :broker
belongs_to :trade_good
end
|
require 'cards'
require 'player'
module Game
def self.setup
@turn = 0
end
def self.turn(application, card, slot)
raise unless %w{left right}.include? application
@turn += 1
@proponent.send(application, card, slot)
end
def self.proponent
@proponent ||= Player.new('0')
end
def s... |
require 'dotenv/load'
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
SSHKit::Backend::Netssh.configure do |ssh|
ssh.connection... |
class Triangle
# write code here
def initialize(lenght_1, lenght_2,length_3)
@length_3 = length_3
@lenght_2 = lenght_2
@lenght_1 = lenght_1
end
def kind ()
if (@lenght_1 + @lenght_2 <= @length_3)||(@length_3 + @lenght_2 <= @lenght_1)||(@lenght_1 + @length_3 <= @lenght_2)
... |
Twitter utiliza la versión uno de OAuth. OAuth es difícil y en particular la versión uno por lo que te ayudaremos en el proceso.
http://oauth.net/core/1.0a/
Diagrama de como funciona OAuth
https://codealab.files.wordpress.com/2015/06/oauth.png
Diagrama de como funciona OAuth
http://www.locomotion.mx/challenges/104/?... |
class Course < ApplicationRecord
has_many :course_users
has_many :users, through: :course_users
has_many :teams
has_many :prototypes
has_many :posts
#Esta asosiacion es solo si la asosiacion es directa. En este caso es indirecta pues cuenta con un modelo intermedio
#Por tal razon se utiliza has_many :cour... |
class CreateImmunizations < ActiveRecord::Migration
def self.up
create_table :immunizations do |t|
t.integer :doctor_visit_id
t.integer :note_id
t.timestamps
end
end
def self.down
drop_table :immunizations
end
end
|
# == Schema Information
# Schema version: 20100705154452
#
# Table name: ratings
#
# id :integer not null, primary key
# value :float
# entity_id :integer
# user_id :integer
# opinion_id :integer
# created_at :datetime
# updated_at :datetime
#
class Rating < ActiveRecord::Base
belongs... |
class ApplicationController < ActionController::Base
helper_method :current_admin
before_action :login_required, only: [:new, :edit, :update, :destroy]
private
def current_admin
@current_admin ||= Admin.find_by(id: session[:admin_id]) if session[:admin_id]
end
def login_required
... |
#declares variable cars and assigns the integer 100 to it
cars = 100
#declares variable and assigns a float number
space_in_car = 4.0
#declares variable and assigns number
drivers = 30
#declares variable and assigns number
passengers = 90
#declares variable and assigns one variable minus another variable
cars_not_drive... |
require "spec_helper"
module CSS
describe Rule do
let(:rule) { Rule.new('#id', 'background-color:#333;color:#FFF;z-index:99') }
it "should return a property by name" do
rule.color.should == '#FFF'
end
it "should return a property reference with a symbol" do
rule[:color].should == '#FFF'... |
require 'spec_helper'
module EZAPIClient
RSpec.describe PasswordTokenizable do
let(:klass) do
Class.new(BaseRequest) do
attribute :reference_no, String
include PasswordTokenizable
end
end
let(:tokenizable) do
klass.new(
prv_path: "/prv_path",
eks_path: "... |
# == Schema Information
#
# Table name: answers
#
# id :integer not null, primary key
# name :string(255)
# correct :boolean default("f")
# question_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'rails_helper'
RSpec.describe Answer, :type => :model d... |
# frozen_string_literal: true
class CompanySerializer < ActiveModel::Serializer
attributes :name
has_many :users
has_many :invitations
def users
object.users.by_name.active
end
end
|
# frozen_string_literal: true
module TeacherSetsEsHelper
# Make teacherset object from elastic search document
def teacher_sets_from_elastic_search_doc(es_doc)
arr = []
if es_doc[:hits].present?
es_doc[:hits].each do |ts|
next if ts["_source"]['mappings'].present?
teacher_set... |
class HelpersController < ApplicationController
def method_missing(method)
render :template => "/helpers/#{method}", :layout => false
end
end |
# module DebuggerOverTCP
# class Server
# class ClientRegistry
# def register(client)
# semaphore.synchronize do
# store[client.id] = client
# end
# end
# def unregister(client)
# semaphore.synchronize do
# store.delete(client.id)
# end
# ... |
class CreateInstallationsUsers < ActiveRecord::Migration
def change
create_table :installations_users, id: false do |t|
t.integer :installation_id
t.integer :user_id
end
end
end
|
class Order < ApplicationRecord
belongs_to :user
has_many :item_in_orders
has_many :items, through: :item_in_orders
has_one :payment
[:user_id, :address_id, :delivery_courier].each do |field|
validates field, presence: true
end
end
|
module ApiResponseCache
module Actions
class ResponseCache
def initialize(cache_path, expires_in)
@cache_path = cache_path
@expires_in = expires_in || 1.hour
end
def present?
cached_response.present?
end
def body
cached_response['body']
end
... |
class LaughTracksApp < Sinatra::Base
get '/' do
redirect '/comedians'
end
get '/comedians' do
@comedians = params[:age] ? Comedian.find_by_age(params[:age]) : Comedian.all
@comedians = @comedians.order(params[:sort].to_sym) if params[:sort]
@average_age, @average_length = get_averages_for(@com... |
module Gaman
module Clip
# Internal: Parses a FIBS You Kibitz CLIP message. This CLIP message
# confirms that FIBS has processed your request to send a kibitz. Message
# is in the format:
#
# message
#
# message: kibitz sent by the user.
class YouKibitz
def initialize(text)
... |
class AddColumnArtistIdToSongs < ActiveRecord::Migration[5.0]
#My code
def change
add_column :songs, :artist_id, :integer
end
#Solution Code
# def change
# change_table :songs do |t|
# t.integer :artist_id
# end
# end
end
|
class ChangeNonTrueValuesToFalseInOrganization < ActiveRecord::Migration
def change
Organization.where(active: nil).update_all(active: false)
end
end
|
class Node
include Comparable
attr_accessor :data, :lefty, :righty
def initialize(data, lefty=nil, righty=nil)
@data = data
@lefty = lefty
@righty = righty
end
def <=> other
@data <=> other.data
end
end
|
desc 'Run phantom against Jasmine for all specs, once'
task :phantom do
`which phantomjs`
raise "Could not find phantomjs on your path" unless $?.success?
port = ENV['JASMINE_PORT'] || 8888
exec "phantomjs #{File.dirname(__FILE__)}/../../spec/run-phantom-jasmine.js #{port} #{ENV['filter']}"
end
|
module Aucklandia
module Routes
ROUTE_ENDPOINT = '/gtfs/routes'
def get_routes
url = build_url(BASE_URL, ROUTE_ENDPOINT)
response = get(url)
JSON.parse(response)['response']
end
def get_routes_by_short_name(short_name)
url = build_url(BASE_URL, ROUTE_ENDPOINT, '/routeShortN... |
module Admin
class CategoriesController < AdminBaseController
before_action :load_category, except: %i(index create)
before_action :check_destroy, only: :destroy
def index
@category = Category.new
@categories = Category.lastest
end
def show
@dish = @category.dishes.build
... |
require 'jekyll'
require 'liquid'
module Jekyll
module Tags
# include module
class HamlInclude < IncludeTag
def read_file(file, context)
return super file, context unless matches_a_haml_template file
file_content = read_file_with_context file, context
template = split_frontmatte... |
class Enemy
attr_accessor :location
def initialize(hp,level, attack, defence,agility, gold, inventory,active_weapon,name,location,id)
@hp = hp
@level = level
@attack = attack
@defence = defence
@agility = agility
@gold = gold
@active_weapon = active_weapon
@inventory = inventory
... |
class AddTotalToShopquikTodoList < ActiveRecord::Migration
def change
add_column :shopquik_todo_lists, :total_expenses, :integer, :limit => 8
end
end
|
require_dependency "db_admin/api/base_controller"
module DbAdmin
class Api::DatabasesController < Api::BaseController
include ActionController::MimeResponds
def index
databases = db_connection.databases
respond_to do |format|
format.json { render json: databases }
format.xml { r... |
require 'rails_helper'
#This has rspec file to verify the controller methods
#First Spec: Checks if by clicking the FindSimilarMovies if it routes to view "Similar Movies With the director"
#Second Spec: If no similar directors the route should render the default view if there are no Similar Movies or No Director
des... |
module SesBlacklistRails
class Notification < ApplicationRecord # :nodoc:
self.table_name = :ses_notifications
enum notification_type: {
bounce: 0,
complaint: 1,
delivery: 2,
other: 9
}
class << self
def validate_bounce
@validate_bounce ||= ->(email) { self.... |
class CreateCourses < ActiveRecord::Migration[5.1]
def change
create_table :courses do |t|
t.string :name, comment: '课程名称'
t.text :description, comment: '课程描述'
t.integer :member_count, comment: '建议上课人数'
t.integer :created_by, comment: '添加人'
t.integer :is_enable, default: 1, comment:... |
Rails.application.routes.draw do
resources :days do
get 'archived', on: :collection
end
resources :entries do
put 'archive', on: :member
put 'unarchive', on: :member
end
devise_for :users
resources :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/ro... |
class ProjectsController < ApplicationController
before_action :set_project, only: [:edit, :update, :destroy, :add, :del]
# GET /projects
def index
@projects = Project.all
end
# GET /projects/1
def show
@project = Project.find(params[:id])
@comments = @project.comments
@comment = Comment.n... |
class TrabatsController < ApplicationController
before_action :set_trabat, only: [:show, :edit, :update, :destroy]
# GET /trabats
# GET /trabats.json
def index
@trabats = Trabat.all
end
# GET /trabats/1
# GET /trabats/1.json
def show
end
# GET /trabats/new
def new
@trabat = Trabat.new
... |
class Api::GamesController < ApplicationController
before_action :get_user
before_action :get_game
before_action :get_game_session
before_action :verify_user_token
before_action :get_wallet, only: [:deal]
def create
@game ||= Game.create!(user: @user, game_session: @session)
if @game.shuffle_time
... |
module Student
class Model < Redson::Form::Model
validates_presence_of 'name'
end
end |
class CalendarsController < ApplicationController
def index
if params[:date]
date = params[:date]
@calendar = Calendar.find_by(date: date)
@day = Day.where(calendars_id: @calendar.id) unless @calendar.nil?
unless @day.nil?
@teachers = Teacher.where(id: @day.map(&:teachers_id))
... |
When /^I GET "([^\"]*)"$/ do |uri|
@result = record_exception { Recliner.get(uri) }
end
When /^I GET "([^\"]*)" with:$/ do |uri, params|
params = eval_hash_keys(params.rows_hash)
@result = record_exception { Recliner.get(uri, params) }
end
When /^I PUT to "([^\"]*)"$/ do |uri|
@result = record_exception { Rec... |
#!/usr/bin/env ruby
module Day11
class HaltException < Exception
end
class Point
attr_accessor :x, :y
def initialize(x, y)
@x, @y = x, y
end
def -(other)
Point.new(@x - other.x, @y - other.y)
end
def +(other)
Point.new(@x + other.x, @y + other.y)
end
def =... |
# frozen_string_literal: true
RSpec.describe TimeTo do
let(:two_days) { 86_400 * 2 }
let(:start_time) { subject - two_days }
it 'has a version number' do
expect(TimeTo::VERSION).not_to be nil
end
context 'Time' do
subject { Time.new }
it { is_expected.to respond_to :to }
it 'returns a lis... |
class AddCountryToImages < ActiveRecord::Migration
def change
add_column :images, :country, :string
end
end
|
# Copyright © 2011-2019 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this l... |
require 'spec_helper'
describe TweetimageController do
describe "GET index" do
context "given a twitter handle" do
before do
get :index, :twitter_handle => 'bob'
end
it "redirects to show action" do
response.should redirect_to(:action => :show, :twitter_handle => 'bob')
e... |
describe Pantograph::PluginInfo do
describe 'object equality' do
it "detects equal PluginInfo objects" do
object_a = Pantograph::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details')
object_b = Pantograph::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details')
expect(object_... |
require 'active_support/concern'
require 'pg_search'
module Kuhsaft
module Searchable
extend ActiveSupport::Concern
DICTIONARIES = {
en: 'english',
de: 'german'
}
def update_fulltext
self.fulltext = collect_fulltext
end
included do
unless included_modules.include?(B... |
require 'rails_helper'
describe 'teams/recruit' do
let(:team) { create(:team) }
let!(:users) { create_list(:user, 4) }
it 'shows all users' do
pending "Doesn't work due to _search using 'fullpath'"
assign(:team, team)
assign(:users, User.paginate(page: 1))
render
users.each do |user|
... |
require "check_responds_to/version"
require "set"
require "parser/current"
require "socket"
module CheckRespondsTo
class Checker
def initialize(config)
@config = config
@processor = ASTProcessor.new(config)
end
def check_interfaces(code)
ast = Parser::CurrentRuby.parse(code)
@pro... |
module Meiosis
class Wallet < CKB::Wallet
def initialize(api, privkey)
super(api, privkey)
end
def get_pubkey
pubkey
end
def get_pubkey_bin
pubkey_bin
end
def lock=(data)
@lock = data
end
def lock_binary
CKB::Utils.bin_to_hex(CKB::Blake2b.digest(CK... |
FactoryBot.define do
factory :question do
sequence(:title) { |n| "QuestionTitle#{n}" }
sequence(:body) { |n| "QuestionBody#{n}" }
user
end
factory :question_with_answers, parent: :question do
transient do
answers_count { 1 }
answers_author { create(:user) }
end
after(:create)... |
# In the easy exercises, we worked on a problem where we had to count the
# number of uppercase and lowercase characters, as well as characters that were
# neither of those two. Now we want to go one step further.
# Write a method that takes a string, and then returns a hash that contains 3
# entries: one represents t... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get '/events', to: 'events#index'
get '/events/:id', to: 'events#show', as: "event"
get '/users/:id', to: 'users#show', as: "user"
get '/users/:user_id/events', to: 'user_events... |
class AddBalanceToCustomer < ActiveRecord::Migration
def up
add_column :customers, :balance, :decimal, :precision => 10, :scale => 2, :default => 0.00
add_column :customers, :revenue, :decimal, :precision => 10, :scale => 2, :default => 0.00
Customer.reset_column_information
Appointment.reset_column_... |
# Video example of .each
# letters = ["a", "b", "c", "d", "e"]
# new_letters = []
# puts "Original data:"
# p letters
# p new_letters
# # iterate through the array with .each
# letters.each do |letter|
# new_letters << letter.next
# end
# puts "After .each call:"
# p letters
# p new_letters
# ##################... |
class AddSupportingDocumentationTable < ActiveRecord::Migration
def up
remove_column :documentations, :parent_id
create_table :supporting_documentations do |t|
t.integer :parent_id
t.integer :child_id
end
add_index :supporting_documentations, :child_id
add_index :supporting_documenta... |
# -*- coding: utf-8 -*-
require 'mui/cairo_sub_parts_message_base'
class Gdk::ReplyViewer < Gdk::SubPartsMessageBase
EDGE_ABSENT_SIZE = 2
EDGE_PRESENT_SIZE = 8
register
attr_reader :messages
def on_click(e, message)
case e.button
when 1
case UserConfig[:reply_clicked_action]
when :ope... |
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[5.2]
def create_name_fields(table)
table.string :last_name, null: false, default: ''
table.string :middle_name, null: false, default: ''
table.string :first_name, null: false, default: ''
end
def create_credential_fields(table... |
require "rails_guides/helpers"
module RailsGuides
module HelpersJa
include Helpers
def finished_documents(documents)
# Enable this line when not like to display WIP documents
#documents.reject { |document| document['work_in_progress'] }
documents.map{|doc| doc['url'].insert(0, '/') unless ... |
class AddPublicToPainting < ActiveRecord::Migration
def change
add_column :paintings, :public, :boolean
end
end
|
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "fewo-base"
spec.version = "0.0.1"
spec.authors = ["Lukas Himsel"]
spec.email = ["lukas@himsel.me"]
spec.summary = "A starter pack for AMP-based (amp.dev) Jekyll sites"
spec.homepage = "https... |
Rails.application.routes.draw do
#Employee Routes
get 'employees', to: 'employees#index'
get 'employees/new', to: 'employees#new',as: :new_employee
post 'employees', to: 'employees#create',as: :create_employee
get 'employees/edit/:id', to: 'employees#edit',as: :edit_employee
patch 'employees/:id', to: 'em... |
class CreateOrder < ActiveRecord::Migration
def change
create_table(:orders) do |t|
t.integer :student_id, null: false
t.timestamps
end
add_index :orders, :student_id
end
end
|
require "rails_helper"
describe UsersSubjectsController do
let(:trainee) {FactoryGirl.create :user}
let(:users_subject) {FactoryGirl.create :users_subject}
before do
allow(request.env["warden"]).to receive(:authenticate!).and_return(
trainee)
allow(UsersSubject).to receive(:new).and_return users_su... |
class PacientesController < ApplicationController
def index
name = params[:name]
# Busca pacientes cujos nomes contenham a "string" pesquisada
# O resultado será ordenado pelos nomes dos pacientes de forma alfabética
# Cada página exibirá 20 resultados
@pacientes = if name.nil?
... |
class RemoveTaskStatuses < ActiveRecord::Migration
def change
drop_table :task_statuses
end
end
|
class PurchaseEntry < Plutus::Entry
has_one :purchase
validates_presence_of :purchase
# Override Plutus::Entry#amounts_cancel? due to a strange issue with BigDecimal
# resulting in the following:
#
# (0..5).collect{ |i| (BigDecimal.new(i) + 0.30 + 0.69).to_f }
# # => [0.9899999999999999, 1.99, 2.98... |
#coding: utf-8
class Dashboard::MailBoxesController < Dashboard::ApplicationController
inherit_resources
defaults route_prefix: "dashboard"
actions :all, except: :show
respond_to :html
#delete begin/rescue and move to lib/mail_box_uploader.rb
def upload
@mail_box = MailBox.where(id: params[:id]).first
... |
class MailQueue
include Enumerable
attr_reader :resource
private :resource
def initialize args
@resource = args[:resource]
end
def name
resource.name.rpartition('/').last
end
def each &block
decoded_messages.each &block
end
def clear
resource.remove_messages
end
private... |
class AddKidsToRelationship < ActiveRecord::Migration
def change
add_reference :relationships, :kid, index: true
end
end
|
class AddAPIId < ActiveRecord::Migration[6.1]
def change
add_column :stores, :api_key, :integer
end
end
|
class RecExpensesController < ApplicationController
before_action :set_rec_expense, only: [:show, :edit, :update, :destroy]
# GET /rec_expenses
# GET /rec_expenses.json
def index
@rec_expenses = RecExpense.all
end
# GET /rec_expenses/1
# GET /rec_expenses/1.json
def show
end
# GET /rec_expens... |
module MiqLinux
class Utils
def self.parse_ls_l_fulltime(lines)
ret = []
return ret if lines.nil? || lines.empty?
lines.each do |line|
line = line.chomp
parts = line.split(' ')
next unless parts.length >= 9
perms, ftype = permissions_to_octal(parts[0])
... |
require "test_helper"
class ExpenseTest < ActiveSupport::TestCase
def setup
@expense= Expense.new(user_guid: "USR-12345678-1234-1234-1234-1234567890ab", name: "Expense Test", amount: 500, date: Time.now )
end
test "should be valid" do
assert @expense.valid?
end
test "should have valid user guid" do... |
class RemoveReviewFromMeals < ActiveRecord::Migration
def up
remove_column :meals, :review_id
end
def down
add_column :meals, :review_id, :integer
end
end
|
class Dojo < ActiveRecord::Base
validates :branch, :street, :city, presence: true, length: { in: 3..30 }
validates :state, presence: true, length: { is: 2 }
has_many :students
end
|
# encoding: utf-8
control "V-52359" do
title "The DBMS must support the requirement to automatically audit account modification."
desc "Once an attacker establishes initial access to a system, they often attempt to create a persistent method of reestablishing access. One way to accomplish this is for the attacker to... |
require 'test/unit'
require 'lib/rake_dotnet.rb'
class SvnTest < Test::Unit::TestCase
def test_initialize_with_no_opts
svn = Svn.new
assert_equal "\"#{TOOLS_DIR}/svn/bin/svn.exe\"", svn.exe
end
def test_initialize_with_path
svn = Svn.new :svn => 'foo/bar/svn.exe'
assert_equal "\"foo/bar/svn.exe\"", ... |
# ACQUIRING BEHAVIOR THROUGH INHERITANCE
# Inheritance can be complicated, but at the end of the day it's about
# automatic message delegation. If the original receiving object does
# not know how to respond to that message, it is automatically sent to
# the superclass.
# Starting with what is necessary for a road bik... |
class AddFieldsToUser < ActiveRecord::Migration
def change
add_column :users, :name, :string
add_column :users, :employee_id, :string
add_column :users, :jive_id, :integer
add_column :users, :mentor, :boolean, default: false
end
end
|
class RemoveNamesAndVenuesFromShows < ActiveRecord::Migration[5.1]
def change
remove_column :shows, :venue_city
remove_column :shows, :venue_st
remove_column :shows, :venue_country
remove_column :shows, :promoter_name
remove_column :shows, :promoter_phone
remove_column :shows, :promoter_email
... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :current_user
def current_user
@login_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
end
def require_login
unless current_user
flash[:status] = :failure
flash[:res... |
class AddBodyToEssay < ActiveRecord::Migration
def change
add_column :essays, :body_id, :integer
add_index :essays, :body_id
end
end
|
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
before(:each) do
@client = YtDataApi::YtDataApiClient.new(ENV['YT_USER'], ENV['YT_USER_PSWD'], ENV['YT_DEV_AUTH_KEY'])
response_one, @youtube_id_one = @client.create_playlist("test_playlist_one")
respons... |
class BrochureSubsectionsController < ApplicationController
layout "staff"
before_filter :confirm_logged_in
def index
@brochure_subsections = BrochureSubsection.order("brochure_subsections.brochure_section_id, brochure_subsections.name ASC")
end
def show
end
def new
@brochure_subsection = Brochure... |
module Slack
module Aria
class Aika < Undine
class << self
def name
'藍華・S・グランチェスタ'
end
def icon
'https://raw.githubusercontent.com/takesato/slack-aria/master/image/aika120x120.jpg'
end
end
Company.client.on :message do |data|
if(data[... |
class Cms::File < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
set_table_name :cms_files
cms_is_categorized
# -- AR Extensions --------------------------------------------------------
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options
# -- Rel... |
module Devise
module TwoFactorAuthenticationHelper
def two_factor_preference
if UserOtpSender.new(current_user).otp_should_only_go_to_mobile? || both_options_at_sign_up
return current_user.unconfirmed_mobile
end
second_factors = current_user.second_factors.pluck(:name)
second_fac... |
module ManageIQ::Providers::Amazon::CloudManager::Provision::Configuration
def associate_floating_ip(ip_address)
# TODO(lsmola) this should be moved to FloatingIp model
destination.with_provider_object do |instance|
if ip_address.cloud_network_only?
instance.client.associate_address(:instance_id... |
class CreateAuthors < ActiveRecord::Migration
def change
create_table :authors do |t|
t.string :name
t.string :status
t.string :pic_url
t.string :last_pub_date
t.string :default_type #文章默认类型
t.timestamps
end
add_index :authors, :name, unique: true
add_index :auth... |
class BoardUser < ApplicationRecord
validates :board_id, :user_id, presence:true
belongs_to :board,
foreign_key: :board_id,
class_name: :Board
belongs_to :user,
foreign_key: :user_id,
class_name: :User
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.