Skip to content

Instantly share code, notes, and snippets.

View sthewissen's full-sized avatar
🤷‍♂️
Developing tings.

Steven Thewissen sthewissen

🤷‍♂️
Developing tings.
View GitHub Profile
@sthewissen
sthewissen / CustomFontLabelRenderer.cs
Last active February 15, 2016 10:41
Renders a label using a custom font, as described @ http://bit.ly/20yzZ7i
using System;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using Android.Graphics;
[assembly:ExportRenderer(typeof(Label), typeof(CustomFontLabelRenderer))]
namespace CustomXamFormsFont.Droid
{
public class CustomFontLabelRenderer : LabelRenderer
{
@sthewissen
sthewissen / CustomFontsAppDelegate.cs
Last active February 15, 2016 10:42
Loop through the fonts on iOS to find the internal name as described @ http://bit.ly/20yzZ7i
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace CustomXamFormsFont.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage Title="Login" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyProject.LoginPage">
<Grid Padding="20" HorizontalOptions="CenterAndExpand" AutomationId="LoginPageIdentifier">
<Entry AutomationId="FullNameTextField" Keyboard="Text" Text="{Binding Fullname}" />
<Entry AutomationId="EmailTextField" Keyboard="Email" Text="{Binding Email}" />
<Button AutomationId="SignInButton" Text="Send" Command="{Binding LoginCommand}" />
</Grid>
</ContentPage>
@sthewissen
sthewissen / MainActivity.cs
Last active June 9, 2016 20:15
Piece of startup code for Xamarin Test Cloud UI testing - Android
void SetupTestCloud()
{
// Code for starting up the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => {
if (!string.IsNullOrWhiteSpace(e.View.AutomationId))
{
e.NativeView.ContentDescription = e.View.AutomationId;
}
};
@sthewissen
sthewissen / AppDelegate.cs
Last active June 9, 2016 20:15
Piece of startup code for Xamarin Test Cloud UI testing - iOS
void SetupTestCloud()
{
// Code for starting up the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
Xamarin.Calabash.Start();
//Mapping AutomationId to iOS Labels
Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) =>
{
if (null != e.View.AutomationId)
@sthewissen
sthewissen / LoginPage.cs
Last active June 9, 2016 20:17
LoginPage UI tests for Xamarin
public class LoginPage : BasePage
{
readonly string SignInButton = "SignInButton";
readonly string EmailField = "EmailTextField";
readonly string FullNameField = "FullNameTextField";
public LoginPage() : base("LoginPageIdentifier", "LoginPageIdentifier")
{
}
@sthewissen
sthewissen / Sample.nuspec
Created August 8, 2016 14:49
Rebex sample nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Rebex.2016-R2</id>
<version>1.0.1</version>
<title>Rebex 2016-R2</title>
<authors>Steven Thewissen</authors>
<owners>Rebex</owners>
<iconUrl>https://somefancything.com/rebex.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@sthewissen
sthewissen / nuget.config
Last active August 8, 2016 19:18
A nuget config connecting to a custom feed
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- remove any machine-wide sources with <clear/> -->
<clear />
<!-- add a Team Services feed -->
<add key="MyFeed" value="https://myfeed.pkgs.visualstudio.com/DefaultCollection/_packaging/MyFeed/nuget/v3/index.json" />
<!-- also get packages from the NuGet Gallery -->
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
@sthewissen
sthewissen / data.json
Created June 20, 2017 13:22
Dummy data for YouTube embed
{
"kind": "youtube#searchListResponse",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/tXySRT-f4qSG4YdRv0YhL_k79fE\"",
"nextPageToken": "CBQQAA",
"regionCode": "NL",
"pageInfo": {
"totalResults": 587,
"resultsPerPage": 20
},
"items": [
@sthewissen
sthewissen / YouTube.cs
Last active June 20, 2017 13:46
Calling the YouTube API
using (var httpClient = new HttpClient())
{
var videoIds = new List<string>();
var json = await httpClient.GetStringAsync(channelUrl);
// Deserialize our data, this is in a simple List format
var response = JsonConvert.DeserializeObject<YouTubeApiListRoot>(json);
// Add all the video id's we've found to our list.
videoIds.AddRange(response.items.Select(item => item.id.videoId));