Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Dailey rcdailey

View GitHub Profile
@rcdailey
rcdailey / CompositionRootTest.cs
Created Jan 22, 2022
Demonstration of how to write specialized tests for resolving types with constructor parameters that are not themselves registered
View CompositionRootTest.cs
public record ServiceFactoryWrapper(Type Service, Action<ILifetimeScope> Instantiate);
public static class FactoryForService<TService>
{
public static ServiceFactoryWrapper WithArgs<TP1>(TP1 arg1 = default!)
{
return new ServiceFactoryWrapper(typeof(TService),
c => c.Resolve<Func<TP1, TService>>().Invoke(arg1));
}
}
@rcdailey
rcdailey / MyPage.razor
Created Jun 18, 2021
CascadingValue is null
View MyPage.razor
@page "/mypage"
<WrapperComponent>
@if (stuff)
{
<div>Stuff</div>
}
else
{
<div>More Stuff</div>
View gist:944450796c7b2afe0707e62f28a88ec5
{"items":{"0":{"0":{"itemId":12613,"containerId":0,"slot":0,"quantity":1,"hq":false,"spiritBond":0},"1":{"itemId":2619,"quantity":54,"hq":false,"slot":1,"containerId":0,"spiritBond":0},"2":{"itemId":12706,"containerId":0,"slot":2,"quantity":10,"hq":false,"spiritBond":0},"3":{"itemId":21800,"containerId":0,"slot":3,"quantity":81,"hq":false,"spiritBond":0},"5":{"itemId":5824,"containerId":0,"slot":5,"quantity":45,"hq":false,"spiritBond":0},"6":{"itemId":12667,"containerId":0,"slot":6,"quantity":16,"hq":false,"spiritBond":0},"7":{"itemId":5702,"containerId":0,"slot":7,"quantity":1,"hq":false,"spiritBond":0},"9":{"itemId":12709,"containerId":0,"slot":9,"quantity":50,"hq":false,"spiritBond":0},"10":{"itemId":27784,"containerId":0,"slot":10,"quantity":11,"hq":false,"spiritBond":0},"11":{"itemId":29978,"containerId":0,"slot":11,"quantity":9,"hq":false,"spiritBond":0},"12":{"itemId":5158,"containerId":0,"slot":12,"quantity":2,"hq":false,"spiritBond":0},"13":{"itemId":5707,"containerId":0,"slot":13,"quantity":1,"hq":f
@rcdailey
rcdailey / ignore-certain-commits-during-merge.md
Created Apr 3, 2019
How to ignore certain commits when doing a merge
View ignore-certain-commits-during-merge.md

You can ignore commits during a merge by selectively cherry-picking the commits you want to keep, followed by a merge that ignores all upstream changes. Example below.

Suppose I have the following branch commits:

  • topic
  • topic~1
  • topic~2
  • topic~3
@rcdailey
rcdailey / .gitconfig
Created Apr 20, 2018
Recommended basic git configuration (goes in global .gitconfig)
View .gitconfig
[core]
autocrlf = false
[push]
default = current
[pull]
rebase = true
[rebase]
autoSquash = true
autoStash = true
[merge]
View android_armeabi-v7a.toolchain.cmake
include( ${CMAKE_CURRENT_LIST_DIR}/android_common.toolchain.cmake )
set( CMAKE_SYSTEM_NAME Android )
set( CMAKE_SYSTEM_VERSION 15 ) # API level
set( CMAKE_ANDROID_ARCH_ABI armeabi-v7a )
set( CMAKE_ANDROID_STL_TYPE gnustl_shared )
set( CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang )
# Used by the copy_dlls target later on. These will be packaged with any APK built
# so that they are available by the runtime on the device.
View main.cmake
# Read the version of Android NDK
file( READ ${CMAKE_ANDROID_NDK}/source.properties ndk_properties )
string( REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_ANDROID_NDK_VERSION ${ndk_properties} )
message( STATUS "Android NDK Version: ${CMAKE_ANDROID_NDK_VERSION}" )
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.9.0" )
# Limit unified header usage to NDK r15b and greater (v15.1)
# Unified headers were introduced in r14, but are too buggy for our use.
if( CMAKE_ANDROID_NDK_VERSION VERSION_GREATER_EQUAL 15.1 )
message( STATUS "Unified headers are ENABLED" )
View Catch Test (#472)
Test for issue: https://github.com/philsquared/Catch/issues/472
@rcdailey
rcdailey / gist:f976279ed154eff2eeba
Last active Apr 13, 2020 — forked from dsc/gist:3855240
Python argparse Cheatsheet
View gist:f976279ed154eff2eeba
Arg Name or Optional Flags:
positional : str = "foo"
options : str = "-f", "--foo"
Standard:
action : str = [store], append, store_true, store_false, store_const, append_const, version
default : * = [None]
type : callable = [str], argparse.FileType(mode='wb', bufsize=0)
Exotic:
@rcdailey
rcdailey / Bamboo Plan Branch Deleter
Last active Jan 11, 2021
A python 3.x script that may be used to delete plan branches in a given bamboo instance. Utilizes HTTP calls to perform the task. Requires the 'requests' python library. Install via 'pip install requests'.
View Bamboo Plan Branch Deleter
Uses web API to bulk-delete plan branches
See README.md