Skip to content

Instantly share code, notes, and snippets.

View rjriel's full-sized avatar

Rey Riel rjriel

View GitHub Profile
@rjriel
rjriel / README
Last active June 3, 2022 00:24
Replay to a Temporary Queue
# Create a python3 virtual environment
python3 -m venv venv
# Activate the virtual env
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# the sample code is for an environment where you are running a broker
@rjriel
rjriel / app.component.html
Last active June 2, 2021 13:44
Angular example with Citadel Bridge
<div>
<button (click)="openBridge()">Connect</button>
</div>
<router-outlet></router-outlet>
@rjriel
rjriel / webp.js
Last active September 1, 2020 13:58
const imagemin = require('imagemin'), // The imagemin module.
webp = require('imagemin-webp'), // imagemin's WebP plugin.
outputFolder = './src/assets', // Output folder
PNGImages = './src/assets/*.png', // PNG images
JPEGImages = './src/assets/*.jpg' // JPEG images
imagemin([PNGImages], outputFolder, {
plugins: [
webp({
lossless: true // Losslessly encode images
Course;Const;Pyeongchang Slalom
Gates Total;Const;79
Race Status;Var;Racing
Time;Var;16320
Speed;Var;56
Gates Passed;Var;15
Errors;Var;4
Edging Left;Var;28
Edging Right;Var;0
Gate Edging Left ;Var;0
const layout = await model.getLayout()
const matrix = layout.qHyperCube.qDataPages[0].qMatrix[0]
const edgingValue =
checkNan(matrix[6].qNum) > 0
? -checkNan(matrix[6].qNum)
: checkNan(matrix[7].qNum)
const lastEdgingValue =
checkNan(matrix[11].qNum) > 0
? -checkNan(matrix[11].qNum)
: checkNan(matrix[12].qNum)
const raceId = uuidv4()
const badgePatchProperties = [{
qOp: "replace",
qPath: "/badge",
qValue: participant.badge
},
{
qOp: "replace",
qPath: "/raceId",
qValue: `"${raceId}"`
if (finishedFound) {
...
const badgePatchProperties = [
{
qOp: "replace",
qPath: "/badge",
qValue: "0"
},
{
let results = csvLoad(readDirectory, badgeValue, raceValue)
...
fs.writeFileSync(unprocessedFile, results.join("\n"))
const reload = await qixApp.doReloadEx({ qPartial: true })
await qixApp.doSave()
await qixApp.createObject({
qInfo: { qId: "Badge", qType: "GenericObject" },
badge: "0",
raceId: ""
})
await qixApp.doSave()
badgeObject = await qixApp.getObject("Badge")
badgeObject.on("changed", async () => {
checkBadge()
Simulator:
LOAD
*
FROM [lib://data/processed/ski-data.csv]
(txt, utf8, embedded labels, delimiter is ',');
Simulator:
ADD LOAD
[Race ID],
Badge,