This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ISSUE: Price and Availability Check for Long Nose Pliers | |
| // This test checks the price and availability of Long Nose Pliers on the Practice Software Testing website | |
| import { test, expect } from '@playwright/test'; | |
| test('Checking Price and Availability of Long Nose Pliers', async ({ page }) => { | |
| // 1. Navigate to https://practicesoftwaretesting.com | |
| await page.goto('https://practicesoftwaretesting.com/'); | |
| // 2. Search for pliers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :procon_onion => :environment do | |
| require 'nokogiri' | |
| require 'open-uri' | |
| ## I picked out a few of the pro/con lists and scraped them. | |
| all = ["http://www.theonion.com/graphic/pros-and-cons-raising-minimum-wage-50476", "http://www.theonion.com/graphic/pros-and-cons-freelance-employment-51603", "http://www.theonion.com/graphic/pros-and-cons-political-correctness-52003", "http://www.theonion.com/graphic/pros-and-cons-helicopter-parenting-52130", "http://www.theonion.com/graphic/pros-and-cons-attending-college-52701", "http://www.theonion.com/graphic/pros-and-cons-profit-colleges-53065", "http://www.theonion.com/graphic/pros-and-cons-taking-gap-year-52852", "http://www.theonion.com/graphic/pros-and-cons-standardized-testing-50388", "http://www.theonion.com/graphic/the-pros-and-cons-of-open-plan-offices-38377", "http://www.theonion.com/graphic/the-pros-and-cons-of-paying-college-athletes-38321"] | |
| all.each do |url| | |
| @url = url | |
| @doc = Nokogiri::HTML(open(url)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for(@list) do |f| %> | |
| <%= render 'shared/error_messages', object: f.object %> | |
| <%= f.label :title %> | |
| <%= f.text_field :title %> | |
| <%= f.label :description, "List Details" %> | |
| <%= f.text_area :description%> | |
| <div class="row"> | |
| <%= f.fields_for :items do |ff|%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function( $ ){ | |
| $.fn.dependsOn = function(element, value) { | |
| var elements = this; | |
| var hideOrShow = function() { | |
| var $this = $(this); | |
| var showEm; | |
| if ( $this.is('input[type="checkbox"]') ) { | |
| showEm = $this.is(':checked'); | |
| } else if ($this.is('select')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ApplicationRecord | |
| validates :email, :presence => true | |
| validates :email, :uniqueness => true | |
| has_secure_password | |
| def self.find_or_create_by_omniauth(auth) | |
| oauth_email = auth["info"]["email"] || auth["info"]["nickname"] || auth["info"]["name"] | |
| self.where(:email => oauth_email).first_or_create do |user| | |
| user.password = SecureRandom.hex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SessionsController < ApplicationController | |
| def new | |
| end | |
| def create | |
| @list = List.new | |
| @lists = List.all | |
| if auth = request.env["omniauth.auth"] | |
| @user = User.find_or_create_by_omniauth(auth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| require 'open-uri' | |
| class Scraper | |
| ## I picked out a few of the pro/con lists and scraped them for their content. | |
| @@all = ["http://www.theonion.com/graphic/pros-and-cons-of-screen-time-for-kids-38445", "http://www.theonion.com/graphic/pros-and-cons-of-going-to-grad-school-38467", "http://www.theonion.com/graphic/pros-and-cons-of-the-greek-system-38515", "http://www.theonion.com/graphic/pros-and-cons-raising-minimum-wage-50476", "http://www.theonion.com/graphic/pros-and-cons-freelance-employment-51603", "http://www.theonion.com/graphic/pros-and-cons-political-correctness-52003", "http://www.theonion.com/graphic/pros-and-cons-helicopter-parenting-52130", "http://www.theonion.com/graphic/pros-and-cons-attending-college-52701", "http://www.theonion.com/graphic/pros-and-cons-profit-colleges-53065", "http://www.theonion.com/graphic/pros-and-cons-taking-gap-year-52852", "http://www.theonion.com/graphic/pros-and-cons-standardized-testing-50388", "http://www.theonion.com/graphic/the-pros-an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| get "/" do | |
| erb :form | |
| end | |
| post '/save_image' do | |
| @filename = params[:file][:filename] | |
| file = params[:file][:tempfile] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FamilyWellnessDaily::Scraper | |
| def initialize | |
| scrape_family_wellness | |
| FamilyWellnessDaily::FitnessClass.all | |
| end | |
| def get_document(url) | |
| browser = Watir::Browser.new(:phantomjs) | |
| browser.goto(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FamilyWellnessDaily::FitnessClass | |
| attr_accessor :name, :time, :instructor, :categories, :studio | |
| @@all = [] | |
| @@all_categories = ["cardio", "barre", "bodypump", "strength", "dance", "cycling", "interval training", "boxing", "yoga", "water exercise", "senior fitness", "medical"] | |
| @@hash_title_categories = {"Circuit"=>["interval training", "cardio", "strength"], "Spinsanity"=>["cycling", "cardio"], | |
| "Zumba ®"=>["dance", "cardio"], "Hydro Power"=>["water exercise", "strength", "cardio"], | |
| "Hydro Fitness"=>["water exercise", "strength", "cardio"], "Gold N Fit"=>["senior fitness"], | |
| "Indoor Cycling"=>["cycling", "cardio"], "Tabata Toning"=>["interval training", "cardio", "strength"], | |
| "Parkinson's Program"=>["medical"], "Mat Pilates"=>["pilates", "strength"], "PD FIT"=>["medical"], "BODYPUMP ™"=>["bodypump", "strength"], | |
| "Yoga Level 1"=>["yoga"], "Raw Groove"=>["dance", "cardio"], "R.I.P.P.E.D. ®"=>[ |
NewerOlder