text stringlengths 10 2.61M |
|---|
class Kimono
URL = 'https://www.kimonolabs.com/api/3fw96tv0?apikey=12f6f6024114494a5713c77e55b041da'
def fetch
cleaned_results
end
def create_apartments
cleaned_results.each do |result|
Apartment.create \
title: result["title"]["text"],
url: result["title"]["href"],
... |
require_relative '../../automated_init'
context "Output" do
context "Finish Test" do
context "Failure" do
result = Controls::Result::Failure.example
context "Title" do
title = "Some test"
output = Output.new
output.writer.enable_styling!
output.finish_test(title, r... |
module ProductsHelper
def product_state_display state
case state
when 'outofstock'
'Out of Stock'
when 'instock'
'In-Stock'
when 'backordered'
when 'discontinued'
state.capitalize
else
state.capitalize
end
end
end
|
require 'rails_helper'
RSpec.describe Post, type: :model do
it 'has_many' do
should have_many :comments
end
it 'belongs_to' do
should belong_to :user
end
end |
students = {
:cohort1 => 34,
:cohort2 => 42,
:cohort3 => 22
}
def display_students(students, keys_method = false)
students.each do |cohort, count|
if keys_method == true
puts "#{cohort} : #{count} students"
else
puts "#{cohort} : #{students[cohort]} students"
end
end
puts
end
dis... |
class GroupEventsController < ApplicationController
before_action :set_group_event, only: [:show, :update, :destroy]
def index
@group_events = GroupEvent.all
render json: @group_events
end
def show
render json: @group_event
end
def create
@group_event = GroupEvent.new(group_event_params)... |
class Api::V1::NoteController < Api::V1::ApiController
def notes
controller = ApplicationController::NoteController.new
controller.request = ActionDispatch::Request.new(request.env)
response = controller.notes(@user)
if response[:type] == :error
success_response(type: :error, message: response[... |
require 'rails_helper'
feature 'View question list', %q(
In order to be able to read questions
As a visitor or a user
I want to be able to view a list of questions
) do
given(:user) { create(:user) }
given!(:questions) { create_pair(:unique_question) }
after do
expect(page).to have_content "Count: #{... |
class AddPermalinkToShows < ActiveRecord::Migration
def change
remove_column :shows, :link_mp3
add_column :shows, :permalink, :string
end
end
|
class RolesController < ApplicationController
def index
@roles = Role.all
end
def new
@role = Role.new
end
def create
@role = Role.new(role_params)
if @role.save
redirect_to roles_path
else
render 'new'
end
end
def edit
@role = Role.find(params[:id])
end
def update
@role = Role.f... |
require 'java_buildpack/framework'
require 'java_buildpack/framework/language_server_base'
module JavaBuildpack
module Framework
# Installs XML based LSP server component.
class LanguageServerNodeXML < LanguageServerBase
# Creates an instance
#
# @param [Hash] context a collection of util... |
class DocumentsController < ApplicationController
#respond_to :pdf
def index
@documents = Document.all.sort_by &:name
end
def show
@document = Document.find_by! name: params[:id]
respond_to do |format|
format.pdf do
send_file @document.pdf, type: 'application/pdf'
end
format.text do
self.c... |
def oxford_comma(array)
length = array.length
if length == 0
return "Please give me a real array, no mucking about thank you"
elsif length == 1
return String(array[0])
elsif length > 1
last_item = array.pop
array.push("and " + last_item)
if length > 2
array.join(", ")
else
ar... |
class Post < ActiveRecord::Base
attr_accessible :activity_id, :content, :content_date, :user_id, :subject, :authorized
belongs_to :user
belongs_to :activity
validates_presence_of :content, :content_date, :activity_id, :user_id, :subject
end
|
class OrdersController < ApplicationController
def show
@order = Order.find(params[:id])
end
def edit
@order = Order.find(params[:id])
@status = OrderStatus.all
end
def update
@order = Order.find(params[:id])
if @order.update(order_params)
flash[:success] = "Order Successf... |
module Rbacan
class Role < ApplicationRecord
self.table_name = Rbacan.role_table
validates :name, presence: true, uniqueness: true
has_many :role_permissions, class_name: Rbacan.role_permission_class, dependent: :destroy
has_many :permissions, class_name: Rbacan.permission_... |
require 'chef/provider/lwrp_base'
require_relative 'helpers'
class Chef
class Provider
class ElasticsearchInstance < Chef::Provider::LWRPBase
include ElasticsearchCookbook::Helpers
provides :es_instance if defined?(provides)
action :create do
instance_path = "#{config_path}/#{new_resou... |
require 'rails_helper'
# create_table :mileage_records do |t|
# t.date :record_date
# t.integer :start_mileage
# t.integer :end_mileage
# t.string :route_description
# t.integer :distance
# t.text :notes
# t.references :user, index: true
# t.timestamps
describe Mil... |
unless Vagrant.has_plugin?("vagrant-vbguest")
raise 'vagrant-vbguest is not installed: vagrant plugin install vagrant-vbguest'
end
Vagrant.configure("2") do |config|
config.vm.define "VNPM" do |machine|
machine.vm.box = "ubuntu/trusty64"
config.vm.hostname = "VNPM"
machine.vm.network "private_network", type... |
class VirtualTownsController < ApplicationController
before_filter :authenticate_user!, :site_values, :is_neighbor?
layout :set_layout
load_and_authorize_resource
def index
@menu = "virtual-town"
@posts = Blocker.filter(@user, @user.virtual_town.posts_to_show(params[:event]))
end
def edit
@fil... |
class User < ApplicationRecord
validates :email, uniqueness: true
has_secure_password
def self.confirm(params)
@user = User.find_by({email: params[:email]})
@user ? @user.authenticate(params[:password]) : false
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PaymentNotification do
describe "setting up twitter message" do
before(:each) do
@payment_notification = PaymentNotification.new(
:brick => Brick.new(
:url_key => 'foo',
:message => 'a message',
... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'validations' do
it { is_expected.to validate_presence_of(:first_name) }
it { is_expected.to validate_presence_of(:last_name) }
it { is_expected.to validate_presence_of(:age) }
it { is_expected.to validate_presence_of(:gender) }
e... |
class AddColToMyNotice < ActiveRecord::Migration[5.0]
def change
add_column :my_notices, :like, :boolean
end
end
|
# == Informacion de la tabla
#
# Nombre de la tabla: *dbm_periodistas*
#
# idPeriodistas :integer(11) not null, primary key
# idInstituciones :integer(11) not null
# idTipoMedio :integer(11) not null
# idDepartamento :integer(11) not null
# idDescriptorGenerico :integer(1... |
class AnswersController < ApplicationController
def create
# render plain: params[:post].inspect
@question = Question.find(params[:id])
@answers = @question.answers.create(answers_params)
end
def edit
@question = Question.find(params[:id])
end
def update
# render plain: params[:post].in... |
class Todo
attr_accessor :title, :complete
def initialize(attributes)
self.title = attributes.fetch 'title'
self.complete = attributes.fetch 'complete', false
end
def toggle_complete
self.complete = !self.complete
end
end |
Rails.application.routes.draw do
root 'welcome#index'
get '/handbook', to: 'welcome#handbook'
get '/signup', to: 'users#new'
post '/signup', to: 'users#create'
get '/submit_news', to: 'news_items#new'
get '/submit_post', to: 'microposts#new'
get '/login', to: 'sessions#new'
post '/login', to: 'sessi... |
# Write a method that takes two Array arguments in which each Array contains a list of numbers, and returns a new Array that contains the product of each pair of numbers from the arguments that have the same index. You may assume that the arguments contain the same number of elements.
=begin
approach:
- zip the two ... |
class AttachmentMailer < ApplicationMailer
def new_attachment_notification(user, proposal, attachment)
@proposal = proposal.decorate
@attachment = attachment
@recipient = user
add_inline_attachment("icon-pencil-circle.png")
add_inline_attachment("icon-clipped_page.png")
assign_threading_header... |
require 'rails_helper'
RSpec.describe Admin::TracksController, type: :controller do
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
let(:valid_session) { {} }
describe "GET #ind... |
class Api::PorterController < ApplicationController
def index
render json: {message: "This is Jake Porter's message"}
end
end
|
# == Schema Information
#
# Table name: categories
#
# id :bigint(8) not null, primary key
# name :string
# ancestry :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Category < ApplicationRecord
has_ancestry
def self.parse
category_p... |
$:.concat %w[spec/babushka spec/fancypath]
require 'bin/babushka'
include Babushka
include Babushka::Logger::Helpers
include Babushka::Dep::Helpers
include Babushka::Shell::Helpers
require 'rubygems'
require 'rspec'
Rspec.configure
def tmp_prefix
"#{'/private' if host.osx?}/tmp/rspec/its_ok_if_a_test_deletes_this... |
module ApplicationHelper
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
def flash_messages
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k.to_sym)}
formatted_messages = messages.map do |type|
content_tag :div, :id => type.to_s do
message_for_item(flash... |
module JekyllBuildEbook
module Filters
def self.register
Liquid::Template.register_filter(URLFilters)
end
module URLFilters
include Jekyll::Filters::URLFilters
def relative_url(input)
return if input.nil?
input = input.url if input.respond_to?(:url)
return input... |
module RateCalculatorSystem
class Calculator
attr_reader :lenders, :requested_loan
MINIMUM_AMOUNT = 1000
MAXIMUM_AMOUNT = 15_000
LOAN_PERIOD = 3
def initialize(requested_loan, lenders)
@requested_loan = Float(requested_loan)
@lenders = sort_by_rate!(lenders)
end
def final_ra... |
require 'test_helper'
class InstagramLikedsControllerTest < ActionController::TestCase
setup do
@instagram_liked = instagram_likeds(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:instagram_likeds)
end
test "should get new" do
get :new
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
create_table "messages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "message_room_id", default: 0, null: false, comment: "メッセージルーム"
t.text "content", comment: "メッセージルーム"
t.datetime "send_at", comment: "送信日時"
t.datetime "created_at", n... |
Starrzdance::Application.routes.draw do
devise_for :admins
root 'static_pages#home'
match '/about', to: 'static_pages#about', via: 'get'
match '/achievements', to: 'static_pages#achievements', via: 'get'
match '/faq', to: 'static_pages#faq', via: 'get'
match '/schedule', to: 'static_pages#schedule', via: '... |
require "spec_helper"
describe String do
it "should have a slufigy method" do
string = "My superb slug"
string.should respond_to(:slugify)
end
it "should return a slug" do
slug = "My superb slug".slugify
slug.should eql("my-superb-slug")
end
end |
module Yito
module Model
module Booking
module Concerns
#
# Manage the customer information
#
module Customer
def self.included(model)
model.belongs_to :customer, 'Yito::Model::Customers::Customer', required: false, child_key: [:customer_id], parent_key: [:id]... |
class CommentsController < ApplicationController
before_action :find_commentable
def new
@comment = @commentable.comments.new
end
def create
@commentable = find_commentable
@comment = @commentable.comments.create(comment_params)
#logger.debug "I AM THIS"
#@c... |
include_recipe 'apt::default'
include_recipe 'lxc::default'
# Mocking a chef server inside the lxc host so
# chef-client inside the container can "register" into the server
execute 'run chef-zero' do
command '/opt/chef/bin/chef-zero --host 10.0.3.1 --port 8889 --daemon'
action :run
end
container_name = 'test-co... |
# Provide helper methods to return String or Hash objects used in process Higo::Transport objects
module Higo
module Transport
module Processing
private
# Provides a string if text or Hash if JSON format detected
#
# @private
# @param [String]
# @return [String, Hash]
de... |
require 'helper'
describe LinkedIn::Client::Group do
before do
@client = LinkedIn::Client.new
end
describe ".group" do
it "should return the group of the id" do
stub_get("/groups/120725").
to_return(:body => fixture("group_ruby.json"))
group = @client.group(120725)
group.name.... |
require 'rails_helper'
describe 'the signin process', type: :feature do
let (:user) { create(:user, confirmation_token: nil,
confirmed_at: nil,
confirmation_sent_at: nil) }
let (:confirmed_user) { create (:user) }
scenario 'user c... |
# Die Class 2: Arbitrary Symbols
# I worked on this challenge [by myself, with: ] by myself.
# I spent [2] hours on this challenge.
# Pseudocode
# Input: an array of letters
# Output: the number of sides of the dice, or a random letter from a roll
# Steps:
# set a passed array to a instance variable
# s... |
module SpreeBulkUpload
module Processors
class Base
def get_attributes
{}.tap do |attrs|
attributes_mapping.each do |k, v|
case v
when String
attrs[v] = source_object[k]
when Hash
attrs[v[:attr]] = v[:value].call(sour... |
class Post < ApplicationRecord
validates :title, presence: true
validate :ensure_photo_attached
def ensure_photo_attached
unless self.photo.attached?
errors[:photo] << 'must be attached'
end
end
has_one_attached :photo
belongs_to :user,
primary_key: :id,
foreign_key: :poster_id,
... |
class ChangeOverallRankToPosRank < ActiveRecord::Migration[5.1]
def change
rename_column :stats, :overall_rank, :position_rank
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user
include SessionsHelper
def authenticate_user
return if current_user
redirect_to login_path
end
private
def side_menus1
#用户管理
@side_menus = Menus::SideMenus.list[... |
class Multiple < ApplicationRecord
belongs_to :lesson
has_many :multiple_questions
has_many :multiple_results
end
|
# frozen_string_literal: true
require 'capybara'
require 'capybara/rspec'
require 'selenium-webdriver'
require 'rspec'
require 'sauce_whisk'
Capybara.default_max_wait_time = 10
RSpec.configure do |config|
config.include Capybara::DSL
config.include Capybara::RSpecMatchers
config.before do |test|
Capybara.... |
num = 1000
p num.respond_to?("even?")
p num.respond_to?("length")
if num.respond_to?("next") # true
num.next
end
if num.respond_to?("length") # false won't run
num.next
end
puts
puts "Hello".respond_to?("length")
puts "Hello".respond_to?("class")
puts "Hello".respond_to?("upcase")
puts "Hello".respond_to?("odd?... |
class Solution
def self.max_values(array:, k:)
array.each_cons(k).collect { |subarray| subarray.max }
end
end
|
class Slot
attr_reader :name, :stock_level, :price
def initialize(name, price, stock_level, refill_warning_level)
@name = name
@price = price
@stock_level = stock_level
@refill_warning_level = refill_warning_level
end
def out_of_stock?
self.stock_level == 0
end
def buy(amount_paid)
... |
require 'yaml/store'
class SkillInventory
attr_reader :database
def initialize(database)
@database = database
end
def create(skill)
database.from(:skills).insert(skill)
end
def all
result = database.from(:skills).map { |data| Skill.new(data) }
end
def find(id)
result = database.from(... |
class CreateActivityFeeds < ActiveRecord::Migration
def self.up
create_table :activity_feeds do |t|
t.string :for
t.string :feed_type
t.integer :actor_id
t.timestamps
end
end
def self.down
drop_table :activity_feeds
end
end
|
# U2.W5: A Nested Array to Model a Boggle Board
# I worked on this challenge by myself.
boggle_board = [["b", "r", "a", "e"],
["i", "o", "d", "t"],
["e", "c", "l", "r"],
["t", "a", "k", "e"]]
# Part 1: Access multiple elements of a nested array
# Pseudocode
# Initi... |
Given /^a valid url for a html page$/ do
@url = "http://localhost:3000/"
end
When /^I ask for the urls page weight$/ do
@page_weight = PageWeight::PageWeight.of_html_for(@url)
end
Then /^the weight of the html is supplied$/ do
@page_weight.should == 1837
end
When /^I ask for the page weight report for the spec... |
# JWT exceptions
class AccessDeniedError < StandardError
end
class NotAuthenticatedError < StandardError
end
class AuthenticationTimeoutError < StandardError
end
|
class AddBelongsToInOngs < ActiveRecord::Migration
def change
add_column :ongs, :belongs_to, :integer, :index => true, :after => :longitude
end
end
|
class Content < ActiveRecord::Base
acts_as_voteable
acts_as_taggable_on :tags, :sections
acts_as_featured_item
acts_as_moderatable
acts_as_media_item
belongs_to :user
belongs_to :article
has_one :content_image
has_many :comments, :as => :commentable
has_friendly_id :title, :use_slug => true
na... |
# frozen_string_literal: true
shared_examples "export opinions" do
let!(:opinions) { create_list :opinion, 3, component: current_component }
it "exports a CSV" do
find(".exports.dropdown").click
perform_enqueued_jobs { click_link "Opinions as CSV" }
within ".callout.success" do
expect(page).to ... |
class RenameList < ActiveRecord::Migration
def change
rename_table :lists, :bucket_lists
rename_column :items, :list_id, :bucket_list_id
end
end
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'agents', 'lib', 'common', 'agent_identity'))
# Common options parser
module RightScale
module CommonParser
# Parse common options between rad and rnac
def parse_common(opts, options)
opts.on("--test") do
options[:user] =... |
class ShopSerializer < ActiveModel::Serializer
attributes :id, :name, :books_sold_count
has_many :books_in_stock
def books_sold_count
Stock.books_sold_count(@instance_options[:publisher_id], object.id)
end
def books_in_stock
object.books
.where(publisher_id: @instance_options[:publisher_i... |
require "net/http"
require "veeqo/errors"
require "veeqo/response"
require "veeqo/configuration"
module Veeqo
class Request
def initialize(http_method, path, attributes = {})
@path = path
@http_method = http_method
@attributes = attributes
end
def run
valid_response || raise_resp... |
#!/usr/bin/ruby
require 'curses'
include Curses
# Linear Equation System Solver
# By Dmitry Kudriavtsev
equ_num, var_num = 0
init_screen
def curses_abort(s)
addstr s + ?\n
getch
abort s
end
begin
crmode
addstr "Number of equations: "
equ_num = getstr.to_i
addstr "Number of variables: "
var_num = getstr.to... |
class Model::Section::MainMenu < SitePrism::Section
elements :menu_item, "li a"
end |
module ApplicationHelper
def nav_bar
content_tag(:div, class: 'nav_bar') do
content_tag(:div, class: 'sign_in_links') do
(link_to 'Home', root_path, class: 'home') +
(button_to 'Sign up', new_user_path, method: :get if !logged_in? && controller_name != 'users') +
(button_to 'Log ... |
def initialize_repos_on_host(host)
if host['platform'].include? 'el-6'
el6_repo_config = "http://builds.puppetlabs.lan/puppet/3.6.0-jvm-puppet-preview1/repo_configs/rpm/pl-puppet-3.6.0-jvm-puppet-preview1-el-6-x86_64.repo"
on host, "curl #{el6_repo_config} > /etc/yum.repos.d/special-puppetlabs.repo"
else
... |
class Api::OrdersController < Api::BaseController
before_action :authenticate_user!
def create
@user = current_user
event = Event.find_by(id: params[:event_id])
return render json: {}, status: 422 if event.nil?
# 预订已满
if event.orders.where(state: ['待付款', '已预订']).count >= event.quota
retu... |
require 'open3'
def narp_executable
File.expand_path(File.join( Pathname.new(__FILE__).dirname, '..', '..', 'bin', 'narp'))
end
Given(/^that Narp is invoked with program_definition from (app_spec_\S+)$/) do |yml|
input = yml['program_definition'].gsub('"', '\"').gsub("\n", ' ')
cmd = %Q[ #{narp_executable} "#{inp... |
FactoryBot.define do
factory :event do
name { Faker::Lorem.words(number: 6).join }
date { rand(3).days.from_now }
description { Faker::Lorem.sentences(number: 3).join }
attendee_information { Faker::Lorem.sentences(number: 3).join }
remote_url { Faker::Internet.url }
association ... |
FactoryBot.define do
factory :room do
room_number {Faker::Number.decimal_part(digits: 4)}
description {Faker::Lorem.sentence}
association :room_type
end
end
|
class ChangeColumnToUser < ActiveRecord::Migration[5.1]
def up
change_column :users, :description, :string, default: ''
change_column :users, :website_url, :string, default: ''
end
def down
change_column :users, :description, :string
change_column :users, :website_url, :string
end
end
|
class AddColumnsToAttachments < ActiveRecord::Migration
def change
add_column :attachments, :about, :string
add_column :attachments, :title, :string
add_column :attachments, :attachment, :binary
end
end
|
require 'pry'
class Ride < ActiveRecord::Base
belongs_to :attraction
belongs_to :user
def take_ride
if ticket_check && height_check
ride_taken
elsif ticket_check && !height_check
"Sorry. " + not_tall_enough
elsif height_check && !ticket_check
"Sorry. " + not_enough_tickets
el... |
class Echoable < ActiveRecord::Base
def as_json *args
(data.try(:slice, *data.try(:keys)) || {}).merge slice(:id)
end
end
|
class RenameTagsToTagsNameForBooks < ActiveRecord::Migration
def self.up
rename_column :books, :tags, :tag_names
end
def self.down
rename_column :books, :tag_names, :tags
end
end
|
class EmployeeMailer < ApplicationMailer
default from: 'notifications@example.com'
def welcome_email(employee)
@employee = employee
@url = 'http://example.com/login'
mail(to: @employee.email, subject: 'Welcome to My Awesome Site')
end
end
|
# encoding: UTF-8
class WinesController < ApplicationController
before_filter :authenticate_user!, :except => [:index, :show]
before_filter :set_current_user
before_filter :get_wine_detail, :except => [:comment_vote, :index]
## TODO: 这个action为演示用, 使用后可以删除
def preview
render :layout => false
end
def... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'yaml'
require 'date'
require 'time'
require 'fileutils'
require 'forwardable'
require 'twitter_cldr/version'
require 'twitter_cldr/supported_locales'
Enumerator = Enumerable::Enumerator unless defined?(Enumerator)... |
require 'rails_helper'
RSpec.describe 'Create Item API' do
before(:all) { @merchant = create(:merchant) }
it 'must have merchant_id, name, and unit_price' do
post '/api/v1/items', params: {}
expect(response.status).to eq(400)
body = JSON.parse(response.body)
expect(body['message']).to eq 'Can not p... |
class CreateUrls < ActiveRecord::Migration
def change
#Write a code that will create a URLs table and its needed fields.
#Think of your database like a giant Excel spreadsheet
create_table :urls do |x|
x.string :long_url
x.string :short_url
x.integer :click_count, default: 0
end
end
end
|
# frozen_string_literal: true
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
# You should configure your model like this:
# devise :omniauthable, omniauth_providers: [:twitter]
# You should also create an action method in this controller like this:
def facebook
callback_fro... |
# Required gems
require 'rubygems'
require 'sinatra/base'
require 'mongoid'
require 'haml'
require 'settingslogic'
require 'bing_translator'
# Required files
require './models/settings'
require './models/word'
class Vocabulatron < Sinatra::Base
# directory path settings relative to app file
set :root, Vocabulatro... |
class Bs::Elawa::Event < ActiveRecord::Base
enum status: [:planned, :active, :archived]
validates :name, presence: true
validates :status, presence: true
has_many :segments
end
|
require_relative '../helper'
class PigeonQueueTest < Minitest::Test
class TaggedTask < Pigeon::Task
attr_accessor :tag
def initialize(tag, options = nil)
super(options)
@tag = tag
end
def inspect
"<#{@tag}>"
end
end
def test_empty_state
queue = Pigeon::Queue.n... |
require 'byebug'
class PolyTreeNode
attr_reader :parent, :children, :value
def initialize(value)
@parent = nil
@children = []
@value = value
end
def parent=(value)
old_parent = self.parent
if old_parent.nil?
@parent = value
value.children << self
elsi... |
class UserController < ApplicationController
get '/signup' do
if !logged_in?
erb :"users/signup"
else
redirect to '/home'
end
end
post '/signup' do
user = User.new(username: params["username"], password: params["password"])
if params["username"].empty? || params["password"].empty... |
#!/usr/bin/ruby -w
##############################################################################
# This is a node classifier script for puppet
# http://reductivelabs.com/trac/puppet/wiki/ExternalNodes
##############################################################################
require 'yaml'
require 'nventory'
nam... |
class SubscribersController < ApplicationController
before_filter :authenticate_user!
def list
@title = 'Subscribers'
@subscribers = Subscriber.find(:all, :order => "id desc").paginate(:page => params[:page], :per_page => 100)
end
end
|
require 'spec_helper'
module Whatnot
describe SolutionEnumerator do
def noop(str); str end
describe "#each" do
context "simplest" do
let(:dimacs) do
%(
c Test DIMACS 1
c -------------
p cnf 2 2
1 -2 0
-1 2 0
)
end
... |
When(/^I open automationpractice website$/) do
visit AutomationHomePage
end
And(/^I login using data from yml$/) do
sleep(3)
on(LoginPage).login_yml
end
Then(/^I verify that I successfully logged in$/) do
sleep(5)
expect(on(LandingPage).logout.present?).to be_truthy
end
And(/^I click on Menus$/) do
on(... |
module Arel
module Predications
def between(*other)
range = Nodes::And.new(other.flatten)
Nodes::Between.new self, range
end
def is_null
Nodes::Equality.new(self, nil)
end
def is_not_null
Nodes::NotEqual.new(self, nil)
end
end
end |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Shared
module Properties
autoload :ArabicShaping, 'twitter_cldr/shared/properties/arabic_shaping'
autoload :BidiBrackets, 'twitter_cldr/shared/properties/bidi_brackets'
end
e... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "geerlingguy/ubuntu2004"
config.ssh.insert_key = false
config.vm.provider "virtualbox"
config.vm.provider :virtualbox do |v|
v.memory = 2048
v.cpus = 2
v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.