Skip to content

Instantly share code, notes, and snippets.

View andyweiss1982's full-sized avatar
👨‍🏫

Andy Weiss andyweiss1982

👨‍🏫
View GitHub Profile
name: Yelp Brand Distances SOLUTION
description: ''
host: EXCEL
api_set: {}
script:
content: "const statusText = document.querySelector(\"#status\");\nconst form = document.querySelector(\"form\");\n\nform.addEventListener(\"submit\", handleFormSubmit);\n\nasync function handleFormSubmit(event) {\n event.preventDefault();\n\n const baseBrandRestaurants = await getRestaurants(form.baseBrand.value, form.location.value, form.apiKey.value);\n const competitorBrandRestaurants = await getRestaurants(\n form.competitorBrand.value,\n form.location.value,\n form.apiKey.value\n );\n\n statusText.textContent = `Calculating distance for ${baseBrandRestaurants.length} restaurants...`;\n baseBrandRestaurants.forEach((baseRestaurant) => {\n competitorBrandRestaurants.forEach((competitorRestaurant) => {\n // calculate the distance using lat / long and check if this one is the closest\n const distance = milesBetween(\n baseRestaurant.latitude,\n baseRestaurant.longitude,\n co
@andyweiss1982
andyweiss1982 / Github API.EXCEL.yaml
Created October 30, 2020 20:22
Search for developers across markets and languages
name: Github API
description: Search for developers across markets and languages
host: EXCEL
api_set: {}
script:
content: >
const corsProxy = "https://rbi-tech-bootcamp-cors-proxy.herokuapp.com/";
const form = document.querySelector("form");
@andyweiss1982
andyweiss1982 / Dad Joke API Example.EXCEL.yaml
Created October 30, 2020 19:37
Very basic implementation of fetching data and putting into Excel
name: Dad Joke API Example
description: Very basic implementation of fetching data and putting into Excel
host: EXCEL
api_set: {}
script:
content: |
const button = document.querySelector("button");
button.addEventListener("click", run);
async function getRandomDadJoke(){
@andyweiss1982
andyweiss1982 / Dad Jokes.EXCEL.yaml
Created October 26, 2020 12:56
Create a new snippet from a blank template.
name: Dad Jokes
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: "const button = document.querySelector(\"#run\");\nbutton.addEventListener(\"click\", getJoke);\n\nasync function getJoke() {\n try {\n $('#status').text('Fetching joke... \U0001F92A')\n const url = \"https://icanhazdadjoke.com/\";\n const headers = { Accept: \"application/json\" };\n const response = await fetch(url, { headers });\n const data = await response.json();\n const joke = data.joke;\n await Excel.run(async (context) => {\n $('#status').text('Displaying joke... \U0001F602')\n const sheet = context.workbook.worksheets.getActiveWorksheet();\n const range = sheet.getRange(\"A2\");\n range.values = [[joke]];\n await context.sync();\n });\n $('#status').text('Did you like it ??? \U0001F923')\n } catch (error) {\n console.error(error);\n console.error(error.message);\n }\n}\n"
language: typescript
template:
content: |-
<h1
@andyweiss1982
andyweiss1982 / flag.html
Created December 28, 2018 02:18
USA Flag: CSS Grid and Web Components
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>USA Flag</title>
<style>
body{
margin: 0;
color: #FFFFFF;
font-size: 2vw;
module Equilateral
def assign_sides(a)
@side1 = a
@side2 = a
@side3 = a
@side4 = a
end
def equilateral_sidelength
@side1
module Display
def self.showtitle
puts "
███████╗██╗ ███████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗
██╔════╝██║ ██╔════╝██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║
█████╗ ██║ █████╗ ██║ ██║ ██║██║ ██║██╔██╗ ██║
██╔══╝ ██║ ██╔══╝ ██║ ██║ ██║██║ ██║██║╚██╗██║
███████╗███████╗███████╗╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║
class Animal
def initialize(animalname)
@name=animalname
end
def jumped_over (firstthingjumpedover, secondthingjumpedover)
puts "#{@name} jumped over the #{firstthingjumpedover} and the #{secondthingjumpedover}."
end
end
@andyweiss1982
andyweiss1982 / wyncodemethods.rb
Created July 28, 2014 22:26
Wyncode Modules and Methods
require "./wyncodemodules.rb"
WyncodeTests.float_fixer_test
WyncodeTests.bignum_digits_test
WyncodeTests.join_split_test
WyncodeTests.hash_genetics_test
WyncodeTests.class_methods_comparison_test
@andyweiss1982
andyweiss1982 / pleasureisland.rb
Last active August 29, 2015 14:04
Pleasure Island
def perpetual_NYE
10.downto(0).each {|i|
sleep 1
puts i
}
perpetual_NYE
end