View chimes.ino
This file contains 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
#include <Adafruit_NeoPixel.h> | |
#include <HTTPClient.h> | |
#include <WiFi.h> | |
// Define a pixel strip of 1 pixel | |
Adafruit_NeoPixel pixels(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); | |
// Wifi | |
char ssid[] = "..."; | |
char password[] = "..."; |
View elastic.js
This file contains 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
const { Elastic } = require(...) | |
const { mock } = Elastic(); | |
beforeEach(() => mock.clearAll()) | |
test('..', async () => { | |
mock.add('.....'); | |
await request.get('/serach?...') |
View App.jsx
This file contains 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
import { useState } from 'react'; | |
import ClickCounter from './ClickCounter'; | |
import ClickHeading from './ClickHeading'; | |
function App() { | |
// State: held by the parent | |
const [numClicks, setNumClicks] = useState(0); | |
const onClickHandler = (e) => setNumClicks(numClicks + 1); |
View restaurantDB.js
This file contains 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
const mongoose = require("mongoose"); | |
const Schema = mongoose.Schema; | |
const restaurantSchema = new Schema({ | |
address: { | |
building: String, | |
coord: [Number], | |
street: String, | |
zipcode: String | |
}, |
View index.js
This file contains 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
// Simple module that uses fetch to do a HEAD request | |
const fetch = require('node-fetch'); | |
module.exports.fn = async (url) => { | |
try { | |
const response = await fetch(url, { method: "HEAD" }); | |
return response.ok; | |
} catch(err) { | |
return false; | |
} |
View App.jsx
This file contains 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
// Use it like this | |
import usePageLifecycle from './lib/use-page-lifecycle'; | |
App() { | |
const isVisible = usePageLifecycle(); | |
} |
View globeandmail.html
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Globe And Mail</title> | |
</head> | |
<body> | |
<header> | |
Menu | Logo | TRAVEL | <button>SUBSCRIBE</button> | LOG IN | Search |
View index.html
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Experiments with HTML Elements</title> | |
</head> | |
<body> | |
<h1>Main Title of Document</h1> | |
<h2>Embed</h2> |
View index.js
This file contains 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 makeCalls() { | |
return Promise.all( | |
linkArr.map(async link => { | |
try { | |
const response = await fetch(link, { method: "HEAD" }); | |
if (response.status == 200) { // good | |
console.log(`${link} was good! status: ${response.status}`.green); | |
} else if (response.status == 404 || response.status == 401) { // bad | |
console.log(`${link} was bad! status: ${response.status}`.red); | |
allGood = false; |
View index.js
This file contains 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
/** | |
* Week 3 - A Larger Example (String, Array, RegExp): | |
* | |
* Write a series of functions to accomplish the following, building a larger program as you go: | |
* | |
* 1. Split the string into an `Array` of separate rows (i.e., an `Array` with rows separated by `\n`). | |
* Bonus: how could we deal with data that includes both Unix (`\n`) and Windows (`\r\n`) line endings? | |
* | |
* 2. Each row contains information user info: `ID`, `Name`, `Phone Number`, and `Height` info all separated by commas. | |
* Split each row into an `Array` with all of its different fields. You need to deal with extra and/or no |
NewerOlder