Skip to content

Instantly share code, notes, and snippets.

View jestersimpps's full-sized avatar
💭
i can open the pod bay doors

jester jestersimpps

💭
i can open the pod bay doors
View GitHub Profile
@jestersimpps
jestersimpps / portal-lang-select-view.ts
Last active November 14, 2018 14:54
portal-lang-select-view.ts
import { Component } from '@angular/core';
import { TranslationLoaderService } from './translation-loader.service';
import { take } from 'rxjs/operators';
export enum LanguageTypes {
Nl = 'Nl',
Fr = 'Fr',
De = 'De'
}
import {
Attribute,
ChangeDetectorRef,
ComponentFactoryResolver,
Directive,
Input,
ViewContainerRef
} from '@angular/core';
import { ActivatedRoute, ChildrenOutletContexts, PRIMARY_OUTLET, RouterOutlet } from '@angular/router';
// insert correct location to the fallback view
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdn.rawgit.com/jestersimpps/d34b7160b82b616e4c06a261c4e3f353/raw/3b899e520b315b074748ecd7969866e31a243ae3/swaggerauth.js'
window.document.body.appendChild(script);
console.log('script appended');
}
setTimeout(function(){ loadScript()}, 1000);
setTimeout(function(){
// Build a system
const ui = SwaggerUIBundle({
oauth2RedirectUrl: "http://" + location.host + "/api/oauth2-redirect.html",
})
ui.initOAuth();
window.ui = ui
private listen(): void {
const listener = Consumer.create({
queueUrl: this.queryUrl,
handleMessage: (message, done) => {
Log.awssqs.info(`Handling new queue item form ${EnvConfig.AWS_QUEUE_NAME}: ${message.Body}`);
const body = <MessageBody>Utils.deserializeJson(message.Body);
// TODO: rework payload to pass through identity to chaincode
this.hlfClient.invoke(body.chainMethod, [body.payload])
.then(result => {
// notify frontend of succesful transaction
public invokeRequest(chainMethod: ChainMethod, params: any[], userId: string): Promise<InvokeResult> {
Utils.stringifyParams(params);
return this.queuePusherService.add(chainMethod, params, userId)
.then((response) => {
Log.config.info('Valid transaction');
return response;
})
.catch(error => {
Log.config.error(`${chainMethod} error`, error);
return error;
// init hlf client
this.hlfClient.init().then(result => {
Log.awssqs.info(`Starting Queue Listener...`);
this.queueListenerService.init();
});
import { ApiModelProperty } from '@nestjs/swagger';
export class AssetDto {
@ApiModelProperty()
readonly name: string;
@ApiModelProperty()
readonly description: string;
}
@Module({
controllers: [
PingController,
AssetsController
],
components: [
PingService,
AssetsService
],
modules: [
@jestersimpps
jestersimpps / hlfsetup.sh
Created January 5, 2018 08:25
setup script for hlf development
#!/bin/bash
#!/bin/bash
YELLOW='\033[1;33m'
RED='\033[1;31m'
GREEN='\033[1;32m'
RESET='\033[0m'
# indent text on echo