View life-left.ts
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
constructor(private formBuilder: FormBuilder, private dataService: DataService) {} | |
ngOnInit() { | |
this.birthday = this.formBuilder.group({ | |
birthdayDate: ['', Validators.required], | |
}); | |
this.gender = this.formBuilder.group({ | |
genderSelect: ['', Validators.required], | |
}); |
View usa-jobs.ts
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 { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'title', | |
}) | |
export class TitlePipe implements PipeTransform { | |
transform(title: string): string { | |
if (title.length > 50) { |
View new-york-tolerance.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
dataArray.forEach(element => { | |
d3.select(`.population-map #${element.county}`) | |
.style('fill', color(element.total / (element.population / 10000))) | |
.on('mouseover', () => | |
tooltip.style('display', 'block').html( | |
`<p><strong>${element.county} County</strong></p> | |
<p>${(element.total / (element.population / 10000)).toFixed(2)} Crime(s) </p>`, | |
)) | |
.on('mousemove', () => tooltip.style('top', `${d3.event.pageY + 10}px`) |
View reviews-of-the-week.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
filterByBrand = event => { | |
this.setState({ brand: event.target.value }, () => { | |
const filtered = this.state.items.filter(item => | |
item.manufacturer.toLowerCase() | |
.includes(this.state.brand.toLowerCase()), | |
); | |
this.setState({ filtered }); | |
}); | |
}; | |
View bankroll.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
async function getCurrencies(url) { | |
await fetch(url) | |
.then(result => result.json()) | |
.then(result => sortCurrencies(result)) | |
.then(result => setOptions(result)); | |
} | |
View population-trends.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
async function getData(event) { | |
event.target.value ? (country = event.target.value) : (country = countrySelect.selectedOptions[0].innerText); | |
for (let i = year; i < 2018; i++) { | |
let obj = {}; | |
await fetch(`http://api.population.io/ 1.0/population/${year}/${country}`) | |
.then(result => result.json()) | |
.then(result => result.map(age => age.total).reduce((a, b) => a + b)) | |
.then(result => { | |
obj['year'] = i; | |
obj['population'] = result; |
View vat-viz.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 tooltip = d3 | |
.select('body') | |
.append('div') | |
.attr('class', 'tooltip'); | |
const color = d3 | |
.scaleLinear() | |
.domain([d3.min(vatValues), d3.mean(vatValues), d3.max(vatValues)]) | |
.range(['green', 'yellow', 'red']); |
View 3d-printer.css
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
@media screen and (max-width: 1100px) { | |
.mobile-menu { | |
display: flex; | |
} | |
header, .nav-container, .nav-container ul li, .gray-nav, .gray-nav ul { | |
flex-direction: column; | |
justify-content: center; |
View country-coder.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 getCountryName(event) { | |
event.preventDefault(); | |
const countryOutput = document.querySelector('#country-output'); | |
let code = document.querySelector('#country-text').value; | |
countryOutput.innerHTML = ''; | |
fetch(`https://restcountries.eu/rest/v2/ callingcode/${code}`) | |
.then(result => result.json()) | |
.then(result => { | |
result.map(country => | |
(countryOutput.innerHTML += |
View order-tracker.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
if (timeRemaining >= 0) { | |
hours = parseInt(timeRemaining / 3600); | |
timeRemaining = timeRemaining % 3600; | |
minutes = parseInt(timeRemaining / 60); | |
timeRemaining = timeRemaining % 60; | |
seconds = parseInt(timeRemaining); | |
document.querySelector('#hours').innerHTML = ('0' + hours).slice(-2); | |
document.querySelector('#minutes').innerHTML = ('0' + minutes).slice(-2); | |
document.querySelector('#seconds').innerHTML = ('0' + seconds).slice(-2); |
NewerOlder