Skip to content

Instantly share code, notes, and snippets.

Chase Florell ChaseFlorell

View GitHub Profile
@ChaseFlorell
ChaseFlorell / .gitconfig
Last active Apr 15, 2019
Customized Git Config
View .gitconfig
[rebase]
autoStash = true
[alias]
co = checkout
st = status -s
stats = shortlog -sn --no-merges
lg = log --decorate --pretty=format:%h%x09%an%x09%ad%x09%s --no-merges
cleanup = "!git fetch --all && git branch --merged | grep -v '\\*\\|master\\|develop\\|development\\|dev\\|vnext' | xargs -n 1 git branch -d"
new = checkout -b
alias = config --get-regexp ^alias\\. # List all aliases.
@ChaseFlorell
ChaseFlorell / example.xaml
Created Mar 3, 2019
trying to adjust FlexLayout.Basis on orientation changed
View example.xaml
<Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding CurrentOrientation, Source={x:Static Device.Info}}" Value="{x:Static internals:DeviceOrientation.Portrait}" >
<Setter Property="FlexLayout.Basis" Value="50%" />
</DataTrigger>
<DataTrigger TargetType="Grid" Binding="{Binding CurrentOrientation, Source={x:Static Device.Info}}" Value="{x:Static internals:DeviceOrientation.Landscape}" >
<Setter Property="FlexLayout.Basis" Value="33%" />
</DataTrigger>
</Grid.Triggers>
View fast-find-powershell-profile.ps1
Set-Alias less "C:\Program Files\Git\usr\bin\less.exe"
function f($text, $files="*.*")
{
findstr /spin $text $files | less
}
View PropertyCopy.cs
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace MiscUtil.Reflection
{
/// <summary>
/// Non-generic class allowing properties to be copied from one instance
/// to another existing instance of a potentially different type.
@ChaseFlorell
ChaseFlorell / Progress.cs
Created Apr 26, 2017
How to run two processes simultaneously.
View Progress.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Utils
{
public static class Progress
{
public static Task ProgressDots(CancellationToken token)
{
@ChaseFlorell
ChaseFlorell / listview.cs.xaml
Created Apr 21, 2017
my idea of a xamarin forms listview
View listview.cs.xaml
<ListView SeparatorWidth="2"
PullToRefreshCommand="{Binding Fetch}"
ItemTappedCommand="{Binding Navigate}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ItemStyles>
<ViewCellItemStyle State="Normal" BackgroundColor="White" SeparatorColor="Red" />
<ViewCellItemStyle State="Pressed" BackgroundColor="Grey" SeparatorColor="Blue" />
<ViewCellItemStyle State="LongPressed" BackgroundColor="Green" SeparatorColor="Pink" />
@ChaseFlorell
ChaseFlorell / FontData.cs
Created Apr 18, 2017
Build a formatted string for Xamarin Forms
View FontData.cs
using System;
using System.Linq;
using Xamarin.Forms;
namespace Helpers
{
public class FontData
{
public double FontSize { get; set; }
public FontAttributes FontAttributes { get; set; }
@ChaseFlorell
ChaseFlorell / TouchableBoxViewRenderer_Droid.cs
Created Nov 16, 2016
Xamarin Forms Android Ripple Effect
View TouchableBoxViewRenderer_Droid.cs
public class TouchableBoxViewRenderer_Droid : BoxRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
{
base.OnElementChanged(e);
if (e.NewElement == null) return;
var attrs = new[] {Android.Resource.Attribute.SelectableItemBackground};
var ta = Context.ObtainStyledAttributes(attrs);
@ChaseFlorell
ChaseFlorell / Localize.cs
Created Aug 31, 2016
Xamarin Forms Localization
View Localize.cs
// iOS
public class Localize : ILocalize
{
private static CultureInfo _currentCulture;
public CultureInfo GetCurrentCultureInfo()
{
if (_currentCulture != null)
{
@ChaseFlorell
ChaseFlorell / android-ndk.ps1
Created Jun 9, 2016
Install the Android NDK as part of your PowerShell build. Xamarin Android
View android-ndk.ps1
$path ='C:\Android\android-ndk'
$ndk = 'android-ndk-r11c'
$fullPath = Join-Path $path $ndk
if(!(Test-Path $fullPath)){
New-Item $path -Force -ItemType directory
(New-Object Net.WebClient).DownloadFile("http://dl.google.com/android/repository/$ndk-windows-x86.zip", "C:\Temp\$ndk-windows-x86.zip")
(new-object -com shell.application).namespace("$path").CopyHere((new-object -com shell.application).namespace("C:\Temp\$ndk-windows-x86.zip").Items(),16)
$regPath = 'HKCU:\Software\Novell\Mono for Android'
$regKey = 'AndroidNdkDirectory'
$regValue = $fullPath
You can’t perform that action at this time.