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() { | |
console.clear() | |
const response = {} | |
const values = [ ...document.querySelectorAll('.infobox td') ].slice(1).map(el => el.innerText) | |
;[ ...document.querySelectorAll('.infobox th') ].map(el => el.innerText).map(keyText => { | |
response[keyText.replace(/\s/g, '_').toLowerCase()] = values.shift() | |
}) | |
return { ...response} | |
})() |
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 data = [ | |
[1,2,3,4,5], | |
[6,7,8,9,10] | |
] | |
function* getNumbers() { | |
for(let idx in data) { | |
for(let subIdx in data[idx]) { | |
yield data[idx][subIdx] |
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
export const getInput = () => new Promise((resolve, reject) => { | |
document.querySelector('form').addEventListener('submit', function listener(e) { | |
e.preventDefault() | |
const inputString = e.target.querySelector('input[type=text]').value | |
resolve(inputString) | |
e.target.removeEventListener('submit', listener) | |
}) | |
}) | |
/* USAGE |
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
/** USAGE | |
import { speak, createSound } from './synth.js'; | |
(async () => { | |
document.querySelector('button[start-static]').addEventListener('click', () => { | |
const sound = createSound("a.mp3"); | |
sound.play() | |
}) |
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
(async () => { | |
const img = document.createElement('img') | |
img.src = "_assets/data/example.png" | |
img.onload = () => { | |
document.body.appendChild(img) | |
const canvas = document.createElement('canvas') | |
canvas.width = img.width; | |
canvas.height = img.height; | |
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height); | |
document.body.removeChild(img) |
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 script = document.createElement('script'); | |
const link = document.createElement('link'); | |
function appendThisScriptToTheBodyTag(src, callback, options) { | |
// Explicitly set the defaults for any optional parameters of the function | |
options = (options) ? options : new Object() | |
callback = (callback) ? callback : new Function() | |
const scriptClone = script.cloneNode(true); | |
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode |
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 url('https://fonts.googleapis.com/css?family=Raleway|Raleway+Dots|Roboto+Slab'); | |
:root { | |
--color-navy: #001F3F; | |
--color-blue: #0074D9; | |
--color-aqua: #7FDBFF; | |
--color-teal: #39CCCC; | |
--color-olive: #3D9970; | |
--color-green: #2ECC40; | |
--color-lime: #01FF70;--color-yellow: #FFDC00; |
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 React from 'react' | |
import { Deck, Slide, Text } from 'spectacle' | |
const FirstSlide = props => { | |
return ( | |
<Slide> | |
<Text>Hello there {props.key}.</Text> | |
<Text>Ready?</Text> | |
</Slide> | |
) |
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 React, { Component } from "react"; | |
import firebase from "../firebase.js"; | |
const FirebasePromise = props => { | |
return props.children("testing, 1 2 3"); | |
}; | |
// firebase | |
// .storage() | |
// .ref() |
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 React from "react"; | |
import firebase from "../firebase.js"; | |
const FiebasePromise = props => firebase | |
.storage() | |
.ref() | |
.child("images/" + props.imageName) | |
.getDownloadURL() | |
}; | |