This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Pivot ItemsSource="{Binding Items}" | |
SelectedItem="{Binding ActiveItem, Mode=TwoWay}" | |
HeaderTemplate="{StaticResource PivotHeaderTemplate}" | |
ItemContainerStyle="{StaticResource PivotItemContainerStyle}"> | |
<Pivot.ItemTemplate> | |
<DataTemplate> | |
<ContentControl cm:View.Model="{Binding}"/> | |
</DataTemplate> | |
</Pivot.ItemTemplate> | |
</Pivot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace KMeans.Core | |
module Clustering = | |
type Distance<'a> = 'a -> 'a -> float | |
type Recenter<'a> = 'a list -> 'a | |
let sample n (xs : 'a list) = | |
let step = xs.Length / n | |
match step with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ComboBox | |
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |
ScrollViewer.VerticalScrollBarVisibility="Disabled" | |
ScrollViewer.HorizontalScrollMode="Disabled" | |
ScrollViewer.VerticalScrollMode="Disabled"> | |
<ComboBox.ItemsPanel> | |
<ItemsPanelTemplate> | |
<StackPanel/> | |
</ItemsPanelTemplate> | |
</ComboBox.ItemsPanel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Application | |
x:Class="Spectrum.Demo.App" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:convereters="using:Spectrum.Universal.Converters"> | |
<Application.Resources> | |
<convereters:ComplimentConverter x:Key="Compliment" /> | |
<convereters:ShiftLightnessConverter x:Key="ShiftLightness" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OAuthCredentialsStore : ICredentialStore | |
{ | |
private const string ClientId = "<redacted>"; | |
private const string ClientSecret = "<redacted>"; | |
private readonly IGitHubClient _gitHubClient; | |
public OAuthCredentialsStore() | |
{ | |
_gitHubClient = new GitHubClient(new ProductHeaderValue("HubBug", "0.0.0.1")) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gitHubClient = new GitHubClient(new ProductHeaderValue("Test App", "0.0.0.1")) | |
{ | |
Credentials = Credentials.Anonymous | |
}; | |
var content = new FormUrlEncodedContent(new Dictionary<string, string> | |
{ | |
{"client_id", ClientId }, | |
{"client_secret", ClientSecret }, | |
{"code", responseParameters["code"] }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public async Task CanInsertInterfaces() | |
{ | |
BlobCache.ApplicationName = "RepoTests"; | |
IList<string> strings = new List<string> { "foo", "bar", "baz" }; // fails | |
// var = new List<string> { "foo", "bar", "baz" }; // passes | |
await BlobCache.LocalMachine.InsertObject("strings", strings); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projects = await GetProjectsAsync(); | |
await BlobCache.LocalMachine.InsertObject("projects", projects); | |
var test = await BlobCache.LocalMachine.GetOrCreateObject("projects", () => new List<Project>()); | |
if (projects.Count != test.Count) | |
throw new InvalidOperationException("Hmmm"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_task(FileIO::ReadTextAsync(file)).then([this, file](task<String^> task) | |
{ | |
try | |
{ | |
String^ fileContent = task.get(); | |
OutputTextBlock->Text = "The following text was read from '" + file->Name + "':\n\n" + fileContent; | |
} | |
catch(COMException^ ex) | |
{ | |
rootPage->HandleFileNotFoundException(ex); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnLoaded(object sender, RoutedEventArgs args) | |
{ | |
var pointerMoved = Observable.FromEventPattern<PointerEventHandler, PointerRoutedEventArgs>(h => PathRoot.PointerMoved += h, h => PathRoot.PointerMoved -= h).Select(e => e.EventArgs); | |
var pointerInContact = pointerMoved.Where(p => p.Pointer.IsInContact); | |
var points = pointerInContact.Select(p => p.GetCurrentPoint(PathRoot)).Select(p => new Vector2((float) p.Position.X, (float) p.Position.Y)); | |
var previousPoints = points.Skip(1); | |
var deltas = points.Zip(previousPoints, (current, previous) => new Vector2Delta { Point = current, Delta = current - previous }); | |
var scannedDeltas = deltas.Scan(new Vector2Delta { Point = Vector2.Zero, Delta = Vector2.Zero }, ScanSignificantDeleta); |
NewerOlder