wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
mv MailHog_linux_amd64 mailhog
chmod +x mailhog
sudo vi /etc/systemd/system/mailhog.service
server { | |
listen 80; | |
server_name example.com; | |
root /var/www//public; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
index index.php; |
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
// takes a {} object and returns a FormData object | |
var objectToFormData = function(obj, form, namespace) { | |
var fd = form || new FormData(); | |
var formKey; | |
for(var property in obj) { | |
if(obj.hasOwnProperty(property)) { | |
if(namespace) { |
map $sent_http_content_type $expires { | |
"text/html" epoch; | |
"text/html; charset=utf-8" epoch; | |
default off; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name servername.com; |
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip | |
# under public domain terms | |
country_bounding_boxes = { | |
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)), | |
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)), | |
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)), | |
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)), | |
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)), | |
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)), |
/// <summary> | |
/// Takes an L.latLngBounds object and returns an 8 point L.polygon. | |
/// L.rectangle takes an L.latLngBounds object in its constructor but this only creates a polygon with 4 points. | |
/// This becomes an issue when you try and do spatial queries in SQL Server or another database because when the 4 point polygon is applied | |
/// to the curvature of the earth it loses it's "rectangular-ness". | |
/// The 8 point polygon returned from this method will keep it's shape a lot more. | |
/// </summary> | |
/// <param name="map">L.map object</param> | |
/// <returns type="">L.Polygon with 8 points starting in the bottom left and finishing in the center left</returns> | |
function createPolygonFromBounds(latLngBounds) { |