Skip to content

Instantly share code, notes, and snippets.

View hydr's full-sized avatar

Maximilian Balbach hydr

View GitHub Profile
@hydr
hydr / gist:4338698
Created December 19, 2012 17:47
ToGoogleMapsPolygon
public static List<List<Coordinate>> ToGoogleMapsPolygon(this DbGeography dbGeo)
{
// contains all geo data for one postal code / admin area code
// conversion to SqlGeography because DbGeography does not offer properties to determine rings within geometries. we need those ring information to display areas with holes
var sqlGeo = (SqlGeography) dbGeo.ProviderValue;
var numberOfGeometries = sqlGeo.STNumGeometries();
var result = new List<List<Coordinate>>((int) numberOfGeometries);
@hydr
hydr / RazorTemplateBase
Created March 20, 2013 12:19
Custom BaseTemplate for ActionMailer.Standalone
public class RazorTemplateBase<T> : TemplateBase<T>
{
private StandaloneHtmlHelpers _html;
public StandaloneHtmlHelpers Html
{
get
{
_html = _html ?? new StandaloneHtmlHelpers(TemplateService, ViewBag);
return _html;
}