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
<template> | |
<div> | |
<span v-if="true">Her er noe tekst</span> | |
<span v-else>Dette vises hvis noe er feil</span> | |
</div> | |
</template> |
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
<template lang="pug"> | |
div.carousel(:class="{ responsive: responsive }") | |
div.carousel-button.prev(@click="prev") | |
img(src="@/assets/images/icons/previous-arrow.svg") | |
div.carousel-button.next(@click="next") | |
img(src="@/assets/images/icons/next-arrow.svg") | |
div.siema | |
img.carousel-image(v-for="image in images" :key="image" :src="image" height="200" alt="Product image") | |
</template> | |
<script> |
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 default function(elements) { | |
return new Promise((resolve, reject) => { | |
let elementsLoaded = 0; | |
const isFinishedLoading = (a) => { | |
if (elementsLoaded === elements.length) { | |
resolve(); | |
} | |
}; | |
elementsLoaded = 0; |
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
let data = [ | |
{ | |
x: 1, | |
y: 2, | |
}, | |
{ | |
x: 2, | |
y: 3, | |
}, | |
{ |
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 knn(input, iterations, k, limit) { | |
let centroids = []; | |
// Step #2: Initialize k amount of clusters | |
for (let i = 0; i < k; i++) { | |
centroids.push({id: i, x: Math.random() * limit, y: Math.random() * limit}); | |
} | |
console.log(prettyjson.render(centroids, options)); | |
// loop through iterations | |
for (let i = 0; i < iterations; i++) { | |
// Find nearest centroid and assign data point to it |
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
console.log(data[4]); | |
console.log(getDeliveryTime(data[4].milesTraveled, data[4].numDeliveries, data[4].gasPrice)); |
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 getDeliveryTime(milesTraveled, numDeliveries, gasPrice) { | |
return (slopes.milesTraveled.travelTime * milesTraveled) + (slopes.numDeliveries.travelTime * numDeliveries) + (slopes.gasPrice.travelTime * gasPrice); | |
} |
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 used to get best fit. See http://www.varsitytutors.com/hotmath/hotmath_help/topics/line-of-best-fit.html for formula | |
function LOBF(data, xiden, yiden) { | |
let Xsum = 0, Ysum = 0, Xmean = 0, Ymean = 0; | |
for (let i = 0; i < data.length; i++) { | |
let point = data[i]; | |
Xsum += point[xiden]; | |
Ysum += point[yiden]; | |
} |
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
.module--link | |
text-decoration: none | |
font-weight: bold | |
color: $primary | |
position: relative | |
&:before | |
content: "" | |
position: absolute | |
width: 100% |
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
// step 1. create an element with the class of "message" | |
// Step 2. Insert the code below in a file or script tag | |
var message = document.querySelector('.message'); | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "http://numbersapi.com/random"); | |
xhr.onload = function (e) { | |
if (xhr.readyState === 4) { | |
if (xhr.status === 200) { | |
message.innerHTML = xhr.responseText; |
NewerOlder