Skip to content

Instantly share code, notes, and snippets.

@julesx
julesx / AuthorizeService.js
Last active November 24, 2022 16:50
ASP.Net Core with React API Authorization
import { UserManager, WebStorageStateStore } from 'oidc-client';
import { ApplicationPaths, ApplicationName } from './ApiAuthorizationConstants';
export class AuthorizeService {
_callbacks = [];
_nextSubscriptionId = 0;
_user = null;
_isAuthenticated = false;
// By default pop ups are disabled because they don't work properly on Edge.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
public class CrazyTag : ICrazyTag
{
protected readonly List<Subscription> observables = new List<Subscription>();
protected readonly List<IObserver<ICrazyTag>> observers = new List<IObserver<ICrazyTag>>();
bool disposedValue = false;
protected CrazyTag() { }
IDisposable IObservable<ICrazyTag>.Subscribe(IObserver<ICrazyTag> observer)
{
<ListBox x:Class="PG.UserControls.ListBoxPgItems"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:classes="clr-namespace:WPF.Core.Classes;assembly=WPF.Core"
mc:Ignorable="d"
SelectionMode="Extended"
Style="{StaticResource MaterialDesignListBox}"
xmlns:controls="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
<autocompletetextbox:AutoCompleteTextBox
DisplayMember="Name"
SelectedItem="{Binding SelectedTag, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
MaxPopupHeight="300" x:Name="AddTagAutoComplete"
Text="{Binding AutoCompleteText, Mode=OneWayToSource}"
Provider="{Binding SuggestionProvider, RelativeSource={RelativeSource AncestorType=UserControl}}"
Grid.Column="0"
Height="28"
Width="150"
Watermark="Add tag">
public static class NavHelper
{
public static Page CurrentPage => Application.Current.MainPage;
private static INavigation Navigation => CurrentPage.Navigation;
public static async Task PopAsync()
{
var masterDetailPage = CurrentPage as MasterDetailPage;
(function ($) {
// register namespace
$.extend(true, window, {
"Slick": {
"GroupedCheckboxSelectColumn": GroupedCheckboxSelectColumn
}
});
function GroupedCheckboxSelectColumn(options) {
@julesx
julesx / slick.checkboxselectionmodel.js
Created February 4, 2020 15:48
slickgrid custom plugins
(function ($) {
// register namespace
$.extend(true, window, {
"Slick": {
"CheckboxSelectionModel": CheckboxSelectionModel
}
});
function CheckboxSelectionModel(options) {
var _ranges = [];
public class AndroidExternalStorageWriter : IAndroidExternalStorageWriter
{
public string CreateFile(string filename, byte[] bytes)
{
if (!Directory.Exists(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate")))
Directory.CreateDirectory(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate"));
var path = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate", filename);
File.WriteAllBytes(path, bytes);
@julesx
julesx / AndroidDocumentViewer.cs
Last active October 4, 2018 07:43
Xamarin Forms file opener
using Android.Content;
using Mobile.Core.Droid.NativeImplementations;
using Mobile.Core.Interfaces;
using Xamarin.Forms;
[assembly: Xamarin.Forms.Dependency(typeof(DocumentViewer))]
namespace Mobile.Core.Droid.NativeImplementations
{
public class DocumentViewer : IDocumentViewer
{