Skip to content

Instantly share code, notes, and snippets.

View atlefren's full-sized avatar

Atle Frenvik Sveen atlefren

View GitHub Profile
var Holsen = {};
(function(ns){
ns.ellipsoids = {
"bessel": {
"a": 6377492.018,
"b": 6356173.509
},
"international": {
"a": 6378388.000,
@atlefren
atlefren / buss.sh
Last active December 14, 2015 11:59
#!/bin/sh
q=""
if [ $1 = "hjem" ]
then
q="rotvoll vestlia"
elif [ $1 = "sentrum" ]
then
q="rotvoll sentrum"
@atlefren
atlefren / web_map_client_poc
Created April 17, 2013 19:34
A proof of concept web map client. Requires a WMS-server that serves a map in EPSG:4326. Should not be used for anything serious
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="underscore-min.js"></script>
<style type="text/css">
#map {
width: 500px;
@atlefren
atlefren / QueryParams
Last active December 18, 2015 02:39
query params handler. made for underscore
(function (lib) {
"use strict";
var QueryParams = function (initParams) {
var params = initParams || {};
function addParam(key, value) {
params[key] = value;
}
function toString() {
return _.map(params, function (value, key) {
@atlefren
atlefren / statkart_ol3.html
Created September 25, 2013 09:48
Small utility for displaying tiles from Statkart in OpenLayers 3
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta charset="UTF-8">
<title>OpenLayers 3 with Statkart tiles</title>
</head>
<link rel="stylesheet" href="http://ol3js.org/en/master/build/ol.css" type="text/css">
<style type="text/css">
html, body {
@atlefren
atlefren / statkart_leaflet.html
Created September 25, 2013 17:20
Small utility for displaying Statkart tiles on a Leaflet map
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta charset="UTF-8">
<title>Leaflet with Statkart tiles</title>
</head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
#!/usr/bin/python
# -*- coding: latin-1 -*-
from suds.client import Client
import xml.etree.ElementTree as ET
import suds
import os
import logging
@atlefren
atlefren / jstricks
Last active December 31, 2015 03:39
(![]) = false
(![]+[]) = "false"
(!![]) = true
(!(![])+[]) = "true"
+[] = 0
+!+[] = 1
!+[]+!+[] = 2
+!+[]+[+[]] = "10"
+(+!+[]+[+[]]) = 10
@atlefren
atlefren / markdown
Last active December 31, 2015 05:59
<html>
<head>
<title></title>
<style>
div.col50 {
width: 50%;
float: left;
}
@atlefren
atlefren / initpy.sh
Created February 13, 2014 20:07
initpy
#!/bin/sh
#inits an empty git repo with .gitignore, readme.md and a virtualenv
if [ -n "$1" ]; then
echo $1
if [ ! -d "$1" ]; then
name=$1
git init $name
cd $name