text stringlengths 10 2.61M |
|---|
ActiveAdmin.register Image do
# config.clear_action_items!
form do |f|
f.inputs do
f.input :file, label: 'File'
f.input :imageable_id, as: :select, label: 'Product', collection: Product.all
f.input :imageable_type, as: :hidden, input_html: {value: 'Product'}
end
f.buttons
end
index do... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
helper_method :current_user
private
def current_user
@current_user ||= User.find(session[:user_id]) if sessi... |
class Add2ColumnToInventories < ActiveRecord::Migration
def change
add_column :inventories, :satuan, :string
add_column :inventories, :ukuran, :string
add_column :inventories, :berat, :string
add_column :inventories, :warna, :string
end
end
|
Given(/^the build has failed$/) do
add_run_input "/Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSArrayCategoriesTests.m:53:13: error: use of undeclared identifier 'something'"
end
Then(/^the exit status code should be (\d)$/) do |numbah|
$?.exitstatus.should == numbah.to_i
end
|
class MemberReview
include Mongoid::Document
include Mongoid::Timestamps
store_in database: 'sribulancer_development', collection: 'member_reviews'
DESCRIPTION_MINIMUM_LENGTH = 20
DESCRIPTION_MAXIMUM_LENGTH = 300
DESCRIPTION_MAXIMUM_LENGTH_DB = 320
field :description
field :rating, type: Integer
be... |
class IssuersController < ApplicationController
# GET /issuers
# GET /issuers.json
def index
@issuers = Issuer.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @issuers }
end
end
# GET /issuers/1
# GET /issuers/1.json
def show
@issuer = Issue... |
require File.expand_path('../../helper.rb', File.dirname(__FILE__))
describe VirtualBox::Net::Dhcp do
describe 'ip 192.168.0.1' do
before do
@dhcp = VirtualBox::Net::Dhcp.new :ip => '192.168.0.1'
end
it 'has a default netmask' do
@dhcp.netmask.must_equal '255.255.255.0'
end
it 'comput... |
class AddDetailsToSales < ActiveRecord::Migration
def change
add_column :sales, :email, :string
add_column :sales, :guid, :string
add_reference :sales, :product, index: true
end
end
|
require 'relayapi/gpiodriver/base'
module RelayAPI::GPIODriver
class SysManual < RelayAPI::GPIODriver::Base
def initialize(*args)
super *args
if ! File.exists? "/sys/class/gpio/gpio#{@pin}"
IO.write('/sys/class/gpio/export', @pin.to_s)
end
if File.exists? "/sys/class/gpio/gpio#{@... |
class AddStreamToBets < ActiveRecord::Migration
def change
add_column(:bets, :stream_link, :string)
end
end
|
class AddParentElementIdToAlchemyElements < ActiveRecord::Migration
def change
add_column :alchemy_elements, :parent_element_id, :integer
add_index :alchemy_elements, [:page_id, :parent_element_id]
end
end
|
class SecretNumbersController < ApplicationController
def new
@secret_numbers = secret_numbers
end
def show
@secret_number = secret_numbers.sample
@chosen_number = params[:id].to_i
@player_won = is_winner?
if @player_won
@outcome_partial = 'win'
else
@outcome_partial = 'lose... |
module PageObjects
module Images
class IndexPage < PageObjects::Document
path :images
path :root
element :navbar, locator: '.navbar', is: PageObjects::Shared::NavBar
collection :images, locator: '.card-columns', item_locator: '.js-card-block', contains: ImageCard
def add_new_image... |
#!/usr/bin/env ruby
# :title: PlanR::Plugins::Interpreter::Shell
=begin rdoc
Interpreter plugin for shell scripts
(c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
=end
require 'tg/plugin'
require 'plan-r/document/script'
require 'plan-r/application/script_mgr'
module PlanR
module Plugins
module Inter... |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Patrick::Application.load_tasks
task :clean do
puts "\n~~~~~~~~~~~~~~~~~~~~~~~~"
puts " Clean... |
require 'digest/md5'
class User < ActiveRecord::Base
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
has_many :group_users
has_many :groups, through: :group_users
has_many :oauth_registrations
has_many :notification_tokens
has_many :totals
has_many :paid_payments, class_name: 'Payment', forei... |
require 'rubygems'
require 'sinatra'
require 'pry'
PLAYER_STATUS = ['not_played', 'stayed', 'blackjack', 'busted']
set :sessions, true
get '/' do
# redirect '/welcome'
# OR
redirect '/start'
session[:player_name] = "Jouni"
end
get '/welcome' do
erb :welcome
end
post '/set_name' do
session[:player_name... |
require 'rails_helper'
RSpec.describe PriceRecord, type: :model do
describe 'attributes' do
it { should respond_to(:name) }
it { should respond_to(:code) }
it { should respond_to(:min_order_qty) }
it { should respond_to(:single_price) }
it { should respond_to(:unit_price) }
it { should respo... |
# frozen_string_literal: true
class TravelDestinationSerializer < ActiveModel::Serializer
attributes :country_id, :destination, :image_path
belongs_to :country
has_many :products
def image_path
"#{ENV['HOST']}#{object.image.url}"
end
end
|
# To practice Ruby, we want to re-create the standard Ruby library for the Prime class
require 'prime'
class Prime2
def self.prime?(num)
return false if !num.is_a? Integer
return false if num < 2
# We only need to loop through and check up to the square root of the number
max_num_to_check = (num**... |
source 'https://rubygems.org'
ruby '2.4.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# Use Postgres as the database for Active Record
gem 'pg', '~> 0.15.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.12'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0... |
class User < ApplicationRecord
validates_presence_of :name, :title
validates :username, uniqueness: true, presence: true
validates_presence_of :password, require: true
has_many :user_kids, dependent: :destroy
has_many :kids, through: :user_kids
has_secure_password
enum role: %w(default admin)
def event... |
module Workers
class DropboxDownloader
include Sidekiq::Worker
def perform(dropbox_uid, options={})
@dropbox_uid = dropbox_uid
@request_id = options['request_id']
begin
fetch_user_id
verify_app_attached
setup_clients
rescue Errors::AuthenticationMissing
... |
require 'cgi'
require 'bel'
require 'uri'
module OpenBEL
module Routes
class Expressions < Base
def initialize(app)
super
# RdfRepository using Jena
@rr = BEL::RdfRepository.plugins[:jena].create_repository(
:tdb_directory => 'biological-concepts-rdf'
)
... |
if ARGV.length < 7
puts "usage: raxrun <dataset> <model> <algo> <seq_start> <seq_end> <gap_start> <gap_end>"
throw "missing arguments"
end
$dataset = ARGV[0]
$model = ARGV[1]
$algo = ARGV[2]
$seq_start = ARGV[3].to_i
$seq_end = ARGV[4].to_i
$gap_start = ARGV[5].to_i
$gap_end = ARGV[6].to_i
throw "bad paramete... |
class Talent < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
acts_as_token_authenticatable
devise :database_authenticatable,
:registerable,
:recoverable,
:rememberable,
:trackable,
... |
class Pupil < Cask
url 'http://pupil.io/downloads/1.1/Pupil.app.zip'
homepage 'http://pupil.io/'
version '1.1'
sha1 'a5a0a59b8963552776b06b11774dfa232b3c1c68'
end
|
class FontNotoSerifCjkJp < Formula
head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifCJKjp-hinted.zip", verified: "noto-website-2.storage.googleapis.com/"
desc "Noto Serif CJK JP"
homepage "https://www.google.com/get/noto/#serif-jpan"
def install
(share/"fonts").install "NotoSerifCJKjp-Black... |
module SlugRedirectable
extend ActiveSupport::Concern
included do
def redirect_if_new_slug_for(record, params_keys)
parameter_key = params.slice(*params_keys).keys.first
unless params[parameter_key] == record.slug || params[:format] == "js"
return redirect_to(parameter_key => record.slug... |
require 'date'
class SuperSquareMaker
def initialize(start)
@start_date = start
@outline = flatten_outline
@all_dates = []
find_major_dates
commit
end
def flatten_outline
%w(
--##########--#####------########-----#####----#####
------#**-----#--##------#------##----#*--------###... |
class Instructors::LanguagesController < ApplicationController
before_action :ensure_logged_in
before_action :ensure_user_is_admin
before_action :current_language, only: [:show, :edit ]
def index
@languages = Language.all
end
def show
@stepsperchapter = {}
@testperstep = {}
@userperchapter... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# user_name :string(255)
# location :string(255)
# url :string(255)
# description :string(255)
# followers :integer
# friends :integer
# created_at :datetime
# u... |
require 'spec_helper'
describe "websites/new.html.haml" do
before(:each) do
assign(:website, stub_model(Website,
:name => "MyString",
:url => "MyString",
:css => "MyText",
:js => "MyText",
:title => "MyString",
:sub_title => "MyString",
:logo => ""
).as_new_record)
... |
require 'pry'
# your code goes here
def begins_with_r(array)
i = 0
new_array = []
while i < array.length
if yield(array[i])
new_array << array[i]
end
i += 1
end
new_array
end
def begins_with_r(array)
array.all?{|word| word[0] == "r"}
end
def contain_a(array)
array.select{|word... |
#!/usr/bin/env ruby
#
# Homebrew Bundle file
# - https://github.com/Homebrew/homebrew-bundle
#
# Pre-requisites
# brew 'git'
# brew 'make'
# brew 'stow'
# Bash
# brew 'bash'
# brew 'bash-completion@2'
# Zsh
# brew 'zsh'
# brew 'zsh-autosuggestions'
# brew 'zsh-completions'
# brew 'zsh-history-substring-search'
# bre... |
class ViewsController < ApplicationController
before_filter :authenticate_user!
before_filter :find_view, :only => [:update, :destroy]
# GET /views
#----------------------------------------------------------------------------
def index
render :json => current_user.views.find(:all).to_json(:include => :fil... |
feature "Registration unit - Create" do
context 'Visitor' do
scenario "Access invalid" do
visit new_registration_unit_path
expect(current_path).to eq new_session_path
end
end
context 'Admin' do
let(:user) { create :user}
... |
# encoding:utf-8
require 'elasticsearch_rasi/util'
class ElasticsearchRasi
module Rotation
KEYS = {
:created => 'created',
:read_all => 'all',
:read_from => 'read_from',
}
# rotate_type: :node / :mention
# direct_idx == :node
# opts : Hash
# :read_age - ... |
require 'rails_helper'
RSpec.describe Credit, type: :model do
before(:each) do
@organization = Organization.create(name: "neworg")
@organization.asset_accounts.create(name: "debitaccount", number: 1)
@debit_account = @organization.asset_accounts.first
@organization.liability_accounts.create(name: ... |
Gem::Specification.new do |s|
s.name = 'cluster_def'
s.version = '0.1.0'
s.date = '2017-08-02'
s.summary = "Provide an abstraction for cookbooks and scripts to examine cluster data in custer.txt"
s.description = "Make cluster data reachable on the cluster either locally or over http mech... |
require "faraday"
require "versionomy"
require "logger"
require "json"
require 'open-uri'
require 'uri'
desc "Update Zapp with app center link"
namespace :publish_to_zapp do
task(
:update_zapp_version
) do |_task, args|
next unless ENV["triggered_by"] == "zapp"
app_version_id = ENV['version_id']
... |
# frozen_string_literal: true
module Importers
class Memberships < Importer
self.path = :memberships
def hashify_json
json_data.map do |row|
[
row['id'],
{
user_id: row['user_id'],
starts_at: row['effective_from'],
ends_at: row['effective... |
# Copyright (c) 2016 Scott O'Hara, oharagroup.net
# frozen_string_literal: true
require 'rails_helper'
require 'models/concerns/transactable'
RSpec.describe Security, type: :model do
before :each do
FactoryBot.reload
end
it_behaves_like Transactable do
let(:context_factory) { :security }
let(:ledger_json_ke... |
class MemberController < ApplicationController
before_action find_group, only: [:create]
def new
@member = Member.new()
end
def create
@member = Member.new()
@group = @group.members.create()
@group.user_id = current_user.id
if @member.save
flash[:success]= "you have joined the group"... |
class SingleBoard
def initialize
@board = {"1"=>0,"2"=>0,"3"=>0,"4"=>0,"5"=>0,"6"=>0,"7"=>0,"8"=>0,"9"=>0}
end
def emptyspaces?
empty =9
@board.each_key {|key|
if @board[key] == 1
empty = empty - 1
end
}
empty
end
end
|
class FontGeostar < Formula
head "https://github.com/google/fonts/raw/main/ofl/geostar/Geostar-Regular.ttf", verified: "github.com/google/fonts/"
desc "Geostar"
homepage "https://fonts.google.com/specimen/Geostar"
def install
(share/"fonts").install "Geostar-Regular.ttf"
end
test do
end
end
|
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :... |
class Order < ActiveRecord::Base
attr_writer :current_step
validates :shipping_name, presence: true, if: lambda {|o| o.current_step == "shipping"}
validates :billing_name, presence: true, if: lambda {|o| o.current_step == "billing"}
def current_step
@current_step || steps.first
end
def steps
%w[s... |
class Owner
after_update :deliver_changes, :if => :valid?
after_destroy :account_cancellation
def self.deliver_scheduled_messages
deliver_card_expirations
deliver_cards_have_expired
deliver_trial_expiration_reminder
deliver_trial_expirations
deliver_holded_status
end
def... |
# 1. Convert an array of arrays into a hash.
# For example, [[1, 3], [8, 9], [2, 16]] becomes {1 => 3, 8 => 9, 2 => 16}.
array = [[1, 3], [8, 9], [2, 16]]
hash = array.to_h
# p hash
# 2. Convert an array of hashes into a hash using the :id key from the array's hashes as the keys in the new hash.
# For examp... |
require 'spec_helper'
describe HTTPalooza::Response do
it 'is equal to itself' do
response = HTTPalooza::Response.new(200, 'response body')
expect(response.eql?(response)).to be(true)
expect(response == response).to be(true)
expect(response.hash).to eq(response.hash)
end
it 'is equal to another ... |
# spec/requests/scenarios/update_spec.rb
require 'rails_helper'
RSpec.describe 'update scenario (PUT scenario)', type: :request do
let(:admin) { create(:user, :admin) }
let!(:scenario) { create(:scenario, user: admin) }
let(:scenario_id) { scenario.id }
let(:headers) { { 'ACCEPT' => 'application/json' } }
... |
# Rakefile.rb
# June 19, 2007
#
require 'rubygems'
require 'rake/gempackagetask'
#require 'rake'
#require 'rake/testtask'
#require 'rake/rdoctask'
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "twm-cms-bindings"
s.version = "3.0.1"
... |
require 'test_helper'
class AddressTest < ActiveSupport::TestCase
test "address must have building" do
address = addresses(:one)
address.building = ""
assert_not address.valid?
end
test "address must have street" do
address = addresses(:one)
address.street = ""
assert_not address.valid?
... |
require "spec_helper"
describe "Comment on talk", :type => :request do
it_behaves_like "a commentable" do
let!(:commentable) { create(:talk, :users => [ user ], :owner => user.id) }
let(:commentable_path) { talk_path commentable }
end
end |
require 'node'
describe Node do
describe "#initialize" do
it "return initialized score of 1" do
node = Node.new(1)
expect(node.score).to eq(1)
end
it "returns initial node with no children" do
node = Node.new(1)
expect(node.children... |
# => Author:: yguenver
# => Version:: 0.1
# => Copyright:: © 2016
# => License:: Distributes under the same terms as Ruby
##
## Technique des jumeaux et triplés
##
class HPTriple < Technique
##
## Constructeur de la classe HPTriple
##
## @return une instance de la classe HPTriple
##
def HPTriple.creer
... |
module Response
def json_response(object, serializer, status = :ok)
render :json => object, each_serializer: serializer, status: status
end
end
|
require 'rspec'
require 'date'
require 'json'
require_relative '../model/calendario_eventos'
require_relative '../model/evento'
require_relative '../model/evento_diario'
require_relative '../model/calendario'
require_relative '../model/recurrencia'
describe 'CalendarioEventos' do
it 'to_json de Calendario Eventos ... |
class Sightseeing < ApplicationRecord
belongs_to :location
has_many :likes, dependent: :destroy
has_many :travelers, through: :likes
has_many :reviews, dependent: :destroy
# has_many :travelers, through: :likes, source: :traveler
# has_many :travelers, through: :reviews, source: :traveler
end
|
class User < ApplicationRecord
has_many :surveys, dependent: :restrict_with_error
before_save { email.downcase! }
enum role: [:regular_user, :administrator]
validates :first_name, :last_name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z... |
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |el|
el.string :username
el.string :password
el.float :balance
end
end
end
|
class Man < ActiveRecord::Base
validates_numericality_of :name
end
|
class RegistrationUnitsController < ApplicationController
before_action :register
def index
@grid_registration_units = RegistrationUnitsGrid.new(params[:registration_units_grid]) do |scope|
scope.page(params[:page])
end
registration_unit_id = params[:format]
if registration_unit_id
@registration_unit ... |
class Membership < ActiveRecord::Base
belongs_to :bet
belongs_to :user
validates :bet, uniqueness: { scope: :user }
end
|
require 'spec_helper'
describe ScriptNotifier::Services::Email do
before(:each) do
Mail::TestMailer.deliveries.clear
end
def failure_script_result(attrs = {})
sample_failure_script_data.merge!(attrs)
end
def success_script_result(attrs = {})
sample_success_script_data.merge!(attrs)
end
de... |
class CreateTumblrPosts < ActiveRecord::Migration
def self.up
create_table :tumblr_posts do |t|
t.integer :user_id
t.string :tumblr_post_id
t.integer :favorite_id
t.integer :towatch_id
t.integer :seen_id
t.timestamps
end
end
def self.down
drop_table :tumblr_posts
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
helper_method :current_user
def current_user
@current_user ||= User.find(session[:user_id]) if session[... |
module Roark
module Aws
module CloudFormation
class StackStatus
def initialize(connection)
@connection = connection
end
def status(name)
@connection.cf.stacks[name].status
end
def exists?(name)
@connection.cf.stacks[name].exists?
... |
class AddPasswordResetColumnsToCompanyAdmin < ActiveRecord::Migration[5.1]
def up
add_column :company_admins, :reset_password_token, :string
add_column :company_admins, :reset_password_sent_at, :datetime
end
def down
remove_column :company_admins , :reset_password_token
remove_column :company_admi... |
require('minitest/autorun')
require('pry')
require_relative('../models/address.rb')
class TestAddress < Minitest::Test
def setup
options1 = {
'street_addr' => '21',
'street' => 'Lothian Road',
'area' => '',
'city' => 'Edinburgh',
'post_code' => 'EH1 2AB',
'telephone' => '+44 ... |
class Article
include Mongoid::Document
include Mongoid::Timestamps
field :rank, type: Integer
field :title, type: String
field :url, type: String
field :point, type: String
field :commentCnt, type: Integer
field :uniqUsrCnt, type: Integer
has_many :comments
# urlをクエリとして関連ツイートを取得し、commentsに格納す... |
# This file runs your queries
require_relative 'db_connection'
require_relative 'db_models'
include DbConnection
connect_to_db!
# Dummy store to be used when we can't find a Store record for a user
class DummyStore
def total_order
0
end
end
# Returns a string table for with the store data. The | can be rep... |
require 'rspec'
require_relative '../../../lib/xml/builder'
class XML
include Xml::Builder
def gen
html {
head {
title { '123' }
}
body {
div(class: 'v1') { 'div1' }
div(class: 'v2') { 'div2' }
}
}
end
def gen_for_to_str
html {
head {
t... |
# Token.rb
#
# Descripcion: Archivo que contiene los tokens que se van a manejar
# en el lenguaje BasicTran
#
# Autores : Ritces Parra 12-11088
# Palacios Gomez 10-10870
class Token
attr_accessor :valor, :linea , :columna
def initialize valor, linea, columna
@valor = valor
... |
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular 'restaurant', 'restaurants'
inflect.irregular 'dish', 'dishes'
end |
class CreateCourseWhos < ActiveRecord::Migration[5.2]
def change
create_table :course_whos do |t|
t.string :icon
t.string :title
t.text :description
end
add_column :lessons, :description, :text
end
end
|
class NotificationMailer < ApplicationMailer
require 'mailgun'
def notification_email(user)
@user = user
mail(to: @user.email, subject: 'Notification Email')
end
def to_do_reminder_email(user, to_do)
@user = user
@to_do = to_do
puts "USER EMAIL IS: " + user.email
mg_client = Mailgun:... |
require 'rails_helper'
RSpec.describe StaticPagesController, type: :controller do
describe "GET #home" do
before(:each) { get :home }
it "returns http success" do
expect(response).to have_http_status(:success)
end
it "renders the layout; application" do
expect(response).to re... |
class PageCandidates < Candidates
def find_image
image = nil
if domains_match?
image = check_for_meta_images
end
image
end
def check_for_meta_images
image = nil
if page_checked?
if image = cached_image
Librato.increment 'entry_image.page_request.cache_hit'
end
... |
require_relative 'temporal_operator'
module ConceptQL
module Operators
class AnyOverlap < TemporalOperator
register __FILE__
desc 'If a result in the LHR overlaps in any way a result in the RHR, it is passed through.'
def where_clause
l_partly_in_r = Sequel.expr { r__start_date <= l__s... |
class AddScheduleToPosts < ActiveRecord::Migration
def change
add_column :posts, :schedule, :datetime
add_index :favorites, :user_id
add_index :tags, :name
end
end
|
class Galaxy < ApplicationRecord
validates :name,:size,:distance, presence: true
validates :distance, numericality: { less_than_or_equal_to: 1400000 , only_integer: true }
validates :name, uniqueness: true
end
|
require 'test_helper'
class SchedulesControllerTest < ActionController::TestCase
setup do
user = users(:user1)
user.confirm!
sign_in user
@schedule = one_make
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:schedules)
end
test "sho... |
class AddDatarecordToTemperature < ActiveRecord::Migration
def change
add_reference :temperatures, :datarecord, index: true
add_foreign_key :temperatures, :datarecords
end
end
|
class CreateExpenses < ActiveRecord::Migration[5.2]
def up
create_table :expenses do |t|
t.string :spent_for
t.decimal :amount
t.boolean :pricy
t.timestamps
end
end
def down
drop_table :expenses
end
end
|
class CreateLinks < ActiveRecord::Migration
def up
create_table :links do |t|
t.string :given_url, null: false
t.string :slug, unique: true
t.integer :clicks, default: 0
t.string :title
t.boolean :active, default: true
t.integer :user_id
t.timestamps null: false
end
... |
require 'rufus/lru'
require_relative "../MiqDisk"
require 'ostruct'
module MiqDiskCache
MIN_SECTORS_PER_ENTRY = 32
DEF_LRU_HASH_ENTRIES = 100
DEBUG_CACHE_STATS = false
attr_reader :d_size, :blockSize, :lru_hash_entries, :min_sectors_per_entry, :cache_hits, :cache_misses
def self.new(up_stream, lru_has... |
require 'spec_helper'
describe Pokemon do
let(:pokemon) { new_pokemon }
it "responds to #name" do
expect(pokemon.name).to eq('Bulbasaur')
end
it "responds to #pokedex_number" do
expect(pokemon.pokedex_number).to eq('001')
end
it "responds to #type" do
expect(pokemon.type).to eq(['Grass', 'P... |
# encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_news'
s.version = '1.0.0'
s.summary = 'Adds a Javascript enabled scrolling news feed ticker wherever you call it'
s.description = 'Provides an Admin view to create/edit posts which will be shown ... |
class TestNokogiriXlsxParser < Test::Unit::TestCase
def test_does_not_raise_error_when_second_workbook_has_id_of_3
file_path = File.expand_path("../../data/reordered_workbooks.xlsx", __FILE__)
sheet = Sheets::Parsers::NokogiriXlsxParser.new(File.read(file_path), :xlsx, file_path)
assert_nothing_raised { s... |
class RenameColumnDepartmentName < ActiveRecord::Migration
def change
rename_column :departments2people2publications, :department_name, :name
end
end
|
module HTTPalooza
module Players
class PostgresPlayer < Base
introducing! :postgres, %w[pg]
def response
raise("I don't think Postgres supports request headers...") unless request.headers.empty?
case request.method
when :get
endpoint = request.url
unless r... |
class OrdersController < ApplicationController
before_filter :load_cart, :only => [:new, :create]
before_filter :load_charities_deals, :only => [:new, :create]
before_filter :build_customer, :only => [:new, :create]
before_filter :build_certificates, :only => [:new, :create]
before_filter :build_credit_card, ... |
require 'test_helper'
class Movie::MovieTypesControllerTest < ActionDispatch::IntegrationTest
setup do
@movie_movie_type = movie_movie_types(:one)
end
test "should get index" do
get movie_movie_types_url
assert_response :success
end
test "should get new" do
get new_movie_movie_type_url
... |
# Write your sql queries in this file in the appropriate method like the example below:
#
# def select_category_from_projects
# "SELECT category FROM projects;"
# end
# Make sure each ruby method returns a string containing a valid SQL statement.
def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe... |
# -*- coding: utf-8 -*-
#
# Author:: lnznt
# Copyright:: (C) 2011 lnznt.
# License:: Ruby's
#
require 'gmrw/ssh2/message/def_message'
# see RFC4419 for details
module GMRW::SSH2::Message
categories = ['diffie-hellman-group-exchange-sha1','diffie-hellman-group-exchange-sha256']
def_message :kex_dh_gex_group, [
... |
class MakeTagsPolymorpic < ActiveRecord::Migration
def change
change_table :tags do |t|
t.references :taggable, polymorphic: true, index: true
end
end
end
|
module Grape::Support::API::RequestStoreKey
extend Grape::Support::Enum
AUTH_TOKEN = :auth_token
end
|
class InstallUnity < Formula
desc "Script to install Unity 3D versions from the command-line"
homepage "https://github.com/sttz/install-unity"
url "https://github.com/sttz/install-unity/archive/2.12.0.tar.gz"
sha256 "d076f6d4ba882709b20bfae9135e9df4adc61d6ab4945e6e22589018f2815693"
head "https://github.com/st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.