Skip to content

Instantly share code, notes, and snippets.

@jenyayel
jenyayel / TraceLoggingProvider.cs
Created November 15, 2016 22:12
INpgsql trace logger
public class TraceLoggingProvider : INpgsqlLoggingProvider
{
public NpgsqlLogger CreateLogger(string name)
{
return new TraceLogger();
}
}
public class TraceLogger : NpgsqlLogger
{
@jenyayel
jenyayel / .gitignore
Last active November 7, 2016 07:52
OAuth JWT autorenew demo
node_modules
bower_components
.idea
.DS_STORE
_showNotification(client, newState, oldState) {
if(!client.subscribed || newState != SENSOR_STATE_FREE)
return false;
this._clearAllAlertsSubscriptions();
let message = {
title: `Restroom available`,
body: `Restroom just become available at floor ${client.floor.replace('floor-', '')} in ${client.area} wing`,
media: '/media/favicon-160x160.png',
timeout: 30000
@jenyayel
jenyayel / OIDC and OAuth2 Flows.md
Created February 2, 2016 17:20 — forked from jawadatgithub/OIDC and OAuth2 Flows.md
Enrich IdentityServer3 Documentation with OIDC (OpenID Connect) and OAuth2 Flows section
Note for community:

A. IdentityServer3 docs, samples and source code use OIDC & OAuth2 terms interchangeably to refer to same thing in many areas. I think that's make sense because OIDC introduced as complement & extension for OAuth2.

B. IdentityServer3, STS, OP, OIDC server, OAuth2 server, CSP, IDP and others: means same thing (software that provide/issue tokens to clients) as explained in [Terminology] (http://identityserver.github.io/Documentation/docs/overview/terminology.html).

C. Grants and flows mean same thing, grant was the common term in OAuth2 specs and flow is the common term in OIDC specs.

D. This document will not focus on custom flow/grant.

E. [Important] Choosing wrong flow leads to security threat.

@jenyayel
jenyayel / bracketsMatchingTest.js
Last active May 4, 2018 09:23
Implement function check (text) which checks whether brackets within text are correctly nested. You need to consider brackets of three kinds: (), [], {}.
var expect = require('expect')
var _matches = {
'{': { invert: '}', isOpening: true },
'}': { invert: '{', isOpening: false },
'(': { invert: ')', isOpening: true },
')': { invert: '(', isOpening: false },
'[': { invert: ']', isOpening: true },
']': { invert: '[', isOpening: false }
};
@jenyayel
jenyayel / build.js
Created January 27, 2016 14:35
per-environment-configuration-in-aurelia
var gulp = require('gulp');
var runSequence = require('run-sequence');
var changed = require('gulp-changed');
var plumber = require('gulp-plumber');
var to5 = require('gulp-babel');
var sourcemaps = require('gulp-sourcemaps');
var paths = require('../paths');
var compilerOptions = require('../babel-options');
var assign = Object.assign || require('object.assign');
var notify = require("gulp-notify");
@jenyayel
jenyayel / pinger.htm
Last active February 2, 2016 13:24
Performs a simple requests for a given Uri on scheduled basis
<!DOCTYPE html>
<html>
<head>
<title>Pinger</title>
</head>
<body>
<a href="#">return back</a>
<hr />
<pre></pre>
<script src="pinger.js"></script>
@jenyayel
jenyayel / .travis.yml
Created November 16, 2015 14:04
Deploy via git
after_success:
- git clone [email protected]:qurrus-web-prod.git dist
- gulp build
- gulp bundle
- cd dist
- git config user.name "travis-ci"
- git config user.email "[email protected]"
- git add -f *
- cd ../jspm_packages
- git add -f system.js
@jenyayel
jenyayel / app-pools-recycle.ps1
Created February 11, 2015 13:55
Misc powershells
# recycle all local IIS's application pools
$appPools = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool"
foreach ($pool in $appPools)
{
trap [Exception] {
Write-Host "ERROR"
continue
}
@jenyayel
jenyayel / Retry.cs
Created February 11, 2015 13:53
Retry mechanism
using System;
using System.Collections.Generic;
using System.Threading;
namespace RetryPolicy
{
public class Retry
{
/// <summary>
/// Implements simple retry mechanism