Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominic Gunther Bauer DominicGBauer

View GitHub Profile
View badlyNamedFunction.js
Object.keys(data).sort().map((item, key) => {
const grouped = {};
data[item].map(item => {
if (typeof grouped[item.type] === 'undefined') {
grouped[item.type] = {
name: item.type,
members: [item]
};
}
else {
View namedfunction.js
Object.keys(productionDays)
.sort()
.map((productionDay) => {
const groupCastMembersByRoleType = {}
productionDays[productionDay].map((castMember) => {
if (
typeof groupCastMembersByRoleType[castMember.type] === 'undefined'
) {
groupCastMembersByRoleType[castMember.type] = {
roleType: castMember.type,
View aws-s3.yml
# This code is licensed from CircleCI to the user under the MIT license. See
# https://circleci.com/orbs/registry/licensing for details.
version: 2.1
description: |
A set of tools for working with Amazon S3. Requirements: bash
Source: https://github.com/circleci-public/circleci-orbs
examples:
basic_commands:
View webdriver-example.js
it('should slide through gallery', async () => {
const gallery = await browser.$('.open-gallery-button')
await gallery.click()
await delay(2000)
const rightSwipe = await browser.$('.right-arrow')
await rightSwipe.click()
await delay(2000)
const paragraph = await browser.$$(
'div:nth-of-type(3) .caption-drawer .post-content p'
)
View nasa_api_adventure_arc3.js
// Use the componentDidMount function to use the
// handlepic function we just created and therefore
// render the picture to the screen
componentDidMount() {
this.handlepic()
}
View nasa_api_adventure_arc2.js
// We're creating a function to handle retrieving
// the image from the NASA API
// Function is asynchronous because talking to the API
// isn't instantaneous (your bartender can't instantly
// give you your drink when you ask him for it)
handlePic = async () => {
// Create a response variable that retrieves the data
const response = await nasa.get()
// Change the state of picture to be the hdurl
View nasa_call_json.json
{
"date": "2019-02-10",
"explanation": "What does Venus look like beneath its thick clouds? These clouds keep the planet's surface hidden from even the powerful telescopic eyes of Earth-bound astronomers. In the early 1990s, though, using imaging radar, NASA's Venus-orbiting Magellan spacecraft was able to lift the veil from the face of Venus and produced spectacular high resolution images of the planet's surface. Colors used in this computer generated picture of Magellan radar data are based on color images from the surface of Venus transmitted by the Soviet Venera 13 and 14 landers. The bright area running roughly across the middle represents the largest highland region of Venus known as Aphrodite Terra. Venus, on the left, is about the same size as our Earth, shown to the right for comparison.",
"hdurl": "https://apod.nasa.gov/apod/image/1902/VenusEarth_MagellanApollo17_3000.jpg",
"media_type": "image",
"service_version": "v1",
"title": "Venus Unveiled",
"url": "https://apod.nasa.gov/apod/image/1902/Ve
View nasa_api_adventure_arc1.js
import axios from 'axios'
// Create a KEY variable for the NASA API key you received earlier
// Make sure it's in quotations
const KEY = 'YOUR KEY'
// Create a nasa variable that we will use to perform our API request
// Axios is going to create a url for us that conforms to NASA's
// specifications
let nasa = axios.create({
View axios
// Use the following line in your CLI
// Make sure you're in your app directory
// That would be Nasa for me
npm install axios
You can’t perform that action at this time.