Skip to content

Instantly share code, notes, and snippets.

View NickPolyder's full-sized avatar
🏠
Working from home

Nick Polyderopoulos NickPolyder

🏠
Working from home
View GitHub Profile
@georgejecook
georgejecook / INavigationService.cs
Last active November 7, 2018 10:08
ADVANCED XAMARIN FORMS TECHNIQUES FOR FLEXIBLE AND PERFORMANT CROSS PLATFORM APPS - PART 5, PAGE IN PAGE EMBEDDING.
public interface INavigationServiceProvider
{
/// <summary>
/// Toggles the toolbar visibility
/// </summary>
/// <param name="showing">If set to <c>true</c> showing.</param>
/// <param name="animated">If set to <c>true</c> animate.</param>
void ToggleToolbar (bool showing, bool animated = true);
/// <summary>
@rionmonster
rionmonster / IQueryableExtensions
Last active November 9, 2022 16:39
Resolve the SQL being executed behind the scenes in Entity Framework Core
public static class IQueryableExtensions
{
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler");
private static readonly PropertyInfo NodeTypeProviderField = QueryCompilerTypeInfo.DeclaredProperties.Single(x => x.Name == "NodeTypeProvider");
private static readonly MethodInfo CreateQueryParserMethod = QueryCompilerTypeInfo.DeclaredMethods.First(x => x.Name == "CreateQueryParser");
@softlion
softlion / MyTabbedRenderer.Droid.cs
Last active September 29, 2020 05:14
Custom Tabbed Renderer for Xamarin Forms to display Svg icons using XamSvg
using System.Threading;
using Android.App;
using Android.Graphics;
using Android.OS;
using Android.Util;
using Android.Views;
using Vapolia.Droid.Lib.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using XamSvg;
@nikaburu
nikaburu / Generic builder with extensions
Created September 4, 2017 08:59 — forked from jand187/Generic builder with extensions
Generic builder with extensions
public class GenericBuilder<TEntity> where TEntity : new()
{
private readonly List<Func<TEntity, object>> setters;
public GenericBuilder()
{
setters = new List<Func<TEntity, object>>();
}
public GenericBuilder<TEntity> With(params Func<TEntity, object>[] props)
@BretFisher
BretFisher / docker-for-windows.md
Last active June 5, 2024 10:16
Getting a Shell in the Docker for Windows Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1

@morteymike
morteymike / README.md
Created June 16, 2023 13:36
LangChain Streaming using Python Generators

LangChain Streaming Generator

Background

For most chat applications, we want to stream each token back to the client. LangChain's callback support is fantastic for async Web Sockets via FastAPI, and supports this out of the box.

However, developers migrating from OpenAI's python library may find difficulty in implementing a Python generator along the same lines of the OpenAI library approach.

OpenAI Streaming Example

Here's an example of the OpenAI library streaming generator, from the OpenAI Cookbook