Skip to content

Instantly share code, notes, and snippets.

View kkoziarski's full-sized avatar

Krzysztof Koziarski kkoziarski

View GitHub Profile
@kkoziarski
kkoziarski / Startup.cs
Last active April 13, 2018 12:26
JSNLog sample demo
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace JSNLogCore.Demo
{
public class Startup
{
@kkoziarski
kkoziarski / rx-subscribe-unsubscribe-listeners.ts
Last active February 20, 2018 08:11
Subscribe with unsubscribe listeners
// https://github.com/ng-book/angular2-redux-chat/blob/master/tutorial/06b-rx-store.ts
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/scan';
interface Action {
type: string;
payload?: any;
}
@kkoziarski
kkoziarski / AudiencesStore.cs
Created January 22, 2018 08:25
AudiencesStore - create a ClientId(AudienceId) and Base64Secret(AudienceSecret) for JWT tokens
namespace WebApi.Identity.Providers
{
using System;
using System.Collections.Concurrent;
using System.Security.Cryptography;
using Microsoft.IdentityModel.Tokens;
public static class AudiencesStore
{
public static ConcurrentDictionary<string, Audience> AudiencesList = new ConcurrentDictionary<string, Audience>();
@kkoziarski
kkoziarski / jira-copy-description-bookmarklet.js
Last active October 2, 2021 20:35
Copy JIRA issue number bookmarklet
javascript: (function() {
var id;
var descr;
var a = document.querySelector('#ghx-detail-issue .ghx-group .ghx-key dl.ghx-detail-list dd a');
if (a) {
/*side details*/
id = a.textContent;
descr = document.querySelector('#ghx-detail-issue .ghx-group .ghx-detail-summary dl.ghx-detail-list dd.ghx-detail-description').textContent;
} else if (a = document.getElementById("key-val")) {
/*full page details*/
@kkoziarski
kkoziarski / yarn_angular_cli.md
Created November 24, 2017 17:26
Yarn for Angular CLI

To enable Yarn for Angular CLI run the following command:

ng set --global packageManager=yarn

To revert it back to using npm use this:

ng set --global packageManager=npm
@kkoziarski
kkoziarski / Paradox-custom-theme.psm1
Last active February 9, 2019 20:37
Scripts to run on a new system
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
import { Injectable } from "@angular/core";
import { TestBed, async, inject } from '@angular/core/testing';
import { HttpModule, Http, Response, ResponseOptions, XHRBackend } from '@angular/http';
import { MockBackend } from '@angular/http/testing';
import { Observable } from 'rxjs/Rx';
@Injectable()
export class FancyService {
protected value = 'real value';
@kkoziarski
kkoziarski / AppBuilderExtensions.cs
Last active March 31, 2017 12:15 — forked from dschenkelman/Extensions.cs
Intro to OWIN talk and a simple IP filtering middleware sample
namespace Owin.IpFilter
{
using System;
using System.Net;
public static class AppBuilderExtensions
{
public static IAppBuilder UseIpFiltering(this IAppBuilder appBuilder, Func<IPAddress, bool> rejectRequest)
{
appBuilder.Use(typeof(IpFilterMiddleware), rejectRequest);
@kkoziarski
kkoziarski / FULL-Microsoft.PowerShell_profile.ps1
Last active September 27, 2017 12:08
cmd PROMPT settings
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
function PromptX {
# Print the working directory:
@kkoziarski
kkoziarski / npp_external_editor.config
Created January 20, 2017 07:02
Notepad++ as external editor
EDITOR: "C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -notabbar -nosession
VIEWER: "C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -notabbar -nosession -ro