Skip to content

Instantly share code, notes, and snippets.

View lgsantiago's full-sized avatar

Luis Santiago lgsantiago

View GitHub Profile
@lgsantiago
lgsantiago / screenshot.py
Last active November 7, 2020 20:21
Wodify automation: screenshot
# Capture Image
time.sleep(3)
image_file = 'screenshots/screenshot.png'
chrome_driver.save_screenshot(image_file)
# Get location of element to crop screenshot
element = chrome_driver.find_element_by_id("AthleteTheme_wtLayoutNormal_block_wtMainContent")
location = element.location
size = element.size
from selenium import webdriver
import credentials
import time
from PIL import Image
# Navigate to Wodify
chrome_driver = webdriver.Chrome()
chrome_driver.implicitly_wait(10)
chrome_driver.get("https://app.wodify.com")
from selenium import webdriver
import credentials
# Navigate to Wodify
chrome_driver = webdriver.Chrome()
chrome_driver.implicitly_wait(10)
chrome_driver.get("https://app.wodify.com")
# Sign in to Wodify
chrome_driver.find_element_by_id("Input_UserName").send_keys(credentials.user_name)
from selenium import webdriver
chrome_driver = webdriver.Chrome()
chrome_driver.get("https://app.wodify.com")
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
@Data
@Entity
public class Patient {
interface MyGeneric<T> {
T compute(T t);
}
public static void main(String args[]){
// String version of MyGenericInteface
MyGeneric<String> reverse = (str) -> {
String result = "";
interface MyString {
String myStringFunction(String str);
}
public static void main (String args[]) {
// Block lambda to reverse string
MyString reverseStr = (str) -> {
String result = "";
for(int i = str.length()-1; i >= 0; i--)
MyGreeting morningGreeting = (String str) -> "Good Morning " + str + "!";
MyGreeting eveningGreeting = (String str) -> "Good Evening " + str + "!";
interface NumericTest {
boolean computeTest(int n);
}
public static void main(String args[]) {
NumericTest isEven = (n) -> (n % 2) == 0;
NumericTest isNegative = (n) -> (n < 0);
// Output: false
System.out.println(isEven.computeTest(5));
interface MyGreeting {
String processName(String str);
}
public static void main(String args[]) {
MyGreeting morningGreeting = (str) -> "Good Morning " + str + "!";
MyGreeting eveningGreeting = (str) -> "Good Evening " + str + "!";
// Output: Good Morning Luis!
System.out.println(morningGreeting.processName("Luis"));