Skip to content

Instantly share code, notes, and snippets.

View aleksandar-b's full-sized avatar
:electron:
Focusing

Aleksandar.B aleksandar-b

:electron:
Focusing
View GitHub Profile
@aleksandar-b
aleksandar-b / opentok_multiple_sessions.html
Created January 13, 2017 08:18 — forked from doomhz/opentok_multiple_sessions.html
OpenTok Multiple sessions and one publisher example
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>OpenTok API Sample &#8212; Basic Tutorial</title>
<link href="samples.css" type="text/css" rel="stylesheet" >
<script src="http://staging.tokbox.com/v0.91/js/TB.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
@aleksandar-b
aleksandar-b / .block
Created September 2, 2017 08:25
Undergraduate Major Disciplines that Co-Occur in Fall 2014
license: mit
@aleksandar-b
aleksandar-b / .block
Created February 6, 2018 14:37 — forked from akbstone/.block
Closest Point on Path
license: gpl-3.0
@aleksandar-b
aleksandar-b / .block
Created March 15, 2018 17:55
Animated Donut Chart with Percentage
license: gpl-3.0
["https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/recording_lywr.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/gifts_btw0.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/booking_33fn.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/youtube_tutorial_2gn3.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/logistics_x4dc.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/teddy_bear_hns1.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/email_campaign_qa8y.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/vehicle_sale_v7fm.svg","https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcd
import { should, each, iff, prop, props } from 'rvl-pipe'
import { createUser, createAuthToken, authTokenValidator, requestValidator } from '../account'
import ctx from './dummyContext'
const registerUser = each(
validateRequest(requestValidator),
generatePasswordHash(prop('body.password'), 'passwordHash'),
createDocument('users', createUser, "userAccount"),
should(prop('userAccount'), 'invalidUser'),
createJsonWebToken(createAuthToken),
// language exceptions
var exceptions = {
"are": "were",
"eat": "ate",
"go": "went",
"have": "had",
"inherit": "inherited",
"is": "was",
"run": "ran",
"sit": "sat",
const filter = ([head, ...rest] = [], callback) => {
if(!head) return [];
return [
...callback(head) ? [head] : [],
...filter(rest, callback)
];
@aleksandar-b
aleksandar-b / NestInterceptor.ts
Last active March 24, 2022 06:13
Interceptor wrapper for NestJs
import {
CallHandler,
ExecutionContext,
Injectable,
Logger,
NestInterceptor,
} from "@nestjs/common";
import { Observable } from "rxjs";
import { catchError, tap } from "rxjs/operators";
import { isFunction } from "../utils";
// cause => effect
user()
.correlationId('userId')
.stateOfAffairs(UserHasRegistered).causes(KycVerified)
.stateOfAffairs(UserHasRegistered,KycVerified).causes(AccountCreated)
.stateOfAffairs(UserHasRegistered,KycVerified,AccountCreated).causes(UserHasTopUp)
.stateOfAffairs(UserHasRegistered,KycVerified,AccountCreated,UserHasTopUp).causes(CreditCardCreated)
.stateOfAffairs(UserHasRegistered,KycVerified,AccountCreated,UserHasTopUp,CreditCardCreated).causes(OnboardFinished)