Skip to content

Instantly share code, notes, and snippets.

@zirkelc
zirkelc / post-merge.sh
Created December 27, 2021 10:40
Run npm install automatically after git pull if package-lock.json has changed
#!/bin/zsh
. "$(dirname "$0")/_/husky.sh"
IFS=$'\n'
# regex supports mono-repos with a package.json at root-level and at package-level
PACKAGE_LOCK_REGEX="(^packages\/.*\/package-lock\.json)|(^package-lock\.json)"
# extract all paths to package-lock.json files
PACKAGES=("$(git diff --name-only HEAD@{1} HEAD | grep -E "$PACKAGE_LOCK_REGEX")")
if [[ ${PACKAGES[@]} ]]; then
@zirkelc
zirkelc / LICENSE
Created December 22, 2020 15:02 — forked from zorrodg/LICENSE
CLI Integration Test Helper
MIT License
Copyright © 2019 Andrés Zorro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--
Base application theme for API 21+. This theme completely replaces
MyTheme from BOTH res/values/styles.xml on API 21+ devices.
-->
<style name="MyTheme" parent="MyTheme.Base">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
public class SquareTransformation : ITransformation
{
public string Key => "SquareTransformation";
public IBitmap Transform(IBitmap source)
{
double sourceWidth = source.Width;
double sourceHeight = source.Height;
double desiredWidth = sourceWidth;
public static class Instantiator
{
static Dictionary<Type, Func<object>> compiledExpressions = new Dictionary<Type, Func<object>>();
static Dictionary<Tuple<Type, Type>, Func<object>> genericCompiledExpressions = new Dictionary<Tuple<Type, Type>, Func<object>>();
public static T CreateInstance<T>()
{
return (T)CreateInstance(typeof(T));
}
public interface INavigationItem<out T> where T : class, IViewModel
{
Type ViewModelType { get; set; }
object ViewModel { get; set; }
}
public interface INavigationService
{
void RegisterViewModels(System.Reflection.Assembly asm);
void Register(Type viewModelType, Type viewType);
Task PopAsync();
Task PopModalAsync();
Task PushAsync<T>(T viewModel) where T : class, IViewModel;
Task PushAsync<T>(Action<T> initialize = null) where T : class, IViewModel;
Task PushModalAsync<T>(Action<T> initialize = null) where T : class, IViewModel;