Skip to content

Instantly share code, notes, and snippets.

View pksorensen's full-sized avatar

Poul Kjeldager Sørensen pksorensen

View GitHub Profile
@pksorensen
pksorensen / cesium_customprojection.ts
Created August 27, 2015 11:34
work in progress of custom projection in cesium
proj4.defs("EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
class Proj4WebMapProjection {
private _proj :transformer;
constructor(public ellipsoid = Cesium.Ellipsoid.WGS84, code = "EPSG:25832") {
this._proj = proj4(code);
}
project(cartographic:Cesium.Cartographic, result) {
var viewer = new Cesium.Viewer('cesiumContainer', {
baseLayerPicker : false
});
var imageryLayers = viewer.imageryLayers;
require(["https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.10/proj4-src.js"],function(proj4){
proj4.defs("EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
var cache={};var cache1={};
var Proj4WebMapProjection = (function () {
@pksorensen
pksorensen / GenericApplicationOAuthProvider.cs
Created February 18, 2014 18:20
ApplicationOAuthProvider
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OAuth;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Management;
using Newtonsoft.Json;
using System;
using System.Configuration;
using System.Globalization;
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
using Microsoft.Owin.Security.WsFederation;
using System.Linq;
using System.Globalization;
using System.Web;
using Microsoft.Owin.Security.Cookies;
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType,
});
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters
{
@pksorensen
pksorensen / gist:9660650
Last active August 29, 2015 13:57
TraceTimer : using(var timer = new TraceTimer("doing somethign"){ TraceLevel = TraceLevel.Verbose}){ STUFF ...}
using System;
using System.Diagnostics;
namespace Composite.WindowsAzure.Util
{
/// <summary>
/// Wrap TraceTimer around a code block with using and it will write out the time used for the block to trace.
/// </summary>
public class TraceTimer : IDisposable
Host Name: WIN-TDA94991L4B
OS Name: Microsoft Windows Server 2012 R2 Datacenter
OS Version: 6.3.9600 N/A Build 9600
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
OS Build Type: Multiprocessor Free
Registered Owner: Windows User
---
PRIVATE STUFF
---
@pksorensen
pksorensen / RoslynTest0001.cs
Created April 5, 2014 13:32
My first go with roslyn, parsing properties out of classes that has class names ending with model
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@pksorensen
pksorensen / AerialMapVisualize.m
Created April 7, 2014 22:21
GetRotationAndTranslation is needed
clc;
clear all;
close all;
% SELECT A FOLDER
folder = 'C:\test\homography\20140330_0\';
% CAMERA INTERNAL PARAMTERS
imWidth = 7360;
imHeight =4912;
A = [1.1349e+04 0 imWidth/2