Skip to content

Instantly share code, notes, and snippets.

View taylortom's full-sized avatar
🛸
Working from home

Tom Taylor taylortom

🛸
Working from home
View GitHub Profile
{
a: [ 'target', 'href', 'title' ],
abbr: [ 'title' ],
address: [],
area: [ 'shape', 'coords', 'href', 'alt' ],
article: [],
aside: [ 'class' ],
audio: [
'autoplay',
'controls',
<!-- Text Content Elements -->
<div
aria-describedby="ariadescribedby"
aria-description="ariadescription"
aria-label="arialabel"
aria-hidden="false"
class="test"
role="region"
tabindex="0">
@taylortom
taylortom / adapt-examples.html
Created January 16, 2024 18:00
Adapt Example HTML
<h1>Text Content Elements</h1>
<!-- blockquote p -->
<blockquote cite="https://www.huxley.net/bnw/four.html">
<p>Words can be like X-rays, if you use them properly—they’ll go through anything. You read and you’re pierced.</p>
<footer>—Aldous Huxley, <cite>Brave New World</cite></footer>
</blockquote>
<!-- dd dt dl -->
<p>Cryptids of Cornwall:</p>
@taylortom
taylortom / register-super.js
Last active October 13, 2022 12:31
Script to register a new super user account in AAT v1.0.0
import path from 'path';
import { pathToFileURL } from 'url';
import { spawn } from 'child_process';
/**
* Handles installing/removing the npm dependencies for this script
*/
function deps(command) {
return new Promise((resolve, reject) => {
let error = '';
const npm = spawn(`npm ${command} prompts`, { shell: true })
const { AbstractModule } = require('adapt-authoring-core');
const glob = require('util').promisify(require('glob'));
const JsonSchemaValidator = require('./jsonSchemaValidator');
const path = require('path');
/**
* Module which add support for the JSON Schema specification
* @extends {AbstractModule}
*/
class JsonSchemaModule extends AbstractModule {
/** @override */
@taylortom
taylortom / MongoDBModule-examples.js
Last active April 13, 2022 17:40
MongoDBModule examples
/**
* General notes:
* - find is the only action which returns a cursor, the rest return a Promise
* - With the AbstractAPIModule, we've added some restrictions. Should we map these
* to also restrict MongoDBModule to these:
* - POST: only ever create one => insertOne
* - GET: with _id param, returns one, otherwise array => findOne/findMany
* - UPDATE: must provide _id, only ever update one => insertOne
* - PATCH: NO SUPPORT
* - DELETE: must provide _id, only ever update one => deleteOne
@taylortom
taylortom / adapt.json
Created January 13, 2020 15:37
Example route handler config
{
"documentation": {
"enable": true
},
"api": {
"name": "courses",
"root": "/courses",
"middleware": "./lib/middleware.js",
"routeHandlers": "./lib/routes.js",
"routes": [
@taylortom
taylortom / reqScopes.json
Last active October 21, 2019 13:53
Example auth scopes file
[
"read:auth",
"read:builds",
"read:config",
"read:courses",
"read:helloworld",
"read:lang",
"read:course",
"write:course"
]
@taylortom
taylortom / dev.config.js
Last active August 13, 2019 10:45
Example config file
module.exports = {
'app': {
local_modules_path: "/Users/tom/Projects/adapt_authoring_restructure"
},
'adapt-authoring-logger': {
enabledLevels: ['error', 'warn', 'success', 'info', 'debug']
},
'adapt-authoring-mongodb': {
host: "localhost",
port: 27017,
curl PATCH_URL | git apply -v