Skip to content

Instantly share code, notes, and snippets.

@RoboSparrow
RoboSparrow / .clang-format
Created March 22, 2020 08:48
.clang-format
---
Language: Cpp
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# BasedOnStyle: Mozilla
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
@RoboSparrow
RoboSparrow / test-analyse.sh
Last active November 5, 2019 22:46
Surveysystem: Test /analyse endpoint
#!/bin/bash
## performs two calls to /analyse for a given session and compares responses.
## If both match the test passes.
## If a mismatch occurs or a single response is invalid then the error and the response will be logged into ./error.log
## Tests are repeated 50 times.
# config
# - a valid seesion id, the session has to be finished (all questions answered)
SESSID=<SESSID>
@RoboSparrow
RoboSparrow / Makefile
Last active October 8, 2019 00:58
surveysystem compare_session_line() tests
CC=gcc
CFLAGS=-I. -Wall -pedantic -Werror -Wshadow -Wstrict-aliasing -Wstrict-overflow -g
all: main.o
$(CC) -o main main.o
.PHONY: clean
clean:
@RoboSparrow
RoboSparrow / colors.js
Last active June 17, 2022 17:14
Simple node colors
const colors = {
green: text => `\x1b[32m${text}\x1b[0m`,
red: text => `\x1b[31m${text}\x1b[0m`,
yellow: text => `\x1b[33m${text}\x1b[0m`,
blue: text => `\x1b[34m${text}\x1b[0m`,
};
module.exports = colors;
@RoboSparrow
RoboSparrow / learninglocker-verify-user.js
Created August 21, 2017 02:06
Leaninglocker Mongo tweaks
/**
* Verify a user (bypass email verification)
*/
db.getCollection('users').update({
"_id" : ObjectId("<users:record:_id>")
}, {
"$set": {
"verified": "yes"
}
});
@RoboSparrow
RoboSparrow / 01-distinct.statements.js
Last active October 27, 2018 04:34
lxHive Mongo Admin
// get a list of all verb ids
db.getCollection('statements').distinct('statement.verb.id');
// get a list of all object activity ids
db.getCollection('statements').distinct( "statement.object.id");
// get a list of object definition extension sub property values
db.getCollection('statements').distinct( "statement.object.definition.extensions.https://lxhive[dot].com/recipes/extensions/object.subType");
// get a list of object id's containing "lesson"
db.getCollection('statements').find({"statement.object.id": /lesson/});
// get a list of all verb display["en-US"] values
db.getCollection('statements').distinct('statement.verb.display.en-US');
@RoboSparrow
RoboSparrow / switch-php.sh
Last active July 17, 2017 05:44
helper script for switching PHP versions
#!/bin/bash
###
# Script for switching PHP versions
# Ubuntu 16.x dual php install.
# Instructions on how to set this up: http://robosparrow.github.io/2016/12/10/php-5-on-ubuntu16.html
###
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
@RoboSparrow
RoboSparrow / rollup.config.js
Last active May 15, 2017 09:00
Quick and Dirty Rollup copy plugin
//..imports for rollup.config
////
// plugin for copy
////
import fs from 'fs';
import path from 'path';
const copyPlugin = function (options) {
return {
{
"name": "brightcookie/lxhive",
"description": "An open-source LRS from Brightcookie",
"license": "GPL-3.0",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sraka1/Slim"
}
],
<?php
/**
* @see https://github.com/Brightcookie/lxHive/issues/91
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);