Skip to content

Instantly share code, notes, and snippets.

View rjriel's full-sized avatar

Rey Riel rjriel

View GitHub Profile
engine: localhost:19076
app: Qonnections2019.qvf
script: ./load-script.qvs
connections:
data:
connectionstring: /data
type: folder
version: "2"
services:
engine:
image: qlikcore/engine:12.368.0
command: -S AcceptEULA=yes -S DocumentDirectory=/docs -S EnableFilePolling=1
ports:
- "19076:9076"
volumes:
- ./core-docs:/docs
const fs = require('fs')
const path = require('path')
require('dotenv').config()
const { dataFile, saveDirectory} = process.env
while(true) {
try {
fs.renameSync(dataFile, path.join(saveDirectory,`${Date.now()}.csv`))
} catch(e) {}
@rjriel
rjriel / acquire_selection_state.js
Last active January 20, 2022 07:11
The basics of the Capability API's
// https://help.qlik.com/en-US/sense-developer/September2018/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/SelectionAPI/qlik-selectionState-interface.htm
// here is a basic example of acquiring and working with the current selection
// state. Here we can get a list of all fields that have selections and what
// values have been selected for each field
var selectionState = app.selectionState()
var listener = function() {
var selections = selectionState.selections
// each item in the selectionState.selections is a field
@rjriel
rjriel / main.html
Last active September 18, 2017 21:12
Functions for API Training
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<link rel="stylesheet" href="https://playground.qlik.com/playground/resources/autogenerated/qlik-styles.css">
</head>
<body>
<script type="text/javascript" src="https://playground.qlik.com/playground/resources/assets/external/requirejs/require.js"></script>
<script type="text/javascript" src="/node_modules/playground-js-api/dist/playground-js-api.min.js"></script>
@rjriel
rjriel / Repo.ts
Last active April 8, 2017 18:30
Get Github Info
export class Repo {
name: string;
forks_count: number;
open_issues: number;
constructor(json: {}) {
this.name = json.name;
this.forks_count = json.forks_count;
this.open_issues = json.open_issues;
}
const cheerio = require('cheerio')
const request = require('request')
const mongoose = require('mongoose')
const config = require('config')
const Publication = require('./server/models/publication')
mongoose.Promise = global.Promise
let archives = [
["2016", "12"],
@rjriel
rjriel / index.js
Created October 27, 2016 15:29
MOVE PLAYED
socket.on('move played', (move) => {
// someone has played a move in our game
// if the move just played wasn't by us, it is now
// our turn to play.
if (move.player != playerId) {
console.log(`opponent performed ${move.result}`)
performMove()
}
})
@rjriel
rjriel / index.js
Created October 27, 2016 15:25
PERFORM MOVE (ATTACK ONLY)
let performMove = () => {
// this is where we would put our logic for deciding which move to make
// here we are just attacking all the time. We should probably be more
// creative than this. If we don't heal our Qritter will most likely be
// defeated in no time.
let body = {action: "attack"}
let options = createOptions("moves", "POST", body)
@rjriel
rjriel / index.js
Created October 27, 2016 15:15
FULL START GAME
const io = require("socket.io-client")
const request = require("request")
const config = require("./config")
console.log("Welcome to the Qritter Wars Client")
// This is the api key passed to the Qritter Wars REST API in the Authorization header
// for authentication
// format: base64 encoded value of <apiId>:<apiSecret>
const apiKey = new Buffer(`${config.apiId}:${config.apiSecret}`).toString('base64')