Skip to content

Instantly share code, notes, and snippets.

@hawkrives
Last active March 15, 2024 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkrives/4855616dbda70f7708839ac07cfcf246 to your computer and use it in GitHub Desktop.
Save hawkrives/4855616dbda70f7708839ac07cfcf246 to your computer and use it in GitHub Desktop.
test carbide
import {examine, expandStudent} from '@gobbldygook/core'
import yaml from 'js-yaml'
import {padStart} from 'lodash/padStart'
import * as school from '@gobbldygook/school-stolaf'
function find_details_subdir(clbid) {
let str_clbid = padStart(clbid, 10, '0')
let n_thousand = Math.floor(clbid / 1000)
let thousands_subdir = padStart(n_thousand * 1000, 5, '0')
return thousands_subdir + '/' + str_clbid
}
function loadCourse(clbid) { ///Load the course… by requesting it from github! :D
return fetch(`https://raw.githubusercontent.com/StoDevX/course-data/master/courses/${find_details_subdir(clbid)}.json`).then(r => r.json())
}
function loadArea({name, revision, type}) { ///This variant won't actually work for most people, but it'd do for a demo.
let url
if (name === 'Computer Science') {
url = 'https://raw.githubusercontent.com/hawkrives/gobbldygook-area-data/master/majors/computer-science.yaml'
}
else if (name === 'Asian Studies') {
url = 'https://raw.githubusercontent.com/hawkrives/gobbldygook-area-data/master/majors/asian-studies.yaml'
}
return fetch(url).then(r => r.text()).then(t => yaml.safeLoad(t))
}
function prettify(school, results) {
// make the results pretty
return JSON.stringify(results)
}
async function main(student_file) {
const student = {name: 'Hawken Rives'}
// We start with a basic student, and flesh it out with the referenced data
const loaded = await expandStudent(student, loadCourse, loadArea)
// Then we check it
const results = await examine(loaded)
// and finally we show the results
console.log(prettify(school, results))
}
@nemoj463
Copy link

Good afternoon. Every time I play at the Australian Shazam Casino, I get a lot of positive emotions and impressions. The casino website has a user-friendly and optimised interface that allows you to navigate through the sections and quickly find games for yourself. By the way, all the games that are presented on this casino are developed by leading providers that guarantee the quality of the game and high winnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment