text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe Match do
include ActiveSupport::Testing::TimeHelpers
let(:match) { create(:match) }
describe 'associations' do
it { should belong_to(:project) }
it { should belong_to(:user) }
it { should have_many(:matchings) }
it do
should have_many(:original_contributions... |
require_relative './Mastermind.rb'
class Interface
def initialize
@game = Mastermind.new
run
end
def welcome
puts "Welcome to Mastermind! Try to guess the Computer's secret code."
puts "There are 4 slots and 5 colors - red, yellow, green, black, and white."
puts "When prompted, input your gu... |
class WeightedQuickUnion
attr_reader :array
def initialize size
@array = (0...size).to_a
@sizes = Array.new(size, 1)
end
def union node1, node2
if sizes[root(node1)] >= sizes[root(node2)]
array[root(node2)] = root(node1)
sizes[root(node1)] += sizes[root(node2)]
else
array[roo... |
class CreateFriendLinks < ActiveRecord::Migration
def change
create_table :friend_links do |t|
t.string :name
t.string :f_url
t.string :f_logo
t.integer :f_group_id
t.timestamps null: false
end
end
end
|
FactoryGirl.define do
factory :christmas, class: Campaign do
name 'Natal'
description "Vamos celebrar um Natal único, um Natal nas ruas.\n Venha celebrar com a gente."
start_date Date.parse('2016-11-15')
end_date Date.parse('2016-12-25')
campaign_type 0
trait :enabled do
display true
... |
class AddEmergencyToUsers < ActiveRecord::Migration
def change
change_column :users, :emergency, :string
add_column :users, :from_time, :datetime
add_column :users, :to_time, :datetime
end
end
|
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'rex'
require 'rexml/document'
require 'msf/core/post/... |
# frozen_string_literal: true
module PokerHands
class Card
attr_reader :value, :suit
def initialize(denotation)
@value, @suit = denotation.split('')
end
end
end
|
class StageOrder < ActiveRecord::Base
belongs_to :group
belongs_to :fes_date
has_one :fes_year, through: :fes_date
has_one :assign_stage, dependent: :destroy
validates :group_id, :fes_date_id, presence: true
validates :group_id, :uniqueness => {:scope => [:fes_date_id, :is_sunny] } # 日付と天候でユニーク
validate ... |
# collection of tasks for working with MongoDB databases
# known providers should have env variables set:
# MONGOHQ_URI
# MONGOLAB_URI
require "uri"
require "pathname"
BACKUP_PATH = "db/backups"
namespace :mongo do
desc "checks mongodb tools are installed"
task :mongo_tools do
["mongo", "mongodump", "mon... |
# Question 1
# Ben is right. There is an attribute reader for the @balance variable, and line 9 of the code snippet correctly calls that reader method.
# Question 2
# self is missing in line 11. Line 11 will actually initialize a locvar! Also, need a setter! Alternatively, use @quantity on line 11.
# Question 3
# ... |
PROVIDERS.fetch(:typeracer).register_metric :completed_games do |metric|
metric.title = "Completed Games"
metric.description = "Number of completed games"
metric.block = proc do |adapter|
Datapoint.new value: adapter.completed_games
end
end
|
RSpec.describe RegexGenerator::Target do
let(:target_instance) { described_class.new(target) }
describe '#present?' do
let(:text) { build(:simple_text) }
context 'when target is present in the text' do
let(:target) { build(:simple_target) }
it { expect(target_instance).to be_present(text) }
... |
require "stormtroopers/manager"
describe Stormtroopers::Manager do
let(:manager) { Stormtroopers::Manager.instance }
before(:each) {
stub_const("Stormtroopers::Army", Class.new)
Stormtroopers::Manager.stub(:instance).and_return(Stormtroopers::Manager.send(:new))
}
describe "#working_directory" do
... |
name 'myapache-role'
maintainer 'Alex'
maintainer_email 'alex@example.com'
license 'All rights reserved'
description 'Installs/Configures myapache-role'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'myapache-cookbook'
|
class TasksController < ApplicationController
before_filter :load_model, :except => [:create]
def create
@task = Task.new(params[:task])
@task.taskgroup_id = params[:taskgroup_id].to_i
@task.save
redirect_to taskgroup_path(@task.taskgroup)
end
def edit
end
def update
@model.update_att... |
# frozen_string_literal: true
module Api::V1::Admin::Videos::Signs
ShowSchema = Dry::Validation.Params(BaseSchema) do
required(:name).filled(:str?)
required(:size).filled(:int?, included_in?: ::SixByThree::Constants::VIDEO_FILE_SIZE_RANGE)
required(:content_type).filled(:allowed_video_mime_type?)
end
e... |
def rotate90 matrix
new_matrix = Array.new(matrix[0].length){Array.new(matrix.length)}
x = 0
while x < new_matrix.length
y = 0
while y < new_matrix[x].length
new_matrix[x][y] = matrix[matrix.length - 1 - y][x]
y += 1
end
x += 1
end
return new_matrix
end
matrix1 = [
[1, 5, 8],
... |
class UserLog < ActiveRecord::Base
validates :log_data, presence: true
belongs_to :user
end
|
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
before_action :authenticate_user!
def logged_in?
!!current_user
end
# http://stackoverflow.com/questions/1... |
module QBIntegration
class Auth
attr_reader :token, :secret
def initialize(credentials = {})
@token = credentials[:token]
@secret = credentials[:secret]
end
def access_token
@access_token ||= OAuth::AccessToken.new(consumer, token, secret)
end
private
def consumer
... |
class CandidatesController < ApplicationController
before_filter :authenticate_user!
layout 'admin'
def index
@candidates = Candidate.search(params[:status])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @candidates }
end
end
def show
@c... |
class Group < ApplicationRecord
has_many :users
has_many :containers, through: :users
has_many :items, through: :containers
validates :name, presence: true, uniqueness: true
end
|
module Ekidata
class Company < ActiveRecord::Base
attr_accessible :code,
:name,
:name_k,
:name_h,
:name_r,
:url,
:company_type,
:status,
:sort
validates :code, :presence => true, :uniqueness => true
validates :name, :presence => true
end
end
|
describe ScheduledReporter do
describe "#new" do
it "requires a Time object instantiation" do
now = Time.current
reporter = ScheduledReporter.new(now)
expect(reporter.check_time).to eq(now)
end
it "raises exception if arg is not a Time" do
expect {
ScheduledReporter.new("... |
class CreateWarranties < ActiveRecord::Migration[6.0]
def change
create_table :warranties do |t|
t.references :asset, null: false, foreign_key: true
t.integer :length
t.text :notes
t.timestamps
end
end
end
|
class Api::V1::UsersController < Api::V1::BaseApiController
swagger_controller :users, "User Management"
swagger_api :create do
summary "Creates a new User"
param :form, :token, :string, :required, "token = RegisterID"
param :form, :email, :string, :required, "Email address"
... |
xml.image do
xml.id @img.id
xml.status @img.status
xml.url @img.url
xml.estimated_time_arrival @eta
end
|
class Objection < ApplicationRecord
belongs_to :company, required: false
has_many :objection_list_objections, dependent: :destroy
has_many :objection_lists, through: :objection_list_objections
mount_uploader :sound, SoundUploader
end
|
class RegistrationsController < Devise::RegistrationsController
private
def signed_up_params
params.require(:user).permit(:username, :fullname, :photo, :coverimage, :email, :password_confirmation)
end
def account_update_params
params.require(:user).permit(:username, :fullname, :photo, :coverimage, :em... |
module V2::TradeEvent
class Query < ::CountryIndustryQuery
#
# NOTE: This is mostly duplicated code.
# Given the fact we'll remove V1 soon after V2 becomes default it might
# not make sense to work on unifying just now.
# ... I should know better. You can make fun of me when you ... |
=begin
Class Thing
Classe mère des "choses", telles que les Questions ou les Commentaires
@IMPORTANT: Il est important de comprendre que pour un unique élément (par
exemple un projet ou un article), il n'existe qu'une et une
seule Thing (si elle existe). Cette Thing contient d... |
Rails.application.routes.draw do
match 'ola' => 'ola_mundo#index', via: 'get'
resources :restaurantes
end
|
# Helper for handling workflow mechanics. Mix in with a model with the class
# method `workflow_setup`
module WorkflowModel
extend ActiveSupport::Concern
included do
include Workflow
workflow_column :status
validates :status, presence: true, inclusion: {in: lambda{ |wf| statuses.map(&:to_s)}}
end
... |
require_relative 'Compiler'
require_relative 'Matcher'
# Main class of the library and the only one that needs to be used from
# an user perspective.
#
# It takes an string representing the regular expression in its constructor
# and compiles this expression into an NFA, which is kept on cache.
#
# Through the method ... |
module Devise
module Models
# Allow for expiration date on Devise resources. Adds attribute:
# * expires_at
module AccountExpireable
extend ActiveSupport::Concern
def expired?
expires_at.present? && expires_at < DateTime.now
end
def expire_now
expire_at
... |
Tramway::Admin::Engine.routes.draw do
root to: 'welcome#index'
resources :records
resource :singleton, only: [ :show, :edit, :update ]
end
|
class FontGalada < Formula
head "https://github.com/google/fonts/raw/main/ofl/galada/Galada-Regular.ttf", verified: "github.com/google/fonts/"
desc "Galada"
homepage "https://fonts.google.com/specimen/Galada"
def install
(share/"fonts").install "Galada-Regular.ttf"
end
test do
end
end
|
# frozen_string_literal: true
module Films
class Season < ApplicationRecord
belongs_to :film
has_many :episodes
end
end
|
class Server < ApplicationRecord
validates :title, :invitation_code, presence: true
validates :public, inclusion: { in: [true, false] }
belongs_to :admin,
foreign_key: :admin_id,
class_name: "User"
has_many :user_servers
has_many :connected_users,
through: :user_servers,
source: :user
h... |
module Sumac
# Raised by the local endpoint when the remote endpoint has sent an invalid message.
# Will be rescued and cause the connection to be killed.
# @api private
class ProtocolError < Error
def initialize(message = 'unexpected behaviour from the remote endpoint, likely due to a faulty implementati... |
class PassengerMailer < ApplicationMailer
default from: 'notifications@example.com'
def welcome_email(passenger)
@passenger = passenger
@url = 'localhost:3000'
mail(to: @passenger.email, subject: 'Welcome to my cool site')
end
end
|
# frozen_string_literal: true
require 'rom-repository'
module Sandbox
class Repository < ROM::Repository::Root
include Deps[container: 'persistence.rom']
commands :create
end
end
|
module Maicoins
class Price
BASE_URL = "https://www.maicoin.com/api/prices/%s"
def self.btc
new.call 'BTC', (BASE_URL % 'btc-twd')
end
def self.eth
new.call 'ETH', (BASE_URL % 'eth-twd')
end
def call kind, url
response = JSON.parse RestClient.get(url), symbolize_names: tru... |
class AddColumnToChallenges < ActiveRecord::Migration[5.0]
def change
add_column :challenges, :evaluation_instructions, :text
end
end
|
# encoding: utf-8
require 'spec_helper'
describe Chain::DSL, '#processors' do
subject { object.processors }
let(:env) { Spec::FAKE_ENV }
let(:processor) { Spec::FAKE_PROCESSOR }
context "and a block is given" do
let(:object) { described_class.new(env, chain, &block) }
let(:chain) { Chain::EMP... |
require 'rails_helper'
RSpec.describe PurchaseHistory, type: :model do
before do
@purchase = FactoryBot.build(:purchase_history)
end
it "user_idとitem_idが有れば購入ができること" do
expect(@purchase).to be_valid
end
end
|
require 'formula'
class Batteries < Formula
homepage 'http://batteries.forge.ocamlcore.org'
url 'https://forge.ocamlcore.org/frs/download.php/1363/batteries-2.2.tar.gz'
sha256 '7a7139ffa0c0da356a3be63a1024eb15f15eaf6d396b999565e77f77ca789c7c'
depends_on 'objective-caml'
depends_on 'ocaml-findlib'
def ins... |
class Setting < ActiveRecord::Base
belongs_to :user
belongs_to :site
belongs_to :track
def self.new_or_old_setting(user)
"Class method"
if user.setting
setting = Setting.find_by_user_id(user)
else
setting = Setting.new
end
return setting
end
def self.just_site_numbe... |
require_relative '../environment'
class Game
attr_reader :items, :equippable_items
def initialize
@items = load_file(File.join(YAML_LOAD_PATH, "items.yaml"))
@equippable_items = load_file(File.join(YAML_LOAD_PATH, "equippable_items.yaml"))
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class Users::RoomsController < ApplicationController
before_action :authenticate_user!
def create
room = Room.create
entry1 = Entry.create(room_id: room.id, user_id: current_user.id)
entry2 = Entry.create(user_id: params[:entry][:user_id], room_id: room.id)
redirect_to room_path(room)
end
def ... |
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
def reverse_list(list, previous=nil)
if list
next_node = list.next_node
list.next_node = previous
reverse_list(next_node, list)
end
end
def print_values... |
class Driver
attr_reader :name
@@all = []
def initialize(name)
@name=name
@@all << self unless @@all.any?(self)
end
def self.all
@@all
end
def rides
Ride.all.select { |ride| ride.driver == self }
end
def passengers
rides.map { |drives|... |
class Characteristic < ApplicationRecord
has_many :profile_characteristics
has_many :profiles, through: :profile_characteristics
end
|
class AddSalesManIdToBirthdayParties < ActiveRecord::Migration
def change
add_reference :birthday_parties, :sales_man, index: true
end
end
|
class EmailController < ApplicationController
def course_section
@course_section = CourseSection.find(params[:class_id])
templates = Dir[Rails.root + "app/views/teacher_mailer/templates/*"].map{ |file| file.split("/").last.sub(".text.erb", "").sub(".html.erb", "")}.uniq
@templates = templates.map{ |temp|... |
module Boilerpipe::SAX
class Preprocessor
def self.strip(text)
# script bug - delete script tags
text = text.gsub(/\<script.+?<\/script>/im, '')
# nokogiri uses libxml for mri and nekohtml for jruby
# mri doesn't remove when missing the semicolon
text.gsub(/( ) /, '\1; ')
... |
class SellersController < ApplicationController
def index
@sellers = Seller.all
render json: @sellers, except: [:created_at, :updated_at]
end
def show
@seller = Seller.find(params[:id])
render json: @seller
end
def new
@seller = Seller.new
end
def... |
#Deep clone - eg: h={"objs"=>[{a:[33,32], b:{p:[34,45]}}, {a:2, b:3} ]"}
def deep_clone(hash)
hash1 = {}
hash.each do |k,v|
hash1[k] = deep_clone_value(v)
end
hash1
end
def deep_clone_value(v)
if v.is_a?(Array)
v.map { |val| deep_clone_value(val) }
elsif v.is_a?(Hash)
h = {}
v.each { |k,... |
# frozen-string-literal: true
require File.join(File.dirname(__FILE__), 'helper')
class FlacFileTest < Test::Unit::TestCase
context 'TagLib::FLAC::File' do
setup do
@file = TagLib::FLAC::File.new('test/data/flac.flac')
end
should 'have a tag' do
tag = @file.tag
assert_not_nil tag
... |
class UsersController < Clearance::UsersController
def new
redirect_to sign_up_path
end
def disabled_signup
flash[:notice] = "Sign up is temporarily disabled."
redirect_to root_path
end
def user_params
params.require(:user).permit(*User::PERMITTED_ATTRS)
end
end
|
require 'colorize'
require 'pry'
require_relative './pieces/pawns'
require_relative './pieces/king'
require_relative './pieces/queen'
require_relative './pieces/knight'
require_relative './pieces/bishop'
require_relative './pieces/rook'
require_relative './modules/board_coords.rb'
require_relative './error.rb'
# respo... |
require 'spec_helper'
describe 'postfix::main' do
let(:title) do
'dovecot_destination_recipient_limit'
end
let(:params) do
{
value: '1',
}
end
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
it { is_expected.to compile.with... |
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "geoq"
require "minitest/autorun"
require "minitest/reporters"
require "minitest/spec"
Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new
module Geoq::TestData
def self.fc
{type: "FeatureCollection", features: [{type: "Feature", ... |
require "minitest/autorun"
require "minitest/rg"
require_relative "../bartab"
require_relative "../guest"
class TestBartab < MiniTest::Test
def setup
@bartab = Bartab.new(purchase: 'Beer', cost: 5)
end
def test_bartab_has_purchase
assert_equal('Beer', @bartab.purchase)
end
def test_bartab_has_co... |
class AddSubjectToMockTests < ActiveRecord::Migration
def change
add_reference :mock_tests, :subject, index: true
end
end
|
# WORKING!
namespace :scraper do
desc "Scrape all interview questions from https://leetcode.com/problemset/algorithms/"
task leetcode: :environment do
require 'nokogiri'
require 'open-uri'
# 1. Go to URL
browser = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko)... |
require 'rspec-pubsub-formatter'
describe RSpecPubsub::Formatter do
let(:output) { StringIO.new }
let(:channel) { stub("Channel", :publish => true) }
subject{ RSpecPubsub::Formatter.new(output) }
before do
RSpecPubsub::Channel.stub(:new).and_return(channel)
end
it "publishes its status with example c... |
require 'spec_helper'
describe GearsController do
let(:default_params) { { format: :json } }
let(:valid_attributes) { attributes_for(:gear) }
let(:valid_session) { {} }
describe "GET index" do
it "assigns all gears as @gears" do
gear = create(:gear)
get :index, {}, valid_session
assigns(... |
# frozen_string_literal: true
class DropTranscripts < ActiveRecord::Migration[5.1]
def change
drop_table :transcripts
end
end
|
require 'rails_helper'
RSpec.describe Subscription, type: :model do
it { should validate_presence_of :name }
it { should validate_presence_of :monthly_price }
it { should validate_numericality_of(:monthly_price).only_integer.is_greater_than(0) }
it { should have_many :users_subs_relationships }
it { should h... |
# Write a method that takes a string as an argument and returns a new string
# in which every uppercase letter is replaced by its lowercase version, and
# every lowercase letter by its uppercase version. All other characters should
# be unchanged.
# You may not use String#swapcase; write your own version of this me... |
class Screening < ActiveRecord::Base
belongs_to :movie
belongs_to :user
belongs_to :theatre
belongs_to :offer
end
|
require 'rails_helper'
RSpec.describe Api::V1::GroupEventsController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# GroupEvent. As you add validations to GroupEvent, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { attributes_for(... |
module SetCard #登録済みのクレジットカードの呼び出し
extend ActiveSupport::Concern
private
def set_card
@card = Card.find_by(user_id: current_user.id)
end
end |
class AddRacknoToHardware < ActiveRecord::Migration
def change
add_column :hardwares, :rack_number, :integer
end
end
|
class ApplicationController < ActionController::Base
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_cache_buster
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:firs... |
# Create table PostGraduation
class CreatePostGraduations < ActiveRecord::Migration[5.1]
# Create table
def change
create_table :post_graduations do |t|
t.string :name
t.string :initials
t.integer :seniority
t.integer :status
t.timestamps
end
end
end
|
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :address
def name
{
firstName: object.fname,
lastName: object.lname
}
end
def address
if !object.street || !object.city || !object.postalcode
nil
else
{
street: object.street,
city: object.... |
# == Schema Information
#
# Table name: ideas
#
# id :integer not null, primary key
# name :string(255)
# description :string(255)
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# private :boolean default(FALSE)
# ra... |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{repub}
s.version = "0.3.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dmitri Goutnik"]
s.date = %q{2009-07-17}
s.default_executable = %q{repub}
s.description = %... |
class EncontrosController < ApplicationController
before_action :set_encontro, only: [:show, :edit, :update, :destroy]
# GET /encontros
# GET /encontros.json
def index
@encontros = Encontro.all
end
# GET /encontros/1
# GET /encontros/1.json
def show
authorize @encontro
end
# GET /encontro... |
# -*- coding: utf-8 -*-
=begin
Faça um programa que converta da notação de 24 horas para a notação de 12
horas. Por exemplo, o programa deve converter 14:25 em 2:25 P.M. A entrada é
dada em dois inteiros. Deve haver pelo menos duas funções: uma para fazer a
conversão e uma para a saída. Registre a informação A.M./P.M.... |
class OfferingCourse < ActiveRecord::Base
belongs_to :offering
belongs_to :course
end
|
# app/validators/reserved_name_validator.rb
class ReservedNameValidator < ActiveModel::EachValidator
RESERVED_NAMES = %w{
about account add admin api
app apps archive archives auth
blog event
config connect contact create company companies
delete downloads
edit email
faq favorites feed fee... |
# frozen_string_literal: true
require 'thor'
require 'fakerbot/cli'
require 'fakerbot/version'
require 'fakerbot/commands/list'
require 'fakerbot/commands/search'
module FakerBot
class CLI < Thor
Error = Class.new(StandardError)
desc 'version', 'fakerbot version'
def version
require_relative 'ver... |
include_recipe 'directory_helper'
home_dir = DirectoryHelper.home(node)
home_path = "#{home_dir}/" + node[:user]
dropbox_path = home_path + "/Dropbox"
config_path = home_path + "/.config"
links = [
{ from: home_path + "/.tmux.conf", to: dropbox_path + "/Public/tmux/.tmux.conf" },
{ from: home_path + "/... |
module MailerHelper
def advertised_link name, url
(link url do
orange_button do
name
end
end) +
(tag :br) +
(small_orange_link url do
url
end)
end
def body
content_tag :div, :style => style_for(body_style) do
yield
end
end
def content
content... |
class FriendshipsController < ApplicationController
# Following
def show
@user = User.find_by_slug params[:id]
@friends = @user.friends
respond_to do |format|
format.html
format.plist {
render :plist => {:user => @user, :following => @friends}
}
end
end
# ... |
class CreatePatients < ActiveRecord::Migration
def self.up
create_table :patients do |t|
t.column :doctor_id, :integer
t.column :account_number, :string
t.column :last_name, :string #CMS 2a
t.column :first_name, ... |
# encoding: UTF-8
require_relative '../test_helper'
class SpecWriter < Creq::Writer
def title(r); super(r); end
def attributes(r); super(r); end
def body(r); super(r); end
end
describe Writer do
let(:req) {
req = Requirement.new(id: 'ur', title: 'User reqs')
req << Requirement.new(id: 'ur.... |
class Offer < ApplicationRecord
validates :amount, presence: true, length: (1..10), numericality: true
validates :discount, presence: true, length: (0..3), numericality: true
end
|
class Album
attr_reader :artist
def initialize(album_hash)
@album_hash = album_hash
@artist = @album_hash.artists.first.name # Artists lazy loaded
end
def name
@album_hash.name
end
def release_date
return if @album_hash.release_date.blank?
Date.parse(@album_hash.release_date)
rescue... |
require 'rails_helper'
RSpec.describe Review, type: :model do
# pending "add some examples to (or delete) #{__FILE__}"
describe "create question" do
it "creates a valid motorcycle" do
user = FactoryGirl.create(:user)
style = FactoryGirl.create(:style)
moto = FactoryGirl.create(:motorcycle, ... |
# a resturuant looks like this
# res_data = {
# id: INTEGER *MUST BE UNIQUE,
# name: STRING,
# location: {
# city: STRING,
# state: STRING,
# },
# delivery: BOOLEAN,
# days_open: STRING *DAYS SEPERATED BY COMMAS(NO SPACES),
# likes: INTEGER,
# dishes: ARRAY OF OBJECTS/HASHES
# { name: STRING... |
class FontImFellFrenchCanonSc < Formula
head "https://github.com/google/fonts/raw/main/ofl/imfellfrenchcanonsc/IMFeFCsc28P.ttf", verified: "github.com/google/fonts/"
desc "IM Fell French Canon SC"
homepage "https://fonts.google.com/specimen/IM+Fell+French+Canon+SC"
def install
(share/"fonts").install "IMFeF... |
# **Loremarkov** uses Markov chains to generate plausible-sounding text, given
# an input corpus. It comes with a few built-in sample texts.
#
# It is based upon Kernighan & Pike's *The Practice of Programming* Chapter 3
#
# Install Loremarkov with Rubygems:
#
# gem install loremarkov
#
# Once installed, the `dest... |
require 'rubygems'
require 'rss'
require 'rsolr'
require 'pry'
require 'securerandom'
require 'ruby-progressbar'
def harvest_rss (rss_source)
open(rss_source) do |rss|
feed = RSS::Parser.parse(rss_source)
puts "Harvesting: #{feed.channel.title}"
progressbar = ProgressBar.create(:title => "Item", :total =... |
# Handle user submissions of soundbites
class SubmissionsController < ApplicationController
def new
@submission = Submission.new
end
def create
@submission = Submission.new submission_params
if @submission.valid?
if params[:do_not_use].blank?
@submission.save
flash[:success] = '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.