Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Thor mindspank

View GitHub Profile
View package.json
{
"name": "apptofiles",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Tests?\" && exit 1"
},
"keywords": [],
"author": "",
View jwt-qlik.js
const jwt = require('jsonwebtoken')
const fs = require('fs')
const path = require('path')
const request = require('request-promise') //Peer-dep to request
const QLIK_HOST = 'usrad-aklprobook'
const QLIK_VIRTUAL_PROXY_PREFIX = 'stratsys'
/**
* In this case we re-use the private cert from Qlik to sign our token
View sessionpage.js
define(['qlik', 'qvangular'], function (qlik, qv) {
return {
initialProperties: {
version: 1,
qHyperCubeDef: {
qSuppressZero: true,
qSuppressMissing: true,
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}]
}
},
View sessionpage.js
define(['qlik', 'qvangular'], function (qlik, qv) {
return {
initialProperties: {
version: 1,
qHyperCubeDef: {
qSuppressZero: true,
qSuppressMissing: true,
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}]
}
},
@mindspank
mindspank / console.js
Last active Apr 18, 2018
Get object properties in Sense
View console.js
document.addEventListener('click', function(e) {
(function recurse(scope) {
if(!scope.model) return recurse(scope.$parent);
scope.model.getProperties().then(properties => {
delete properties['qInfo'];
delete properties['qMetaDef'];
window.qliksenseobject = JSON.stringify(properties, null, 4);
console.log( JSON.stringify(properties, null, 4) )
})
})(angular.element(e.target).scope());
@mindspank
mindspank / mp3base64.js
Created Dec 25, 2016
Base64 in extensions
View mp3base64.js
define(['jquery', './mp3source'], function($, defaultsound) {
return {
initialProperties: {
sound: [{ label: 'Default', value: defaultsound}]
},
paint: function($element, layout) {
$element.empty();
let audio = $(`<audio controls="controls" autobuffer="autobuffer"><source src="data:audio/mp3;base64,${layout.sound[0].value}"/></audio>`);
audio.appendTo($element)
}
@mindspank
mindspank / index.js
Last active Dec 21, 2016
Connect to Qlik Sense Desktop using enigma.js
View index.js
const enigma = require('enigma.js');
const qixSchema = require('../node_modules/enigma.js/schemas/qix/3.1/schema.json');
const WebSocket = require('ws');
const config = {
schema: qixSchema,
session: {
unsecure: true,
port: 4848
},
View DimExpr.js
define([], function() {
return {
initialProperties: {
version: 1.0,
qHyperCubeDef: {
qDimensions: [],
qMode: 'P',
qMeasures: [],
qInitialDataFetch: [{
qWidth: 3,
View 10session.js
var qsocks = require('qsocks');
var fs = require('fs');
var request = require('request');
// Set our request defaults, ignore unauthorized cert warnings as default QS certs are self-signed.
// Export the certificates from your Qlik Sense installation and refer to them
var r = request.defaults({
rejectUnauthorized: false,
host: 'localhost',
pfx: fs.readFileSync(__dirname + '\\client.pfx')
View search.js
const qsocks = require('qsocks');
const fs = require('fs');
const Promise = require('bluebird');
var config = {
host: 'localhost',
port: 4747,
headers: {
'X-Qlik-User': 'UserDirectory=INTERNAL;UserId=sa_repository'
},
You can’t perform that action at this time.