Skip to content

Instantly share code, notes, and snippets.

View gsbeaton's full-sized avatar

George Beaton gsbeaton

  • London
View GitHub Profile
@gsbeaton
gsbeaton / jQuery.js
Created August 7, 2017 20:30
jquery v3.2.1
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.construc
@gsbeaton
gsbeaton / dumpVariables.js
Last active June 21, 2017 19:29
A quick and dirty Node.js script to dump QlikSense variables out to a file.
/*
| -------------------------------------------------------------------
| A node.js script to write your app variables to file
| -------------------------------------------------------------------
|
|
*/
const serializeapp = require('serializeapp');
const enigma = require('enigma.js');
@gsbeaton
gsbeaton / CreatVars.QVS
Last active July 31, 2019 17:10
A QlikView and QlikSense script to generate variables from a CSV include.
/*
| -------------------------------------------------------------------
| Create Variables
| -------------------------------------------------------------------
| Loads data from the Variables repository and loops through to
| create a valid variable for each row of the repo.
|
| Set your CSV doc up like this:
|
| VariableName, VariableValue, Comments
@gsbeaton
gsbeaton / QlikViewFlexiReportVars.qvs
Last active May 5, 2017 11:09
Use these variables to help create a flexible report object.
// Self Service Report Helper
SET vActivateReportMeasure = If(Index(Concat(MeasureFieldName,';'),SubField(concat(MeasureFieldName,';'),';',$1)) AND GetSelectedCount(MeasureLabel),1,0);
SET vMeasureFieldName      = SubField(concat(MeasureFieldName,';'),';',$1);
SET vMeasureLabel          = Only({<MeasureFieldName={"~(=SubField(concat(MeasureFieldName,';'),';',$1))"}>} MeasureLabel);
LET vMeasureLabel          = Replace(vMeasureLabel,'~','$');  //I wish QlikView had an escape character!
//usage:
//$(vActivateReportMeasure(1))
//=$(vMeasureLabel(1))
//$(=$(vMeasureFieldName(1)))
@gsbeaton
gsbeaton / unixToQlikTime.js
Last active May 22, 2017 07:53
A JavaScript function to convert Unix time (milliseconds since 1 Jan 1970 at 00:00:00) to a Qlik time (days since 30 Dec 1899 at 00:00:00). Correct to the nearest second.
/*
| -------------------------------------------------------------------
| Unix to Qlik time
| -------------------------------------------------------------------
| Convert a unix timestamp to a Qlik timestamp.
|
*/
var unixToQlikTime = function(){
a = new Date(1899,12,30); //this is Qlik's Epoch date (http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/DateAndTimeFunctions/date-time-functions.htm).
b = new Date();