Skip to content

Instantly share code, notes, and snippets.

View HeathHopkins's full-sized avatar

Heath Hopkins HeathHopkins

View GitHub Profile
@HeathHopkins
HeathHopkins / ExtensionMethods.cs
Last active April 27, 2022 13:33
Xamarin.iOS Extension Methods
using System;
using MonoTouch.UIKit;
namespace System
{
public static class ExtensionMethods
{
public static UIColor ToUIColor(this string hexString)
{
hexString = hexString.Replace("#", "");
public override void OnActivated (UIApplication application)
{
//When your app is backgrounded, iOS takes a snapshot.
//When the app comes back from the background it shows this snapshot at launch until your app is ready
//Sometimes apple forgets to remove the splash screen.
//Your app is in the forground and working. To prove it you can rotate, and see half your real screen.
//To prevent this from happening you can manually remove the view
foreach (var w in application.Windows) {
if (w != null && w != window) {
@HeathHopkins
HeathHopkins / fa-checkbox.css
Last active August 29, 2015 14:23
Font Awesome Checkbox
input[type=checkbox] { display:none; }
input[type=checkbox] + label:before {
font-family: FontAwesome;
display: inline-block;
content: "\f096";
letter-spacing: 10px;
}
input[type=checkbox]:checked + label:before {
content: "\f046";
letter-spacing: 5px;
public const int KEY_SIZE = 16;
public byte[] Encrypt (string password, string input)
{
var sha256CryptoServiceProvider = new SHA256CryptoServiceProvider();
var hash = sha256CryptoServiceProvider.ComputeHash(Encoding.UTF8.GetBytes(password));
var key = new byte[KEY_SIZE];
var iv = new byte[KEY_SIZE];
Buffer.BlockCopy(hash, 0, key, 0, KEY_SIZE);
@HeathHopkins
HeathHopkins / ParentViewController.Keyboard.cs
Created April 24, 2016 16:20 — forked from redent/ParentViewController.Keyboard.cs
Parent view controller to handle keyboard notifications to center views in the screen. UIScrollView related methods moved to an extension class.
using System;
using Foundation;
using UIKit;
using TwinCoders.TouchUtils.Extensions;
using CoreGraphics;
namespace SalesForce.Touch.Views
{
public abstract partial class ParentViewController
{
#r "Newtonsoft.Json"
#r "System.Configuration"
#r "Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
using System.Net;
using System.Configuration;
using System.Security.Claims;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
@HeathHopkins
HeathHopkins / Remove-AllPackages.ps1
Created October 15, 2016 14:56
Remove All NuGetPackages
Get-Package | Uninstall-Package -RemoveDependencies
@HeathHopkins
HeathHopkins / deploy.pubxml
Created November 8, 2016 19:56
asp.net core web deploy
<MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
<AuthType>NTLM</AuthType>
@HeathHopkins
HeathHopkins / makeicons.sh
Last active October 30, 2017 15:26
Create all of the icon sizes needed by Apple devices (2016).
#! /bin/bash
# place this script and your 1024x1024 icon in the same directory then run
# usage sh makeicons.sh [nameof1024file.png]
declare dir=$(pwd)
declare -a sizes=( 16 20 29 32 40 48 50 55 57 58 60 64 72 76 80 87 88 100 114 120 128 144 152 167 172 180 196 256 512 1024 )
for i in "${sizes[@]}"
do
sips --resampleWidth "$i" "${dir}/${1}" --out "${dir}/Icon-$i.png"
<?xml version="1.0" encoding="utf-8" ?>
<NavigationPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
BackgroundColor="{Binding BackgroundColor}"
BarBackgroundColor="{Binding BarBackgroundColor}"
BarTextColor="{Binding BarTextColor}"
Title="{Binding Title}"
x:Class="MyProject.Views.PrismNavigationPage">
</NavigationPage>