Skip to content

Instantly share code, notes, and snippets.

View fijiaaron's full-sized avatar

Aaron Evans fijiaaron

View GitHub Profile
@fijiaaron
fijiaaron / RubyAccessors
Last active February 26, 2019 23:44
RubyAccessors created by fijiaaron - https://repl.it/@fijiaaron/RubyAccessors
Demonstrate how to use getters and setters in Ruby
@fijiaaron
fijiaaron / flv2mp4.sh
Created February 27, 2019 22:23
Convert FLV to MP4 using FFMPEG
#!/usr/bin/env bash
flv_input="$1"
mp4_output=`echo "$flv_input" | sed s/flv$/mp4/`
echo converting $flv_input to $mp4_output
ffmpeg -i "$flv_input" "$mp4_output"
@fijiaaron
fijiaaron / BookDownload_StepDefs.java
Last active March 13, 2019 00:41
Demonstrate how to check that a file can be downloaded
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
@fijiaaron
fijiaaron / GetErroredTests.java
Created March 15, 2019 20:23
Using the Sauce Labs Analytics REST API
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import com.mashape.unirest.request.HttpRequest;
import io.restassured.path.json.JsonPath;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@fijiaaron
fijiaaron / GetJobInfoResponse.java
Last active March 22, 2019 19:57
Use GSON to parse Sauce Labs getJobInfo JSON response into a POJO object
package com.saucelabs.api.responses;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GetJobInfoResponse
{
public String assigned_tunnel_id;
public String automation_backend;
import nsfg
df = nsfg.ReadFemPreg()
def first_babies(df):
for index, row in df.iterrows():
if row.prgoutcome == 1: # only report on live births
print(index, row.caseid, row.prgoutcome, row.pregordr, row.birthord, row.wksgest)
first_babies(df)
# Python Data Science lesson 2
# strings
greeting = "Hello, World!"
print(greeting)
# a string is a sequence of characters
print(greeting[0]) #=> 'H'
# index starts with 0, so index 5 is the 6th character
@fijiaaron
fijiaaron / UpdateTest.java
Created August 12, 2019 23:19
Update failing test with custom data about the failure
import com.saucelabs.saucerest.SauceREST;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
package com.saucelabs.api.examples.analytics;
import io.mikael.urlbuilder.UrlBuilder;
import org.junit.Test;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@fijiaaron
fijiaaron / pom.xml
Created April 13, 2020 16:23
Selenium Project setup
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>oneshore.training.tests</artifactId>
<version>1.0-SNAPSHOT</version>