Skip to content

Instantly share code, notes, and snippets.

View frankvilhelmsen's full-sized avatar

Frank Vilhelmsen frankvilhelmsen

View GitHub Profile
@frankvilhelmsen
frankvilhelmsen / multipart.groovy
Last active September 3, 2021 06:48
Java or Groovy file to check Multipart/form-data opload protocol.
/**
* This utility class provides an abstraction layer for sending multipart HTTP
* POST requests to a web server.
* @author www.codejava.net
*
*/
public class MultipartUtility {
private final String boundary;
private static final String LINE_FEED = "\r\n";
private HttpURLConnection httpConn;
@frankvilhelmsen
frankvilhelmsen / haversine.clj
Created February 10, 2012 07:40
The haversine formular
(ns util
(:use clojure.contrib.generic.math-functions))
; http://en.wikipedia.org/wiki/Earth_radius
(def R 6367)
; rad argument to haversine function (180° d/πR).
(defn rad [x]
(* x (/ Math/PI 180)))