Skip to content

Instantly share code, notes, and snippets.

View Sebosek's full-sized avatar
🦊
I'm a fox.

Sebastian Sebosek

🦊
I'm a fox.
View GitHub Profile
@Sebosek
Sebosek / user.service.ts
Created September 15, 2022 09:39
Type safe observable filter for RxJS
import { BehaviorSubject, filter, Observable, OperatorFunction, pipe, UnaryFunction } from "rxjs";
import { Injectable } from '@angular/core';
interface User {
id: string;
name: string;
}
export type Nullable<T> = T | null;
export const defined = <T>(): UnaryFunction<Observable<Nullable<T>>, Observable<T>> => pipe(
@Sebosek
Sebosek / gist:1cf3a852cef0744eea1810a1ff85c548
Created September 12, 2022 20:34
Dead simple example of variable in ng-template
<ng-container *ngTemplateOutlet="alert; context: {$implicit: user | async}"></ng-container>
<ng-template #alert let-user>
<ng-template [ngIf]="user.demo">
<app-alert [type]="AlertType.warning">
Sign-in with demo account
</app-alert>
</ng-template>
</ng-template>
@Sebosek
Sebosek / GraphJwksProvider.cs
Last active July 24, 2020 18:28
JWT token verification
internal class GraphJwksProvider : IGraphJwksProvider
{
protected internal const string CACHE_KEY = "MS_GRAPH__KEY_SET";
private const int CACHE_VALIDITY_IN_DAYS = 7;
private readonly IOAuthUrlProvider _oAuthUrlProvider;
private readonly HttpClient _httpClient;
@Sebosek
Sebosek / ubuntu-server-setup-16.04.md
Created January 17, 2017 20:43 — forked from marcuslilja/ubuntu-server-setup-16.04.md
Server setup for Ubuntu 16.04 on Digital Ocean

Server setup for Ubuntu 16.04 on Digital Ocean

The setup installs the following software:

  • Nginx
  • MySQL
  • PHP
  • Node
  • Composer
@Sebosek
Sebosek / ngrxintro.md
Created November 23, 2016 10:10 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@Sebosek
Sebosek / UrlGenerator.php
Last active January 2, 2016 12:59 — forked from matej21/UrlGenerator.php
Fix presenter constants.
<?php
use Nette\Application\IRouter;
use Nette\Application\UI\Presenter;
use Nette\Application\UI\InvalidLinkException;
use Nette\Application;
use Nette\Http\Url;
use Nette\Object;
/**