This file contains hidden or 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
LOCAL SERVER | |
[0] Sun, 06 Dec 2020 09:04:28 GMT express-session fetching 9WPVeBkvg6cTnR0YUC4F3WpbeeVd0B2O | |
[0] Sun, 06 Dec 2020 09:04:28 GMT express-session no session found | |
[0] Sun, 06 Dec 2020 09:04:28 GMT express-session saving 6ZaYxgdEys6EsOL-yTFXPDf8eTMIO9S2 | |
[0] Sun, 06 Dec 2020 09:04:28 GMT express-session set-cookie connect.sid=s%3A6ZaYxgdEys6EsOL-yTFXPDf8eTMIO9S2.m6OdWQzYtgUqrG9XPJ4ML4%2B0AzfvhtyZ0FbTfyDTYgw; Path=/; HttpOnly | |
[0] Sun, 06 Dec 2020 09:05:39 GMT express-session fetching 6ZaYxgdEys6EsOL-yTFXPDf8eTMIO9S2 | |
[0] Sun, 06 Dec 2020 09:05:39 GMT express-session session found | |
[0] Sun, 06 Dec 2020 09:05:39 GMT express-session touching | |
[0] Sun, 06 Dec 2020 09:05:39 GMT express-session touched |
This file contains hidden or 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 myWidget = (function() { | |
// Private array of objects | |
const data = [ | |
{ | |
name: 'Jenny', | |
likes: ['cats', 'music'] | |
}, | |
{ | |
name: 'Patrick', | |
likes: ['cars', 'paintings'] |
This file contains hidden or 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 convertCSVToJSON(str, delimiter = ',') { | |
const titles = str.slice(0, str.indexOf('\n')).split(delimiter); | |
const rows = str.slice(str.indexOf('\n') + 1).split('\n'); | |
return rows.map(row => { | |
const values = row.split(delimiter); | |
return titles.reduce((object, curr, i) => (object[curr] = values[i], object), {}) | |
}); | |
}; | |
let data; |
This file contains hidden or 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 convertCSVToJSON(str, delimiter = ',') { | |
const titles = str.slice(0, str.indexOf('\n')).split(delimiter); | |
const rows = str.slice(str.indexOf('\n') + 1).split('\n'); | |
return rows.map(row => { | |
// Convert to 2D array | |
const values = row.split(delimiter); | |
// Convert array to object | |
return titles.reduce((object, curr, i) => { | |
object[curr] = values[i]; | |
return object; |
This file contains hidden or 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 convertCSVToJSON(str, delimiter = ',') { | |
const titles = str.slice(0, str.indexOf('\n')).split(delimiter); | |
const rows = str.slice(str.indexOf('\n') + 1).split('\n'); | |
return rows.map(row => { | |
// Convert to 2D array | |
const values = row.split(delimiter); | |
}); | |
}; | |
let data; |
This file contains hidden or 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 convertCSVToJSON(str, delimiter = ',') { | |
const title = str.slice(0, str.indexOf('\n')).split(delimiter); | |
} | |
let data; | |
data = 'id, name, email\n0, Todd, todd@gmail.com\n1, Petra, petra@gmail.com'; | |
console.log(convertCSVToJSON(data, ',')) |
This file contains hidden or 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 { takeEvery, call, put } from 'redux-saga/effects'; | |
import actionTypes from '../constants/action-types'; | |
export default function* watcherSaga() { | |
yield takeEvery(actionTypes.DATA_REQUESTED, workerSaga); | |
}; | |
function* workerSaga() { | |
try { | |
const payload = yield call(fetchAll); |
This file contains hidden or 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
... | |
// Handle user input | |
const form = document.getElementById('form'); | |
const place = document.getElementById('place'); | |
function handleChange() { | |
if (place.value === '') { | |
place.style.border = '3px solid lightcoral'; | |
} else { |
This file contains hidden or 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
... | |
// Show places on map | |
async function showMap() { | |
let places = await getPlaces(); | |
map.on('load', () => { | |
map.addSource('api', { | |
type: 'geojson', |
This file contains hidden or 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
mapboxgl.accessToken = '...'; | |
const map = new mapboxgl.Map({ | |
container: 'map', | |
style: 'mapbox://styles/mapbox/streets-v11', | |
zoom: 1, | |
}); | |
// Get places from API | |
async function getPlaces() { |
NewerOlder