VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.
This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated
VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.
This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated
const getArea = (shape, values) => { | |
let area = -1 | |
switch(shape) { | |
case "square": | |
area = Math.pow(values[0], 2); | |
break; | |
case "rectangle": | |
area = values[0] * values[1]; | |
break; | |
case "circle": |
function post(url, data) { | |
return new Promise((resolve, reject) => { | |
let xhr = new XMLHttpRequest(); | |
xhr.open('POST', url); | |
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); | |
xhr.addEventListener('load', () => { | |
let { response, status } = xhr; | |
let res = JSON.parse(response); | |
if(status >= 200 && status < 400){ |
<?php | |
// Converts a number into a short version, eg: 1000 -> 1k | |
// Based on: http://stackoverflow.com/a/4371114 | |
function number_format_short( $n, $precision = 1 ) { | |
if ($n < 900) { | |
// 0 - 900 | |
$n_format = number_format($n, $precision); | |
$suffix = ''; | |
} else if ($n < 900000) { |
function timeSince(date) { | |
var seconds = Math.floor((new Date() - date) / 1000); | |
var interval = Math.floor(seconds / 31536000); | |
if (interval > 1) { | |
return interval + " years"; | |
} | |
interval = Math.floor(seconds / 2592000); |