Skip to content

Instantly share code, notes, and snippets.

View vmilev's full-sized avatar

Vladimir Milev vmilev

  • Sofia, Bulgaria
View GitHub Profile
@vmilev
vmilev / sample1.xaml
Created February 29, 2016 11:49
Relative position panel
<panels:RelativePositionPanel>
<Button panels:RelativePositionPanel.RelativeX="0.5"
panels:RelativePositionPanel.RelativeY="0.5"
Content="Test" />
</panels:RelativePositionPanel>
@vmilev
vmilev / MainPage.cs
Created February 29, 2016 13:19
Share Code Blog 1
using MyApp.Infrastructure;
namespace MyApp.Views
{
public sealed partial class MainPage : PageBase
{
public MainPage()
{
this.InitializeComponent();
}
@vmilev
vmilev / App.xaml.cs
Created February 29, 2016 14:51
Share Code Blog 2
public partial class App : Application
{
private static readonly IUnityContainer Container = new UnityContainer();
public static INavigationService NavigationService { get; private set; }
// Other code omitted for conciseness
internal static void InitializeNavigationService(NavigationService service)
{
NavigationService = new SimpleNavigationService(service);
@vmilev
vmilev / MyApp.csproj
Created March 1, 2016 08:24
Share Code Blog 3
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Insert the following code into your project file:
<Import Project="PreprocessXaml.targets" />
-->
<PropertyGroup>
<MarkupCompilePass1DependsOn>
@vmilev
vmilev / DeserializedBlogPost.cs
Last active May 9, 2016 14:51
Migration Blog
public class DeserializedBlogPost
{
private const string Wp = "http://wordpress.org/export/1.2/";
private const string ContentUrl = "http://purl.org/rss/1.0/modules/content/";
private const string Dc = "http://purl.org/dc/elements/1.1/";
public DeserializedBlogPost(XElement blogElement)
{
this.Title = blogElement.Element("title").Value;
@vmilev
vmilev / GraphicsPathExtensions.cs
Last active June 9, 2016 12:20
An extension method to calculate the surface area (in squared pixels) of a single polygon represented by a GraphicsPath object
public static class GraphicsPathExtensions
{
public static float ComputeArea(this GraphicsPath graphicsPath)
{
var points = graphicsPath.PathPoints.ToList();
//Add the first point as the last in order to close the figure and compute area properly.
points.Add(points[0]);
return Math.Abs(points.Take(points.Count - 1).Select((p, i) => p.X * points[i + 1].Y - p.Y * points[i + 1].X).Sum()) / 2;
}
@vmilev
vmilev / rewritemap.config
Last active April 28, 2017 14:01
URL Rewriter
<rewriteMaps>
<rewriteMap name="StaticRedirects">
<add key="old_url" value="new_url" />
</rewriteMap>
</rewriteMaps>
@vmilev
vmilev / web.config
Last active August 9, 2020 05:00
Sample web.config for Angular 4 CLI app
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>