Skip to content

Instantly share code, notes, and snippets.

View jmarus's full-sized avatar

Jon jmarus

View GitHub Profile
@nathancahill
nathancahill / gist:4bf47635ee4484746d57
Created August 22, 2014 21:27
Distance between two points
var getDistanceFromLatLonInKm = function(lat1, lon1, lat2, lon2) {
var R = 6371,
dLat = deg2rad(lat2 - lat1),
dLon = deg2rad(lon2 - lon1),
a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(deg2rad(lat1)) * Math.cos(eg2rad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2),
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),
d = R * c;
@drewjoh
drewjoh / example.php
Last active January 11, 2021 18:06 — forked from mloberg/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
$result = $postmark->to("reciver@example.com")
->subject("Email Subject")
->plain_message("This is a plain text message.")
->attachment('File.pdf', base64_encode(file_get_contents('sample.pdf')), 'application/pdf')