Skip to content

Instantly share code, notes, and snippets.

View timheuer's full-sized avatar
🚴‍♂️
https://twitter.com/timheuer

Tim Heuer timheuer

🚴‍♂️
https://twitter.com/timheuer
View GitHub Profile
static void Main(string[] args)
{
string foo = string.Format("foo{0}", "bar");
}
@timheuer
timheuer / gist:2131230
Created March 20, 2012 04:07
ToggleAppBarButtonStyle
<Style x:Key="ToggleAppBarButtonStyle" TargetType="ToggleButton">
<Setter Property="Foreground" Value="{StaticResource AppBarItemForegroundBrush}"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="FontFamily" Value="Segoe UI Symbol"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="21.333"/>
<Setter Property="AutomationProperties.ItemType" Value="AppBar ToggleButton"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
@timheuer
timheuer / dynamic.xaml
Created April 10, 2012 15:52
dynamic type binding Metro
<Page
x:Class="Application141.BlankPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Application141"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
#if DEBUG
if (Debugger.IsAttached)
{
FirstFloor.XamlSpy.XamlSpyConnection.Current.Open("localhost", 4530);
}
#endif
@timheuer
timheuer / mainpage.xaml
Created April 23, 2012 18:41
LengthConverters
<Page.Resources>
<local:LengthConverter x:Key="lc" />
<local:LengthBoolConverter x:Key="lb" />
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.Resources>
<local:MyViewModel x:Key="MyVM" BoundText="{Binding Path=Text, ElementName=inputbox, Mode=TwoWay}" />
</Grid.Resources>
<StackPanel DataContext="{Binding Source={StaticResource MyVM}}">
<TextBox x:Name="inputbox" FontSize="24.667" Text="{Binding BoundText, Mode=TwoWay}" />
@timheuer
timheuer / ViewModelBase.cs
Created May 22, 2012 15:59
Base View Model (simple)
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace App1
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void SetValue<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
@timheuer
timheuer / gistdiff.ps1
Created August 22, 2012 05:45
My hack start at creating a script for auto-submitting a diff to gist.github.com
# ask the user for a gist name
param (
[string]$gistname = "$(Read-Host 'Enter a name for the gist')"
)
# constant
$gistapi = "https://api.github.com/gists"
$filename = $gistname + '.diff'
$teststring = "`{`"description`": `"the description for this gist`",`"public`": true,`"files`": `{`"file1.txt`": `{`"content`": `"String file contents`"`}`}`}"
# get the diff from the current session
@timheuer
timheuer / foobar
Created August 22, 2012 16:23
Change to allow the current diff to be a gist
diff --git a/DiffGist.psm1 b/DiffGist.psm1
index 89004da..a57686d 100644
--- a/DiffGist.psm1
+++ b/DiffGist.psm1
@@ -1,11 +1,9 @@
. (join-path $PSScriptRoot "/json 1.7.ps1")
-
function Get-Github-Credential($username) {
$host.ui.PromptForCredential("Github Credential", "Please enter your Github user name and password.", $username, "")
}
@timheuer
timheuer / settingschange.diff
Created August 22, 2012 17:00
Changing to ensure we don't try this in snapped
diff --git a/src/Callisto/Controls/Settings/SettingsFlyout.cs b/src/Callisto/Controls/Settings/SettingsFlyout.cs
index 2846ea5..eebed12 100644
--- a/src/Callisto/Controls/Settings/SettingsFlyout.cs
+++ b/src/Callisto/Controls/Settings/SettingsFlyout.cs
@@ -5,6 +5,7 @@
using Windows.Foundation;
using Windows.UI;
using Windows.UI.ApplicationSettings;
+using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
@timheuer
timheuer / default.js
Created August 27, 2012 20:35
Async Void method from JavaScript
function dostuff() {
var j = document.getElementById("mycontent");
j.innerText = "";
var b = new WindowsRuntimeComponent6.Class1();
var c = b.initializeAsync().done(onStuffComplete, onStuffError);
}
function onStuffComplete() {
var j = document.getElementById("mycontent");