Skip to content

Instantly share code, notes, and snippets.

View kaileeagray's full-sized avatar

Kailee Gray kaileeagray

View GitHub Profile
// 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
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))
<%= 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|%>
@kaileeagray
kaileeagray / depends_on.js
Created September 10, 2016 17:50 — forked from masonjm/depends_on.js
Show/Hide form fields based on the value in another field.
(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')) {
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
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)
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
@kaileeagray
kaileeagray / app.rb
Created July 12, 2016 00:44 — forked from runemadsen/app.rb
Sinatra File Upload
require 'sinatra'
get "/" do
erb :form
end
post '/save_image' do
@filename = params[:file][:filename]
file = params[:file][:tempfile]
class FamilyWellnessDaily::Scraper
def initialize
scrape_family_wellness
FamilyWellnessDaily::FitnessClass.all
end
def get_document(url)
browser = Watir::Browser.new(:phantomjs)
browser.goto(url)
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. ®"=>[