$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
$ brew install ffmpeg
const { height, width } = await new Promise(resolve => { | |
const fr = new FileReader(); | |
fr.onload = () => { | |
const img = new Image(); | |
img.onload = () => { | |
resolve({ width: img.width, height: img.height }); | |
}; | |
img.src = fr.result; | |
}; | |
fr.readAsDataURL(file); |
const express = require('express'); | |
const request = require('request'); | |
const { | |
PROXIED_HOST: proxiedHost = 'https://tomekf.pl', | |
PROXY_PORT: proxyPort = 1337, | |
LOCAL_PORT: localPort = 8000, | |
LOCAL_HOST: localHost = 'http://localhost', | |
} = process.env; |
const http = require('http'); | |
const { parse: urlParse } = require('url'); | |
const { parse: querystringParse } = require('querystring'); | |
const log = require('fancy-log'); | |
const chalk = require('chalk'); | |
const env = require('minimist')(process.argv.slice(2)); | |
const getUrlVar = (where, item) => querystringParse(urlParse(where).query)[item]; | |
const line = '-'.repeat(80); |
var eartMeanRadiusInMeters = 6378137; | |
function rad(x) { | |
return x * Math.PI / 180; | |
} | |
function distHaversine(p1, p2) { | |
var radLat = rad(p2.lat() - p1.lat()); | |
var radLng = rad(p2.lng() - p1.lng()); | |
var intermediate = |